-;; Time-stamp: <2015-09-13 19:17:49 kmodi>
+;; Time-stamp: <2016-03-29 17:59:22 kmodi>
 
 ;; multi-term
-;; Source: http://www.emacswiki.org/emacs/multi-term.el
+;; http://www.emacswiki.org/emacs/multi-term.el
 ;; http://paralambda.org/2012/07/02/using-gnu-emacs-as-a-terminal-emulator/
 
 (use-package multi-term
-  :commands (multi-term)
+  :commands (multi-term
+             hydra-launch/multi-term-and-exit)
   :config
   (progn
     ;; term
-    (use-package term)
-    (setq term-prompt-regexp ".*?:.*?\\>.*? ")
+    (use-package term
+      :config
+      (progn
+        (setq term-prompt-regexp ".*:.*>.*? ")))
     ;; NOTE: After changing the above regexp, call `term-mode' in the term
     ;; buffer for this expression to be effective; because the term buffers
     ;; make a local copy of this var each time a new term buffer is opened or
     ;; `term-mode' is called again.
 
-    ;; multi-term
-    (setq multi-term-buffer-name "term")
-    (setq multi-term-program "/bin/tcsh")
+    ;; Change default multi-term shell to tcsh if available
+    (let ((tcsh-bin (executable-find "tcsh")))
+      (when tcsh-bin
+        (setq multi-term-program tcsh-bin)))
 
     (setq term-bind-key-alist
           '(("C-c C-c" . term-interrupt-subjob)            ; default

            ("C-c C-j" . term-line-mode)
            ("C-c C-k" . term-char-mode)
            ("C-a"     . term-bol)
            ("C-p"     . previous-line)                    ; default
            ("C-n"     . next-line)                        ; default
            ("C-s"     . isearch-forward)                  ; default

            ("M-r"     . term-send-reverse-search-history) ; default
            ("M-,"     . term-send-raw)                    ; default
            ("M-."     . comint-dynamic-complete)))        ; default

    (setq multi-term-buffer-name "term")))


(provide 'setup-term)
