2001-07-15 16:15:35 +00:00
|
|
|
;;; msb.el --- customizable buffer-selection with multiple menus
|
1996-01-14 07:34:30 +00:00
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
;; Copyright (C) 1993-1995, 1997-2020 Free Software Foundation, Inc.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
2002-04-29 22:50:36 +00:00
|
|
|
;; Author: Lars Lindberg <lars.lindberg@home.se>
|
2019-05-25 20:43:06 +00:00
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Created: 8 Oct 1993
|
1998-02-15 16:45:52 +00:00
|
|
|
;; Lindberg's last update version: 3.34
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Keywords: mouse buffer menu
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1994-12-23 17:58:46 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1994-12-23 17:58:46 +00:00
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
1996-01-14 07:34:30 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Purpose of this package:
|
|
|
|
;; 1. Offer a function for letting the user choose buffer,
|
|
|
|
;; not necessarily for switching to it.
|
1999-05-31 14:49:05 +00:00
|
|
|
;; 2. Make a better mouse-buffer-menu. This is done as a global
|
|
|
|
;; minor mode, msb-mode.
|
1994-12-23 17:58:46 +00:00
|
|
|
;;
|
|
|
|
;; Customization:
|
1994-12-24 16:47:58 +00:00
|
|
|
;; Look at the variable `msb-menu-cond' for deciding what menus you
|
|
|
|
;; want. It's not that hard to customize, despite my not-so-good
|
|
|
|
;; doc-string. Feel free to send me a better doc-string.
|
1994-12-23 17:58:46 +00:00
|
|
|
;; There are some constants for you to try here:
|
|
|
|
;; msb--few-menus
|
|
|
|
;; msb--very-many-menus (default)
|
2003-02-04 12:29:42 +00:00
|
|
|
;;
|
1994-12-24 16:47:58 +00:00
|
|
|
;; Look at the variable `msb-item-handling-function' for customization
|
|
|
|
;; of the appearance of every menu item. Try for instance setting
|
|
|
|
;; it to `msb-alon-item-handler'.
|
2003-02-04 12:29:42 +00:00
|
|
|
;;
|
1994-12-24 16:47:58 +00:00
|
|
|
;; Look at the variable `msb-item-sort-function' for customization
|
|
|
|
;; of sorting the menus. Set it to t for instance, which means no
|
1994-12-23 17:58:46 +00:00
|
|
|
;; sorting - you will get latest used buffer first.
|
|
|
|
;;
|
1994-12-24 16:47:58 +00:00
|
|
|
;; Also check out the variable `msb-display-invisible-buffers-p'.
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
;; Known bugs:
|
1995-01-09 22:16:23 +00:00
|
|
|
;; - Files-by-directory
|
1995-02-24 09:12:56 +00:00
|
|
|
;; + No possibility to show client/changed buffers separately.
|
1998-02-15 16:45:52 +00:00
|
|
|
;; + All file buffers only appear in a file sub-menu, they will
|
1995-02-24 09:12:56 +00:00
|
|
|
;; for instance not appear in the Mail sub-menu.
|
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Future enhancements:
|
|
|
|
|
|
|
|
;;; Thanks goes to
|
1995-02-24 09:12:56 +00:00
|
|
|
;; Mark Brader <msb@sq.com>
|
|
|
|
;; Jim Berry <m1jhb00@FRB.GOV>
|
|
|
|
;; Hans Chalupsky <hans@cs.Buffalo.EDU>
|
|
|
|
;; Larry Rosenberg <ljr@ictv.com>
|
|
|
|
;; Will Henney <will@astroscu.unam.mx>
|
|
|
|
;; Jari Aalto <jaalto@tre.tele.nokia.fi>
|
2019-05-26 07:58:28 +00:00
|
|
|
;; Michael Kifer <kifer@cs.stonybrook.edu>
|
1995-02-24 09:12:56 +00:00
|
|
|
;; Gael Marziou <gael@gnlab030.grenoble.hp.com>
|
|
|
|
;; Dave Gillespie <daveg@thymus.synaptics.com>
|
|
|
|
;; Alon Albert <alon@milcse.rtsg.mot.com>
|
|
|
|
;; Kevin Broadey, <KevinB@bartley.demon.co.uk>
|
|
|
|
;; Ake Stenhof <ake@cadpoint.se>
|
1999-08-16 04:04:27 +00:00
|
|
|
;; Richard Stallman <rms@gnu.org>
|
1995-02-24 09:12:56 +00:00
|
|
|
;; Steve Fisk <fisk@medved.bowdoin.edu>
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1999-07-28 16:46:30 +00:00
|
|
|
;; This version turned into a global minor mode and subsequently
|
|
|
|
;; hacked on by Dave Love.
|
1994-12-23 17:58:46 +00:00
|
|
|
;;; Code:
|
|
|
|
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(eval-when-compile (require 'cl-lib))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
;;
|
|
|
|
;; Some example constants to be used for `msb-menu-cond'. See that
|
|
|
|
;; variable for more information. Please note that if the condition
|
|
|
|
;; returns `multi', then the buffer can appear in several menus.
|
|
|
|
;;
|
1994-12-23 17:58:46 +00:00
|
|
|
(defconst msb--few-menus
|
|
|
|
'(((and (boundp 'server-buffer-clients)
|
|
|
|
server-buffer-clients
|
|
|
|
'multi)
|
|
|
|
3030
|
|
|
|
"Clients (%d)")
|
|
|
|
((and msb-display-invisible-buffers-p
|
|
|
|
(msb-invisible-buffer-p)
|
|
|
|
'multi)
|
|
|
|
3090
|
|
|
|
"Invisible buffers (%d)")
|
|
|
|
((eq major-mode 'dired-mode)
|
|
|
|
2010
|
|
|
|
"Dired (%d)"
|
|
|
|
msb-dired-item-handler
|
|
|
|
msb-sort-by-directory)
|
|
|
|
((eq major-mode 'Man-mode)
|
|
|
|
4090
|
|
|
|
"Manuals (%d)")
|
|
|
|
((eq major-mode 'w3-mode)
|
|
|
|
4020
|
|
|
|
"WWW (%d)")
|
2000-08-15 11:19:13 +00:00
|
|
|
((or (memq major-mode
|
|
|
|
'(rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))
|
|
|
|
(memq major-mode '(mh-letter-mode mh-show-mode mh-folder-mode))
|
|
|
|
(memq major-mode
|
|
|
|
'(gnus-summary-mode message-mode gnus-group-mode
|
|
|
|
gnus-article-mode score-mode gnus-browse-killed-mode)))
|
1994-12-23 17:58:46 +00:00
|
|
|
4010
|
|
|
|
"Mail (%d)")
|
|
|
|
((not buffer-file-name)
|
|
|
|
4099
|
|
|
|
"Buffers (%d)")
|
|
|
|
('no-multi
|
|
|
|
1099
|
|
|
|
"Files (%d)")))
|
|
|
|
|
|
|
|
(defconst msb--very-many-menus
|
|
|
|
'(((and (boundp 'server-buffer-clients)
|
|
|
|
server-buffer-clients
|
|
|
|
'multi)
|
|
|
|
1010
|
|
|
|
"Clients (%d)")
|
|
|
|
((and (boundp 'vc-mode) vc-mode 'multi)
|
|
|
|
1020
|
|
|
|
"Version Control (%d)")
|
|
|
|
((and buffer-file-name
|
|
|
|
(buffer-modified-p)
|
|
|
|
'multi)
|
|
|
|
1030
|
|
|
|
"Changed files (%d)")
|
|
|
|
((and (get-buffer-process (current-buffer))
|
|
|
|
'multi)
|
|
|
|
1040
|
|
|
|
"Processes (%d)")
|
|
|
|
((and msb-display-invisible-buffers-p
|
|
|
|
(msb-invisible-buffer-p)
|
|
|
|
'multi)
|
|
|
|
1090
|
1997-12-22 02:26:17 +00:00
|
|
|
"Invisible buffers (%d)")
|
1994-12-23 17:58:46 +00:00
|
|
|
((eq major-mode 'dired-mode)
|
|
|
|
2010
|
|
|
|
"Dired (%d)"
|
|
|
|
;; Note this different menu-handler
|
|
|
|
msb-dired-item-handler
|
|
|
|
;; Also note this item-sorter
|
|
|
|
msb-sort-by-directory)
|
|
|
|
((eq major-mode 'Man-mode)
|
1998-02-15 16:45:52 +00:00
|
|
|
5030
|
1994-12-23 17:58:46 +00:00
|
|
|
"Manuals (%d)")
|
|
|
|
((eq major-mode 'w3-mode)
|
1998-02-15 16:45:52 +00:00
|
|
|
5020
|
1994-12-23 17:58:46 +00:00
|
|
|
"WWW (%d)")
|
2000-08-15 11:19:13 +00:00
|
|
|
((or (memq major-mode
|
|
|
|
'(rmail-mode rmail-edit-mode vm-summary-mode vm-mode mail-mode))
|
|
|
|
(memq major-mode '(mh-letter-mode mh-show-mode mh-folder-mode))
|
|
|
|
(memq major-mode '(gnus-summary-mode message-mode gnus-group-mode
|
|
|
|
gnus-article-mode score-mode
|
1994-12-23 17:58:46 +00:00
|
|
|
gnus-browse-killed-mode)))
|
1998-02-15 16:45:52 +00:00
|
|
|
5010
|
1994-12-23 17:58:46 +00:00
|
|
|
"Mail (%d)")
|
|
|
|
;; Catchup for all non-file buffers
|
|
|
|
((and (not buffer-file-name)
|
|
|
|
'no-multi)
|
1998-02-15 16:45:52 +00:00
|
|
|
5099
|
1994-12-23 17:58:46 +00:00
|
|
|
"Other non-file buffers (%d)")
|
|
|
|
((and (string-match "/\\.[^/]*$" buffer-file-name)
|
|
|
|
'multi)
|
|
|
|
3090
|
|
|
|
"Hidden Files (%d)")
|
|
|
|
((memq major-mode '(c-mode c++-mode))
|
|
|
|
3010
|
|
|
|
"C/C++ Files (%d)")
|
|
|
|
((eq major-mode 'emacs-lisp-mode)
|
|
|
|
3020
|
|
|
|
"Elisp Files (%d)")
|
|
|
|
((eq major-mode 'latex-mode)
|
|
|
|
3030
|
2005-09-08 18:42:37 +00:00
|
|
|
"LaTeX Files (%d)")
|
1994-12-23 17:58:46 +00:00
|
|
|
('no-multi
|
|
|
|
3099
|
|
|
|
"Other files (%d)")))
|
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; Customizable variables
|
|
|
|
;;;
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defgroup msb nil
|
|
|
|
"Customizable buffer-selection with multiple menus."
|
|
|
|
:prefix "msb-"
|
|
|
|
:group 'mouse)
|
|
|
|
|
|
|
|
(defun msb-custom-set (symbol value)
|
|
|
|
"Set the value of custom variables for msb."
|
|
|
|
(set symbol value)
|
1999-07-23 22:57:32 +00:00
|
|
|
(if (and (featurep 'msb) msb-mode)
|
1998-02-15 16:45:52 +00:00
|
|
|
;; wait until package has been loaded before bothering to update
|
|
|
|
;; the buffer lists.
|
1999-07-23 22:57:32 +00:00
|
|
|
(msb-menu-bar-update-buffers t)))
|
1998-02-15 16:45:52 +00:00
|
|
|
|
|
|
|
(defcustom msb-menu-cond msb--very-many-menus
|
2008-12-03 05:48:14 +00:00
|
|
|
"List of criteria for splitting the mouse buffer menu.
|
1998-02-15 16:45:52 +00:00
|
|
|
The elements in the list should be of this type:
|
|
|
|
(CONDITION MENU-SORT-KEY MENU-TITLE ITEM-HANDLING-FN ITEM-SORT-FN).
|
|
|
|
|
|
|
|
When making the split, the buffers are tested one by one against the
|
1999-05-31 14:49:05 +00:00
|
|
|
CONDITION, just like a Lisp cond: When hitting a true condition, the
|
1998-02-15 16:45:52 +00:00
|
|
|
other criteria are *not* tested and the buffer name will appear in the
|
|
|
|
menu with the menu-title corresponding to the true condition.
|
|
|
|
|
|
|
|
If the condition returns the symbol `multi', then the buffer will be
|
|
|
|
added to this menu *and* tested for other menus too. If it returns
|
|
|
|
`no-multi', then the buffer will only be added if it hasn't been added
|
|
|
|
to any other menu.
|
|
|
|
|
|
|
|
During this test, the buffer in question is the current buffer, and
|
|
|
|
the test is surrounded by calls to `save-excursion' and
|
|
|
|
`save-match-data'.
|
|
|
|
|
|
|
|
The categories are sorted by MENU-SORT-KEY. Smaller keys are on top.
|
2007-05-16 11:25:05 +00:00
|
|
|
A value of nil means don't display this menu.
|
1998-02-15 16:45:52 +00:00
|
|
|
|
|
|
|
MENU-TITLE is really a format. If you add %d in it, the %d is
|
|
|
|
replaced with the number of items in that menu.
|
|
|
|
|
2007-10-31 09:02:14 +00:00
|
|
|
ITEM-HANDLING-FN is optional. If it is supplied and is a function,
|
|
|
|
then it is used for displaying the items in that particular buffer
|
1998-02-15 16:45:52 +00:00
|
|
|
menu, otherwise the function pointed out by
|
|
|
|
`msb-item-handling-function' is used.
|
|
|
|
|
2007-10-31 09:02:14 +00:00
|
|
|
ITEM-SORT-FN is also optional.
|
1998-02-15 16:45:52 +00:00
|
|
|
If it is not supplied, the function pointed out by
|
|
|
|
`msb-item-sort-function' is used.
|
|
|
|
If it is nil, then no sort takes place and the buffers are presented
|
|
|
|
in least-recently-used order.
|
|
|
|
If it is t, then no sort takes place and the buffers are presented in
|
|
|
|
most-recently-used order.
|
|
|
|
If it is supplied and non-nil and not t than it is used for sorting
|
|
|
|
the items in that particular buffer menu.
|
|
|
|
|
|
|
|
Note1: There should always be a `catch-all' as last element, in this
|
|
|
|
list. That is an element like (t TITLE ITEM-HANDLING-FUNCTION).
|
|
|
|
Note2: A buffer menu appears only if it has at least one buffer in it.
|
|
|
|
Note3: If you have a CONDITION that can't be evaluated you will get an
|
|
|
|
error every time you do \\[msb]."
|
|
|
|
:type `(choice (const :tag "long" :value ,msb--very-many-menus)
|
2000-05-18 18:41:46 +00:00
|
|
|
(const :tag "short" :value ,msb--few-menus)
|
|
|
|
(sexp :tag "user"))
|
1998-02-15 16:45:52 +00:00
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
|
|
|
|
|
|
|
(defcustom msb-modes-key 4000
|
|
|
|
"The sort key for files sorted by mode."
|
|
|
|
:type 'integer
|
|
|
|
:set 'msb-custom-set
|
1998-04-20 03:35:05 +00:00
|
|
|
:group 'msb
|
|
|
|
:version "20.3")
|
1998-02-15 16:45:52 +00:00
|
|
|
|
|
|
|
(defcustom msb-separator-diff 100
|
2008-12-03 05:48:14 +00:00
|
|
|
"Non-nil means use separators.
|
1997-12-22 02:26:17 +00:00
|
|
|
The separators will appear between all menus that have a sorting key
|
1998-02-15 16:45:52 +00:00
|
|
|
that differs by this value or more."
|
|
|
|
:type '(choice integer (const nil))
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
(defvar msb-files-by-directory-sort-key 0
|
2012-04-09 13:05:48 +00:00
|
|
|
"The sort key for files sorted by directory.")
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-max-menu-items 15
|
2008-12-03 05:48:14 +00:00
|
|
|
"The maximum number of items in a menu.
|
1997-12-22 02:26:17 +00:00
|
|
|
If this variable is set to 15 for instance, then the submenu will be
|
2007-10-31 09:02:14 +00:00
|
|
|
split up in minor parts, 15 items each. A value of nil means no limit."
|
1998-02-15 16:45:52 +00:00
|
|
|
:type '(choice integer (const nil))
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-max-file-menu-items 10
|
2008-12-03 05:48:14 +00:00
|
|
|
"The maximum number of items from different directories.
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1994-12-24 16:47:58 +00:00
|
|
|
When the menu is of type `file by directory', this is the maximum
|
1996-01-04 23:45:49 +00:00
|
|
|
number of buffers that are clumped together from different
|
1994-12-23 17:58:46 +00:00
|
|
|
directories.
|
|
|
|
|
1995-01-09 22:16:23 +00:00
|
|
|
Set this to 1 if you want one menu per directory instead of clumping
|
|
|
|
them together.
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
If the value is not a number, then the value 10 is used."
|
|
|
|
:type 'integer
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-most-recently-used-sort-key -1010
|
2008-12-03 05:48:14 +00:00
|
|
|
"Where should the menu with the most recently used buffers be placed?"
|
1998-02-15 16:45:52 +00:00
|
|
|
:type 'integer
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-display-most-recently-used 15
|
2008-12-03 05:48:14 +00:00
|
|
|
"How many buffers should be in the most-recently-used menu.
|
1998-02-15 16:45:52 +00:00
|
|
|
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)"
|
2008-12-03 05:48:14 +00:00
|
|
|
"The title for the most-recently-used menu."
|
1998-02-15 16:45:52 +00:00
|
|
|
:type 'string
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
2003-02-04 12:29:42 +00:00
|
|
|
|
2011-05-23 17:57:17 +00:00
|
|
|
(defvar msb-horizontal-shift-function (lambda () 0)
|
2012-04-09 13:05:48 +00:00
|
|
|
"Function that specifies how many pixels to shift the top menu leftwards.")
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-display-invisible-buffers-p nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"Show invisible buffers or not.
|
1994-12-23 17:58:46 +00:00
|
|
|
Non-nil means that the buffer menu should include buffers that have
|
1998-02-15 16:45:52 +00:00
|
|
|
names that starts with a space character."
|
|
|
|
:type 'boolean
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
(defvar msb-item-handling-function 'msb-item-handler
|
2012-04-09 13:05:48 +00:00
|
|
|
"The appearance of a buffer menu.
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
The default function to call for handling the appearance of a menu
|
2007-10-31 09:02:14 +00:00
|
|
|
item. It should take two arguments, BUFFER and MAX-BUFFER-NAME-LENGTH,
|
1994-12-23 17:58:46 +00:00
|
|
|
where the latter is the max length of all buffer names.
|
1995-01-09 22:16:23 +00:00
|
|
|
|
|
|
|
The function should return the string to use in the menu.
|
|
|
|
|
1997-12-22 02:26:17 +00:00
|
|
|
When the function is called, BUFFER is the current buffer. This
|
|
|
|
function is called for items in the variable `msb-menu-cond' that have
|
|
|
|
nil as ITEM-HANDLING-FUNCTION. See `msb-menu-cond' for more
|
1994-12-23 17:58:46 +00:00
|
|
|
information.")
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-item-sort-function 'msb-sort-by-name
|
2008-12-03 05:48:14 +00:00
|
|
|
"The order of items in a buffer menu.
|
1997-12-22 02:26:17 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
The default function to call for handling the order of items in a menu
|
1997-12-22 02:26:17 +00:00
|
|
|
item. This function is called like a sort function. The items look
|
|
|
|
like (ITEM-NAME . BUFFER).
|
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
ITEM-NAME is the name of the item that will appear in the menu.
|
|
|
|
BUFFER is the buffer, this is not necessarily the current buffer.
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
Set this to nil or t if you don't want any sorting (faster)."
|
|
|
|
:type '(choice (const msb-sort-by-name)
|
|
|
|
(const :tag "Newest first" t)
|
|
|
|
(const :tag "Oldest first" nil))
|
|
|
|
:set 'msb-custom-set
|
2000-08-15 11:19:13 +00:00
|
|
|
:group 'msb)
|
2003-02-04 12:29:42 +00:00
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defcustom msb-files-by-directory nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"Non-nil means that files should be sorted by directory.
|
1999-05-31 14:49:05 +00:00
|
|
|
This is instead of the groups in `msb-menu-cond'."
|
1998-02-15 16:45:52 +00:00
|
|
|
:type 'boolean
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
1994-12-23 17:58:46 +00:00
|
|
|
|
2011-01-27 07:54:04 +00:00
|
|
|
(define-obsolete-variable-alias 'msb-after-load-hooks
|
|
|
|
'msb-after-load-hook "24.1")
|
|
|
|
|
2000-11-03 22:29:27 +00:00
|
|
|
(defcustom msb-after-load-hook nil
|
|
|
|
"Hook run after the msb package has been loaded."
|
1998-02-15 16:45:52 +00:00
|
|
|
:type 'hook
|
|
|
|
:set 'msb-custom-set
|
|
|
|
:group 'msb)
|
2020-01-17 07:06:04 +00:00
|
|
|
(make-obsolete-variable 'msb-after-load-hook
|
|
|
|
"use `with-eval-after-load' instead." "28.1")
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; Internal variables
|
|
|
|
;;;
|
|
|
|
|
|
|
|
;; The last calculated menu.
|
|
|
|
(defvar msb--last-buffer-menu nil)
|
|
|
|
|
|
|
|
;; If this is non-nil, then it is a string that describes the error.
|
|
|
|
(defvar msb--error nil)
|
|
|
|
|
|
|
|
;;;
|
1995-01-09 22:16:23 +00:00
|
|
|
;;; Some example function to be used for `msb-item-handling-function'.
|
1994-12-23 17:58:46 +00:00
|
|
|
;;;
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
(defun msb-item-handler (_buffer &optional _maxbuf)
|
1994-12-23 17:58:46 +00:00
|
|
|
"Create one string item, concerning BUFFER, for the buffer menu.
|
|
|
|
The item looks like:
|
|
|
|
*% <buffer-name>
|
1994-12-24 16:47:58 +00:00
|
|
|
The `*' appears only if the buffer is marked as modified.
|
|
|
|
The `%' appears only if the buffer is read-only.
|
1994-12-23 17:58:46 +00:00
|
|
|
Optional second argument MAXBUF is completely ignored."
|
|
|
|
(let ((name (buffer-name))
|
|
|
|
(modified (if (buffer-modified-p) "*" " "))
|
|
|
|
(read-only (if buffer-read-only "%" " ")))
|
|
|
|
(format "%s%s %s" modified read-only name)))
|
|
|
|
|
|
|
|
|
1994-12-24 16:47:58 +00:00
|
|
|
;; `dired' can be called with a list of the form (directory file1 file2 ...)
|
|
|
|
;; which causes `dired-directory' to be in the same form.
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb--dired-directory ()
|
|
|
|
(cond ((stringp dired-directory)
|
|
|
|
(abbreviate-file-name (expand-file-name dired-directory)))
|
|
|
|
((consp dired-directory)
|
|
|
|
(abbreviate-file-name (expand-file-name (car dired-directory))))
|
|
|
|
(t
|
1994-12-24 16:47:58 +00:00
|
|
|
(error "Unknown type of `dired-directory' in buffer %s"
|
1994-12-23 17:58:46 +00:00
|
|
|
(buffer-name)))))
|
|
|
|
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
(defun msb-dired-item-handler (_buffer &optional _maxbuf)
|
1994-12-23 17:58:46 +00:00
|
|
|
"Create one string item, concerning a dired BUFFER, for the buffer menu.
|
|
|
|
The item looks like:
|
|
|
|
*% <buffer-name>
|
1994-12-24 16:47:58 +00:00
|
|
|
The `*' appears only if the buffer is marked as modified.
|
|
|
|
The `%' appears only if the buffer is read-only.
|
1994-12-23 17:58:46 +00:00
|
|
|
Optional second argument MAXBUF is completely ignored."
|
|
|
|
(let ((name (msb--dired-directory))
|
|
|
|
(modified (if (buffer-modified-p) "*" " "))
|
|
|
|
(read-only (if buffer-read-only "%" " ")))
|
|
|
|
(format "%s%s %s" modified read-only name)))
|
|
|
|
|
|
|
|
(defun msb-alon-item-handler (buffer maxbuf)
|
|
|
|
"Create one string item for the buffer menu.
|
|
|
|
The item looks like:
|
|
|
|
<buffer-name> *%# <file-name>
|
1994-12-24 16:47:58 +00:00
|
|
|
The `*' appears only if the buffer is marked as modified.
|
|
|
|
The `%' appears only if the buffer is read-only.
|
|
|
|
The `#' appears only version control file (SCCS/RCS)."
|
1994-12-23 17:58:46 +00:00
|
|
|
(format (format "%%%ds %%s%%s%%s %%s" maxbuf)
|
|
|
|
(buffer-name buffer)
|
|
|
|
(if (buffer-modified-p) "*" " ")
|
|
|
|
(if buffer-read-only "%" " ")
|
|
|
|
(if (and (boundp 'vc-mode) vc-mode) "#" " ")
|
|
|
|
(or buffer-file-name "")))
|
|
|
|
|
|
|
|
;;;
|
1995-01-09 22:16:23 +00:00
|
|
|
;;; Some example function to be used for `msb-item-sort-function'.
|
1994-12-23 17:58:46 +00:00
|
|
|
;;;
|
|
|
|
(defun msb-sort-by-name (item1 item2)
|
1999-05-31 14:49:05 +00:00
|
|
|
"Sort the items ITEM1 and ITEM2 by their `buffer-name'.
|
|
|
|
An item looks like (NAME . BUFFER)."
|
1994-12-23 17:58:46 +00:00
|
|
|
(string-lessp (buffer-name (cdr item1))
|
|
|
|
(buffer-name (cdr item2))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun msb-sort-by-directory (item1 item2)
|
1999-05-31 14:49:05 +00:00
|
|
|
"Sort the items ITEM1 and ITEM2 by directory name. Made for dired.
|
1994-12-23 17:58:46 +00:00
|
|
|
An item look like (NAME . BUFFER)."
|
2007-10-22 04:26:47 +00:00
|
|
|
(string-lessp (with-current-buffer (cdr item1)
|
|
|
|
(msb--dired-directory))
|
|
|
|
(with-current-buffer (cdr item2)
|
|
|
|
(msb--dired-directory))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; msb
|
|
|
|
;;;
|
|
|
|
;;; This function can be used instead of (mouse-buffer-menu EVENT)
|
|
|
|
;;; function in "mouse.el".
|
1997-12-22 02:26:17 +00:00
|
|
|
;;;
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb (event)
|
|
|
|
"Pop up several menus of buffers for selection with the mouse.
|
|
|
|
This command switches buffers in the window that you clicked on, and
|
|
|
|
selects that window.
|
|
|
|
|
1994-12-24 16:47:58 +00:00
|
|
|
See the function `mouse-select-buffer' and the variable
|
|
|
|
`msb-menu-cond' for more information about how the menus are split."
|
1994-12-23 17:58:46 +00:00
|
|
|
(interactive "e")
|
1995-02-24 09:12:56 +00:00
|
|
|
(let ((old-window (selected-window))
|
2006-06-20 18:08:40 +00:00
|
|
|
(window (posn-window (event-start event)))
|
|
|
|
early-release)
|
1995-02-24 09:12:56 +00:00
|
|
|
(unless (framep window) (select-window window))
|
2006-06-20 18:08:40 +00:00
|
|
|
;; This `sit-for' magically makes the menu stay up if the mouse
|
|
|
|
;; button is released within 0.1 second.
|
|
|
|
(setq early-release (not (sit-for 0.1 t)))
|
1995-02-24 09:12:56 +00:00
|
|
|
(let ((buffer (mouse-select-buffer event)))
|
|
|
|
(if buffer
|
|
|
|
(switch-to-buffer buffer)
|
2006-06-20 18:08:40 +00:00
|
|
|
(select-window old-window)))
|
|
|
|
;; If the above `sit-for' was interrupted by a mouse-up, avoid
|
|
|
|
;; generating a drag event.
|
|
|
|
(if (and early-release (memq 'down (event-modifiers last-input-event)))
|
|
|
|
(discard-input)))
|
1994-12-23 17:58:46 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
;;;
|
|
|
|
;;; Some supportive functions
|
|
|
|
;;;
|
|
|
|
(defun msb-invisible-buffer-p (&optional buffer)
|
|
|
|
"Return t if optional BUFFER is an \"invisible\" buffer.
|
|
|
|
If the argument is left out or nil, then the current buffer is considered."
|
|
|
|
(and (> (length (buffer-name buffer)) 0)
|
2005-06-29 13:50:41 +00:00
|
|
|
(eq ?\s (aref (buffer-name buffer) 0))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1997-12-22 02:33:25 +00:00
|
|
|
(defun msb--strip-dir (dir)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Strip one hierarchy level from the end of DIR."
|
1998-01-23 06:42:27 +00:00
|
|
|
(file-name-directory (directory-file-name dir)))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
;; Create an alist with all buffers from LIST that lies under the same
|
2003-01-19 19:53:34 +00:00
|
|
|
;; directory will be in the same item as the directory name.
|
|
|
|
;; ((DIR1 . (BUFFER-1 BUFFER-2 ...)) (DIR2 . (BUFFER-K BUFFER-K+1...)) ...)
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb--init-file-alist (list)
|
|
|
|
(let ((buffer-alist
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Make alist that looks like
|
2003-01-19 19:53:34 +00:00
|
|
|
;; ((DIR-1 BUFFER-1) (DIR-2 BUFFER-2) ...)
|
|
|
|
;; sorted on DIR-x
|
2000-08-15 11:19:13 +00:00
|
|
|
(sort
|
|
|
|
(apply #'nconc
|
|
|
|
(mapcar
|
|
|
|
(lambda (buffer)
|
|
|
|
(let ((file-name (expand-file-name
|
|
|
|
(buffer-file-name buffer))))
|
|
|
|
(when file-name
|
|
|
|
(list (cons (msb--strip-dir file-name) buffer)))))
|
|
|
|
list))
|
|
|
|
(lambda (item1 item2)
|
|
|
|
(string< (car item1) (car item2))))))
|
2003-01-19 19:53:34 +00:00
|
|
|
;; Now clump buffers together that have the same directory name
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Make alist that looks like
|
2003-01-19 19:53:34 +00:00
|
|
|
;; ((DIR1 . (BUFFER-1 BUFFER-2 ...)) (DIR2 . (BUFFER-K)) ...)
|
|
|
|
(let ((dir nil)
|
1997-12-22 02:26:17 +00:00
|
|
|
(buffers nil))
|
|
|
|
(nconc
|
2000-08-15 11:19:13 +00:00
|
|
|
(apply
|
|
|
|
#'nconc
|
|
|
|
(mapcar (lambda (item)
|
|
|
|
(cond
|
2003-01-19 19:53:34 +00:00
|
|
|
((equal dir (car item))
|
|
|
|
;; The same dir as earlier:
|
|
|
|
;; Add to current list of buffers.
|
2000-08-15 11:19:13 +00:00
|
|
|
(push (cdr item) buffers)
|
|
|
|
;; This item should not be added to list
|
|
|
|
nil)
|
|
|
|
(t
|
2003-01-19 19:53:34 +00:00
|
|
|
;; New dir
|
|
|
|
(let ((result (and dir (cons dir buffers))))
|
|
|
|
(setq dir (car item))
|
2000-08-15 11:19:13 +00:00
|
|
|
(setq buffers (list (cdr item)))
|
|
|
|
;; Add the last result the list.
|
|
|
|
(and result (list result))))))
|
|
|
|
buffer-alist))
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Add the last result to the list
|
2003-01-19 19:53:34 +00:00
|
|
|
(list (cons dir buffers))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
2003-01-19 19:53:34 +00:00
|
|
|
(defun msb--format-title (top-found-p dir number-of-items)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Format a suitable title for the menu item."
|
1999-07-28 16:46:30 +00:00
|
|
|
(format (if top-found-p "%s... (%d)" "%s (%d)")
|
2003-01-19 19:53:34 +00:00
|
|
|
(abbreviate-file-name dir) number-of-items))
|
1997-12-22 02:26:17 +00:00
|
|
|
|
1998-02-11 04:20:09 +00:00
|
|
|
;; Variables for debugging.
|
|
|
|
(defvar msb--choose-file-menu-list)
|
|
|
|
(defvar msb--choose-file-menu-arg-list)
|
1997-12-22 02:26:17 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb--choose-file-menu (list)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Choose file-menu with respect to directory for every buffer in LIST."
|
1998-02-11 04:20:09 +00:00
|
|
|
(setq msb--choose-file-menu-arg-list list)
|
1994-12-23 17:58:46 +00:00
|
|
|
(let ((buffer-alist (msb--init-file-alist list))
|
|
|
|
(final-list nil)
|
|
|
|
(max-clumped-together (if (numberp msb-max-file-menu-items)
|
|
|
|
msb-max-file-menu-items
|
|
|
|
10))
|
|
|
|
(top-found-p nil)
|
2003-01-19 19:53:34 +00:00
|
|
|
(last-dir nil)
|
|
|
|
first rest dir buffers old-dir)
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Prepare for looping over all items in buffer-alist
|
|
|
|
(setq first (car buffer-alist)
|
|
|
|
rest (cdr buffer-alist)
|
2003-01-19 19:53:34 +00:00
|
|
|
dir (car first)
|
1997-12-22 02:26:17 +00:00
|
|
|
buffers (cdr first))
|
2000-08-15 11:19:13 +00:00
|
|
|
(setq msb--choose-file-menu-list (copy-sequence rest))
|
1997-12-22 02:26:17 +00:00
|
|
|
;; This big loop tries to clump buffers together that have a
|
|
|
|
;; similar name. Remember that buffer-alist is sorted based on the
|
2003-01-19 19:53:34 +00:00
|
|
|
;; directory name of the buffers' visited files.
|
1994-12-23 17:58:46 +00:00
|
|
|
(while rest
|
|
|
|
(let ((found-p nil)
|
|
|
|
(tmp-rest rest)
|
2007-10-22 04:26:47 +00:00
|
|
|
item)
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq item (car tmp-rest))
|
2003-01-19 19:53:34 +00:00
|
|
|
;; Clump together the "rest"-buffers that have a dir that is
|
|
|
|
;; a subdir of the current one.
|
1994-12-23 17:58:46 +00:00
|
|
|
(while (and tmp-rest
|
|
|
|
(<= (length buffers) max-clumped-together)
|
2003-01-19 19:53:34 +00:00
|
|
|
(>= (length (car item)) (length dir))
|
1999-08-16 11:29:58 +00:00
|
|
|
;; `completion-ignore-case' seems to default to t
|
|
|
|
;; on the systems with case-insensitive file names.
|
2003-01-19 19:53:34 +00:00
|
|
|
(eq t (compare-strings dir 0 nil
|
|
|
|
(car item) 0 (length dir)
|
1999-08-16 11:29:58 +00:00
|
|
|
completion-ignore-case)))
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq found-p t)
|
1997-12-22 02:26:17 +00:00
|
|
|
(setq buffers (append buffers (cdr item))) ;nconc is faster than append
|
|
|
|
(setq tmp-rest (cdr tmp-rest)
|
|
|
|
item (car tmp-rest)))
|
1994-12-23 17:58:46 +00:00
|
|
|
(cond
|
|
|
|
((> (length buffers) max-clumped-together)
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Oh, we failed. Too many buffers clumped together.
|
|
|
|
;; Just use the original ones for the result.
|
2003-01-19 19:53:34 +00:00
|
|
|
(setq last-dir (car first))
|
1997-12-22 02:26:17 +00:00
|
|
|
(push (cons (msb--format-title top-found-p
|
|
|
|
(car first)
|
|
|
|
(length (cdr first)))
|
|
|
|
(cdr first))
|
|
|
|
final-list)
|
1995-01-09 22:16:23 +00:00
|
|
|
(setq top-found-p nil)
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq first (car rest)
|
1997-12-22 02:26:17 +00:00
|
|
|
rest (cdr rest)
|
2003-01-19 19:53:34 +00:00
|
|
|
dir (car first)
|
1994-12-23 17:58:46 +00:00
|
|
|
buffers (cdr first)))
|
|
|
|
(t
|
1997-12-22 02:26:17 +00:00
|
|
|
;; The first pass of clumping together worked out, go ahead
|
|
|
|
;; with this result.
|
1994-12-23 17:58:46 +00:00
|
|
|
(when found-p
|
|
|
|
(setq top-found-p t)
|
2003-01-19 19:53:34 +00:00
|
|
|
(setq first (cons dir buffers)
|
1994-12-23 17:58:46 +00:00
|
|
|
rest tmp-rest))
|
1997-12-22 02:26:17 +00:00
|
|
|
;; Now see if we can clump more buffers together if we go up
|
|
|
|
;; one step in the file hierarchy.
|
2003-01-19 19:53:34 +00:00
|
|
|
;; If dir isn't changed by msb--strip-dir, we are looking
|
1998-02-15 16:45:52 +00:00
|
|
|
;; at the machine name component of an ange-ftp filename.
|
2003-01-19 19:53:34 +00:00
|
|
|
(setq old-dir dir)
|
|
|
|
(setq dir (msb--strip-dir dir)
|
1994-12-23 17:58:46 +00:00
|
|
|
buffers (cdr first))
|
2003-01-19 19:53:34 +00:00
|
|
|
(if (equal old-dir dir)
|
|
|
|
(setq last-dir dir))
|
|
|
|
(when (and last-dir
|
|
|
|
(or (and (>= (length dir) (length last-dir))
|
1999-08-16 11:29:58 +00:00
|
|
|
(eq t (compare-strings
|
2003-01-19 19:53:34 +00:00
|
|
|
last-dir 0 nil dir 0
|
|
|
|
(length last-dir)
|
1999-08-16 11:29:58 +00:00
|
|
|
completion-ignore-case)))
|
2003-01-19 19:53:34 +00:00
|
|
|
(and (< (length dir) (length last-dir))
|
1999-08-16 11:29:58 +00:00
|
|
|
(eq t (compare-strings
|
2003-01-19 19:53:34 +00:00
|
|
|
dir 0 nil last-dir 0 (length dir)
|
1999-08-16 11:29:58 +00:00
|
|
|
completion-ignore-case)))))
|
1997-12-22 02:26:17 +00:00
|
|
|
;; We have reached the same place in the file hierarchy as
|
|
|
|
;; the last result, so we should quit at this point and
|
|
|
|
;; take what we have as result.
|
|
|
|
(push (cons (msb--format-title top-found-p
|
|
|
|
(car first)
|
|
|
|
(length (cdr first)))
|
|
|
|
(cdr first))
|
|
|
|
final-list)
|
1995-01-09 22:16:23 +00:00
|
|
|
(setq top-found-p nil)
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq first (car rest)
|
1997-12-22 02:26:17 +00:00
|
|
|
rest (cdr rest)
|
2003-01-19 19:53:34 +00:00
|
|
|
dir (car first)
|
1997-12-22 02:26:17 +00:00
|
|
|
buffers (cdr first)))))))
|
|
|
|
;; Now take care of the last item.
|
1998-02-15 16:45:52 +00:00
|
|
|
(when first
|
|
|
|
(push (cons (msb--format-title top-found-p
|
|
|
|
(car first)
|
|
|
|
(length (cdr first)))
|
|
|
|
(cdr first))
|
|
|
|
final-list))
|
1995-01-09 22:16:23 +00:00
|
|
|
(setq top-found-p nil)
|
1994-12-23 17:58:46 +00:00
|
|
|
(nreverse final-list)))
|
|
|
|
|
|
|
|
(defun msb--create-function-info (menu-cond-elt)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Create a vector from an element MENU-COND-ELT of `msb-menu-cond'.
|
|
|
|
This takes the form:
|
2015-09-17 23:08:20 +00:00
|
|
|
[BUFFER-LIST-VARIABLE CONDITION MENU-SORT-KEY MENU-TITLE ITEM-HANDLER SORTER]
|
1999-07-23 22:57:32 +00:00
|
|
|
See `msb-menu-cond' for a description of its elements."
|
1994-12-23 17:58:46 +00:00
|
|
|
(let* ((list-symbol (make-symbol "-msb-buffer-list"))
|
|
|
|
(tmp-ih (and (> (length menu-cond-elt) 3)
|
|
|
|
(nth 3 menu-cond-elt)))
|
|
|
|
(item-handler (if (and tmp-ih (fboundp tmp-ih))
|
|
|
|
tmp-ih
|
|
|
|
msb-item-handling-function))
|
|
|
|
(tmp-s (if (> (length menu-cond-elt) 4)
|
|
|
|
(nth 4 menu-cond-elt)
|
|
|
|
msb-item-sort-function))
|
|
|
|
(sorter (if (or (fboundp tmp-s)
|
|
|
|
(null tmp-s)
|
1994-12-24 16:47:58 +00:00
|
|
|
(eq tmp-s t))
|
2000-08-15 11:19:13 +00:00
|
|
|
tmp-s
|
1994-12-23 17:58:46 +00:00
|
|
|
msb-item-sort-function)))
|
|
|
|
(when (< (length menu-cond-elt) 3)
|
1999-05-31 14:49:05 +00:00
|
|
|
(error "Wrong format of msb-menu-cond"))
|
1994-12-23 17:58:46 +00:00
|
|
|
(when (and (> (length menu-cond-elt) 3)
|
|
|
|
(not (fboundp tmp-ih)))
|
|
|
|
(signal 'invalid-function (list tmp-ih)))
|
|
|
|
(when (and (> (length menu-cond-elt) 4)
|
|
|
|
tmp-s
|
|
|
|
(not (fboundp tmp-s))
|
1994-12-24 16:47:58 +00:00
|
|
|
(not (eq tmp-s t)))
|
1994-12-23 17:58:46 +00:00
|
|
|
(signal 'invalid-function (list tmp-s)))
|
1994-12-24 16:47:58 +00:00
|
|
|
(set list-symbol ())
|
1994-12-23 17:58:46 +00:00
|
|
|
(vector list-symbol ;BUFFER-LIST-VARIABLE
|
|
|
|
(nth 0 menu-cond-elt) ;CONDITION
|
|
|
|
(nth 1 menu-cond-elt) ;SORT-KEY
|
|
|
|
(nth 2 menu-cond-elt) ;MENU-TITLE
|
|
|
|
item-handler ;ITEM-HANDLER
|
|
|
|
sorter) ;SORTER
|
|
|
|
))
|
|
|
|
|
|
|
|
;; This defsubst is only used in `msb--choose-menu' below. It was
|
1998-02-15 16:45:52 +00:00
|
|
|
;; pulled out merely to make the code somewhat clearer. The indentation
|
1994-12-23 17:58:46 +00:00
|
|
|
;; level was too big.
|
|
|
|
(defsubst msb--collect (function-info-vector)
|
|
|
|
(let ((result nil)
|
|
|
|
(multi-flag nil)
|
|
|
|
function-info-list)
|
|
|
|
(setq function-info-list
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(cl-loop for fi
|
|
|
|
across function-info-vector
|
|
|
|
if (and (setq result
|
|
|
|
(eval (aref fi 1))) ;Test CONDITION
|
|
|
|
(not (and (eq result 'no-multi)
|
|
|
|
multi-flag))
|
|
|
|
(progn (when (eq result 'multi)
|
|
|
|
(setq multi-flag t))
|
|
|
|
t))
|
|
|
|
collect fi
|
|
|
|
until (and result
|
|
|
|
(not (eq result 'multi)))))
|
1994-12-23 17:58:46 +00:00
|
|
|
(when (and (not function-info-list)
|
|
|
|
(not result))
|
|
|
|
(error "No catch-all in msb-menu-cond!"))
|
|
|
|
function-info-list))
|
|
|
|
|
|
|
|
(defun msb--add-to-menu (buffer function-info max-buffer-name-length)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Add BUFFER to the menu depicted by FUNCTION-INFO.
|
|
|
|
All side-effects. Adds an element of form (BUFFER-TITLE . BUFFER)
|
2007-10-31 09:02:14 +00:00
|
|
|
to the buffer-list variable in FUNCTION-INFO."
|
1994-12-23 17:58:46 +00:00
|
|
|
(let ((list-symbol (aref function-info 0))) ;BUFFER-LIST-VARIABLE
|
|
|
|
;; Here comes the hairy side-effect!
|
|
|
|
(set list-symbol
|
|
|
|
(cons (cons (funcall (aref function-info 4) ;ITEM-HANDLER
|
|
|
|
buffer
|
|
|
|
max-buffer-name-length)
|
|
|
|
buffer)
|
|
|
|
(eval list-symbol)))))
|
2003-02-04 12:29:42 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
(defsubst msb--choose-menu (buffer function-info-vector max-buffer-name-length)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Select the appropriate menu for BUFFER."
|
|
|
|
;; This is all side-effects, folks!
|
|
|
|
;; This should be optimized.
|
1994-12-23 17:58:46 +00:00
|
|
|
(unless (and (not msb-display-invisible-buffers-p)
|
|
|
|
(msb-invisible-buffer-p buffer))
|
|
|
|
(condition-case nil
|
2007-10-22 04:26:47 +00:00
|
|
|
(with-current-buffer buffer
|
1994-12-24 16:47:58 +00:00
|
|
|
;; Menu found. Add to this menu
|
2000-03-24 20:45:10 +00:00
|
|
|
(dolist (info (msb--collect function-info-vector))
|
|
|
|
(msb--add-to-menu buffer info max-buffer-name-length)))
|
1994-12-23 17:58:46 +00:00
|
|
|
(error (unless msb--error
|
|
|
|
(setq msb--error
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
|
|
|
(format-message
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
"In msb-menu-cond, error for buffer `%s'."
|
1994-12-23 17:58:46 +00:00
|
|
|
(buffer-name buffer)))
|
1996-01-29 23:17:49 +00:00
|
|
|
(error "%s" msb--error))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
(defun msb--create-sort-item (function-info)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Return (SORT-KEY TITLE . BUFFER-LIST) or nil if the buffer-list is empty."
|
1994-12-23 17:58:46 +00:00
|
|
|
(let ((buffer-list (eval (aref function-info 0))))
|
|
|
|
(when buffer-list
|
|
|
|
(let ((sorter (aref function-info 5)) ;SORTER
|
|
|
|
(sort-key (aref function-info 2))) ;MENU-SORT-KEY
|
|
|
|
(when sort-key
|
1997-12-22 02:26:17 +00:00
|
|
|
(cons sort-key
|
1994-12-23 17:58:46 +00:00
|
|
|
(cons (format (aref function-info 3) ;MENU-TITLE
|
|
|
|
(length buffer-list))
|
|
|
|
(cond
|
|
|
|
((null sorter)
|
|
|
|
buffer-list)
|
1994-12-24 16:47:58 +00:00
|
|
|
((eq sorter t)
|
1994-12-23 17:58:46 +00:00
|
|
|
(nreverse buffer-list))
|
|
|
|
(t
|
|
|
|
(sort buffer-list sorter))))))))))
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defun msb--aggregate-alist (alist same-predicate sort-predicate)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Return ALIST as a sorted, aggregated alist.
|
|
|
|
|
|
|
|
In the result all items with the same car element (according to
|
|
|
|
SAME-PREDICATE) are aggregated together. The alist is first sorted by
|
|
|
|
SORT-PREDICATE.
|
|
|
|
|
|
|
|
Example:
|
2000-03-24 20:45:10 +00:00
|
|
|
\(msb--aggregate-alist
|
2015-09-02 01:21:42 +00:00
|
|
|
\\='((a . a1) (a . a2) (b . b1) (c . c3) (a . a4) (a . a3) (b . b3) (b . b2))
|
1999-07-23 22:57:32 +00:00
|
|
|
(function string=)
|
|
|
|
(lambda (item1 item2)
|
|
|
|
(string< (symbol-name item1) (symbol-name item2))))
|
|
|
|
results in
|
2000-03-24 20:45:10 +00:00
|
|
|
\((a a1 a2 a4 a3) (b b1 b3 b2) (c c3))"
|
1998-02-15 16:45:52 +00:00
|
|
|
(when (not (null alist))
|
2007-10-22 04:26:47 +00:00
|
|
|
(let (same
|
1998-02-15 16:45:52 +00:00
|
|
|
tmp-old-car
|
|
|
|
tmp-same
|
|
|
|
(first-time-p t)
|
|
|
|
old-car)
|
|
|
|
(nconc
|
2000-08-15 11:19:13 +00:00
|
|
|
(apply #'nconc
|
|
|
|
(mapcar
|
|
|
|
(lambda (item)
|
1998-02-15 16:45:52 +00:00
|
|
|
(cond
|
|
|
|
(first-time-p
|
|
|
|
(push (cdr item) same)
|
|
|
|
(setq first-time-p nil)
|
|
|
|
(setq old-car (car item))
|
|
|
|
nil)
|
|
|
|
((funcall same-predicate (car item) old-car)
|
|
|
|
(push (cdr item) same)
|
|
|
|
nil)
|
|
|
|
(t
|
|
|
|
(setq tmp-same same
|
|
|
|
tmp-old-car old-car)
|
|
|
|
(setq same (list (cdr item))
|
|
|
|
old-car (car item))
|
|
|
|
(list (cons tmp-old-car (nreverse tmp-same))))))
|
|
|
|
(sort alist (lambda (item1 item2)
|
2007-10-22 04:26:47 +00:00
|
|
|
(funcall sort-predicate
|
|
|
|
(car item1) (car item2))))))
|
1998-02-15 16:45:52 +00:00
|
|
|
(list (cons old-car (nreverse same)))))))
|
|
|
|
|
|
|
|
|
|
|
|
(defun msb--mode-menu-cond ()
|
|
|
|
(let ((key msb-modes-key))
|
|
|
|
(mapcar (lambda (item)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(cl-incf key)
|
1998-02-15 16:45:52 +00:00
|
|
|
(list `( eq major-mode (quote ,(car item)))
|
|
|
|
key
|
|
|
|
(concat (cdr item) " (%d)")))
|
1999-05-31 14:49:05 +00:00
|
|
|
(sort
|
1998-02-15 16:45:52 +00:00
|
|
|
(let ((mode-list nil))
|
2000-03-24 20:45:10 +00:00
|
|
|
(dolist (buffer (cdr (buffer-list)))
|
2007-10-22 04:26:47 +00:00
|
|
|
(with-current-buffer buffer
|
2000-03-24 20:45:10 +00:00
|
|
|
(when (and (not (msb-invisible-buffer-p))
|
|
|
|
(not (assq major-mode mode-list)))
|
2008-01-04 06:29:12 +00:00
|
|
|
(push (cons major-mode
|
|
|
|
(format-mode-line mode-name nil nil buffer))
|
2000-03-24 20:45:10 +00:00
|
|
|
mode-list))))
|
1998-02-15 16:45:52 +00:00
|
|
|
mode-list)
|
|
|
|
(lambda (item1 item2)
|
|
|
|
(string< (cdr item1) (cdr item2)))))))
|
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb--most-recently-used-menu (max-buffer-name-length)
|
1999-07-23 22:57:32 +00:00
|
|
|
"Return a list for the most recently used buffers.
|
|
|
|
It takes the form ((TITLE . BUFFER-LIST)...)."
|
1995-01-09 22:16:23 +00:00
|
|
|
(when (and (numberp msb-display-most-recently-used)
|
|
|
|
(> msb-display-most-recently-used 0))
|
1995-02-24 09:12:56 +00:00
|
|
|
(let* ((buffers (cdr (buffer-list)))
|
|
|
|
(most-recently-used
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(cl-loop with n = 0
|
|
|
|
for buffer in buffers
|
|
|
|
if (with-current-buffer buffer
|
|
|
|
(and (not (msb-invisible-buffer-p))
|
|
|
|
(not (eq major-mode 'dired-mode))))
|
|
|
|
collect (with-current-buffer buffer
|
|
|
|
(cons (funcall msb-item-handling-function
|
|
|
|
buffer
|
|
|
|
max-buffer-name-length)
|
|
|
|
buffer))
|
|
|
|
and do (cl-incf n)
|
|
|
|
until (>= n msb-display-most-recently-used))))
|
1994-12-23 17:58:46 +00:00
|
|
|
(cons (if (stringp msb-most-recently-used-title)
|
|
|
|
(format msb-most-recently-used-title
|
|
|
|
(length most-recently-used))
|
|
|
|
(signal 'wrong-type-argument (list msb-most-recently-used-title)))
|
|
|
|
most-recently-used))))
|
|
|
|
|
|
|
|
(defun msb--create-buffer-menu-2 ()
|
|
|
|
(let ((max-buffer-name-length 0)
|
|
|
|
file-buffers
|
|
|
|
function-info-vector)
|
|
|
|
;; Calculate the longest buffer name.
|
2000-03-24 20:45:10 +00:00
|
|
|
(dolist (buffer (buffer-list))
|
|
|
|
(when (or msb-display-invisible-buffers-p
|
|
|
|
(not (msb-invisible-buffer-p)))
|
|
|
|
(setq max-buffer-name-length
|
|
|
|
(max max-buffer-name-length (length (buffer-name buffer))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Make a list with elements of type
|
|
|
|
;; (BUFFER-LIST-VARIABLE
|
|
|
|
;; CONDITION
|
|
|
|
;; MENU-SORT-KEY
|
|
|
|
;; MENU-TITLE
|
|
|
|
;; ITEM-HANDLER
|
|
|
|
;; SORTER)
|
|
|
|
;; Uses "function-global" variables:
|
|
|
|
;; function-info-vector
|
|
|
|
(setq function-info-vector
|
|
|
|
(apply (function vector)
|
|
|
|
(mapcar (function msb--create-function-info)
|
1998-02-15 16:45:52 +00:00
|
|
|
(append msb-menu-cond (msb--mode-menu-cond)))))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Split the buffer-list into several lists; one list for each
|
1994-12-24 16:47:58 +00:00
|
|
|
;; criteria. This is the most critical part with respect to time.
|
2000-03-24 20:45:10 +00:00
|
|
|
(dolist (buffer (buffer-list))
|
|
|
|
(cond ((and msb-files-by-directory
|
|
|
|
(buffer-file-name buffer)
|
|
|
|
;; exclude ange-ftp buffers
|
|
|
|
;;(not (string-match "\\/[^/:]+:"
|
|
|
|
;; (buffer-file-name buffer)))
|
|
|
|
)
|
|
|
|
(push buffer file-buffers))
|
|
|
|
(t
|
|
|
|
(msb--choose-menu buffer
|
|
|
|
function-info-vector
|
|
|
|
max-buffer-name-length))))
|
1994-12-23 17:58:46 +00:00
|
|
|
(when file-buffers
|
|
|
|
(setq file-buffers
|
1998-02-15 16:45:52 +00:00
|
|
|
(mapcar (lambda (buffer-list)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
`(,msb-files-by-directory-sort-key
|
|
|
|
,(car buffer-list)
|
|
|
|
,@(sort
|
|
|
|
(mapcar (lambda (buffer)
|
|
|
|
(cons (with-current-buffer buffer
|
|
|
|
(funcall
|
|
|
|
msb-item-handling-function
|
|
|
|
buffer
|
|
|
|
max-buffer-name-length))
|
|
|
|
buffer))
|
|
|
|
(cdr buffer-list))
|
|
|
|
(lambda (item1 item2)
|
|
|
|
(string< (car item1) (car item2))))))
|
2007-10-22 04:26:47 +00:00
|
|
|
(msb--choose-file-menu file-buffers))))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Now make the menu - a list of (TITLE . BUFFER-LIST)
|
1995-01-09 22:16:23 +00:00
|
|
|
(let* (menu
|
1994-12-23 17:58:46 +00:00
|
|
|
(most-recently-used
|
|
|
|
(msb--most-recently-used-menu max-buffer-name-length))
|
1997-12-22 02:26:17 +00:00
|
|
|
(others (nconc file-buffers
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(cl-loop for elt
|
|
|
|
across function-info-vector
|
|
|
|
for value = (msb--create-sort-item elt)
|
|
|
|
if value collect value))))
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq menu
|
|
|
|
(mapcar 'cdr ;Remove the SORT-KEY
|
|
|
|
;; Sort the menus - not the items.
|
|
|
|
(msb--add-separators
|
|
|
|
(sort
|
|
|
|
;; Get a list of (SORT-KEY TITLE . BUFFER-LIST)
|
|
|
|
;; Also sorts the items within the menus.
|
|
|
|
(if (cdr most-recently-used)
|
|
|
|
(cons
|
|
|
|
;; Add most recent used buffers
|
|
|
|
(cons msb-most-recently-used-sort-key
|
|
|
|
most-recently-used)
|
|
|
|
others)
|
|
|
|
others)
|
1998-02-15 16:45:52 +00:00
|
|
|
(lambda (elt1 elt2)
|
|
|
|
(< (car elt1) (car elt2)))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Now make it a keymap menu
|
|
|
|
(append
|
|
|
|
'(keymap "Select Buffer")
|
|
|
|
(msb--make-keymap-menu menu)
|
|
|
|
(when msb-separator-diff
|
1997-12-22 02:26:17 +00:00
|
|
|
(list (list 'separator "--")))
|
|
|
|
(list (cons 'toggle
|
1994-12-23 17:58:46 +00:00
|
|
|
(cons
|
|
|
|
(if msb-files-by-directory
|
2000-08-15 11:19:13 +00:00
|
|
|
"*Files by type*"
|
|
|
|
"*Files by directory*")
|
|
|
|
'msb--toggle-menu-type)))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
2007-10-31 00:30:09 +00:00
|
|
|
(defun msb--create-buffer-menu ()
|
1994-12-23 17:58:46 +00:00
|
|
|
(save-match-data
|
|
|
|
(save-excursion
|
|
|
|
(msb--create-buffer-menu-2))))
|
|
|
|
|
|
|
|
(defun msb--toggle-menu-type ()
|
2007-10-31 09:02:14 +00:00
|
|
|
"Multi-purpose function for selecting a buffer with the mouse."
|
1994-12-23 17:58:46 +00:00
|
|
|
(interactive)
|
|
|
|
(setq msb-files-by-directory (not msb-files-by-directory))
|
1998-02-11 04:20:09 +00:00
|
|
|
;; This gets a warning, but it is correct,
|
|
|
|
;; because this file redefines menu-bar-update-buffers.
|
1999-07-23 22:57:32 +00:00
|
|
|
(msb-menu-bar-update-buffers t))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
|
|
|
(defun mouse-select-buffer (event)
|
|
|
|
"Pop up several menus of buffers, for selection with the mouse.
|
|
|
|
Returns the selected buffer or nil if no buffer is selected.
|
|
|
|
|
1995-01-09 22:16:23 +00:00
|
|
|
The way the buffers are split is conveniently handled with the
|
1994-12-24 16:47:58 +00:00
|
|
|
variable `msb-menu-cond'."
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Popup the menu and return the selected buffer.
|
|
|
|
(when (or msb--error
|
|
|
|
(not msb--last-buffer-menu)
|
|
|
|
(not (fboundp 'frame-or-buffer-changed-p))
|
|
|
|
(frame-or-buffer-changed-p))
|
|
|
|
(setq msb--error nil)
|
|
|
|
(setq msb--last-buffer-menu (msb--create-buffer-menu)))
|
1995-01-09 22:16:23 +00:00
|
|
|
(let ((position event)
|
|
|
|
choice)
|
1994-12-23 17:58:46 +00:00
|
|
|
(when (and (fboundp 'posn-x-y)
|
|
|
|
(fboundp 'posn-window))
|
|
|
|
(let ((posX (car (posn-x-y (event-start event))))
|
|
|
|
(posY (cdr (posn-x-y (event-start event))))
|
1995-01-09 22:16:23 +00:00
|
|
|
(posWind (posn-window (event-start event))))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; adjust position
|
|
|
|
(setq posX (- posX (funcall msb-horizontal-shift-function))
|
|
|
|
position (list (list posX posY) posWind))))
|
1995-02-24 21:26:05 +00:00
|
|
|
;; Popup the menu
|
1995-01-09 22:16:23 +00:00
|
|
|
(setq choice (x-popup-menu position msb--last-buffer-menu))
|
1994-12-23 17:58:46 +00:00
|
|
|
(cond
|
1995-01-09 22:16:23 +00:00
|
|
|
((eq (car choice) 'toggle)
|
|
|
|
;; Bring up the menu again with type toggled.
|
|
|
|
(msb--toggle-menu-type)
|
|
|
|
(mouse-select-buffer event))
|
|
|
|
((and (numberp (car choice))
|
|
|
|
(null (cdr choice)))
|
2006-05-28 03:58:47 +00:00
|
|
|
(let ((msb--last-buffer-menu (nthcdr 2 (assq (car choice)
|
2000-08-15 11:19:13 +00:00
|
|
|
msb--last-buffer-menu))))
|
1994-12-23 17:58:46 +00:00
|
|
|
(mouse-select-buffer event)))
|
1995-01-09 22:16:23 +00:00
|
|
|
((while (numberp (car choice))
|
|
|
|
(setq choice (cdr choice))))
|
|
|
|
((and (stringp (car choice))
|
|
|
|
(null (cdr choice)))
|
|
|
|
(car choice))
|
1995-01-12 06:59:56 +00:00
|
|
|
((null choice)
|
|
|
|
choice)
|
1995-01-09 22:16:23 +00:00
|
|
|
(t
|
|
|
|
(error "Unknown form for buffer: %s" choice)))))
|
1998-02-15 16:45:52 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Add separators
|
|
|
|
(defun msb--add-separators (sorted-list)
|
2000-08-15 11:19:13 +00:00
|
|
|
(if (or (not msb-separator-diff)
|
|
|
|
(not (numberp msb-separator-diff)))
|
|
|
|
sorted-list
|
1994-12-23 17:58:46 +00:00
|
|
|
(let ((last-key nil))
|
2000-08-15 11:19:13 +00:00
|
|
|
(apply #'nconc
|
|
|
|
(mapcar
|
|
|
|
(lambda (item)
|
|
|
|
(cond
|
|
|
|
((and msb-separator-diff
|
|
|
|
last-key
|
|
|
|
(> (- (car item) last-key)
|
|
|
|
msb-separator-diff))
|
|
|
|
(setq last-key (car item))
|
|
|
|
(list (cons last-key 'separator)
|
|
|
|
item))
|
|
|
|
(t
|
|
|
|
(setq last-key (car item))
|
|
|
|
(list item))))
|
|
|
|
sorted-list)))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1995-01-09 22:16:23 +00:00
|
|
|
(defun msb--split-menus-2 (list mcount result)
|
|
|
|
(cond
|
|
|
|
((> (length list) msb-max-menu-items)
|
|
|
|
(let ((count 0)
|
|
|
|
sub-name
|
|
|
|
(tmp-list nil))
|
|
|
|
(while (< count msb-max-menu-items)
|
|
|
|
(push (pop list) tmp-list)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(cl-incf count))
|
2000-08-15 11:19:13 +00:00
|
|
|
(setq tmp-list (nreverse tmp-list))
|
|
|
|
(setq sub-name (concat (car (car tmp-list)) "..."))
|
|
|
|
(push (nconc (list mcount sub-name
|
|
|
|
'keymap sub-name)
|
|
|
|
tmp-list)
|
|
|
|
result))
|
1995-01-09 22:16:23 +00:00
|
|
|
(msb--split-menus-2 list (1+ mcount) result))
|
|
|
|
((null result)
|
|
|
|
list)
|
|
|
|
(t
|
|
|
|
(let (sub-name)
|
|
|
|
(setq sub-name (concat (car (car list)) "..."))
|
2000-08-15 11:19:13 +00:00
|
|
|
(push (nconc (list mcount sub-name 'keymap sub-name)
|
|
|
|
list)
|
|
|
|
result))
|
1995-01-09 22:16:23 +00:00
|
|
|
(nreverse result))))
|
|
|
|
|
1998-02-15 16:45:52 +00:00
|
|
|
(defun msb--split-menus (list)
|
|
|
|
(if (and (integerp msb-max-menu-items)
|
|
|
|
(> msb-max-menu-items 0))
|
|
|
|
(msb--split-menus-2 list 0 nil)
|
|
|
|
list))
|
1995-01-09 22:16:23 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
(defun msb--make-keymap-menu (raw-menu)
|
2014-09-16 00:28:28 +00:00
|
|
|
(let ((end 'menu-bar-select-buffer)
|
1994-12-23 17:58:46 +00:00
|
|
|
(mcount 0))
|
|
|
|
(mapcar
|
1998-02-15 16:45:52 +00:00
|
|
|
(lambda (sub-menu)
|
1999-05-31 14:49:05 +00:00
|
|
|
(cond
|
1998-02-15 16:45:52 +00:00
|
|
|
((eq 'separator sub-menu)
|
|
|
|
(list 'separator "--"))
|
|
|
|
(t
|
2000-08-15 11:19:13 +00:00
|
|
|
(let ((buffers (mapcar (lambda (item)
|
|
|
|
(cons (buffer-name (cdr item))
|
|
|
|
(cons (car item) end)))
|
1998-02-15 16:45:52 +00:00
|
|
|
(cdr sub-menu))))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
(nconc (list (cl-incf mcount) (car sub-menu)
|
1998-02-15 16:45:52 +00:00
|
|
|
'keymap (car sub-menu))
|
|
|
|
(msb--split-menus buffers))))))
|
1994-12-23 17:58:46 +00:00
|
|
|
raw-menu)))
|
|
|
|
|
1999-07-23 22:57:32 +00:00
|
|
|
(defun msb-menu-bar-update-buffers (&optional arg)
|
|
|
|
"A re-written version of `menu-bar-update-buffers'."
|
1994-12-23 17:58:46 +00:00
|
|
|
;; If user discards the Buffers item, play along.
|
|
|
|
(when (and (lookup-key (current-global-map) [menu-bar buffer])
|
|
|
|
(or (not (fboundp 'frame-or-buffer-changed-p))
|
|
|
|
(frame-or-buffer-changed-p)
|
|
|
|
arg))
|
1995-02-24 09:12:56 +00:00
|
|
|
(let ((frames (frame-list))
|
1994-12-23 17:58:46 +00:00
|
|
|
buffers-menu frames-menu)
|
|
|
|
;; Make the menu of buffers proper.
|
|
|
|
(setq msb--last-buffer-menu (msb--create-buffer-menu))
|
2007-10-22 04:26:47 +00:00
|
|
|
;; Skip the `keymap' symbol.
|
|
|
|
(setq buffers-menu (cdr msb--last-buffer-menu))
|
1994-12-23 17:58:46 +00:00
|
|
|
;; Make a Frames menu if we have more than one frame.
|
1995-02-24 09:12:56 +00:00
|
|
|
(when (cdr frames)
|
|
|
|
(let* ((frame-length (length frames))
|
|
|
|
(f-title (format "Frames (%d)" frame-length)))
|
|
|
|
;; List only the N most recently selected frames
|
|
|
|
(when (and (integerp msb-max-menu-items)
|
2007-10-31 00:30:09 +00:00
|
|
|
(> msb-max-menu-items 1)
|
1995-02-24 09:12:56 +00:00
|
|
|
(> frame-length msb-max-menu-items))
|
|
|
|
(setcdr (nthcdr msb-max-menu-items frames) nil))
|
1994-12-23 17:58:46 +00:00
|
|
|
(setq frames-menu
|
1995-02-24 09:12:56 +00:00
|
|
|
(nconc
|
2014-09-16 00:28:28 +00:00
|
|
|
(list 'frame f-title 'keymap f-title)
|
1995-02-24 09:12:56 +00:00
|
|
|
(mapcar
|
1998-02-15 16:45:52 +00:00
|
|
|
(lambda (frame)
|
|
|
|
(nconc
|
2002-05-08 13:14:17 +00:00
|
|
|
(list (frame-parameter frame 'name)
|
2014-09-16 00:28:28 +00:00
|
|
|
(frame-parameter frame 'name))
|
2011-01-27 07:48:23 +00:00
|
|
|
`(lambda ()
|
|
|
|
(interactive) (menu-bar-select-frame ,frame))))
|
1995-02-24 09:12:56 +00:00
|
|
|
frames)))))
|
2007-10-22 04:26:47 +00:00
|
|
|
(setcdr global-buffers-menu-map
|
1994-12-23 17:58:46 +00:00
|
|
|
(if (and buffers-menu frames-menu)
|
1995-02-24 09:12:56 +00:00
|
|
|
;; Combine Frame and Buffers menus with separator between
|
2007-10-22 04:26:47 +00:00
|
|
|
(nconc (list "Buffers and Frames" frames-menu
|
1997-12-22 02:26:17 +00:00
|
|
|
(and msb-separator-diff '(separator "--")))
|
2007-10-22 04:26:47 +00:00
|
|
|
(cdr buffers-menu))
|
|
|
|
buffers-menu)))))
|
1994-12-23 17:58:46 +00:00
|
|
|
|
1999-05-31 14:49:05 +00:00
|
|
|
;; Snarf current bindings of `mouse-buffer-menu' (normally
|
|
|
|
;; C-down-mouse-1).
|
|
|
|
(defvar msb-mode-map
|
2000-08-15 11:19:13 +00:00
|
|
|
(let ((map (make-sparse-keymap "Msb")))
|
2003-01-12 20:46:51 +00:00
|
|
|
(define-key map [remap mouse-buffer-menu] 'msb)
|
1999-05-31 14:49:05 +00:00
|
|
|
map))
|
|
|
|
|
|
|
|
;;;###autoload
|
2000-08-16 19:40:41 +00:00
|
|
|
(define-minor-mode msb-mode
|
1999-05-31 14:49:05 +00:00
|
|
|
"Toggle Msb mode.
|
Fix minor mode docstrings for the new meaning of a nil ARG.
* abbrev.el (abbrev-mode):
* allout.el (allout-mode):
* autoinsert.el (auto-insert-mode):
* autoarg.el (autoarg-mode, autoarg-kp-mode):
* autorevert.el (auto-revert-mode, auto-revert-tail-mode)
(global-auto-revert-mode):
* battery.el (display-battery-mode):
* composite.el (global-auto-composition-mode)
(auto-composition-mode):
* delsel.el (delete-selection-mode):
* desktop.el (desktop-save-mode):
* dired-x.el (dired-omit-mode):
* dirtrack.el (dirtrack-mode):
* doc-view.el (doc-view-minor-mode):
* double.el (double-mode):
* electric.el (electric-indent-mode, electric-pair-mode):
* emacs-lock.el (emacs-lock-mode):
* epa-hook.el (auto-encryption-mode):
* follow.el (follow-mode):
* font-core.el (font-lock-mode):
* frame.el (auto-raise-mode, auto-lower-mode, blink-cursor-mode):
* help.el (temp-buffer-resize-mode):
* hilit-chg.el (highlight-changes-mode)
(highlight-changes-visible-mode):
* hi-lock.el (hi-lock-mode):
* hl-line.el (hl-line-mode, global-hl-line-mode):
* icomplete.el (icomplete-mode):
* ido.el (ido-everywhere):
* image-file.el (auto-image-file-mode):
* image-mode.el (image-minor-mode):
* iswitchb.el (iswitchb-mode):
* jka-cmpr-hook.el (auto-compression-mode):
* linum.el (linum-mode):
* longlines.el (longlines-mode):
* master.el (master-mode):
* mb-depth.el (minibuffer-depth-indicate-mode):
* menu-bar.el (menu-bar-mode):
* minibuf-eldef.el (minibuffer-electric-default-mode):
* mouse-sel.el (mouse-sel-mode):
* msb.el (msb-mode):
* mwheel.el (mouse-wheel-mode):
* outline.el (outline-minor-mode):
* paren.el (show-paren-mode):
* recentf.el (recentf-mode):
* reveal.el (reveal-mode, global-reveal-mode):
* rfn-eshadow.el (file-name-shadow-mode):
* ruler-mode.el (ruler-mode):
* savehist.el (savehist-mode):
* scroll-all.el (scroll-all-mode):
* scroll-bar.el (scroll-bar-mode):
* server.el (server-mode):
* shell.el (shell-dirtrack-mode):
* simple.el (auto-fill-mode, transient-mark-mode)
(visual-line-mode, overwrite-mode, binary-overwrite-mode)
(line-number-mode, column-number-mode, size-indication-mode)
(auto-save-mode, normal-erase-is-backspace-mode, visible-mode):
* strokes.el (strokes-mode):
* time.el (display-time-mode):
* t-mouse.el (gpm-mouse-mode):
* tool-bar.el (tool-bar-mode):
* tooltip.el (tooltip-mode):
* type-break.el (type-break-mode-line-message-mode)
(type-break-query-mode):
* view.el (view-mode):
* whitespace.el (whitespace-mode, whitespace-newline-mode)
(global-whitespace-mode, global-whitespace-newline-mode):
* xt-mouse.el (xterm-mouse-mode): Doc fix.
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Fix
autogenerated docstring.
2011-10-19 12:54:24 +00:00
|
|
|
|
1999-05-31 14:49:05 +00:00
|
|
|
This mode overrides the binding(s) of `mouse-buffer-menu' to provide a
|
|
|
|
different buffer menu using the function `msb'."
|
2005-04-04 09:03:43 +00:00
|
|
|
:global t :group 'msb
|
1999-05-31 14:49:05 +00:00
|
|
|
(if msb-mode
|
1999-07-23 22:57:32 +00:00
|
|
|
(progn
|
|
|
|
(add-hook 'menu-bar-update-hook 'msb-menu-bar-update-buffers)
|
2001-02-20 15:24:39 +00:00
|
|
|
(remove-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
|
|
|
|
(msb-menu-bar-update-buffers t))
|
1999-07-23 22:57:32 +00:00
|
|
|
(remove-hook 'menu-bar-update-hook 'msb-menu-bar-update-buffers)
|
2001-02-20 15:24:39 +00:00
|
|
|
(add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
|
|
|
|
(menu-bar-update-buffers t)))
|
1999-05-31 14:49:05 +00:00
|
|
|
|
2007-10-31 00:30:09 +00:00
|
|
|
(defun msb-unload-function ()
|
|
|
|
"Unload the Msb library."
|
|
|
|
(msb-mode -1)
|
|
|
|
;; continue standard unloading
|
|
|
|
nil)
|
2000-08-15 11:19:13 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
(provide 'msb)
|
2011-01-27 07:54:04 +00:00
|
|
|
(run-hooks 'msb-after-load-hook)
|
1997-01-05 04:44:30 +00:00
|
|
|
|
1994-12-23 17:58:46 +00:00
|
|
|
;;; msb.el ends here
|