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


Message #255 received at 50067 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: alan <at> idiocy.org, mattiase <at> acm.org, homeros.misasa <at> gmail.com,
 tkk <at> misasa.okayama-u.ac.jp, larsi <at> gnus.org, 50067 <at> debbugs.gnu.org
Subject: Re: bug#50067: Context menus
Date: Wed, 01 Sep 2021 10:08:38 +0300
>> so the new option could provide at least these choices:
>> 1. 'jump': Jump to the first location by selecting its window;
>> 2. 'show': Show the first item, but keep focus in the Xref window;
>> 3. 'move': Move point to the first item in the Xref window
>>     without showing it (maybe this should be the default behavior).
>
> We can do that. Do you expect to be using more than 1 of these values
> yourself, or is it just for completeness?

A good indication that all values are needed is that I still can't decide
which to use, so it would be possible to switch to another value when
one of them does too much or too little.

> Regarding 3 as default, it makes a certain sense, but then you won't be
> able to iterate through all locations with just 'n'. You'd have to press
> 'C-o' and then 'n', 'n', 'n'...

I agree, it should not be the default.

>> To be able to add later a similar variable for xref-find-references,
>> the new variable for xref-find-definitions could be named accordingly
>> with a name that refers to xref-find-definitions, for example,
>> xref-find-definitions-auto-jump.  Then later xref-find-references-auto-jump.
>
> I think the "other" variable would be called something with the word
> "xrefs", not "references", and apply to other commands as well, such as
> xref-find-apropos and project-find-regexp.
>
> So the proposed scheme would not quite work. Maybe like this instead?
>
>  - xref-auto-jump-to-first-definition
>  - xref-auto-jump-to-first-<xref/item/match/result>. Or just
>    xref-auto-jump-to-first.

grep/compilation already supports the value 'jump' by non-nil
'compilation-auto-jump-to-first-error', and the value 'move' when
'compilation-scroll-output' is customized to 'first-error'.

But I think for xref still two separate options are needed
xref-auto-jump-to-first-definition for xref-find-definitions, and
xref-auto-jump-to-first-xref for other more grep-like xref commands.

BTW, I'm testing compilation errors/warnings on xref context menu,
and it reposts this warning:

  prog-mode.el:60:12: Warning: the function `xref-backend-identifier-at-point'
      is not known to be defined.

on this code:

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

Maybe `xref-backend-identifier-at-point' should be autoloaded?




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

Previous Next


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