From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>
Cc: 33992-done@debbugs.gnu.org, "João Távora" <joaotavora@gmail.com>
Subject: bug#33992: 27.0.50; xref-find-definitions wastes too much space
Date: Mon, 10 Jun 2019 03:35:36 +0300 [thread overview]
Message-ID: <fc671b52-ad65-b9eb-adcd-0b191354ec1a@yandex.ru> (raw)
In-Reply-To: <871s0ifj1k.fsf@mail.linkov.net>
Hi Juri,
On 28.05.2019 23:35, Juri Linkov wrote:
> FWIW, this is what I currently use to customize xref-find-definitions
> to act more like Completions:
>
> (custom-set-variables
> '(display-buffer-alist
> '((display-buffer-to-xref-p display-buffer-in-direction
> (direction . below)
> (window-height . fit-window-to-buffer)))))
>
> (defun display-buffer-to-xref-p (buffer-name _action)
> (and (string-match-p "\\`\\*\\(xref\\)\\*\\(\\|<[0-9]+>\\)\\'"
> buffer-name)
> (memq this-command '(xref-find-definitions))))
>
> (with-eval-after-load 'xref
> (defvar xref--original-command nil)
> (advice-add 'xref-find-definitions :after
> (lambda (&rest _args)
> (with-current-buffer (window-buffer)
> (setq-local xref--original-command 'xref-find-definitions))))
> (define-key xref--button-map [(control ?m)]
> (lambda ()
> (interactive)
> (if (memq xref--original-command '(xref-find-definitions))
> (call-interactively 'xref-quit-and-goto-xref)
> (setq xref--original-window nil)
> (call-interactively 'xref-goto-xref)))))
JFYI, one of the changes I've pushed yesterday was the patch I've shown
before, and it should let you have the same behavior with one line:
(setq xref-show-definitions-function 'xref--show-defs-buffer-at-bottom)
It doesn't seem like xref-quit-and-goto-xref works well, though.
It doesn't always honor the intention to open the location in the window
the command was called from. It can show the location in a different
window, and then if I press M-, from there, Emacs does not return to the
previous window configuration.
I've tracked this down to xref--show-pos-in-buf. Apparently, calling
display-buffer with
`((display-buffer-in-previous-window)
(previous-window . ,xref--original-window))
as its second argument doesn't do the trick. Looking at it, it contains
logic where when (eq window (selected-window)), it sets best-window to
something else (in particular, it can favor a window where this buffer
had been displayed previously). So, should some other action function be
used?
I can trace this choice back to your commit 94b320849e9 where this bug
was apparently introduced.
prev parent reply other threads:[~2019-06-10 0:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-05 23:43 bug#33992: 27.0.50; xref-find-definitions wastes too much space Juri Linkov
2019-01-06 11:03 ` João Távora
2019-03-20 21:37 ` Juri Linkov
2019-03-20 23:23 ` João Távora
2019-04-04 0:02 ` Dmitry Gutov
2019-04-04 20:49 ` Juri Linkov
2019-04-04 23:06 ` Dmitry Gutov
2019-04-05 9:44 ` Felician Nemeth
2019-04-05 23:20 ` Dmitry Gutov
2019-04-06 21:08 ` Juri Linkov
2019-04-06 21:03 ` Juri Linkov
2019-05-02 23:05 ` Dmitry Gutov
2019-05-15 20:57 ` Juri Linkov
2019-05-15 22:37 ` Dmitry Gutov
2019-05-28 20:35 ` Juri Linkov
2019-06-10 0:35 ` Dmitry Gutov [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc671b52-ad65-b9eb-adcd-0b191354ec1a@yandex.ru \
--to=dgutov@yandex.ru \
--cc=33992-done@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
--cc=juri@linkov.net \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.