emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7f85a55: * lisp/tmm.el: Fix broken tmm-prompt (bug#


From: Juri Linkov
Subject: [Emacs-diffs] master 7f85a55: * lisp/tmm.el: Fix broken tmm-prompt (bug#34517)
Date: Sun, 8 Sep 2019 16:27:31 -0400 (EDT)

branch: master
commit 7f85a5569d89322546c3ca21c38d9457db3b3665
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/tmm.el: Fix broken tmm-prompt (bug#34517)
    
    * lisp/tmm.el (tmm-prompt): Don't duplicate items of tmm--history.
    Don't reverse tmm-km-list for completion.  Don't set the initial
    position of 'tmm--history.  Use reverse tmm--history as the list
    of default values for M-n.
    (tmm-add-prompt): Don't insert initial value to the minibuffer.
---
 lisp/tmm.el | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/lisp/tmm.el b/lisp/tmm.el
index bf76652..c1c8638 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -240,8 +240,6 @@ instead of executing it."
                                            (car elt)))
                                      tmm-km-list)))))
             (setq history-len (length tmm--history))
-            (setq tmm--history (append tmm--history tmm--history
-                                        tmm--history tmm--history))
             (setq tmm-c-prompt (nth (- history-len 1 index-of-default)
                                      tmm--history))
              (setq out
@@ -249,18 +247,17 @@ instead of executing it."
                        (car (nth index-of-default tmm-km-list))
                      (minibuffer-with-setup-hook #'tmm-add-prompt
                        ;; tmm-km-list is reversed, because history
-                       ;; needs it in LIFO order.  But completion
+                       ;; needs it in LIFO order.  But default list
                        ;; needs it in non-reverse order, so that the
-                       ;; menu items are displayed as completion
-                       ;; candidates in the order they are shown on
-                       ;; the menu bar.  So pass completing-read the
+                       ;; menu items are displayed by M-n as default
+                       ;; values in the order they are shown on
+                       ;; the menu bar.  So pass the DEFAULT arg the
                        ;; reversed copy of the list.
                        (completing-read-default
                         (concat gl-str
                                 " (up/down to change, PgUp to menu): ")
-                        (tmm--completion-table (reverse tmm-km-list)) nil t nil
-                        (cons 'tmm--history
-                              (- (* 2 history-len) index-of-default))))))))
+                        (tmm--completion-table tmm-km-list) nil t nil
+                        'tmm--history (reverse tmm--history)))))))
       (setq choice (cdr (assoc out tmm-km-list)))
       (and (null choice)
            (string-prefix-p tmm-c-prompt out)
@@ -404,8 +401,7 @@ Stores a list of all the shortcuts in the free variable 
`tmm-short-cuts'."
          ;; Try to show everything just inserted and preserve height of
          ;; *Completions* window.  This should fix a behavior described
          ;; in Bug#1291.
-         (fit-window-to-buffer window nil nil nil nil t)))))
-  (insert tmm-c-prompt))
+         (fit-window-to-buffer window nil nil nil nil t))))))
 
 (defun tmm-shortcut ()
   "Choose the shortcut that the user typed."



reply via email to

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