summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-11-24 22:05:38 -0500
committerKyle Meyer <kyle@kyleam.com>2015-11-24 22:05:38 -0500
commitedc7700cfbaa872d23327ed4a6c0bdc38f0d2433 (patch)
tree5c37b3f34305ba6ec71fd857e5da3aa7c2d87eb2 /lisp
parentb8eb24e28283f17ae182ac7dc085d79d2d6a00db (diff)
downloademacs.d-edc7700cfbaa872d23327ed4a6c0bdc38f0d2433.tar.gz
zsh-ansi-term: Use display-buffer to control windows
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-external.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/init-external.el b/lisp/init-external.el
index 65a6681..b42956e 100644
--- a/lisp/init-external.el
+++ b/lisp/init-external.el
@@ -55,13 +55,14 @@ DIRECTORY."
(name (or name (concat "zsh: " dir)))
(full-name (concat "*" name "*"))
(default-directory dir))
- (cond
- ((string= (km/zsh-ansi-term-directory) dir)
- (ansi-term "zsh" name))
- ((get-buffer full-name)
- (switch-to-buffer full-name))
- (t
- (ansi-term "zsh" name)))))
+ (pop-to-buffer-same-window
+ (cond
+ ((and (not (string= (km/zsh-ansi-term-directory) dir))
+ (get-buffer full-name)))
+ (t
+ (cl-letf (((symbol-function 'switch-to-buffer)
+ (lambda (b &rest _) (get-buffer b))))
+ (ansi-term "zsh" name)))))))
(defun km/zsh-toggle-ansi-term-home ()
(interactive)
@@ -71,7 +72,9 @@ DIRECTORY."
(defun km/zsh-ansi-term-other-window (&optional directory)
(interactive (km/zsh-ansi-term--args))
- (pop-to-buffer (save-window-excursion (km/zsh-ansi-term directory))))
+ (let ((display-buffer-overriding-action
+ '(nil (inhibit-same-window . t))))
+ (km/zsh-ansi-term directory)))
(defun km/zsh-ansi-term--args ()
(list (cond