Reword header to fool copyright-update-year.
[bpt/emacs.git] / lisp / msb.el
index 644ded9..6bc8254 100644 (file)
@@ -1,7 +1,7 @@
 ;;; msb.el --- customizable buffer-selection with multiple menus
 
 ;; Copyright (C) 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Lars Lindberg <lars.lindberg@home.se>
 ;; Maintainer: FSF
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,9 +22,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
       (msb-menu-bar-update-buffers t)))
 
 (defcustom msb-menu-cond msb--very-many-menus
-  "*List of criteria for splitting the mouse buffer menu.
+  "List of criteria for splitting the mouse buffer menu.
 The elements in the list should be of this type:
  (CONDITION MENU-SORT-KEY MENU-TITLE ITEM-HANDLING-FN ITEM-SORT-FN).
 
@@ -266,7 +264,7 @@ error every time you do \\[msb]."
   :version "20.3")
 
 (defcustom msb-separator-diff 100
-  "*Non-nil means use separators.
+  "Non-nil means use separators.
 The separators will appear between all menus that have a sorting key
 that differs by this value or more."
   :type '(choice integer (const nil))
@@ -277,7 +275,7 @@ that differs by this value or more."
   "*The sort key for files sorted by directory.")
 
 (defcustom msb-max-menu-items 15
-  "*The maximum number of items in a menu.
+  "The maximum number of items in a menu.
 If this variable is set to 15 for instance, then the submenu will be
 split up in minor parts, 15 items each.  A value of nil means no limit."
   :type '(choice integer (const nil))
@@ -285,7 +283,7 @@ split up in minor parts, 15 items each.  A value of nil means no limit."
   :group 'msb)
 
 (defcustom msb-max-file-menu-items 10
-  "*The maximum number of items from different directories.
+  "The maximum number of items from different directories.
 
 When the menu is of type `file by directory', this is the maximum
 number of buffers that are clumped together from different
@@ -300,20 +298,20 @@ If the value is not a number, then the value 10 is used."
   :group 'msb)
 
 (defcustom msb-most-recently-used-sort-key -1010
-  "*Where should the menu with the most recently used buffers be placed?"
+  "Where should the menu with the most recently used buffers be placed?"
   :type 'integer
   :set 'msb-custom-set
   :group 'msb)
 
 (defcustom msb-display-most-recently-used 15
-  "*How many buffers should be in the most-recently-used menu.
+  "How many buffers should be in the most-recently-used menu.
 No buffers at all if less than 1 or nil (or any non-number)."
   :type 'integer
   :set 'msb-custom-set
   :group 'msb)
 
 (defcustom msb-most-recently-used-title "Most recently used (%d)"
-  "*The title for the most-recently-used menu."
+  "The title for the most-recently-used menu."
   :type 'string
   :set 'msb-custom-set
   :group 'msb)
@@ -322,7 +320,7 @@ No buffers at all if less than 1 or nil (or any non-number)."
   "*Function that specifies how many pixels to shift the top menu leftwards.")
 
 (defcustom msb-display-invisible-buffers-p nil
-  "*Show invisible buffers or not.
+  "Show invisible buffers or not.
 Non-nil means that the buffer menu should include buffers that have
 names that starts with a space character."
   :type 'boolean
@@ -344,7 +342,7 @@ nil as ITEM-HANDLING-FUNCTION.  See `msb-menu-cond' for more
 information.")
 
 (defcustom msb-item-sort-function 'msb-sort-by-name
-  "*The order of items in a buffer menu.
+  "The order of items in a buffer menu.
 
 The default function to call for handling the order of items in a menu
 item.  This function is called like a sort function.  The items look
@@ -361,7 +359,7 @@ Set this to nil or t if you don't want any sorting (faster)."
   :group 'msb)
 
 (defcustom msb-files-by-directory nil
-  "*Non-nil means that files should be sorted by directory.
+  "Non-nil means that files should be sorted by directory.
 This is instead of the groups in `msb-menu-cond'."
   :type 'boolean
   :set 'msb-custom-set
@@ -829,7 +827,8 @@ results in
                 (with-current-buffer buffer
                   (when (and (not (msb-invisible-buffer-p))
                              (not (assq major-mode mode-list)))
-                    (push (cons major-mode mode-name)
+                    (push (cons major-mode
+                                 (format-mode-line mode-name nil nil buffer))
                           mode-list))))
               mode-list)
             (lambda (item1 item2)
@@ -952,7 +951,7 @@ It takes the form ((TITLE . BUFFER-LIST)...)."
                             "*Files by directory*")
                           'msb--toggle-menu-type)))))))
 
-(defun msb--create-buffer-menu  ()
+(defun msb--create-buffer-menu ()
   (save-match-data
     (save-excursion
       (msb--create-buffer-menu-2))))
@@ -1101,7 +1100,7 @@ variable `msb-menu-cond'."
               (f-title  (format "Frames (%d)" frame-length)))
          ;; List only the N most recently selected frames
          (when (and (integerp msb-max-menu-items)
-                    (>  msb-max-menu-items 1)
+                    (> msb-max-menu-items 1)
                     (> frame-length msb-max-menu-items))
            (setcdr (nthcdr msb-max-menu-items frames) nil))
          (setq frames-menu
@@ -1146,9 +1145,11 @@ different buffer menu using the function `msb'."
     (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
     (menu-bar-update-buffers t)))
 
-(defun msb-unload-hook ()
-  (msb-mode 0))
-(add-hook 'msb-unload-hook 'msb-unload-hook)
+(defun msb-unload-function ()
+  "Unload the Msb library."
+  (msb-mode -1)
+  ;; continue standard unloading
+  nil)
 
 (provide 'msb)
 (eval-after-load "msb" '(run-hooks 'msb-after-load-hook 'msb-after-load-hooks))