Commit 52092f0a authored by Michael Albinus's avatar Michael Albinus
Browse files

Merge branch 'master' of

parents 024d5b0c e6681b27
......@@ -712,7 +712,7 @@ minor mode is enabled."
;; Disable minor mode if semantic stuff not available
(setq semantic-stickyfunc-mode nil)
(error "Buffer %s was not set up for parsing" (buffer-name)))
(unless (boundp 'default-header-line-format)
(unless (boundp 'header-line-format)
;; Disable if there are no header lines to use.
(setq semantic-stickyfunc-mode nil)
(error "Sticky Function mode requires Emacs"))
......@@ -1234,7 +1234,7 @@ These two lines must come in the order given."))
(if (null viper-saved-non-viper-variables)
(setq viper-saved-non-viper-variables
(cons 'default-major-mode (list (default-value 'major-mode)))
(cons 'major-mode (list (default-value 'major-mode)))
(cons 'next-line-add-newlines (list next-line-add-newlines))
(cons 'require-final-newline (list require-final-newline))
(cons 'scroll-step (list scroll-step))
......@@ -504,7 +504,7 @@ as-is. The filling is done after mail address alias expansion."
(defcustom feedmail-fill-to-cc-fill-column default-fill-column
(defcustom feedmail-fill-to-cc-fill-column (default-value 'fill-column)
"Fill column used by `feedmail-fill-to-cc'."
:group 'feedmail-headers
:type 'integer
......@@ -1072,14 +1072,26 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
:version "20.8"
:group 'SQL)
(defcustom sql-postgres-login-params `((user :default ,(user-login-name))
(database :default ,(user-login-name))
(defcustom sql-postgres-login-params
`((user :default ,(user-login-name))
(database :default ,(user-login-name)
:completion ,(completion-table-dynamic
(lambda (_) (sql-postgres-list-databases))))
"List of login parameters needed to connect to Postgres."
:type 'sql-login-params
:version "24.1"
:group 'SQL)
(defun sql-postgres-list-databases ()
"Return a list of available PostgreSQL databases."
(when (executable-find sql-postgres-program)
(let ((res '()))
(dolist (row (process-lines sql-postgres-program "-ltX"))
(when (string-match "^ \\([[:alnum:]-_]+\\) +|.*" row)
(push (match-string 1 row) res)))
(nreverse res))))
;; Customization for Interbase
(defcustom sql-interbase-program "isql"
;;; sql-tests.el --- Tests for sql.el -*- lexical-binding: t; -*-
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; Author: Simen Heggestøyl <>
;; Keywords:
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <>.
;;; Commentary:
;;; Code:
(require 'cl-lib)
(require 'ert)
(require 'sql)
(ert-deftest sql-tests-postgres-list-databases ()
"Test that output from `psql -ltX' is parsed correctly."
(((symbol-function 'executable-find)
(lambda (_command) t))
((symbol-function 'process-lines)
(lambda (_program &rest _args)
'(" db-name-1 | foo-user | UTF8 | en_US.UTF-8 | en_US.UTF-8 | "
" db_name_2 | foo-user | UTF8 | en_US.UTF-8 | en_US.UTF-8 | "
(should (equal (sql-postgres-list-databases)
'("db-name-1" "db_name_2")))))
(provide 'sql-tests)
;;; sql-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment