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 #104 received at 32790 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 32790 <at> debbugs.gnu.org
Subject: Re: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Sun, 21 Oct 2018 21:17:28 +0300
>> Using arrow keys as a prefix will allow to tell Emacs explicitly
>> where do you want to display the buffer, e.g.
>>
>> H-up RET will display grep results in the above window after creating it
>>
>> H-left C-h f will display the *Help* buffer in the left window
>>
>> H-right C-x v d will display the vc-dir buffer in the right window
>>
>> H-down C-x C-b will display the buffer list in the bottom window
>>
>> The possibilities are limitless.
>
> I fail to see the connection between hyper key bindings and the way to
> display a buffer.  If at all, isn't that something Stephen Leake's
> 'other-frame-window' package is supposed to provide?

other-frame-window is limited to the coarse choice, i.e. to display the
buffer in a random window on the same frame, or in another frame.

Whereas the needed feature is to allow the user to point out exactly
in which window the buffer should be displayed.  This can be achieved
with something like this:

(let ((modifiers '(hyper)))
  (dolist (key '(left right up down))
    (define-key global-map (vector (append modifiers (list key)))
                'display-buffer-directionally)))

(defun display-buffer-directionally ()
  "Specify in which direction the buffer should be displayed."
  (interactive "P")
  (let* ((dir (event-basic-type (aref (this-command-keys) 0)))
	 (win (window-in-direction dir)))
    (unless win
      (setq win (split-window nil nil dir)))
    (let ((hook (list 'lambda)))
      (setcdr hook `((window)
		     (when (eq window ,win)
		       ;; When a new buffer was displayed in that window,
		       ;; we can restore a previous value.
		       (setq display-buffer-overriding-action
			     ',display-buffer-overriding-action)
		       (remove-hook 'window-state-change-functions ',hook))))
      (add-hook 'window-state-change-functions hook))
    (setq display-buffer-overriding-action
	  `((lambda (buffer alist)
	      (window--display-buffer buffer ,win 'reuse alist))))))

Do you think conceptually this is the right direction of development?




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.