]> git.eshelyaron.com Git - emacs.git/commitdiff
* sql.el (sql-interactive-mode, sql-stop): Correct fix for
authorMichael R. Mauger <michael@mauger.com>
Sat, 1 Nov 2014 22:14:01 +0000 (18:14 -0400)
committerMichael R. Mauger <michael@mauger.com>
Sat, 1 Nov 2014 22:14:01 +0000 (18:14 -0400)
Bug#16814 with let-bind of comint-input-ring variables around read
and save functions.

lisp/ChangeLog
lisp/progmodes/sql.el

index fc7e7392551e384cd64136406fb028fa8044d15d..1195eb1275721c14470a5f228a6094d92086b177 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-01  Michael R. Mauger  <michael@mauger.com>
+
+       * 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.
+
 2014-11-01  Michael Albinus  <michael.albinus@gmx.de>
 
        * net/tramp-cache.el (tramp-get-file-property)
index af7cb0dc2f52a18dd9d177d8ee46cdf41ae4f0c6..04dc22ffdac55afeb0aa12ebdce34dca87f1a58d 100644 (file)
@@ -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))))
 
 \f