[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/counsel 8df9516ae6 1/2: Fix counsel-tmm for Emacs 28+
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/counsel 8df9516ae6 1/2: Fix counsel-tmm for Emacs 28+ |
Date: |
Mon, 27 Mar 2023 10:27:53 -0400 (EDT) |
branch: externals/counsel
commit 8df9516ae6d2e86ec6104b6783ad380fa3945dec
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Fix counsel-tmm for Emacs 28+
* counsel.el (tmm-km-list, tmm-table-undef): Limit special scope.
(tmm-get-keymap, tmm--completion-table): Explicitly declare (so far)
stable arglists.
(counsel--menu-keymap): New compatibility alias for menu-bar-keymap.
(counsel-tmm): Use it in place of tmm-get-keybind in newer Emacs
versions (#2996).
Fixes #2996.
---
counsel.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/counsel.el b/counsel.el
index f9db529948..7bd026242a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -4353,13 +4353,21 @@ Additional actions:\\<ivy-minibuffer-map>
("h" counsel-package-action-homepage "open package homepage")))
;;** `counsel-tmm'
-(defvar tmm-km-list nil)
-(declare-function tmm-get-keymap "tmm")
-(declare-function tmm--completion-table "tmm")
-(declare-function tmm-get-keybind "tmm")
+(declare-function tmm-get-keymap "tmm" (elt &optional in-x-menu))
+(declare-function tmm--completion-table "tmm" (items))
+
+(defalias 'counsel--menu-keymap
+ ;; Added in Emacs 28.1.
+ (if (fboundp 'menu-bar-keymap)
+ #'menu-bar-keymap
+ (autoload 'tmm-get-keybind "tmm")
+ (declare-function tmm-get-keybind "tmm" (keyseq))
+ (lambda () (tmm-get-keybind [menu-bar])))
+ "Compatibility shim for `menu-bar-keymap'.")
(defun counsel-tmm-prompt (menu)
"Select and call an item from the MENU keymap."
+ (defvar tmm-km-list)
(let (out
choice
chosen-string)
@@ -4377,16 +4385,15 @@ Additional actions:\\<ivy-minibuffer-map>
(setq last-command-event chosen-string)
(call-interactively choice)))))
-(defvar tmm-table-undef)
-
;;;###autoload
(defun counsel-tmm ()
"Text-mode emulation of looking and choosing from a menu bar."
(interactive)
(require 'tmm)
+ (defvar tmm-table-undef)
(run-hooks 'menu-bar-update-hook)
(setq tmm-table-undef nil)
- (counsel-tmm-prompt (tmm-get-keybind [menu-bar])))
+ (counsel-tmm-prompt (counsel--menu-keymap)))
;;** `counsel-yank-pop'
(defcustom counsel-yank-pop-truncate-radius 2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/counsel 8df9516ae6 1/2: Fix counsel-tmm for Emacs 28+,
Basil L. Contovounesios <=