unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Reversed tmm-prompt items when tmm-mid-prompt is nil
@ 2023-05-28 14:59 Thiago Melo
  2023-05-29 12:33 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Melo @ 2023-05-28 14:59 UTC (permalink / raw)
  To: emacs-devel

Commit #5d844e1 fixed `tmm-prompt' for Emacs 29 (Bug#63754. Thanks,
Eli!) and even made the `tmm-mid-prompt' = nil option work again.

The fix also surfaced one inconsistency between nil and non-nil
`tmm-mid-prompt'.  When nil, the items shown by `tmm-prompt' are
reversed.

Compare these two cases:


(let ((tmm-mid-prompt "==>")
      (test-menu '("top" ("menu" ("foo" . 1) ("bar" . 2) ("baz" . 3)))))
  (tmm-prompt test-menu))

(let ((tmm-mid-prompt nil)
      (test-menu '("top" ("menu" ("foo" . 1) ("bar" . 2) ("baz" . 3)))))
  (tmm-prompt test-menu))


It seems innocuous and not worth a bug report.  Still, here's a way to
make this behavior more consistent:

--- a/lisp/tmm.el    2023-05-27 21:26:44.594743965 +0200
+++ b/lisp/tmm.el    2023-05-28 01:44:53.850880002 +0200
@@ -172,7 +172,7 @@ (defun tmm-prompt (menu &optional in-pop
        (let ((index-of-default 0))
          (if tmm-mid-prompt
          (setq tmm-km-list (tmm-add-shortcuts tmm-km-list))
-           t)
+           (setq tmm-km-list (reverse tmm-km-list)))
          ;; Find the default item's index within the menu bar.
          ;; We use this to decide the initial minibuffer contents
          ;; and initial history position.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reversed tmm-prompt items when tmm-mid-prompt is nil
  2023-05-28 14:59 Reversed tmm-prompt items when tmm-mid-prompt is nil Thiago Melo
@ 2023-05-29 12:33 ` Eli Zaretskii
  2023-05-29 14:40   ` Thiago Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-05-29 12:33 UTC (permalink / raw)
  To: Thiago Melo; +Cc: emacs-devel

> From: Thiago Melo <tmdmelo@gmail.com>
> Date: Sun, 28 May 2023 14:59:37 +0000
> 
> Commit #5d844e1 fixed `tmm-prompt' for Emacs 29 (Bug#63754. Thanks,
> Eli!) and even made the `tmm-mid-prompt' = nil option work again.

AFAICT, this was broken ever since Emacs 22.1, when someone
"optimized" a regexp without paying attention to the possibility of
tmm-mid-prompt being nil.

> The fix also surfaced one inconsistency between nil and non-nil
> `tmm-mid-prompt'.  When nil, the items shown by `tmm-prompt' are
> reversed.
> 
> Compare these two cases:
> 
> 
> (let ((tmm-mid-prompt "==>")
>       (test-menu '("top" ("menu" ("foo" . 1) ("bar" . 2) ("baz" . 3)))))
>   (tmm-prompt test-menu))
> 
> (let ((tmm-mid-prompt nil)
>       (test-menu '("top" ("menu" ("foo" . 1) ("bar" . 2) ("baz" . 3)))))
>   (tmm-prompt test-menu))
> 
> 
> It seems innocuous and not worth a bug report.  Still, here's a way to
> make this behavior more consistent:

Thanks, I installed a somewhat simpler version of this on the emacs-29
branch.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reversed tmm-prompt items when tmm-mid-prompt is nil
  2023-05-29 12:33 ` Eli Zaretskii
@ 2023-05-29 14:40   ` Thiago Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Thiago Melo @ 2023-05-29 14:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Mon, May 29, 2023 at 12:33 PM Eli Zaretskii <eliz@gnu.org> wrote:
> Thanks, I installed a somewhat simpler version of this on the emacs-29
> branch.

Clever.  Thanks again.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-29 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-28 14:59 Reversed tmm-prompt items when tmm-mid-prompt is nil Thiago Melo
2023-05-29 12:33 ` Eli Zaretskii
2023-05-29 14:40   ` Thiago Melo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).