From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 74361@debbugs.gnu.org
Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action
Date: Sat, 16 Nov 2024 21:12:13 +0200 [thread overview]
Message-ID: <871pzbj8mq.fsf@mail.linkov.net> (raw)
In-Reply-To: <4256f446-e11b-450c-b455-131cb75acab0@gutov.dev> (Dmitry Gutov's message of "Fri, 15 Nov 2024 21:05:51 +0200")
>> This option looks similar to 'display-comint-buffer-action'
>> whose addition was deemed to be a mistake, so we needed to declare it
>> obsolete and replace it with '(category . comint)'.
>> So instead of adding 'xref-navigation-display-window-action',
>> could you just add a category 'xref' to xref display function calls?
>> Then users will be able to customize it with e.g.:
>> (setq display-buffer-alist '(((category . xref)
>> (display-buffer-reuse-window))))
>> Or maybe I misunderstand other requirements for this feature.
>
> Thanks for the comments. The other priority here (I think) seems to retain
> the current behavior by default:
>
> You can see this decision being made in
>
> (defun xref--switch-to-buffer (buf)
> (if xref-navigation-display-window-action
> (pop-to-buffer buf xref-navigation-display-window-action)
> (switch-to-buffer buf)))
>
> So... I suppose one way to do that would be to add an option in Xref which
> make it use 'pop-to-buffer' instead of 'switch-to-buffer' (similar to
> 'switch-to-buffer-obey-display-actions'). And then the user would customize
> 'display-buffer-alist' like in your example. Something like:
>
> (setq xref-navigation-obey-display-actions t
> display-buffer-alist '(((category . xref)
> (display-buffer-reuse-window))))
>
> Is that not too complex, what do we think?
Instead of a new option and 'switch-to-buffer',
a simpler way would be allow the users just to
customize the category with 'display-buffer-same-window':
(setq display-buffer-alist '(((category . xref)
(display-buffer-same-window))))
It works nicely when (category . xref) is added to the same place
like in your patch in 'xref--show-pos-in-buf':
```
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index cf061a18ee0..0193c2e35e0 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -689,7 +689,7 @@ xref--show-pos-in-buf
(eq (window-buffer xref--original-window) buf)))
`((xref--display-buffer-in-window)
(window . ,xref--original-window))))))
- (with-selected-window (display-buffer buf action)
+ (with-selected-window (display-buffer buf (append action '((category . xref))))
(xref--goto-char pos)
(run-hooks 'xref-after-jump-hook)
(selected-window))))
```
next prev parent reply other threads:[~2024-11-16 19:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 22:29 bug#74361: [PATCH] New option xref-navigation-display-window-action Dmitry Gutov
2024-11-15 0:50 ` Dmitry Gutov
2024-11-15 7:49 ` Juri Linkov
2024-11-15 19:05 ` Dmitry Gutov
2024-11-16 19:12 ` Juri Linkov [this message]
2024-11-18 1:28 ` Dmitry Gutov
2024-11-19 18:33 ` Juri Linkov
2024-11-19 19:43 ` Dmitry Gutov
2024-11-15 12:13 ` Eli Zaretskii
2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 19:10 ` Dmitry Gutov
2024-11-16 8:43 ` Eli Zaretskii
2024-11-18 1:42 ` Dmitry Gutov
2024-11-18 12:25 ` Eli Zaretskii
2024-11-18 16:10 ` Dmitry Gutov
2024-11-18 17:03 ` Eli Zaretskii
2024-11-19 1:21 ` Dmitry Gutov
2024-11-19 15:33 ` Eli Zaretskii
2024-11-19 19:51 ` Dmitry Gutov
2024-11-19 18:36 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871pzbj8mq.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=74361@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).