[Emacs] Refine frames-only-mode stuff

This commit is contained in:
Ivan Malison 2016-11-07 22:49:59 -08:00
parent b87b06d3f2
commit 3e50d2989c
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -1170,13 +1170,13 @@ programming mode.
(defun imalison:other-window-or-frame-next-command () (defun imalison:other-window-or-frame-next-command ()
(interactive) (interactive)
(setq imalison:use-new-frame-or-window-next-command t)) (setq imalison:use-new-frame-or-window-next-command
(not imalison:use-new-frame-or-window-next-command))
(message "Using other frame: %s"
imalison:use-new-frame-or-window-next-command))
(defun imalison:use-other-frame-or-window (&rest args) (defun imalison:use-other-frame-or-window (&rest args)
(or (or imalison:use-new-frame-or-window-next-command
(when imalison:use-new-frame-or-window-next-command
(setq imalison:use-new-frame-or-window-next-command nil)
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)
@ -1184,10 +1184,10 @@ programming mode.
(apply 'imalison:display-buffer-other-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-buffer-other-frame-or-window (&rest args) (defun imalison:display-buffer-other-frame-or-window (buffer args)
(if (imalison:use-frames-only) (if (imalison:use-frames-only)
(apply 'display-buffer-use-some-frame args) (apply 'display-buffer-use-some-frame buffer (append args (inhibit-same-window t)))
(apply 'display-buffer-reuse-window args))) (apply 'display-buffer-reuse-window buffer args)))
(defun imalison:split-window-right () (defun imalison:split-window-right ()
(interactive) (interactive)
@ -1201,6 +1201,11 @@ programming mode.
(other-window count 'visible) (other-window count 'visible)
(select-frame-set-input-focus (selected-frame))) (select-frame-set-input-focus (selected-frame)))
(defun imalison:set-use-new-frame-to-default (&rest args)
(setq imalison:use-new-frame-or-window-next-command nil))
(advice-add 'display-buffer :after 'imalison:set-use-new-frame-to-default)
(when imalison:use-frames-only (when imalison:use-frames-only
(setq pop-up-frames 'graphic-only) (setq pop-up-frames 'graphic-only)
(bind-key "C-c s" 'imalison:other-window-or-frame-next-command) (bind-key "C-c s" 'imalison:other-window-or-frame-next-command)
@ -1209,19 +1214,19 @@ programming mode.
(bind-key "C-x O" (lambda () (interactive) (imalison:other-window -1))) (bind-key "C-x O" (lambda () (interactive) (imalison:other-window -1)))
(setq display-buffer-alist (setq display-buffer-alist
'((".*popup\*" . (display-buffer-pop-up-window)) '((".*popup\*" . (display-buffer-pop-up-window))
;; XXX: This was a failed attempt to get magit-commit to properly use ("\\*Flycheck errors\\*" . ((display-buffer-use-some-frame) ((inhibit-same-window t))))
;; frames.
(".*magit-diff.*" . ((display-buffer-pop-up-window) (".*magit-diff.*" . ((display-buffer-pop-up-window)
((reusable-frames . 0) ((reusable-frames . 0)
(inhibit-switch-frame . t) (inhibit-switch-frame . t)
(inhibit-same-window . t)))) (inhibit-same-window . t))))
;; (".*COMMIT_.*MSG.*" . ((display-buffer-pop-up-frame) (imalison:use-other-frame-or-window
;; ((reusable-frames . 0) .
;; (inhibit-same-window . t)))) ((display-buffer-use-some-frame display-buffer-pop-up-frame)
(".*" . ((imalison:display-buffer display-buffer-same-window ((inhibit-same-window . t)
display-buffer-use-some-frame (reusable-frames . t))))
display-buffer-pop-up-frame) (".*" . ((display-buffer-same-window
display-buffer-use-some-frame
display-buffer-pop-up-frame)
((reusable-frames . t))))))) ((reusable-frames . t)))))))
#+END_SRC #+END_SRC
** Fill Setup ** Fill Setup