[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/other-frame-window 9228aab 06/16: * other-frame-window.
From: |
Stefan Monnier |
Subject: |
[elpa] externals/other-frame-window 9228aab 06/16: * other-frame-window.el: Use new prefix-command features |
Date: |
Tue, 1 Dec 2020 16:38:34 -0500 (EST) |
branch: externals/other-frame-window
commit 9228aab932706f49bc2f9b3d5febc3c65020dc0d
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* other-frame-window.el: Use new prefix-command features
(ofw--set-prefix): Use prefix-command-preserve-state is available.
Remove left-over prefix state.
(ofw--echo-keystrokes, ofw--preserve-state): New functions.
(prefix-command-echo-keystrokes-functions)
(prefix-command-preserve-state-hook): Use them.
(other-frame-window-mode): Autoload.
---
other-frame-window.el | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/other-frame-window.el b/other-frame-window.el
index 4b7f6b6..6fc718f 100755
--- a/other-frame-window.el
+++ b/other-frame-window.el
@@ -54,9 +54,10 @@
;;;; Todo:
-;; - Make the `C-x 7' prefix appear in the echo area.
-;; - `C-x 7 C-h' should display the transient map.
-;; - `C-x 7 C-u foo' should pass both prefixes to `foo'.
+;; - Pay attention to bindings added to ctl-x-4-map and ctl-x-5-map
+;; - Should `C-x 7 C-h' display the transient map?
+;; - `C-x 7 C-h k f' should show `find-file' rather than `self-insert-command'.
+;; This should probably be fixed in set-transient-map.
;;; Code:
@@ -88,20 +89,36 @@
(defun ofw--set-prefix (func)
"Add ofw prefix function FUNC."
+ (ofw-delete-from-overriding)
(let ((functions (car display-buffer-overriding-action))
(attrs (cdr display-buffer-overriding-action)))
(push func functions)
(setq display-buffer-overriding-action (cons functions attrs))
- ;; Make sure the next pre-command-hook doesn't immediately set
- ;; display-buffer-overriding-action back to nil.
- (setq ofw--just-set t)
;; C-u C-x 7 foo should pass C-u to foo, not to C-x 7, so
;; pass the normal prefix to the next command.
- ;; FIXME: This should be done by all prefix commands and for all kinds of
- ;; prefixes, so that C-x 7 C-u foo works as well!
- (setq prefix-arg current-prefix-arg)
+ (if (fboundp 'prefix-command-preserve-state)
+ (prefix-command-preserve-state)
+ ;; Make sure the next pre-command-hook doesn't immediately set
+ ;; display-buffer-overriding-action back to nil.
+ (setq ofw--just-set t)
+ (setq prefix-arg current-prefix-arg))
(set-transient-map ofw-transient-map)))
+(defun ofw--echo-keystrokes ()
+ (let ((funs (car display-buffer-overriding-action)))
+ (cond
+ ((memq #'ofw-display-buffer-other-frame funs) "[other-frame]")
+ ((memq #'ofw-display-buffer-other-window funs) "[other-window]"))))
+
+(when (boundp 'prefix-command-echo-keystrokes-functions)
+ (add-hook 'prefix-command-echo-keystrokes-functions
+ #'ofw--echo-keystrokes))
+
+(defun ofw--preserve-state () (setq ofw--just-set t))
+(when (boundp 'prefix-command-preserve-state-hook)
+ (add-hook 'prefix-command-preserve-state-hook
+ #'ofw--preserve-state))
+
(defun ofw-delete-from-overriding ()
"Remove ourselves from 'display-buffer-overriding-action' action list, if
present."
(let ((functions (car display-buffer-overriding-action))
@@ -211,6 +228,7 @@ Point stays in moved buffer."
(setq ofw--just-set nil)
(ofw-delete-from-overriding)))
+;;;###autoload
(define-minor-mode other-frame-window-mode
"Minor mode for other frame/window buffer placement.
Enable mode if ARG is positive."
- [elpa] branch externals/other-frame-window created (now df437ff), Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window a5b8e69 04/16: Resolve FIXME:s in other-frame-window.el, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window a28cceb 02/16: * other-frame-window.el: Fix layout convention, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 58a1e66 01/16: * packages/other-frame-window/other-frame-window.el: New single-file package., Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 9875a19 03/16: * other-frame-window.el: Disable more carefully; add transient map, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 034d510 11/16: * packages/other-frame-window: add text for list-packages long description, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 7939a1b 08/16: Fix some quoting problems in doc strings, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 9228aab 06/16: * other-frame-window.el: Use new prefix-command features,
Stefan Monnier <=
- [elpa] externals/other-frame-window 97e41af 05/16: Bump version of other-frame-window.el, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 88820e3 07/16: Bump version of other-frame-window.el, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window e4aa050 10/16: * packages/other-frame-window: bump version; improve minor mode doc string, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 061ffe1 09/16: Clear executable bit for Emacs Lisp files., Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window c706e22 12/16: * packages/other-frame-window/other-frame-window.el: improve description, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 7477b00 15/16: Other-frame-window: bump version to publish changes, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window 6a6de0e 14/16: Package other-frame-window; improve description, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window a5ef264 13/16: Minor improvements in other-frame-window, Stefan Monnier, 2020/12/01
- [elpa] externals/other-frame-window df437ff 16/16: * .gitignore: New file, Stefan Monnier, 2020/12/01