Northward Midget Pole to Pole

17Mar/110

Emacs Menubar Buffers List Format

And now for something completely different.  No depression updates this time.  A new "Hacking" category and a code tip on getting the full filenames in the menubar buffers list of Emacs.

I use Emacs 23.1.50.1 on my desktop, mostly for the kinds of things (quick copy and pasting and scratch pads) vim's modal model doesn't make altogether easy.  I'm not a vehement advocate of either editor, but of both.

;; Copied from /usr/share/emacs/23.1.50/lisp/menu-bar.el.gz
(defun menu-bar-update-buffers-1 (elt)
  (let* ((buf (car elt))
     (file
      (and (if (eq buffers-menu-show-directories 'unless-uniquify)
           (or (not (boundp 'uniquify-buffer-name-style))
               (null uniquify-buffer-name-style))
         buffers-menu-show-directories)
           (or (buffer-file-name buf)
           (buffer-local-value 'list-buffers-directory buf)))))
    (cons (if buffers-menu-show-status
          (let ((mod (if (buffer-modified-p buf) "*" ""))
            (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
        (if file
            (format "%s  %s%s" file mod ro )
          (format "%s  %s%s" (cdr elt) mod ro)))
        (if file
        (format "%s  --  %s"  (cdr elt) file)
          (cdr elt)))
      buf)))

Just add that to your init.el or wherever you put your emacs customizations, and you should see the full path and filename of files in your menubar buffers list instead of the basename then the directory.

Also gonna paste this into my flat-text coredump file, where I'll probably find I've already got some code snippet that solved it.

 

Posted by Quinn

Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.