   "Configuration options for eshell-mode."
   :group 'dotemacs
   :prefix 'dotemacs-eshell)
+
 
 (defcustom dotemacs-eshell/plan9
   nil

  :group 'dotemacs-eshell)


;; eshell
(setq eshell-directory-name (concat dotemacs-cache-directory "eshell"))
(setq eshell-scroll-to-bottom-on-input 'this)
(setq eshell-buffer-shorthand t)


(when (executable-find "fortune")
  (defadvice eshell (before advice-for-eshell activate)
    (setq eshell-banner-message (concat (shell-command-to-string "fortune") "\n"))))


;; em-alias
(setq eshell-aliases-file (concat user-emacs-directory ".eshell-aliases"))


;; em-glob
(setq eshell-glob-case-insensitive t)
(setq eshell-error-if-no-glob t)


;; em-hist
(setq eshell-history-size 1024)


;; em-compl
(setq eshell-cmpl-ignore-case t)


;; plan 9 smart shell

    (mapc #'find-file (mapcar #'expand-file-name (eshell-flatten-list (reverse args))))))


(defun eshell/j ()
  "Quickly jump to previous directories."
  (let ((candidates (delete-dups (ring-elements eshell-last-dir-ring)))
        (reader (cond ((eq dotemacs-switch-engine 'ivy) #'ivy-completing-read)
                      (t #'ido-completing-read))))
    (eshell/cd (apply reader (list "Jump to directory:" candidates)))))


(setq my-eshell-buffer-count 0)
