bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#50067: Context menus


From: Juri Linkov
Subject: bug#50067: Context menus
Date: Tue, 31 Aug 2021 20:43:36 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>> ** 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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]