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: martin rudalics
Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window
Date: Wed, 31 Oct 2018 09:11:52 +0100

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

I forgot (or never learned) how to use it.  Can you please include an
example so people can try it.

> (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))

Can you give the rationale for the latter?  I don't grok it.

>                         (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)))))))

'reuse' holds only for the ?0 case.  When we split, the third argument
should be 'window'.

martin





reply via email to

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