From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: How to make Emacs buffers menu show long filenames in full Date: Sun, 06 Apr 2008 23:50:27 +0300 Organization: JURTA Message-ID: <87myo886us.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1207516575 16642 80.91.229.12 (6 Apr 2008 21:16:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Apr 2008 21:16:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 06 23:16:48 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JicEC-0007OS-9Y for ged-emacs-devel@m.gmane.org; Sun, 06 Apr 2008 23:16:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JicDZ-0002Cy-66 for ged-emacs-devel@m.gmane.org; Sun, 06 Apr 2008 17:16:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JicDU-0002CO-CJ for emacs-devel@gnu.org; Sun, 06 Apr 2008 17:15:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JicDS-0002CC-OH for emacs-devel@gnu.org; Sun, 06 Apr 2008 17:15:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JicDS-0002C9-JO for emacs-devel@gnu.org; Sun, 06 Apr 2008 17:15:54 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JicDS-0004Zy-Bm for emacs-devel@gnu.org; Sun, 06 Apr 2008 17:15:54 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JicDO-000421-VX for emacs-devel@gnu.org; Mon, 07 Apr 2008 00:15:51 +0300 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 3b0094320302fba07e8f985c89e0b8e6 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2569 [Apr 04 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 10 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:94505 Archived-At: I received a complaint from a Emacs user about buffer names truncated in the Buffers menu. I think it is justified to provide a new variable to customize the length of buffer names in this menu and even to provide an option to not truncate buffer names at all because usually buffer names are not too long, unlike e.g. items in the yank-menu whose length are limited by the existing variable `yank-menu-length' that doesn't have an option to display in full length usually very long multi-line elements of the kill ring. Below is a patch that adds a new user option `buffers-menu-buffer-name-length' with the default 30 (rounded from the currently hard-coded value 27). Also it moves the definition of `buffers-menu-max-size' to the "Buffers Menu" section, and changes the group name from `mouse' to `menu': Index: lisp/menu-bar.el =================================================================== RCS file: /sources/emacs/emacs/lisp/menu-bar.el,v retrieving revision 1.327 diff -c -r1.327 menu-bar.el *** lisp/menu-bar.el 23 Mar 2008 11:44:23 -0000 1.327 --- lisp/menu-bar.el 6 Apr 2008 20:45:52 -0000 *************** *** 30,46 **** ;;; Code: - ;;; User options: - - (defcustom buffers-menu-max-size 10 - "*Maximum number of entries which may appear on the Buffers menu. - If this is 10, then only the ten most-recently-selected buffers are shown. - If this is nil, then all buffers are shown. - A large number or nil slows down menu responsiveness." - :type '(choice integer - (const :tag "All" nil)) - :group 'mouse) - ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key ;; definitions made in loaddefs.el. (or (lookup-key global-map [menu-bar]) --- 30,35 ---- *************** *** 1477,1483 **** (defcustom yank-menu-length 20 "*Maximum length to display in the yank-menu." :type 'integer ! :group 'mouse) (defun menu-bar-update-yank-menu (string old) (let ((front (car (cdr yank-menu))) --- 1466,1472 ---- (defcustom yank-menu-length 20 "*Maximum length to display in the yank-menu." :type 'integer ! :group 'menu) (defun menu-bar-update-yank-menu (string old) (let ((front (car (cdr yank-menu))) *************** *** 1514,1519 **** --- 1503,1528 ---- (insert last-command-event)) + ;;; Buffers Menu + + (defcustom buffers-menu-max-size 10 + "*Maximum number of entries which may appear on the Buffers menu. + If this is 10, then only the ten most-recently-selected buffers are shown. + If this is nil, then all buffers are shown. + A large number or nil slows down menu responsiveness." + :type '(choice integer + (const :tag "All" nil)) + :group 'menu) + + (defcustom buffers-menu-buffer-name-length 30 + "*Maximum length of the buffer name on the Buffers menu. + If this is a number, then buffer names are truncated to this length. + If this is nil, then buffer names are shown in full. + A large number or nil makes the menu too wide." + :type '(choice integer + (const :tag "Full length" nil)) + :group 'menu) + (defcustom buffers-menu-show-directories 'unless-uniquify "If non-nil, show directories in the Buffers menu for buffers that have them. The special value `unless-uniquify' means that directories will be shown *************** *** 1601,1611 **** (unless (eq ?\s (aref name 0)) (push (menu-bar-update-buffers-1 (cons buf ! (if (> (length name) 27) ! (concat (substring name 0 12) ! "..." ! (substring name -12)) ! name))) alist)))) ;; Now make the actual list of items. (let ((buffers-vec (make-vector (length alist) nil)) --- 1610,1625 ---- (unless (eq ?\s (aref name 0)) (push (menu-bar-update-buffers-1 (cons buf ! (if (and (integerp buffers-menu-buffer-name-length) ! (> (length name) buffers-menu-buffer-name-length)) ! (concat ! (substring ! name 0 (/ buffers-menu-buffer-name-length 2)) ! "..." ! (substring ! name (- (/ buffers-menu-buffer-name-length 2)))) ! name) ! )) alist)))) ;; Now make the actual list of items. (let ((buffers-vec (make-vector (length alist) nil)) -- Juri Linkov http://www.jurta.org/emacs/