Last active
December 20, 2015 13:19
-
-
Save orontee/6137875 to your computer and use it in GitHub Desktop.
Try at `temporary-display-pop-up-frame'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq lexical-binding t) | |
(defun temporary-display-pop-up-frame () | |
(interactive) | |
(let* ((prepfunsym (make-symbol "prepare-temporary-display-pop-up-frame")) | |
(prepfun | |
(lambda () | |
(when (commandp this-command) | |
(if (eq this-command 'execute-extended-command) | |
(progn | |
(restore-overriding-map) | |
(message "Extended command...")) | |
(let* ((clearfunsym (make-symbol | |
"clear-temporary-display-pop-up-frame")) | |
(clearfun | |
(lambda () | |
(remove-hook 'post-command-hook clearfunsym) | |
(setq display-buffer-overriding-action '(nil))))) | |
(fset clearfunsym clearfun) | |
(add-hook 'post-command-hook clearfunsym)) | |
(restore-overriding-map) | |
(remove-hook 'pre-command-hook prepfunsym) | |
(setq display-buffer-overriding-action '(display-buffer-pop-up-frame))))))) | |
(fset prepfunsym prepfun) | |
(message "Next command will pop-up a frame") | |
(save&set-overriding-map temporary-display-map) | |
(add-hook 'pre-command-hook prepfunsym))) | |
;; (defun temporary-display-other-key (arg) | |
;; (interactive "P") | |
;; (setq prefix-arg arg) | |
;; (restore-overriding-map)) | |
(defvar temporary-display-map | |
(let ((map (make-sparse-keymap))) | |
;; (define-key map [t] 'temporary-display-other-key) | |
(define-key map [switch-frame] nil) | |
(define-key map [?0] 'delete-frame) | |
(define-key map [?1] 'delete-other-frames) | |
(define-key map [?2] 'make-frame-command) | |
(define-key map [?o] 'other-frame) | |
(define-key map [kp-0] 'delete-frame) | |
(define-key map [kp-1] 'delete-other-frames) | |
(define-key map [kp-2] 'make-frame-command) | |
map) | |
"Keymap used while processing \\[temporary-display-pop-up-frame].") | |
(global-set-key "\C-x5" 'temporary-display-pop-up-frame) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment