bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Juri Linkov
Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Thu, 08 Nov 2018 23:38:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

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

Dmitry, do you agree this is a change for the better?

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

I see that an extra ARG when ‘C-u’ is not interpreted as a positive arg,
and ‘M--’ is not interpreted as a negative arg.  So I propose to support
these prefix keys as well:

diff --git a/lisp/windmove.el b/lisp/windmove.el
index 598e495c7a..ea4506049b 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -512,7 +512,7 @@ windmove-left
 If no window is at the desired location, an error is signaled
 unless `windmove-create-window' is non-nil that creates a new window."
   (interactive "P")
-  (windmove-do-window-select 'left arg))
+  (windmove-do-window-select 'left (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-up (&optional arg)
@@ -524,7 +524,7 @@ windmove-up
 If no window is at the desired location, an error is signaled
 unless `windmove-create-window' is non-nil that creates a new window."
   (interactive "P")
-  (windmove-do-window-select 'up arg))
+  (windmove-do-window-select 'up (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-right (&optional arg)
@@ -536,7 +536,7 @@ windmove-right
 If no window is at the desired location, an error is signaled
 unless `windmove-create-window' is non-nil that creates a new window."
   (interactive "P")
-  (windmove-do-window-select 'right arg))
+  (windmove-do-window-select 'right (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-down (&optional arg)
@@ -548,7 +548,7 @@ windmove-down
 If no window is at the desired location, an error is signaled
 unless `windmove-create-window' is non-nil that creates a new window."
   (interactive "P")
-  (windmove-do-window-select 'down arg))
+  (windmove-do-window-select 'down (and arg (prefix-numeric-value arg))))
 
 
 ;;; set up keybindings






reply via email to

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