Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right click on category fails with Emacs 27.1 and later #37

Closed
hdasch opened this issue Aug 15, 2021 · 1 comment
Closed

Right click on category fails with Emacs 27.1 and later #37

hdasch opened this issue Aug 15, 2021 · 1 comment

Comments

@hdasch
Copy link

hdasch commented Aug 15, 2021

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
Copy link
Author

hdasch commented Aug 15, 2021

Fixed for Emacs 28 with commit bf55b5ac17cd5a40ad5ff2e25af7e050602180bb.

@hdasch hdasch closed this as completed Aug 15, 2021
@scymtym scymtym pinned this issue Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant