Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to keep dired open as a tall pane, separated horizontally from my other windows (like in TextMate). How can I move dired's path name into its modeline?

share|improve this question

3 Answers 3

Have you look SpeedBar? It opens new frame that show files in the current folder. Also SrSpeedBar provides same functionality in the current frame.

share|improve this answer

Consider hiding the details instead of moving the header line (directory name) to the mode line.

  • In development builds of Emacs 24 (which will become 24.4), just hit ( (left paren character) to toggle hiding details.

  • In all versions of Emacs you can alternatively use libraries dired-details.el and dired-details+.el, available on EmacsWiki. A description is here.

The directory header line is important in Dired; it is not just a label. It becomes especially important when you insert subdirectory listings in the same Dired buffer: you can easily navigate among the main directory and subdirectories.

If you do decide to opt for hiding details, consider also using library fit-frame.el and perhaps its companion library autofit-frame.el.

They let you automatically fit the frame to the displayed buffer, and they automatically ignore the width of the directory header when doing so (it is just wrapped; only file names are used for calculating the needed frame width). They can be used to automatically refit the frame whenever you toggle hiding details.

When details are hidden this gives you a skinny frame, with the advantages of both Speedbar and Dired.

share|improve this answer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MODELINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(add-hook 'dired-mode-hook 'lawlist-modeline-setup)
;; add additional hooks as needed

(defun lawlist-modeline-setup ()
  (if (or
      (eq major-mode 'dired-mode)
      ;; add additional modes as needed
      (setq mode-line-format '(
      " " ;; needed to maintain a black border on the left margin
      ;; Position, including warning for 80 columns
       (:propertize "Mod. " face mode-line-position-face) ;; 0% = flush left
       ;; read-only or modified status
        (cond (buffer-read-only
                   (propertize " RO " 'face 'mode-line-read-only-face))
                  (propertize "%*" 'face 'mode-line-modified-face))
                  (t "-"))) ;; Symbol for when no modifications exist.
       (:propertize " | Siz. %I | Loc. %P | Enc. %Z | Ln. %l | Col. " face mode-line-position-face) ;; 0% = flush left
       (:eval (propertize "%c" 'face
                          (if (>= (current-column) 80)
       ; emacsclient [default -- keep?]
       " | "
       ;; directory and buffer/file name
       (:propertize (:eval (shorten-directory default-directory 30))
                    face mode-line-folder-face)
       (:propertize "%b" face mode-line-filename-face)
       ;; narrow [default -- keep?]
       "%n" ;; print Narrow if applicable
       ;; mode indicators: vc, recursive edit, major mode, minor modes, process, global
       (vc-mode vc-mode)
       " | "
       (:propertize mode-name face mode-line-mode-face)
       " |"
       (:eval (propertize (format-mode-line minor-mode-alist)
                          'face 'mode-line-minor-mode-face))
       (:propertize mode-line-process
                    face mode-line-process-face)
  ))))) ;; end of lawlist-modeline-setup

;; Helper function
(defun shorten-directory (dir max-length)
  "Show up to `max-length' characters of a directory name `dir'."
  (let ((path (reverse (split-string (abbreviate-file-name dir) "/")))
        (output ""))
    (when (and path (equal "" (car path)))
      (setq path (cdr path)))
    (while (and path (< (length output) (- max-length 4)))
      (setq output (concat (car path) "/" output))
      (setq path (cdr path)))
    (when path
      (setq output (concat ".../" output)))

;; Extra mode line faces
(make-face 'mode-line-read-only-face)
(make-face 'mode-line-modified-face)
(make-face 'mode-line-folder-face)
(make-face 'mode-line-filename-face)
(make-face 'mode-line-position-face)
(make-face 'mode-line-mode-face)
(make-face 'mode-line-minor-mode-face)
(make-face 'mode-line-process-face)
(make-face 'mode-line-80col-face)
(set-face-attribute 'mode-line nil
    :foreground "black" :background "LightYellow1"
    :inverse-video nil
    :box '(:line-width 3 :color "red" :style nil))
(set-face-attribute 'mode-line-inactive nil
    :foreground "black" :background "gray70"
    :inverse-video nil
    :box '(:line-width 3 :color "black" :style nil) )
(set-face-attribute 'mode-line-read-only-face nil
    :inherit 'mode-line-face
    :foreground "#4271ae" ;; blue
    :bold t
    :box '(:line-width 3 :color "black"))
(set-face-attribute 'mode-line-modified-face nil
    :inherit 'mode-line-face
    :foreground "red"
    :bold t)
(set-face-attribute 'mode-line-folder-face nil
    :inherit 'mode-line-face
    :foreground "blue")
(set-face-attribute 'mode-line-filename-face nil
    :inherit 'mode-line-face
    :foreground "red"
    :bold t)
(set-face-attribute 'mode-line-position-face nil
    :inherit 'mode-line-face
    :family "Menlo" :height 150)
(set-face-attribute 'mode-line-mode-face nil
    :inherit 'mode-line-face
    :foreground "black")
(set-face-attribute 'mode-line-minor-mode-face nil
    :inherit 'mode-line-mode-face
    :foreground "black"
    :height 160)
(set-face-attribute 'mode-line-process-face nil
    :inherit 'mode-line-face
    :foreground "#718c00")
(set-face-attribute 'mode-line-80col-face nil
    :inherit 'mode-line-position-face
    :foreground "black" :background "#eab700")
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.