unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* xref window switching problems
@ 2015-08-04 19:42 Ingo Lohmar
  2015-08-05  6:56 ` Stephen Leake
  2015-08-05 12:33 ` Dmitry Gutov
  0 siblings, 2 replies; 9+ messages in thread
From: Ingo Lohmar @ 2015-08-04 19:42 UTC (permalink / raw)
  To: emacs-devel

It seems to me that xref has quite.. unusual behavior when it comes to
popping to a location; it surely broke my expectations.  I could not
find any bug report for this; so before "patching" sth which isn't
broken, it cannot hurt to ask...

xref--pop-to-location *first* uses xref--goto-location to select the
target buffer and move point to the proper position.  As long as the
target buffer is different from the source buffer, that's fine.

However, when I call xref-find-definitions-other-window (typically "C-x
4 ."), and the definition is in the same buffer I am in now, strange
things happen:

- the point of the *current* window is moved to the target location
  (just what the user wanted to avoid, I suppose)

- when the current window is the only one showing the buffer in
  question, then the same buffer is newly displayed in another window we
  pop to (hence at the same position)

- when another window already shows the same buffer, we pop to this
  buffer --- less annoying, but still unexpected and not helpful

The behavior is perfectly understandable looking at the code of
xref--pop-to-location and xref--goto-location, but is this intended?

The old pre-xref elisp implementations and the tags functions got the
"...-other-window" behavior right IMO: Leave my current window's buffer
and point alone in any case, and pop to the target shown in another
window.

The change would be easy (see xref--pop-to-location), first get the
buffer, then do the window business, and only then xref--goto-location.

Any objections/opinions?  It always puzzles me how hard it can be to get
the window-changing stuff to do just what I want, so any feedback is
helpful.  Maybe xref-pop-marker-stack could benefit from a discussion as
well.

Ingo



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-07 17:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 19:42 xref window switching problems Ingo Lohmar
2015-08-05  6:56 ` Stephen Leake
2015-08-05 12:40   ` Dmitry Gutov
2015-08-06  9:16     ` Stephen Leake
2015-08-05 12:33 ` Dmitry Gutov
2015-08-05 20:30   ` Ingo Lohmar
2015-08-06  7:05     ` Dmitry Gutov
2015-08-06  9:36     ` Stephen Leake
2015-08-07 17:25       ` Ingo Lohmar

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