all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
To: "Rockefeller\, Harry" <Harry.Rockefeller@flightsafety.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: *buffer list* improvement
Date: Tue, 29 Oct 2013 20:29:01 +0100	[thread overview]
Message-ID: <8761sfdgg2.fsf@zigzag.favinet> (raw)
In-Reply-To: <3185EFAF9C8F7B4E9DBDF56829BF7C782A5D498AAF@srv060ex01.ssd.fsi.com> (Harry Rockefeller's message of "Mon, 28 Oct 2013 12:33:18 -0400")

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

() "Rockefeller, Harry" <Harry.Rockefeller@flightsafety.com>
() Mon, 28 Oct 2013 12:33:18 -0400

   Problem: buffer list mode is too wide for my screen.
   Conclusion:
   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
                                             (expand-file-name
                                              (with-current-buffer tilde 
                                                default-directory)))
                                            (file-name-as-directory "~")
                                            directory-abbrev-alist)
                                   directory-abbrev-alist)))
    (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 #2: Type: application/pgp-signature, Size: 197 bytes --]

      reply	other threads:[~2013-10-29 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 16:33 *buffer list* improvement Rockefeller, Harry
2013-10-29 19:29 ` Thien-Thi Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761sfdgg2.fsf@zigzag.favinet \
    --to=ttn@gnu.org \
    --cc=Harry.Rockefeller@flightsafety.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.