GNU bug report logs - #32790
27.0.50; point jumps unexpectedly after delete-window

Previous Next

Package: emacs;

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


Message #284 received at 32790 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
Cc: 32790 <at> debbugs.gnu.org
Subject: Re: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Thu, 22 Nov 2018 08:40:47 +0100
> One possible solution is to implement directional window deletion.
> The following patch allows using the prefix argument that will delete
> the selected window and select the window at the given direction.

Delete and select - smart idea.

> +;;; Directional window deletion
> +
> +(defun windmove-delete-in-direction (dir &optional arg)
> +  "Delete the window at direction DIR.
> +If prefix ARG is `C-u', delete the selected window and
> +select the window at direction DIR."
> +  (let ((other-window (window-in-direction dir nil nil arg
> +                                           windmove-wrap-around t)))

So 'windmove-wrap-around' non-nil means that the other window could be
the selected one and we try to delete ourselves.  Right?

> +          ((and (window-minibuffer-p other-window)
> +                (not (minibuffer-window-active-p other-window)))
> +           (user-error "Minibuffer is inactive"))

Should we try to delete the active minibuffer window?

> +;;;###autoload
> +(defun windmove-delete-default-keybindings (&optional prefix modifiers)
> +  "Set up keybindings for directional window deletion.
> +Keys are bound to commands that delete windows in the specified
> +direction.  Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down},
> +where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or
> +a single modifier.  Default value of PREFIX is `C-x' and MODIFIERS is `shift'."
> +  (interactive)
> +  (unless prefix (setq prefix '(?\C-x)))
> +  (unless (listp prefix) (setq prefix (list prefix)))
> +  (unless modifiers (setq modifiers '(shift)))
> +  (unless (listp modifiers) (setq modifiers (list modifiers)))
> +  (global-set-key (vector prefix (append modifiers '(left)))  'windmove-delete-left)
> +  (global-set-key (vector prefix (append modifiers '(right))) 'windmove-delete-right)
> +  (global-set-key (vector prefix (append modifiers '(up)))    'windmove-delete-up)
> +  (global-set-key (vector prefix (append modifiers '(down)))  'windmove-delete-down))

Feel free to install.  But note that eventually we should document
the keybinding stuff with a few, good examples.

Thanks, martin




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.