emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xref window switching problems


From: Ingo Lohmar
Subject: xref window switching problems
Date: Tue, 04 Aug 2015 21:42:11 +0200
User-agent: Notmuch/0.19+110~gb2cc2a6 (http://notmuchmail.org) Emacs/25.0.50.3 (x86_64-unknown-linux-gnu)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]