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 #143 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: Tue, 30 Oct 2018 23:42:07 +0200
>>> Moreover, using 'post-command-hook' would automatically fix any
>>> problems when quitting an S-M-up action.  I see no way to catch
>>> quitting via a state change of windows.
>>
>> What do you mean by quitting an S-M-up action?  minibuffer-exit?
>
> Let's say anything C-g does.  I'm not sure whether we can catch that
> always via 'minibuffer-exit-hook' though.  But it should not harm to
> remove the overriding action in that case as well.

Ok, after a small change it handles also C-g:

(defun display-buffer-directionally ()
  "Specify in which direction the buffer should be displayed.
Arrows show the direction.  Mod-0 forces to display in the same window."
  (interactive)
  (let* ((dir (event-basic-type (aref (this-command-keys) 0)))
         (win (if (eq dir ?0)
		  (selected-window)
		(or (window-in-direction dir)
		    (split-window nil nil dir)))))
    (let ((hook (list 'lambda)))
      (setcdr hook `(()
                     (unless (or
			      ;; Remove the hook immediately
			      ;; after exiting the minibuffer.
			      (> (minibuffer-depth) 0)
			      ;; But don't remove immediately after
			      ;; adding the hook by the same command.
			      (eq this-command ',this-command))
                       (setq display-buffer-overriding-action
                             ',display-buffer-overriding-action)
                       (remove-hook 'post-command-hook ',hook))))
      (add-hook 'post-command-hook hook))
    (setq display-buffer-overriding-action
          `((lambda (buffer alist)
              (unless (> (minibuffer-depth) 0)
		(window--display-buffer buffer ,win 'reuse alist)))))))




This bug report was last modified 5 years and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.