emacs - fix bug of sd/toggle-eshell-here default-directory
authorPeng Li <seudut@gmail.com>
Sat, 2 Jul 2016 13:30:03 +0000 (21:30 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 2 Jul 2016 13:30:03 +0000 (21:30 +0800)
emacs.d/config.org

index 91b18bd..20411af 100644 (file)
@@ -1271,15 +1271,17 @@ Quickly start eshll in split window below, refer [[http://www.howardism.org/Tech
             (delete-window)
           (select-window (sd/window-has-eshell)))
       (progn
-        (split-window-vertically (- (/ (window-total-height) 3)))
-        (other-window 1)
-        (unless (and (boundp 'eshell-buffer-name) (get-buffer eshell-buffer-name))
-          (eshell))
-        (switch-to-buffer eshell-buffer-name)
-        (goto-char (point-max))
-        (eshell-kill-input)
-        (insert (format "cd %s" default-directory))
-        (eshell-send-input))))
+        (let ((dir default-directory))
+          
+          (split-window-vertically (- (/ (window-total-height) 3)))
+          (other-window 1)
+          (unless (and (boundp 'eshell-buffer-name) (get-buffer eshell-buffer-name))
+            (eshell))
+          (switch-to-buffer eshell-buffer-name)
+          (goto-char (point-max))
+          (eshell-kill-input)
+          (insert (format "cd %s" dir))
+          (eshell-send-input)))))
 
   (global-unset-key (kbd "M-`"))
   (global-set-key (kbd "M-`") 'sd/toggle-eshell-here)