🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87287

19.27: list-buffers misalignment

#87287
From: terra
Date: Mon, 10 Oct 1994 11:25
43 lines
2131 bytes
In GNU Emacs 19.27.1 (hppa1.1-hp-hpux9, X toolkit) of Mon Oct 10 1994
on frigg.diku.dk

I press `M-x list-buffers' (usually C-x C-b) and get

 MR Buffer         Size   Mode           File
 -- ------         ----   ----           ----
.   .emacs	   14008  Emacs-Lisp	/home/ask2/terra/.emacs
    *scratch*	   0	  Lisp Interaction 
    *Completions*  165	  Completion List 
    *Help*	   162	  Fundamental	
 *  *Buffer List*  281	  Buffer Menu	

Note that the file name column is misaligned.  Incidently, it
would also be better, if the file names were abbriviated like
when using the following piece of code which unfortunately
relies on the local file system setup here.  It should be
possible to do something general for the current user though.

Morten Welinder
terra@diku.dk



(defun new-list-buffers (&optional arg)
  "Similar to list-buffers, but with shorter and more readable file names."
  (interactive "P")
  (list-buffers arg)
  (set-buffer "*Buffer List*")
  (toggle-read-only 0)
  ;; Replace full path to home dirs with ~
  (goto-line 3)
  (while (re-search-forward "/home/[a-z0-9]+/\\([a-z0-9]+\\)/" nil t)
    (let* ((all  (buffer-substring (match-beginning 0) (match-end 0)))
	   (user (buffer-substring (match-beginning 1) (match-end 1)))
	   (~user/ (concat "~" user "/")))
      (if (equal (expand-file-name ~user/) all)
	  (if (equal user (user-login-name))
	      (replace-match "~/" t nil)
	    (replace-match ~user/ t nil)))))
  (toggle-read-only 1))

(define-key ctl-x-map "\C-b" 'new-list-buffers)
Technical Details
Message-ID: <199410101124.AA01365@frigg.diku.dk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!pipex!uunet!cis.ohio-state.edu!diku.DK!terra

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,491234adfbf2b8b6,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-10-10 04:33:06 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!pipex!uunet!cis.ohio-state.edu!diku.DK!terra
From: terra@diku.DK
Newsgroups: gnu.emacs.bug
Subject: 19.27: list-buffers misalignment
Date: 10 Oct 1994 07:25:47 -0400
Organization: GNUs Not Usenet
Lines: 43
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <199410101124.AA01365@frigg.diku.dk>