From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: Dmitry Gutov <dmitry@gutov.dev>, 74361@debbugs.gnu.org
Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action
Date: Thu, 05 Dec 2024 19:52:08 +0200 [thread overview]
Message-ID: <87o71qghzf.fsf@mail.linkov.net> (raw)
In-Reply-To: <c1151c04-7740-45de-aa71-7dc005ed275b@gmx.at> (martin rudalics's message of "Thu, 5 Dec 2024 10:23:15 +0100")
>> Ok. This reminds me adding '(previous-window . WINDOW)'
>> to 'display-buffer-in-previous-window' with:
>>
>> (when (and previous-window (symbolp previous-window)
>> (boundp previous-window))
>> (setq previous-window (symbol-value previous-window)))
>
> Where and how is or would this be used? In the sources all I see is
>
> `((previous-window . ,debugger-previous-window))))))
>
> so I suppose the symbol value would be used in customizations only.
I just tried to understand the differences between
display-buffer-in-previous-window and display-buffer-use-some-window.
>> (when (and (setq window previous-window)
>> (window-live-p window)
>>
>> Probably we should support both a symbol and a value for 'some-window'
>> as well.
>
> Where and how would this be used?
Mostly in customizations to support both ways:
`((previous-window . display-buffer-previous-window))
`((previous-window . ,display-buffer-previous-window))
`((some-window . display-buffer-some-window))
`((some-window . ,display-buffer-some-window))
>> BTW, here is an example of using 'previous-window' with an advice on
>> 'window--display-buffer' that could be combined with 'some-window':
>>
>> (defvar-local display-buffer-previous-window nil)
>>
>> (add-to-list 'display-buffer-alist
>> '((category . xref-jump)
>> display-buffer-in-previous-window
>> (previous-window . display-buffer-previous-window)
>
> So here 'display-buffer' would retrieve the symbol-value of whatever is
> in the buffer-local value of 'display-buffer-previous-window'. Right?
Right.
>> (inhibit-same-window . nil))
>> ;; Append to not override display-buffer-same-window
>> 'append)
>>
>> (define-advice xref-goto-xref (:around (ofun &rest args) previous-window)
>> (let ((buffer (current-buffer)))
>> (apply ofun args)
>> (with-current-buffer buffer
>> (setq-local display-buffer-previous-window (selected-window)))))
>
> This relies on 'ofun' selecting a window and would not work for plain
> 'display-buffer'. Right?
It should work for plain 'display-buffer' because of using 'with-current-buffer'.
>> (define-advice window--display-buffer (:around (ofun &rest args) previous-window)
>> (let ((buffer (current-buffer))
>> (window (apply ofun args)))
>> (with-current-buffer buffer
>> (setq-local display-buffer-previous-window window))
>> window))
>
> And this assumes that the current buffer is the one where to set the
> variable. Would this work with a function calling 'xref-goto-xref',
> bound to a key and called interactively with an arbitrary window
> selected?
This is how it's designed to work: to associate the displayed window
with the buffer that was current.
next prev parent reply other threads:[~2024-12-05 17:52 UTC|newest]
Thread overview: 74+ 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
2024-11-18 1:28 ` Dmitry Gutov
2024-11-19 18:33 ` Juri Linkov
2024-11-19 19:43 ` Dmitry Gutov
2024-11-20 7:11 ` Juri Linkov
2024-11-20 19:12 ` Dmitry Gutov
2024-11-21 7:34 ` Juri Linkov
2024-11-25 1:58 ` Dmitry Gutov
2024-11-27 1:45 ` Dmitry Gutov
2024-11-20 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-20 17:31 ` Juri Linkov
2024-11-20 19:10 ` Dmitry Gutov
2024-11-21 7:29 ` Juri Linkov
2024-11-20 19:08 ` Dmitry Gutov
2024-11-22 9:22 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 9:35 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 18:45 ` Juri Linkov
2024-11-23 19:16 ` Juri Linkov
2024-11-24 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-24 17:40 ` Juri Linkov
2024-11-25 9:18 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-25 17:49 ` Juri Linkov
2024-11-26 9:15 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-27 1:52 ` Dmitry Gutov
2024-11-27 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-27 13:07 ` Dmitry Gutov
2024-11-28 9:27 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-28 17:15 ` Dmitry Gutov
2024-11-28 18:32 ` Juri Linkov
2024-11-28 20:27 ` Dmitry Gutov
2024-12-04 7:35 ` Juri Linkov
2024-12-04 8:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-04 17:14 ` Juri Linkov
2024-12-05 9:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-05 17:52 ` Juri Linkov [this message]
2024-12-06 8:31 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 17:18 ` Juri Linkov
2024-12-08 16:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-05 18:08 ` Dmitry Gutov
2024-11-27 7:30 ` Juri Linkov
2024-11-27 9:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-20 8:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
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-20 12:54 ` Eli Zaretskii
2024-11-21 10:37 ` Eli Zaretskii
2024-11-21 18:01 ` Juri Linkov
2024-11-21 19:16 ` Eli Zaretskii
2024-11-21 19:39 ` Juri Linkov
2024-11-21 19:56 ` Eli Zaretskii
2024-11-22 7:29 ` Juri Linkov
2024-11-22 8:20 ` Eli Zaretskii
2024-11-23 18:25 ` Juri Linkov
2024-11-23 18:53 ` Eli Zaretskii
2024-11-23 19:14 ` Juri Linkov
2024-11-23 19:36 ` Eli Zaretskii
2024-11-24 7:34 ` Juri Linkov
2024-11-24 9:42 ` Eli Zaretskii
2024-11-25 7:28 ` Juri Linkov
2024-12-04 7:41 ` Juri Linkov
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=87o71qghzf.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=74361@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=rudalics@gmx.at \
/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).