From 4945779744dcacced956ce61f9daf1fc6f69e83d Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Wed, 28 Nov 2012 09:23:10 +0900 Subject: [PATCH] fix my-term --- emacs.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/emacs.el b/emacs.el index a1faa9d..96e8043 100644 --- a/emacs.el +++ b/emacs.el @@ -1783,17 +1783,19 @@ if arg given, use that eshell buffer, otherwise make new eshell buffer." my-desktop-terminal)) (my-term))) +(defvar my-term nil "my terminal buffer") (defun my-term () "open terminal buffer and return that buffer." (interactive) - (if (eq system-type 'windows-nt) - (eshell) - (if (require 'multi-term nil t) - (progn - (unless (multi-term-dedicated-exist-p) - (multi-term-dedicated-open)) - (multi-term-dedicated-select)) - (ansi-term shell-file-name)))) + (if (and my-term + (buffer-name my-term)) + (pop-to-buffer my-term) + (setq my-term + (if (eq system-type 'windows-nt) + (eshell) + (if (require 'multi-term nil t) + (multi-term) + (ansi-term shell-file-name)))))) (defun my-delete-frame-or-kill-emacs () "delete frame when opening multiple frame, kill emacs when only one."