Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window

From: martin rudalics <[email-masked]>
Date: Thu, 08 Nov 2018 09:52:55 +0100

> Shouldn't xref support a shorter and easier to type key sequence
 > ‘S-M-<right> M-.’ with the following patch:
 >
 > diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
 > index 6b1421a6f7..6aab174bcf 100644
 > --- a/lisp/progmodes/xref.el
 > +++ b/lisp/progmodes/xref.el
 > @@ -425,7 +425,7 @@ xref--pop-to-location
 >                      (xref-location-marker (xref-item-location item))))
 >            (buf (marker-buffer marker)))
 >       (cl-ecase action
 > -      ((nil)  (switch-to-buffer buf))
 > +      ((nil)  (pop-to-buffer-same-window buf))
 >         (window (pop-to-buffer buf t))
 >         (frame  (let ((pop-up-frames t)) (pop-to-buffer buf t))))
 >       (xref--goto-char marker))

I think so.  In particular because 'xref--goto-char' does not cohabit
well with 'switch-to-buffer-preserve-window-point' in the first place.
Dmitry should consent, though.

 > Then maybe all unused code should be removed including
 > windmove-other-window-loc, windmove-reference-loc,
 > windmove-wrap-loc-for-movement, windmove-constrain-loc-for-movement,
 > etc.

Citing from a discussion with Dmitry:

   > I thought you might go ahead and just port windmove to use
   > `window-in-direction'.

   windmove has an extra ARG to distinguish the upper left corner of a
   window and its position of point as reference points.  I can't easily
   dismiss that.

I'm not sure whether it's still relevant but if so we'd have to include
it in 'window-in-direction'.

martin