(require 'em-cmpl)

;; Auto-complete in eshell should stop at the first ambiguity.
(setq eshell-cmpl-cycle-completions nil)

(defadvice eshell (around eshell-append-cwd (&optional arg) activate)
  "New eshell buffers should be named according to their working directory."
  (interactive "P")
  (if (and arg (not (numberp arg)))
      ;; Non-numeric prefix arg given, change the eshell buffer name.
      (let* ((current-dir (f-parent (buffer-file-name)))
             (eshell-buffer-name (format "*eshell*<%s>" current-dir)))
        ad-do-it)
    ;; Otherwise, continue as normal
    ad-do-it))

(provide 'eshell-customisations)

(require 'em-cmpl)

;; Auto-complete in eshell should stop at the first ambiguity.
(setq eshell-cmpl-cycle-completions nil)

(defadvice eshell (around eshell-append-cwd (&optional arg) activate)
  "New eshell buffers should be named according to their working directory."
  (interactive "P")
  (if (and arg (not (numberp arg)))
      ;; Non-numeric prefix arg given, change the eshell buffer name.
      (let* ((eshell-buffer-name (format "*eshell*<%s>" default-directory)))
        ad-do-it)
    ;; Otherwise, continue as normal
    ad-do-it))

(provide 'eshell-customisations)

Use default-directory to find which directory to use.
Use default-directory to find which directory to use.

dired buffers return nil for (buffer-file-name).

Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d,Wilfred/.emacs.d