[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8d05f21: * lisp/window.el (display-buffer-override-next-command):
From: |
Juri Linkov |
Subject: |
master 8d05f21: * lisp/window.el (display-buffer-override-next-command): Add ECHO arg. |
Date: |
Sat, 18 Jul 2020 19:43:32 -0400 (EDT) |
branch: master
commit 8d05f21946fa846edf8d9c2c77e9e6cc066bbae5
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/window.el (display-buffer-override-next-command): Add ECHO arg.
* lisp/frame.el (other-frame-prefix):
* lisp/tab-bar.el (other-tab-prefix):
* lisp/windmove.el (windmove-display-in-direction):
* lisp/window.el (other-window-prefix, same-window-prefix):
Use new ECHO arg of display-buffer-override-next-command.
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00819.html
---
lisp/frame.el | 3 ++-
lisp/tab-bar.el | 3 ++-
lisp/windmove.el | 4 ++--
lisp/window.el | 16 ++++++++++++----
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/lisp/frame.el b/lisp/frame.el
index 77080b7..081d301 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1083,7 +1083,8 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(cons (display-buffer-pop-up-frame
buffer (append '((inhibit-same-window . t))
alist))
- 'frame)))
+ 'frame))
+ nil "[other-frame]")
(message "Display next command buffer in a new frame..."))
(defun iconify-or-deiconify-frame ()
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 04f4bca..cee88cb 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1581,7 +1581,8 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(display-buffer-in-tab
buffer (append alist '((inhibit-same-window . nil))))
(selected-window))
- 'tab)))
+ 'tab))
+ nil "[other-tab]")
(message "Display next command buffer in a new tab..."))
(define-key tab-prefix-map "2" 'tab-new)
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 341c739..6557960 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -491,8 +491,8 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(cons window type)))
(lambda (old-window new-window)
(when (window-live-p (if no-select old-window new-window))
- (select-window (if no-select old-window new-window))))))
- (message "[display-%s]" dir))
+ (select-window (if no-select old-window new-window))))
+ (format "[display-%s]" dir))))
;;;###autoload
(defun windmove-display-left (&optional arg)
diff --git a/lisp/window.el b/lisp/window.el
index 675aff0..f20940f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4021,7 +4021,8 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(setq type 'window)
(setq window (display-buffer-use-some-window buffer alist)
type 'reuse))
- (cons window type))))
+ (cons window type)))
+ nil "[other-window]")
(message "Display next command buffer in a new window..."))
(defun same-window-prefix ()
@@ -4039,7 +4040,8 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
(cons (or
(display-buffer-same-window buffer alist)
(display-buffer-use-some-window buffer alist))
- 'reuse)))
+ 'reuse))
+ nil "[same-window]")
(message "Display next command buffer in the same window..."))
;; This should probably return non-nil when the selected window is part
@@ -8616,14 +8618,16 @@ documentation for additional customization information."
(list (read-buffer-to-switch "Switch to buffer in other frame: ")))
(pop-to-buffer buffer-or-name display-buffer--other-frame-action norecord))
-(defun display-buffer-override-next-command (pre-function &optional
post-function)
+(defun display-buffer-override-next-command (pre-function &optional
post-function echo)
"Set `display-buffer-overriding-action' for the next command.
`pre-function' is called to prepare the window where the buffer should be
displayed. This function takes two arguments `buffer' and `alist', and
should return a cons with the displayed window and its type. See the
meaning of these values in `window--display-buffer'.
Optional `post-function' is called after the buffer is displayed in the
-window; the function takes two arguments: an old and new window."
+window; the function takes two arguments: an old and new window.
+Optional string argument `echo' can be used to add a prefix to the
+command echo keystrokes that should describe the current prefix state."
(let* ((old-window (or (minibuffer-selected-window) (selected-window)))
(new-window nil)
(minibuffer-depth (minibuffer-depth))
@@ -8641,11 +8645,13 @@ window; the function takes two arguments: an old and
new window."
(setq post-function nil)
new-window))))
(command this-command)
+ (echofun (when echo (lambda () echo)))
(exitfun
(lambda ()
(setcar display-buffer-overriding-action
(delq action (car display-buffer-overriding-action)))
(remove-hook 'post-command-hook clearfun)
+ (remove-hook 'prefix-command-echo-keystrokes-functions echofun)
(when (functionp post-function)
(funcall post-function old-window new-window)))))
(fset clearfun
@@ -8661,6 +8667,8 @@ window; the function takes two arguments: an old and new
window."
;; Reset display-buffer-overriding-action
;; after the next command finishes
(add-hook 'post-command-hook clearfun)
+ (when echofun
+ (add-hook 'prefix-command-echo-keystrokes-functions echofun))
(push action (car display-buffer-overriding-action))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8d05f21: * lisp/window.el (display-buffer-override-next-command): Add ECHO arg.,
Juri Linkov <=