all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ingo Lohmar <i.lohmar@gmail.com>
To: emacs-devel@gnu.org
Subject: xref window switching problems
Date: Tue, 04 Aug 2015 21:42:11 +0200	[thread overview]
Message-ID: <87bnemn8mk.fsf@acer.localhost.com> (raw)

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	other threads:[~2015-08-04 19:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 19:42 Ingo Lohmar [this message]
2015-08-05  6:56 ` xref window switching problems 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

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=87bnemn8mk.fsf@acer.localhost.com \
    --to=i.lohmar@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.