changeset 38982:f12d1ec614e9

(mouse-buffer-menu): If the buffer menu is split by major modes, don't create panes for modes for which mouse-buffer-menu-alist returns an empty alist.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 28 Aug 2001 06:33:37 +0000
parents 89251bf024b5
children a437c3195fd7
files lisp/mouse.el
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mouse.el	Mon Aug 27 22:29:35 2001 +0000
+++ b/lisp/mouse.el	Tue Aug 28 06:33:37 2001 +0000
@@ -1571,26 +1571,29 @@
 	  (while (and split-by-major-mode
 		      (and (> (length (car split-by-major-mode)) 3)
 			   (> (* buffers-left 10) (length buffers))))
-	    (setq subdivided-menus
-		  (cons (cons
-			 (nth 1 (car split-by-major-mode))
-			 (mouse-buffer-menu-alist
-			  (cdr (cdr (car split-by-major-mode)))))
-			subdivided-menus))
+	    (let ((this-mode-list (mouse-buffer-menu-alist
+				   (cdr (cdr (car split-by-major-mode))))))
+	      (and this-mode-list
+		   (setq subdivided-menus
+			 (cons (cons
+				(nth 1 (car split-by-major-mode))
+				this-mode-list)
+			       subdivided-menus))))
 	    (setq buffers-left
 		  (- buffers-left (length (cdr (car split-by-major-mode)))))
 	    (setq split-by-major-mode (cdr split-by-major-mode)))
 	  ;; If any major modes are left over,
 	  ;; make a single submenu for them.
 	  (if split-by-major-mode
-	      (setq subdivided-menus
-		    (cons (cons
-			   "Others"
-			   (mouse-buffer-menu-alist
-			    ;; we don't need split-by-major-mode any
-			    ;; more, so we can ditch it with nconc.
-			    (apply 'nconc (mapcar 'cddr split-by-major-mode))))
-			  subdivided-menus)))
+	      (let ((others-list
+		     (mouse-buffer-menu-alist
+		      ;; we don't need split-by-major-mode any more,
+		      ;; so we can ditch it with nconc.
+		      (apply 'nconc (mapcar 'cddr split-by-major-mode)))))
+		(and others-list
+		     (setq subdivided-menus
+			   (cons (cons "Others" others-list)
+				 subdivided-menus)))))
 	  (setq menu (cons "Buffer Menu" (nreverse subdivided-menus))))
       (progn
 	(setq alist (mouse-buffer-menu-alist buffers))