GNU bug report logs - #50067
Context menus

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 15 Aug 2021 08:52:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Tak Kunihiro <tkk <at> misasa.okayama-u.ac.jp>
Cc: Mattias EngdegÄrd <mattiase <at> acm.org>, Alan Third <alan <at> idiocy.org>, 50067 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: bug#50067: Context menus
Date: Tue, 31 Aug 2021 20:43:36 +0300
>>> ** no multiple horizontal lines
>>>
>>> Sometimes I see double lines on the context menu.  I think that there is
>>> no useful case to have double lines.  To allow only one horizontal line
>>> would look cool.
>>
>> Right, double separators should be removed.
>
> OK.

This is not easy to do.  Because there are menu-items
that use the filter :visible, e.g.:

  (defun prog-context-menu (menu)
    (require 'xref)
    (define-key-after menu [prog-separator] menu-bar-separator
      'mark-whole-buffer)
    (define-key-after menu [xref-find-def]
      '(menu-item "Find Definition" xref-find-definitions-at-mouse
                  :visible (save-excursion
                             (mouse-set-point last-input-event)
                             (xref-backend-identifier-at-point
                              (xref-find-backend)))
                  :help "Find definition of identifier")
      'prog-separator)

So it's not known whether the menu-item will be displayed
until the menu is displayed.  So there is no way to remove
a stray separator in the context-menu function that creates
the context menu.

Maybe such items should be rewritten to avoid the filter :visible,
e.g.:

  (defun prog-context-menu (menu)
    (require 'xref)
    (define-key-after menu [prog-separator] menu-bar-separator
      'mark-whole-buffer)
    (when (save-excursion
            (mouse-set-point last-input-event)
            (xref-backend-identifier-at-point
             (xref-find-backend)))
      (define-key-after menu [xref-find-def]
        '(menu-item "Find Definition" xref-find-definitions-at-mouse
                    :help "Find definition of identifier")
        'prog-separator))




This bug report was last modified 3 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.