[Emacs] Try to tidy up frames only mode

This commit is contained in:
Ivan Malison 2016-11-07 15:25:24 -08:00
parent a76b496feb
commit 7faf5e4b54
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1144,33 +1144,36 @@ programming mode.
(defvar imalison:use-new-frame-or-window nil) (defvar imalison:use-new-frame-or-window nil)
(defvar imalison:use-new-frame-next-command nil) (defvar imalison:use-new-frame-or-window-next-command nil)
(defun imalison:new-frame-next-command () (defun imalison:other-window-or-frame-next-command ()
(interactive) (interactive)
(setq imalison:use-new-frame-next-command t)) (setq imalison:use-new-frame-or-window-next-command t))
(defun imalison:use-new-frame-or-window (&rest args) (defun imalison:use-other-frame-or-window (&rest args)
(or (or
(when imalison:use-new-frame-next-command (when imalison:use-new-frame-or-window-next-command
(setq imalison:use-new-frame-next-command nil) (setq imalison:use-new-frame-or-window-next-command nil)
t) t)
imalison:use-new-frame-or-window)) imalison:use-new-frame-or-window))
(defun imalison:display-buffer (&rest args) (defun imalison:display-buffer (&rest args)
(if (imalison:use-new-frame-or-window args) (if (imalison:use-other-frame-or-window args)
(imalison:new-frame-or-window args) (apply 'imalison:display-buffer-other-frame-or-window args)
(apply 'display-buffer-same-window args))) (apply 'display-buffer-same-window args)))
(defun imalison:display-new-frame-or-window (&rest args) (defun imalison:display-buffer-other-frame-or-window (buffer &rest args)
(if (imalison:use-frames-only) (if (imalison:use-frames-only)
(apply 'display-buffer-pop-up-frame args) (display-buffer buffer '((display-buffer-reuse-window
(apply 'display-buffer-pop-up-window args))) display-buffer-pop-up-frame)
(reusable-frames . t)
(inhibit-same-window . t)) t)
(apply 'display-buffer-reuse-window args)))
(defun imalison:split-window-right () (defun imalison:split-window-right ()
(interactive) (interactive)
(if (imalison:use-frames-only) (if (imalison:use-frames-only)
(new-frame) (make-frame)
(split-window-right))) (split-window-right)))
(defun imalison:other-window (&rest args) (defun imalison:other-window (&rest args)
@ -1180,6 +1183,8 @@ programming mode.
(apply 'other-frame args) (apply 'other-frame args)
(apply 'other-window args))) (apply 'other-window args)))
(bind-key "C-c s" 'imalison:other-window-or-frame-next-command)
(bind-key "C-x o" 'imalison:other-window) (bind-key "C-x o" 'imalison:other-window)
(bind-key "C-x 3" 'imalison:split-window-right) (bind-key "C-x 3" 'imalison:split-window-right)
(bind-key "C-x O" (lambda () (interactive) (imalison:other-window -1))) (bind-key "C-x O" (lambda () (interactive) (imalison:other-window -1)))
@ -1196,8 +1201,9 @@ programming mode.
;; (".*COMMIT_.*MSG.*" . ((display-buffer-pop-up-frame) ;; (".*COMMIT_.*MSG.*" . ((display-buffer-pop-up-frame)
;; ((reusable-frames . 0) ;; ((reusable-frames . 0)
;; (inhibit-same-window . t)))) ;; (inhibit-same-window . t))))
(".*" . ((imalison:display-buffer display-buffer-reuse-window display-buffer-pop-up-frame) (".*" . ((imalison:display-buffer display-buffer-same-window
(reusable-frames . t))))) display-buffer-pop-up-frame)
((reusable-frames . t))))))
(setq display-buffer-alist nil) (setq display-buffer-alist nil)
#+END_SRC #+END_SRC