emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e3b0dd6: Fix problem in `g' in Info with strings li


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master e3b0dd6: Fix problem in `g' in Info with strings like "(foo)"
Date: Tue, 17 Apr 2018 17:15:29 -0400 (EDT)

branch: master
commit e3b0dd6bf118c60ba41a09e3ffdce056b2e7c494
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Fix problem in `g' in Info with strings like "(foo)"
    
    * lisp/info.el (Info-find-file): Add a new parameter to avoid
    jumping to the directory if the user looks for a filename on the
    form "(foo)" that doesn't exist.
    (Info-read-node-name-1): Use it to allow completing over strings
    like "(foo)" without losing focus (bug#30091).
---
 lisp/info.el          | 12 ++++++++----
 lisp/progmodes/sql.el | 19 ++++++++++---------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/lisp/info.el b/lisp/info.el
index 8743b44..0db84fb 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -868,10 +868,13 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits 
Emacs itself."
         (forward-line 1)               ; does the line after delimiter match 
REGEXP?
         (re-search-backward regexp beg t))))
 
-(defun Info-find-file (filename &optional noerror)
+(defun Info-find-file (filename &optional noerror no-pop-to-dir)
   "Return expanded FILENAME, or t if FILENAME is \"dir\".
 Optional second argument NOERROR, if t, means if file is not found
-just return nil (no error)."
+just return nil (no error).
+
+If NO-POP-TO-DIR, don't try to pop to the info buffer if we can't
+find a node."
   ;; Convert filename to lower case if not found as specified.
   ;; Expand it.
   (cond
@@ -930,7 +933,8 @@ just return nil (no error)."
        (if noerror
            (setq filename nil)
          ;; If there is no previous Info file, go to the directory.
-         (unless Info-current-file
+         (when (and (not no-pop-to-dir)
+                     (not Info-current-file))
            (Info-directory))
          (user-error "Info file %s does not exist" filename)))
       filename))))
@@ -1868,7 +1872,7 @@ See `completing-read' for a description of arguments and 
usage."
          (lambda (string pred action)
            (complete-with-action
             action
-            (Info-build-node-completions (Info-find-file file1))
+            (Info-build-node-completions (Info-find-file file1 nil t))
             string pred))
         nodename predicate code))))
    ;; Otherwise use Info-read-node-completion-table.
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index f907a01..ebbef8d 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -4031,15 +4031,16 @@ 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."
-  (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))))
+  (when (buffer-live-p (process-buffer process))
+    (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)))))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]