From unknown Sat Jun 21 02:54:38 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#73498 <73498@debbugs.gnu.org> To: bug#73498 <73498@debbugs.gnu.org> Subject: Status: [PATCH] Add a shortcut to go up in the menu hierarchy. Reply-To: bug#73498 <73498@debbugs.gnu.org> Date: Sat, 21 Jun 2025 09:54:38 +0000 retitle 73498 [PATCH] Add a shortcut to go up in the menu hierarchy. reassign 73498 emacs submitter 73498 Manuel Giraud severity 73498 wishlist tag 73498 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 26 07:28:45 2024 Received: (at submit) by debbugs.gnu.org; 26 Sep 2024 11:28:45 +0000 Received: from localhost ([127.0.0.1]:57552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stmfs-0008FD-M0 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 07:28:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:41958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stmfp-0008F4-D6 for submit@debbugs.gnu.org; Thu, 26 Sep 2024 07:28:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stmfO-0007BV-2C for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 07:28:14 -0400 Received: from ledu-giraud.fr ([51.159.28.247]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stmep-0003JK-7F for bug-gnu-emacs@gnu.org; Thu, 26 Sep 2024 07:27:48 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=XgncRl1E uM2WaeAvfG25Ss07Ji8Ile0DgN33+aIetXo=; h=date:subject:to:from; d=ledu-giraud.fr; b=F5XDvU6hfYpd0jiyj+Oip49P6nomRjYw+43jYbh3OMMuL9YR6z QNqNdMH0Tt9tSjhqEY7HB46ESH6+KKoGdrCA== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=XgncRl1EuM2WaeAv fG25Ss07Ji8Ile0DgN33+aIetXo=; h=date:subject:to:from; d=ledu-giraud.fr; b=lRyYWmGC6aeRvHIjpuVGQhDfQpLmSytkvF871oDewKhNKz7+Nz xj2FyGXLxrp9wRhhDyKQbmF2ujk5qC65WUDgIwb3WNTs0xnCAa6o+eAh+JATgt76iuRR2D 0SlXJq3tBPC93d1tS4U6TAvftBabwKAP74StoEQYa09sdf3w/Nc8aztLmIxZUKy2Ya+5IY vbdv2n/X3y7nsL3s9NEgtql6BW3F3BZJXsKIQvvf2Ow5IRcUCN5CYTbLkpMc3kNAHDqam5 TwkPEBhqgZhm21wQ/fNHMrHiw0WCEscIURtQyvdzIiGpUhh1+EB7zmDMplwW0IGFIGpdfK FYd0KidCGOxg== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id e5576f1f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Thu, 26 Sep 2024 13:27:26 +0200 (CEST) From: Manuel Giraud To: bug-gnu-emacs@gnu.org Subject: [PATCH] Add a shortcut to go up in the menu hierarchy. Date: Thu, 26 Sep 2024 13:27:24 +0200 Message-ID: <87cykqhcyr.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch Hi, Here is a patch that add a shortcut (^) to `tmm-menubar' to go upward in the menu hierarchy. In GNU Emacs 31.0.50 (build 4, x86_64-unknown-openbsd7.6) of 2024-09-21 built on computer Repository revision: 4745bafa6a1d6aeda5ad08e09541d076ee223382 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101013 System Description: OpenBSD computer 7.6 GENERIC.MP#321 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=no --with-toolkit-scroll-bars=no --without-cairo --without-compress-install' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Add-a-shortcut-to-go-up-in-the-menu-hierarchy.patch >From f86caa4cf06801c1917247519a16594b8fad9de9 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Wed, 25 Sep 2024 10:31:12 +0200 Subject: [PATCH] Add a shortcut to go up in the menu hierarchy. * lisp/tmm.el (tmm-prompt): Add a shortcut to go up in the menu hierarchy. (tmm-completion-prompt): Document it in help message. (tmm-define-keys): Add the shortcut in the keymap. --- lisp/tmm.el | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/lisp/tmm.el b/lisp/tmm.el index f52afb7e162..444d7945987 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -88,8 +88,9 @@ tmm-mb-map (defcustom tmm-completion-prompt "Press PageUp key to reach this buffer from the minibuffer. Alternatively, you can use Up/Down keys (or your History keys) to change -the item in the minibuffer, and press RET when you are done, or press the -marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel. +the item in the minibuffer, and press RET when you are done, or press +the marked letters to pick up your choice. Type ^ to go to the parent +menu. Type C-g or ESC ESC ESC to cancel. " "Help text to insert on the top of the completion buffer. To save space, you can set this to nil, @@ -123,7 +124,7 @@ tmm--completion-table (defvar tmm--history nil) ;;;###autoload -(defun tmm-prompt (menu &optional in-popup default-item no-execute) +(defun tmm-prompt (menu &optional in-popup default-item no-execute path) "Text-mode emulation of calling the bindings in keymap. Creates a text-mode menu of possible choices. You can access the elements in the menu in two ways: @@ -136,7 +137,9 @@ tmm-prompt DEFAULT-ITEM, if non-nil, specifies an initial default choice. Its value should be an event that has a binding in MENU. NO-EXECUTE, if non-nil, means to return the command the user selects -instead of executing it." +instead of executing it. +PATH is a stack that keeps track your path into sub-menus. It is used +to go back in the menu hierarchy." ;; If the optional argument IN-POPUP is t, ;; then MENU is an alist of elements of the form (STRING . VALUE). ;; That is used for recursive calls only. @@ -227,22 +230,28 @@ tmm-prompt " (up/down to change, PgUp to menu): ") (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) - (setq out (substring out (length tmm-c-prompt)) - choice (cdr (assoc out tmm-km-list)))) - (and (null choice) out - (setq out (try-completion out tmm-km-list) - choice (cdr (assoc out tmm-km-list))))) + (if (and (stringp out) (string= "^" out)) + ;; a fake choice to please the destructuring later. + (setq choice (cons out out)) + (setq choice (cdr (assoc out tmm-km-list))) + (and (null choice) + (string-prefix-p tmm-c-prompt out) + (setq out (substring out (length tmm-c-prompt)) + choice (cdr (assoc out tmm-km-list)))) + (and (null choice) out + (setq out (try-completion out tmm-km-list) + choice (cdr (assoc out tmm-km-list)))))) ;; CHOICE is now (STRING . MEANING). Separate the two parts. (setq chosen-string (car choice)) (setq choice (cdr choice)) - (cond (in-popup + (cond ((and (stringp choice) (string= "^" choice)) + ;; User wants to go up: do it first. + (if path (tmm-prompt (pop path) in-popup nil nil path))) + (in-popup ;; We just did the inner level of a -popup menu. choice) ;; We just did the outer level. Do the inner level now. - (not-menu (tmm-prompt choice t nil no-execute)) + (not-menu (tmm-prompt choice t nil no-execute (cons menu path))) ;; We just handled a menu keymap and found another keymap. ((keymapp choice) (if (symbolp choice) @@ -250,7 +259,7 @@ tmm-prompt (condition-case nil (require 'mouse) (error nil)) - (tmm-prompt choice nil nil no-execute)) + (tmm-prompt choice nil nil no-execute (cons menu path))) ;; We just handled a menu keymap and found a command. (choice (if chosen-string @@ -322,7 +331,8 @@ tmm-define-keys (define-key map [prior] 'tmm-goto-completions) (define-key map "\ev" 'tmm-goto-completions) (define-key map "\C-n" 'next-history-element) - (define-key map "\C-p" 'previous-history-element))) + (define-key map "\C-p" 'previous-history-element) + (define-key map "^" 'self-insert-and-exit))) (prog1 (current-local-map) (use-local-map (append map (current-local-map)))))) -- 2.46.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 12:10:43 2024 Received: (at 73498) by debbugs.gnu.org; 29 Sep 2024 16:10:43 +0000 Received: from localhost ([127.0.0.1]:40929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suwVO-0006kJ-N6 for submit@debbugs.gnu.org; Sun, 29 Sep 2024 12:10:42 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:60661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suwVL-0006bx-J4 for 73498@debbugs.gnu.org; Sun, 29 Sep 2024 12:10:40 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 7F7B9C0003; Sun, 29 Sep 2024 16:09:59 +0000 (UTC) From: Juri Linkov To: Manuel Giraud Subject: Re: bug#73498: [PATCH] Add a shortcut to go up in the menu hierarchy. In-Reply-To: <87cykqhcyr.fsf@ledu-giraud.fr> (Manuel Giraud via's message of "Thu, 26 Sep 2024 13:27:24 +0200") Organization: LINKOV.NET References: <87cykqhcyr.fsf@ledu-giraud.fr> Date: Sun, 29 Sep 2024 19:04:33 +0300 Message-ID: <86ldzamqzq.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73498 Cc: 73498@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Here is a patch that add a shortcut (^) to `tmm-menubar' to go upward in > the menu hierarchy. Thanks, I tried it, and it works nicely. Should it be mentioned in NEWS? From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 21:36:25 2024 Received: (at control) by debbugs.gnu.org; 30 Sep 2024 01:36:25 +0000 Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5Kq-0007pU-Og for submit@debbugs.gnu.org; Sun, 29 Sep 2024 21:36:25 -0400 Received: from mail-lf1-f52.google.com ([209.85.167.52]:58807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sv5Ko-0007oS-QM for control@debbugs.gnu.org; Sun, 29 Sep 2024 21:36:23 -0400 Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5398e4ae9efso1105950e87.1 for ; Sun, 29 Sep 2024 18:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727660085; x=1728264885; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=jEGNVz8cw2Q5gHV6uWWV89IWwGvbYGutX3Ou0CNjIng=; b=fJDmNApQbgMi+IQIfRtWzuJIvHzdTSdx5a4GR0LP9zLoxMD/xPbLh9q6KtUzBmXusM zynHDHWvHutdlK1B8u1WtVs3M3Ba4sHlmoHwglR3mprcjxHlO2CWoyMuZGmSmZccjAZG 4KKPQfrb1n2tWY+uvI7AOAR0LIvxTvXLe0g8ZTJzAFeFd4IACDVavV5ZlRJoozNdLqDV U6E9CPPK2zEMCa9LnzhtCdzu2WMy3TOb4Lo3bhhyMrpcXOeNnKTaIzqlMCjn7XPIH0TD Xg6lzzvJWXph0jZtDm4CScpzOOn6otgXK+I7rzLpzEq0VIJJBTlU0r+oLRx/FkYw7n6a i0Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727660085; x=1728264885; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jEGNVz8cw2Q5gHV6uWWV89IWwGvbYGutX3Ou0CNjIng=; b=Lk6dk0SpuX9bCdC8Hn4Hh8/ySme4wZnvVW5jTABFnXJvbup90wa8PfvqzMObA/KnJ/ FmdxjwrIxB2F/v46XCw2e/onVAzHNa7XxW5jZLxuEce1NADOOc5MWvjLlm5CfDmRJNZ4 stC4/7dPxcCaqHTlXR8kwy7HbeEJn+imIPhGSR86//ndnPp4/k2QZAYsOGuosglvwwOU OiaJURuV2w4DMIlA0bijHS5apzY/vMdNYlUzNV9+9hEe7IRWPxgP2DtkNtnRRnnQRqa5 BqXWXEehb23ecnuqZAJbvZIWcpwTki5wHHR4zl9GVlPiyY/fM0ghQSSO/FeC1NWd49J/ 5WGQ== X-Gm-Message-State: AOJu0Yyt3j9On01WORcLmkp7xiYDg/qpuKPLy1pcACiTtbIZ2+UlO5G3 r5S7EgktUysqSMmm++VvUS3+Rh1uF/xI7jLQsuALaaVFwCsE7L1ORHRR2q9T1qIvZdVJo4zFORq AdksudPVtSOeMYFQ+4iGHk9ywEBRKeA== X-Google-Smtp-Source: AGHT+IGJ/0O1K/gaQEoB53X36oRG9yBA9PNGj8ku86TytM8zPVO/Qsz+vdcCpe5KnlqJhE0rMu6ihousxzM8zdjenu8= X-Received: by 2002:a05:6512:3a89:b0:536:550e:7804 with SMTP id 2adb3069b0e04-5389fc3afbcmr4334665e87.18.1727660084368; Sun, 29 Sep 2024 18:34:44 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 29 Sep 2024 18:34:44 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Sun, 29 Sep 2024 18:34:44 -0700 Message-ID: Subject: control message for bug #73498 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: -0.9 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) severity 73498 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 03:55:21 2024 Received: (at 73498) by debbugs.gnu.org; 30 Sep 2024 07:55:22 +0000 Received: from localhost ([127.0.0.1]:44600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svBFX-0000si-HZ for submit@debbugs.gnu.org; Mon, 30 Sep 2024 03:55:21 -0400 Received: from ledu-giraud.fr ([51.159.28.247]:25917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svBFM-0000qw-Sw for 73498@debbugs.gnu.org; Mon, 30 Sep 2024 03:55:14 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=Ngvat1sq X2KvBBFOLt65KYpFvp80wOYie2/H4LPwPAQ=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=cP6edyzSYcmHTAF1qg2puTciMcW3dW IySSFZeVGrVBBOw7h1oYM0sZ/JyEaeMCSVN8/9eUozs1+SC3UdPLFbAw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=Ngvat1sqX2KvBBFO Lt65KYpFvp80wOYie2/H4LPwPAQ=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=B5nvcSlokGaM7N9PZBM3JBiisgmDgYOJI9K2uM pqy81RUyx/iBWptvqraGhiRvTAM1oc/XmppnPbrhqQ2s4TJKVe58hKQOYc0milu9U/oXPv 5a/PnSoJ/uFEuSnwcgk+Tm3AhcRYymKFv5eBno49IcVVm5+k6SMcSGJXtcb4bSOdZSW4l8 /WPVHq93uJ5VdiYgPcHKvA//6FFjsZfpIYTVN4ITXJJHoZonb1y9XCoNBqEQt9yOIvBbSf 14gzqwrxYmaUcp4pYrvTq6jfCFP34A1DfzPFd8EqMRvY+XVvcFBxXq94AwtNCPFaKkT8KX B7l+n0WGa3A6Hc2UMGELkovw== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 32ecfd55 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 30 Sep 2024 09:54:31 +0200 (CEST) From: Manuel Giraud To: Juri Linkov Subject: Re: bug#73498: [PATCH] Add a shortcut to go up in the menu hierarchy. In-Reply-To: <86ldzamqzq.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 29 Sep 2024 19:04:33 +0300") References: <87cykqhcyr.fsf@ledu-giraud.fr> <86ldzamqzq.fsf@mail.linkov.net> Date: Mon, 30 Sep 2024 09:54:30 +0200 Message-ID: <87ttdxr2yx.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73498 Cc: 73498@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: >> Here is a patch that add a shortcut (^) to `tmm-menubar' to go upward in >> the menu hierarchy. > > Thanks, I tried it, and it works nicely. > > Should it be mentioned in NEWS? I guess yes, I'll add one. -- Manuel Giraud From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 30 11:50:23 2024 Received: (at 73498) by debbugs.gnu.org; 30 Sep 2024 15:50:23 +0000 Received: from localhost ([127.0.0.1]:45551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svIfH-0000XI-0W for submit@debbugs.gnu.org; Mon, 30 Sep 2024 11:50:23 -0400 Received: from ledu-giraud.fr ([51.159.28.247]:30375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svIfE-0000XA-Ft for 73498@debbugs.gnu.org; Mon, 30 Sep 2024 11:50:22 -0400 DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple; s=ed25519; bh=A3/LzFRT fT/Jb3qu6JlLFlDrOXvC40K0qRfWU0Vh7ss=; h=date:references:in-reply-to: subject:cc:to:from; d=ledu-giraud.fr; b=eRfpCbFP2wTEa7AX3Vno6k5jcAZIV8 7SLla2/83YnyJqR8I2XYeMfifeH5r9aszlZkOJwU9UFTmE20pn2sCQAw== DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=A3/LzFRTfT/Jb3qu 6JlLFlDrOXvC40K0qRfWU0Vh7ss=; h=date:references:in-reply-to:subject: cc:to:from; d=ledu-giraud.fr; b=TLL0sJrsomR+qcYX4UlszgCeyIUKu1U80sDLMx /vWBbIMBhAQFzF5qcty46elmEUMAn7PIAEwyMc0x7QyxkZs6afN/EBDaom+TILzAgyWFKL J0rM9Ryjz1Ld0nv7Cug10Oy0Z9D6cwPEfpnV/HGx267eqtsaWr6R68lIW2ZCjroM8diQAK TSgCCFwe3PTSm6EsN83ImAdLkcVTlJKktXa6U+U94fdJ4GI2d0hwDz1O3wOfy+RJjRDxuB hgvsZZIyGPhpscvWMyDjv28zE02H9WYb9+2xZcpZ7c3RfbKP/vpQBSTNhBZpoS1Q3U56gW 74RVlh/VG5MFA5HL5bd6ckew== Received: from computer ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 927c5876 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 30 Sep 2024 17:49:44 +0200 (CEST) From: Manuel Giraud To: Juri Linkov Subject: Re: bug#73498: [PATCH] Add a shortcut to go up in the menu hierarchy. In-Reply-To: <86ldzamqzq.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 29 Sep 2024 19:04:33 +0300") References: <87cykqhcyr.fsf@ledu-giraud.fr> <86ldzamqzq.fsf@mail.linkov.net> Date: Mon, 30 Sep 2024 17:49:44 +0200 Message-ID: <87ttdxnntz.fsf@ledu-giraud.fr> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73498 Cc: 73498@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Juri Linkov writes: >> Here is a patch that add a shortcut (^) to `tmm-menubar' to go upward in >> the menu hierarchy. > > Thanks, I tried it, and it works nicely. > > Should it be mentioned in NEWS? Here is a new version of the patch with a NEWS entry. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-a-shortcut-to-go-up-in-the-menu-hierarchy.patch >From bd772c361f5060776b5134fcd4dcd71606affc5f Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Wed, 25 Sep 2024 10:31:12 +0200 Subject: [PATCH] Add a shortcut to go up in the menu hierarchy. * lisp/tmm.el (tmm-prompt): Add a shortcut to go up in the menu hierarchy. (tmm-completion-prompt): Document it in help message. (tmm-define-keys): Add the shortcut in the keymap. * etc/NEWS: Document the change. --- etc/NEWS | 6 ++++++ lisp/tmm.el | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index c1a0524c8ba..8445015d16c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -403,6 +403,12 @@ toggle. Putting (require 'midnight) in your init file no longer activates the mode. Now, one needs to say (midnight-mode +1) instead. +** Tmm Menubar + +--- +*** Add a shortcut to navigate to previous menu +The hardcoded "^" shortcut gets you back to the previous menu. + * New Modes and Packages in Emacs 31.1 diff --git a/lisp/tmm.el b/lisp/tmm.el index f52afb7e162..444d7945987 100644 --- a/lisp/tmm.el +++ b/lisp/tmm.el @@ -88,8 +88,9 @@ tmm-mb-map (defcustom tmm-completion-prompt "Press PageUp key to reach this buffer from the minibuffer. Alternatively, you can use Up/Down keys (or your History keys) to change -the item in the minibuffer, and press RET when you are done, or press the -marked letters to pick up your choice. Type C-g or ESC ESC ESC to cancel. +the item in the minibuffer, and press RET when you are done, or press +the marked letters to pick up your choice. Type ^ to go to the parent +menu. Type C-g or ESC ESC ESC to cancel. " "Help text to insert on the top of the completion buffer. To save space, you can set this to nil, @@ -123,7 +124,7 @@ tmm--completion-table (defvar tmm--history nil) ;;;###autoload -(defun tmm-prompt (menu &optional in-popup default-item no-execute) +(defun tmm-prompt (menu &optional in-popup default-item no-execute path) "Text-mode emulation of calling the bindings in keymap. Creates a text-mode menu of possible choices. You can access the elements in the menu in two ways: @@ -136,7 +137,9 @@ tmm-prompt DEFAULT-ITEM, if non-nil, specifies an initial default choice. Its value should be an event that has a binding in MENU. NO-EXECUTE, if non-nil, means to return the command the user selects -instead of executing it." +instead of executing it. +PATH is a stack that keeps track your path into sub-menus. It is used +to go back in the menu hierarchy." ;; If the optional argument IN-POPUP is t, ;; then MENU is an alist of elements of the form (STRING . VALUE). ;; That is used for recursive calls only. @@ -227,22 +230,28 @@ tmm-prompt " (up/down to change, PgUp to menu): ") (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) - (setq out (substring out (length tmm-c-prompt)) - choice (cdr (assoc out tmm-km-list)))) - (and (null choice) out - (setq out (try-completion out tmm-km-list) - choice (cdr (assoc out tmm-km-list))))) + (if (and (stringp out) (string= "^" out)) + ;; a fake choice to please the destructuring later. + (setq choice (cons out out)) + (setq choice (cdr (assoc out tmm-km-list))) + (and (null choice) + (string-prefix-p tmm-c-prompt out) + (setq out (substring out (length tmm-c-prompt)) + choice (cdr (assoc out tmm-km-list)))) + (and (null choice) out + (setq out (try-completion out tmm-km-list) + choice (cdr (assoc out tmm-km-list)))))) ;; CHOICE is now (STRING . MEANING). Separate the two parts. (setq chosen-string (car choice)) (setq choice (cdr choice)) - (cond (in-popup + (cond ((and (stringp choice) (string= "^" choice)) + ;; User wants to go up: do it first. + (if path (tmm-prompt (pop path) in-popup nil nil path))) + (in-popup ;; We just did the inner level of a -popup menu. choice) ;; We just did the outer level. Do the inner level now. - (not-menu (tmm-prompt choice t nil no-execute)) + (not-menu (tmm-prompt choice t nil no-execute (cons menu path))) ;; We just handled a menu keymap and found another keymap. ((keymapp choice) (if (symbolp choice) @@ -250,7 +259,7 @@ tmm-prompt (condition-case nil (require 'mouse) (error nil)) - (tmm-prompt choice nil nil no-execute)) + (tmm-prompt choice nil nil no-execute (cons menu path))) ;; We just handled a menu keymap and found a command. (choice (if chosen-string @@ -322,7 +331,8 @@ tmm-define-keys (define-key map [prior] 'tmm-goto-completions) (define-key map "\ev" 'tmm-goto-completions) (define-key map "\C-n" 'next-history-element) - (define-key map "\C-p" 'previous-history-element))) + (define-key map "\C-p" 'previous-history-element) + (define-key map "^" 'self-insert-and-exit))) (prog1 (current-local-map) (use-local-map (append map (current-local-map)))))) -- 2.46.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 06 13:31:25 2024 Received: (at 73498) by debbugs.gnu.org; 6 Oct 2024 17:31:25 +0000 Received: from localhost ([127.0.0.1]:42258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxV6K-0006DA-Ny for submit@debbugs.gnu.org; Sun, 06 Oct 2024 13:31:24 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:59385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sxV6I-0006Cn-9F; Sun, 06 Oct 2024 13:31:23 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 6AA431C0002; Sun, 6 Oct 2024 17:30:47 +0000 (UTC) From: Juri Linkov To: Manuel Giraud Subject: Re: bug#73498: [PATCH] Add a shortcut to go up in the menu hierarchy. In-Reply-To: <87ttdxnntz.fsf@ledu-giraud.fr> (Manuel Giraud's message of "Mon, 30 Sep 2024 17:49:44 +0200") Organization: LINKOV.NET References: <87cykqhcyr.fsf@ledu-giraud.fr> <86ldzamqzq.fsf@mail.linkov.net> <87ttdxnntz.fsf@ledu-giraud.fr> Date: Sun, 06 Oct 2024 20:29:58 +0300 Message-ID: <86a5fh87hl.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73498 Cc: 73498@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) close 73498 31.0.50 thanks >> Should it be mentioned in NEWS? > > Here is a new version of the patch with a NEWS entry. Thanks, now pushed to master. From unknown Sat Jun 21 02:54:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 04 Nov 2024 12:24:18 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator