From: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 74166@debbugs.gnu.org
Subject: bug#74166: [PATCH] Fix tmm "previous menu" shortcut
Date: Fri, 01 Nov 2024 19:36:00 +0100 [thread overview]
Message-ID: <877c9m244v.fsf@ledu-giraud.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
Tags: patch
Hi,
The following patch fixes the "previous menu" shortcut in tmm-menubar
when one has already used Up/Down keys into a submenu.
How to reproduce the bug:
- M-x tmm-menubar
- t ;; for the Tools menu
- Down ;; to circulate to the first entry
- ^ ;; quits tmm but should go back to toplevel instead
While here, explain a "Why?" comment.
In GNU Emacs 31.0.50 (build 86, x86_64-unknown-openbsd7.6, X toolkit) of
2024-11-01 built on computer
Repository revision: ffda8dfe847094bd8488059be2f96270fe298fa5
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: OpenBSD computer 7.6 GENERIC.MP#394 amd64
Configured using:
'configure CC=egcc CPPFLAGS=-I/usr/local/include
LDFLAGS=-L/usr/local/lib MAKEINFO=gmakeinfo --prefix=/home/manuel/emacs
--bindir=/home/manuel/bin --with-x-toolkit=lucid
--with-toolkit-scroll-bars=no --without-cairo
--without-compress-install'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-tmm-previous-menu-shortcut.patch --]
[-- Type: text/patch, Size: 1825 bytes --]
From 20cbb94b4c83a22d7d65578fab3a581a42836f56 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel@ledu-giraud.fr>
Date: Fri, 1 Nov 2024 19:27:31 +0100
Subject: [PATCH] Fix tmm "previous menu" shortcut
* lisp/tmm.el (tmm-clear-self-insert-and-exit): New function to
clear the minibuffer content then call `self-insert-and-exit'.
(tmm-define-keys): Use it.
(tmm-goto-completions): Explain a why.
---
lisp/tmm.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/tmm.el b/lisp/tmm.el
index 80991b246b6..cf34f643c3b 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -336,6 +336,12 @@ tmm-add-one-shortcut
str))
(cdr elt))))))
+(defun tmm-clear-self-insert-and-exit ()
+ "Clear the minibuffer content before self insert and exit."
+ (interactive)
+ (delete-region (minibuffer-prompt-end) (point-max))
+ (self-insert-and-exit))
+
;; This returns the old map.
(defun tmm-define-keys (minibuffer)
(let ((map (make-sparse-keymap)))
@@ -354,7 +360,7 @@ tmm-define-keys
(define-key map "\C-n" 'next-history-element)
(define-key map "\C-p" 'previous-history-element)
;; Previous menu shortcut (see `tmm-prompt').
- (define-key map "^" 'self-insert-and-exit))
+ (define-key map "^" 'tmm-clear-self-insert-and-exit))
(prog1 (current-local-map)
(use-local-map (append map (current-local-map))))))
@@ -454,7 +460,8 @@ tmm-goto-completions
(interactive)
(let ((prompt-end (minibuffer-prompt-end)))
(setq tmm-c-prompt (buffer-substring prompt-end (point-max)))
- ;; FIXME: Why?
+ ;; Clear minibuffer old content before using *Completions* buffer
+ ;; for selection.
(delete-region prompt-end (point-max)))
(switch-to-buffer-other-window "*Completions*")
(search-forward tmm-c-prompt)
--
2.47.0
[-- Attachment #3: Type: text/plain, Size: 18 bytes --]
--
Manuel Giraud
reply other threads:[~2024-11-01 18:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877c9m244v.fsf@ledu-giraud.fr \
--to=bug-gnu-emacs@gnu.org \
--cc=74166@debbugs.gnu.org \
--cc=manuel@ledu-giraud.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.