diff options
author | Michael R. Mauger <michael@mauger.com> | 2014-11-01 18:14:01 -0400 |
---|---|---|
committer | Michael R. Mauger <michael@mauger.com> | 2014-11-01 18:14:01 -0400 |
commit | fcc5b488b91b8b809ed270d31d172ec18ba7fd89 (patch) | |
tree | eaab4f4e3c6c6dbef0b9f708580ed7c26e470b53 /lisp/progmodes/sql.el | |
parent | bf7ded963c672f858c3b4c14d2cd8278b0d781c4 (diff) | |
download | emacs-fcc5b488b91b8b809ed270d31d172ec18ba7fd89.tar.gz |
* sql.el (sql-interactive-mode, sql-stop): Correct fix for
Bug#16814 with let-bind of comint-input-ring variables around read
and save functions.
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r-- | lisp/progmodes/sql.el | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index af7cb0dc2f5..04dc22ffdac 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -3959,11 +3959,10 @@ you entered, right above the output it created. ;; People wanting a different history file for each ;; buffer/process/client/whatever can change separator and file-name ;; on the sql-interactive-mode-hook. - (setq-local comint-input-ring-separator sql-input-ring-separator) - (setq comint-input-ring-file-name sql-input-ring-file-name) - ;; Calling the hook before calling comint-read-input-ring allows users - ;; to set comint-input-ring-file-name in sql-interactive-mode-hook. - (comint-read-input-ring t)) + (let + ((comint-input-ring-separator sql-input-ring-separator) + (comint-input-ring-file-name sql-input-ring-file-name)) + (comint-read-input-ring t))) (defun sql-stop (process event) "Called when the SQL process is stopped. @@ -3973,11 +3972,15 @@ Writes the input history to a history file using This function is a sentinel watching the SQL interpreter process. Sentinels will always get the two parameters PROCESS and EVENT." - (comint-write-input-ring) - (if (and (eq (current-buffer) sql-buffer) - (not buffer-read-only)) - (insert (format "\nProcess %s %s\n" process event)) - (message "Process %s %s" process event))) + (with-current-buffer (process-buffer process) + (let + ((comint-input-ring-separator sql-input-ring-separator) + (comint-input-ring-file-name sql-input-ring-file-name)) + (comint-write-input-ring)) + + (if (not buffer-read-only) + (insert (format "\nProcess %s %s\n" process event)) + (message "Process %s %s" process event)))) |