changeset 44803:de50fca9a8aa

(buffers-menu-show-directories, buffers-menu-show-status): New variables. (menu-bar-update-buffers-1): Use them.
author Miles Bader <miles@gnu.org>
date Wed, 24 Apr 2002 05:34:33 +0000
parents cb8f23e350ff
children 362418eb5a3d
files lisp/menu-bar.el
diffstat 1 files changed, 44 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/menu-bar.el	Wed Apr 24 01:27:15 2002 +0000
+++ b/lisp/menu-bar.el	Wed Apr 24 05:34:33 2002 +0000
@@ -1244,7 +1244,37 @@
   (interactive "*")
   (push-mark (point))
   (insert last-command-event))
+
 
+(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
+unless `uniquify-buffer-name-style' is non-nil (in which case, buffer
+names should include enough of a buffer's directory to distinguish it
+from other buffers).
+
+Setting this variable directly does not take effect until next time the
+Buffers menu is regenerated."
+  :set (lambda (symbol value)
+	 (set symbol value)
+	 (menu-bar-update-buffers t))
+  :initialize 'custom-initialize-default
+  :type '(choice (const :tag "Never" nil)
+		 (const :tag "Unless uniquify is enabled" unless-uniquify)
+		 (const :tag "Always" t))
+  :group 'menu)
+
+(defcustom buffers-menu-show-status t
+  "If non-nil, show modified/read-only status of buffers in the Buffers menu.
+Setting this variable directly does not take effect until next time the
+Buffers menu is regenerated."
+  :set (lambda (symbol value)
+	 (set symbol value)
+	 (menu-bar-update-buffers t))
+  :initialize 'custom-initialize-default
+  :type 'boolean
+  :group 'menu)
+
 (defvar list-buffers-directory nil)
 
 (defvar menu-bar-update-buffers-maxbuf)
@@ -1264,25 +1294,29 @@
   (select-frame frame)))
 
 (defun menu-bar-update-buffers-1 (elt)
-  ;; (format "%%%ds  %%s%%s  %%s" menu-bar-update-buffers-maxbuf)
   (let* ((buf (car elt))
 	 (file
-	  (and (or (not (boundp 'uniquify-buffer-name-style))
-		   (null uniquify-buffer-name-style))
+	  (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))))
-	 (mod (if (buffer-modified-p buf) "*" ""))
-	 (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
+		   (buffer-local-value 'list-buffers-directory buf)))))
     (when file
       (setq file (file-name-directory file)))
     (when (and file (> (length file) 20))
       (setq file (concat "..." (substring file -17))))
-    (cons (if file
-	      (format "%s  %s%s  --  %s" (cdr elt) mod ro file)
-	    (format "%s  %s%s" (cdr elt) mod ro))
+    (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  --  %s" (cdr elt) mod ro file)
+		  (format "%s  %s%s" (cdr elt) mod ro)))
+	    (if file
+		(format "%s  --  %s"  (cdr elt) file)
+	      (cdr elt)))
 	  buf)))
 
-
 ;; Used to cache the menu entries for commands in the Buffers menu
 (defvar menu-bar-buffers-menu-command-entries nil)