Right click on category fails with Emacs 27.1 and later
hdasch opened this issue · 1 comments
hdasch commented
With emacs 27.1 and later, following the demonstration in the README, a mouse right click on a category results in a wrong-type-arugment
error. This is a regression in Emacs, not an issue with log4slime. I mention it here to leave breadcrumbs for anyone else encountering the issue.
The issue has been reported to debbugs here: https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-08/msg00753.html
Until a fix is available, this dubious bit of code should provide as a workaround:
(eval-after-load 'log4slime
'(when (and
(version<= "27.1" emacs-version)
(version< emacs-version "28.0"))
(defun easy-menu-do-define (symbol maps doc menu)
;; We can't do anything that might differ between Emacs dialects in
;; `easy-menu-define' in order to make byte compiled files
;; compatible. Therefore everything interesting is done in this
;; function.
(let ((keymap (easy-menu-create-menu (car menu) (cdr menu))))
(when symbol
(set symbol keymap)
(defalias symbol
`(lambda (event) ,doc (interactive "@e")
;; FIXME: XEmacs uses popup-menu which calls the binding
;; while x-popup-menu only returns the selection.
(x-popup-menu event
(or (and (symbolp ,symbol)
(funcall
(or (plist-get (get ,symbol 'menu-prop)
:filter)
#'identity)
(symbol-function ,symbol)))
,symbol))))
;; These symbols are commands, but not interesting for users
;; to `M-x TAB'.
(function-put symbol 'completion-predicate #'ignore))
(dolist (map (if (keymapp maps) (list maps) maps))
(define-key map
(vector 'menu-bar (if (symbolp (car menu))
(car menu)
;; If a string, then use the downcased
;; version for greater backwards compatibility.
(intern (downcase (car menu)))))
(easy-menu-binding keymap (car menu))))))
(log4slime-redefine-menus)))
hdasch commented
Fixed for Emacs 28 with commit bf55b5ac17cd5a40ad5ff2e25af7e050602180bb.