]> git.eshelyaron.com Git - emacs.git/commitdiff
Sort completions in Info references/menu correctly
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 5 May 2022 11:30:14 +0000 (13:30 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 5 May 2022 11:30:14 +0000 (13:30 +0200)
* lisp/info.el (Info-follow-reference): Sort completions in the
order they appear in the buffer (bug#54175).
(Info-menu-update): Ditto.

lisp/info.el

index 8ca6c549791bdadae11099db157cd71d9e7c7d08..abfb77b05522781a3168244fad7116c7244ae340 100644 (file)
@@ -2599,7 +2599,8 @@ new buffer."
         (if (eq alt-default t) (setq alt-default str))
         ;; Don't add this string if it's a duplicate.
         (or (assoc-string str completions t)
-            (push str completions))))
+            (push str completions)))
+       (setq completions (nreverse completions)))
      ;; If no good default was found, try an alternate.
      (or default
         (setq default alt-default))
@@ -4285,7 +4286,8 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
                                  (substring str (match-end 0))))
                (setq i (1+ i)))
              (setq items
-                   (cons str items))))
+                   (cons str items)))
+            (setq items (nreverse items)))
          (while (and items (< number 9))
            (setq current (car items)
                  items (cdr items)