GNU bug report logs -
#32790
27.0.50; point jumps unexpectedly after delete-window
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 20 Sep 2018 23:57:01 UTC
Severity: minor
Found in version 27.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> For window selection I use (windmove-default-keybindings 'hyper),
>> so e.g. '<H-left>' selects the left window. Could you recommend
>> a command to bind to e.g. 'C-x <H-left>' that will delete the left
>> window?
>
> Here <H-left> drags the character under the cursor by one character to
> the left and <H-up> drags the current line up by one line. I use
> <M-S-left> for selecting the window on the left. <C-M-S-left> either
> deletes the window on the left of the selected window provided there
> is one or makes a new window on the left of the selected window
> provided the selected window is already on the left of the frame. The
> code for that command is below.
Thanks for sharing the code. Now I have a good configuration:
(defun my-windmove (&optional arg)
(interactive "P")
(let ((dir (event-basic-type (aref (this-command-keys) 0))))
(condition-case nil
(windmove-do-window-select dir arg)
(error (select-window (split-window nil nil dir))))))
(defun my-windelete (&optional arg)
(interactive "P")
(let ((dir (event-basic-type (aref (this-command-keys) 1))))
(delete-window (window-in-direction dir))))
(let ((modifiers '(hyper)))
(dolist (key '(left right up down))
(define-key global-map (vector (append modifiers (list key))) 'my-windmove)
(define-key ctl-x-map (vector (append modifiers (list key))) 'my-windelete)))
The only problem is the mismatch between key names and direction names.
Could you add aliases for 'up' and 'down' in window-in-direction?
Then we won't need such special handling in windmove.el:
(window-in-direction
(cond
((eq dir 'up) 'above)
((eq dir 'down) 'below)
(t dir))
window nil arg windmove-wrap-around t)
This bug report was last modified 5 years and 235 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.