emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111439: * lisp/info.el (Info-read-no


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111439: * lisp/info.el (Info-read-node-name-2): Don't duplicate suffixes for single completion.
Date: Tue, 08 Jan 2013 02:28:55 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111439
fixes bug: http://debbugs.gnu.org/12456
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-01-08 02:28:55 +0200
message:
  * lisp/info.el (Info-read-node-name-2): Don't duplicate suffixes for single 
completion. 
  (info--manual-names): Expand node completions into an explicit list
  before appending it to another list.  Filter out internal buffers
  with the leading space in the buffer name.  (Bug#10771)
modified:
  lisp/ChangeLog
  lisp/info.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-08 00:11:51 +0000
+++ b/lisp/ChangeLog    2013-01-08 00:28:55 +0000
@@ -1,5 +1,13 @@
 2013-01-08  Juri Linkov  <address@hidden>
 
+       * info.el (Info-read-node-name-2): Don't duplicate suffixes for
+       single completion.  (Bug#12456)
+       (info--manual-names): Expand node completions into an explicit list
+       before appending it to another list.  Filter out internal buffers
+       with the leading space in the buffer name.  (Bug#10771)
+
+2013-01-08  Juri Linkov  <address@hidden>
+
        * info.el (Info-read-node-name-1): Allow empty node name in (FILENAME)
        that defaults to the Top node.
        (Info-goto-node, Info-read-node-name): Doc fix to mention that

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2013-01-08 00:11:51 +0000
+++ b/lisp/info.el      2013-01-08 00:28:55 +0000
@@ -1742,6 +1742,7 @@
   (when (file-name-absolute-p string)
     (setq dirs (list (file-name-directory string))))
   (let ((names nil)
+       (names-sans-suffix nil)
         (suffix (concat (regexp-opt suffixes t) "\\'"))
         (string-dir (file-name-directory string)))
     (dolist (dir dirs)
@@ -1764,7 +1765,14 @@
          ;; add the unsuffixed name as a completion option.
          (when (string-match suffix file)
            (setq file (substring file 0 (match-beginning 0)))
-           (push (if string-dir (concat string-dir file) file) names)))))
+           (push (if string-dir (concat string-dir file) file)
+                 names-sans-suffix)))))
+    ;; If there is just one file, don't duplicate it with suffixes,
+    ;; so `Info-read-node-name-1' will be able to complete a single
+    ;; candidate and to add the terminating ")".
+    (if (and (= (length names) 1) (= (length names-sans-suffix) 1))
+       (setq names names-sans-suffix)
+      (setq names (append names-sans-suffix names)))
     (complete-with-action action names string pred)))
 
 (defun Info-read-node-name-1 (string predicate code)
@@ -5174,13 +5182,16 @@
       (with-current-buffer buffer
        (and (eq major-mode 'Info-mode)
             (stringp Info-current-file)
+            (not (string= (substring (buffer-name) 0 1) " "))
             (push (file-name-sans-extension
                    (file-name-nondirectory Info-current-file))
                   names))))
     (delete-dups (append (nreverse names)
-                        (apply-partially 'Info-read-node-name-2
-                                         Info-directory-list
-                                         (mapcar 'car Info-suffix-list))))))
+                        (all-completions
+                         ""
+                         (apply-partially 'Info-read-node-name-2
+                                          Info-directory-list
+                                          (mapcar 'car Info-suffix-list)))))))
 
 (provide 'info)
 


reply via email to

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