[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *buffer list* improvement

From: Thien-Thi Nguyen
Subject: Re: *buffer list* improvement
Date: Tue, 29 Oct 2013 20:29:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

() "Rockefeller, Harry" <address@hidden>
() Mon, 28 Oct 2013 12:33:18 -0400

   Problem: buffer list mode is too wide for my screen.
   If buffer named '~' exists then
     Substitute absolute path of buffer '~' everywhere with '~'.
   end if

You can dynamically bind ‘directory-abbrev-alist’ to achieve this,
something like (lightly tested):

(defun list-buffers-compactly (&optional arg)
  "Like `list-buffers', but with filenames abbreviated (maybe).
If a buffer \"~\" exists, its `default-directory' is substituted
in the buffer list as \"~\"."
  (interactive "P")
  (let* ((tilde (get-buffer "~"))
         (directory-abbrev-alist (if tilde
                                     (acons (file-name-as-directory
                                              (with-current-buffer tilde 
                                            (file-name-as-directory "~")
    (list-buffers arg)))

Personally, i do something similar, but substituting env vars instead,
and w/ ‘buffer-menu’ at the core instead of ‘list-buffers’.

Initially i played w/ ‘(setq directory-abbrev-alist ...)’ globally, but
was disuaded by some uninvestigated weirdness involving emacsclient and
"git rebase -i" and phase of moon...

Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

Attachment: pgp7vMBKi2yCq.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]