From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: patch for buff-menu.el enhancements Date: Mon, 9 Jul 2007 16:52:51 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002A_01C7C249.96519A80" X-Trace: sea.gmane.org 1184025260 27538 80.91.229.12 (9 Jul 2007 23:54:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2007 23:54:20 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 10 01:54:19 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I833N-00089V-0c for ged-emacs-devel@m.gmane.org; Tue, 10 Jul 2007 01:54:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I833M-0006id-5I for ged-emacs-devel@m.gmane.org; Mon, 09 Jul 2007 19:54:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I833I-0006iE-Ax for emacs-devel@gnu.org; Mon, 09 Jul 2007 19:54:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I833G-0006hx-Aa for emacs-devel@gnu.org; Mon, 09 Jul 2007 19:53:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I833G-0006hu-45 for emacs-devel@gnu.org; Mon, 09 Jul 2007 19:53:58 -0400 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I833E-0006mL-Ev for emacs-devel@gnu.org; Mon, 09 Jul 2007 19:53:57 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.186.112]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l69Nrrtu017172 for ; Mon, 9 Jul 2007 17:53:54 -0600 Original-Received: from acsmt350.oracle.com (acsmt350.oracle.com [141.146.40.150]) by rgmgw3.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l69Df54G001711 for ; Mon, 9 Jul 2007 17:53:53 -0600 Original-Received: from dhcp-4op11-4op12-west-130-35-178-179.us.oracle.com by acsmt350.oracle.com with ESMTP id 3023594921184025173; Mon, 09 Jul 2007 16:52:53 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Importance: Normal X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74530 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C7C249.96519A80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Attached is a patch for buff-menu.el that provides some enhancements for *Buffer List* (`C-x C-b'). Some of these are similar to the enhancements I sent recently for Dired. Some of them (e.g. click to change sort direction) are similar to behavior provided by Windows Explorer. To try this out with emacs -Q, load a patched copy of buff-menu.el, and then eval each of these three sexps, the last one using `C-M-x' (I don't know of another way for you to override the pre-existing definition of face `buffer-menu-buffer'): (setq Buffer-menu-mode-map nil) (setq Buffer-menu-sort-column 1) ;; Eval this one explicitly with C-M-x: (custom-declare-face 'buffer-menu-buffer '((t (:foreground "Blue"))) "Face used to highlight buffer names in the buffer menu." :group 'Buffer-menu) Features: 1. A new column, Time, which is the time that a buffer was last accessed (displayed). 2. You can sort up or down by clicking any column heading. The sorted column and its sort order (ascending or descending) are indicated by highlighting of the column header (underlining or overlining, respectively). 3. Clicking column heading `CRM' sorts the buffers by time of first access (visit). This is not the same thing as a descending sort of Time, which is the time of last access (display). If you have many buffers (especially if they have similar names), sorting by one of these columns can be useful. 4. A mouse popup menu (`mouse-3'), providing these items: * Select Buffer * Unmark Buffer * Mark to Save Buffer * Mark to Delete Buffer * Mark as Modified/Unmodified * Execute: Save/Delete Marked Buffers 5. Command `buffer-menu' was redefined so that: * A prefix argument zero or less means list buffers alphabetically. * A prefix argument zero or more means list only file buffers. 6. The buffer-menu buffer (`*Buffer List*') is font-lock highlighted: * Each field of the buffer uses a different face: CRM, Buffer, Size, Mode, File. * Each mark uses a different face (Save, Delete, Read-Only, Mark, Current). 7. The buffer lines have the `mouse-face' property on the whole line, so you can click it anywhere. 8. Command `Buffer-menu-select' (`v') uses `pop-to-buffer' when the *Buffer List* window is `window-dedicated-p'. 9. Different kinds of buffers (directory, `*...*' name, normal) are highlighted differently, and the buffer name is also highlighted specially when you mark or flag a buffer. ------=_NextPart_000_002A_01C7C249.96519A80 Content-Type: application/octet-stream; name="diff-buff-menu-2007-07-09.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="diff-buff-menu-2007-07-09.diff" cd c:/drews-lisp-20/cvs-lisp/=0A= diff -c -b "c:/Emacs-22.1/lisp/buff-menu.el" = "c:/drews-lisp-20/cvs-lisp/buff-menu-CVS-patched-2007-07-09.el"=0A= *** c:/Emacs-22.1/lisp/buff-menu.el Fri May 25 05:43:30 2007=0A= --- c:/drews-lisp-20/cvs-lisp/buff-menu-CVS-patched-2007-07-09.el Mon = Jul 9 15:56:08 2007=0A= ***************=0A= *** 64,85 ****=0A= ;; Put buffer *Buffer List* into proper mode right away=0A= ;; so that from now on even list-buffers is enough to get a buffer = menu.=0A= =0A= (defgroup Buffer-menu nil=0A= "Show a menu of all buffers in a buffer."=0A= :group 'tools=0A= :group 'convenience)=0A= =0A= - (defcustom Buffer-menu-use-header-line t=0A= - "*Non-nil means to use an immovable header-line."=0A= - :type 'boolean=0A= - :group 'Buffer-menu)=0A= - =0A= (defface buffer-menu-buffer=0A= ! '((t (:weight bold)))=0A= "Face used to highlight buffer names in the buffer menu."=0A= :group 'Buffer-menu)=0A= (put 'Buffer-menu-buffer 'face-alias 'buffer-menu-buffer)=0A= =0A= (defcustom Buffer-menu-buffer+size-width 26=0A= "*How wide to jointly make the buffer name and size columns."=0A= :type 'number=0A= --- 64,178 ----=0A= ;; Put buffer *Buffer List* into proper mode right away=0A= ;; so that from now on even list-buffers is enough to get a buffer = menu.=0A= =0A= + (eval-when-compile (require 'cl)) ;; case=0A= + =0A= (defgroup Buffer-menu nil=0A= "Show a menu of all buffers in a buffer."=0A= :group 'tools=0A= :group 'convenience)=0A= =0A= (defface buffer-menu-buffer=0A= ! '((t (:foreground "Blue")))=0A= "Face used to highlight buffer names in the buffer menu."=0A= :group 'Buffer-menu)=0A= + (defvar buffer-menu-buffer-name 'buffer-menu-buffer-name)=0A= (put 'Buffer-menu-buffer 'face-alias 'buffer-menu-buffer)=0A= =0A= + (defface buffer-menu-headings=0A= + '((t (:foreground "Orange" :background "DarkGreen")))=0A= + "Face used for headings in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-headings 'buffer-menu-headings)=0A= + =0A= + (defface buffer-menu-current-buffer=0A= + '((t (:foreground "Red" :background "Aquamarine")))=0A= + "Face used for current buffer mark in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-current-buffer 'buffer-menu-current-buffer)=0A= + =0A= + (defface buffer-menu-view-mark=0A= + '((t (:foreground "Red" :background "Aquamarine")))=0A= + "Face used for buffers to view mark (>) in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-view-mark 'buffer-menu-view-mark)=0A= + =0A= + (defface buffer-menu-star-buffer=0A= + '((t (:foreground "DarkBlue")))=0A= + "Face used for buffers named \"*...*\"in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-star-buffer 'buffer-menu-star-buffer)=0A= + =0A= + (defface buffer-menu-directory-buffer=0A= + '((t (:foreground "Blue" :background "LightBlue")))=0A= + "Face used for directory buffers in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-directory-buffer 'buffer-menu-directory-buffer)=0A= + =0A= + (defface buffer-menu-marked-buffer=0A= + '((t (:underline t)))=0A= + "Face used for buffers marked with `>' in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-marked-buffer 'buffer-menu-marked-buffer)=0A= + =0A= + (defface buffer-menu-flagged-buffer=0A= + '((t (:foreground "Red")))=0A= + "Face used for buffers marked with `D' in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-flagged-buffer 'buffer-menu-flagged-buffer)=0A= + =0A= + (defface buffer-menu-delete-mark=0A= + '((t (:foreground "Aquamarine" :background "Red")))=0A= + "Face used for buffers to delete mark (D) in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-delete-mark 'buffer-menu-delete-mark)=0A= + =0A= + (defface buffer-menu-save-mark=0A= + '((t (:foreground "Orange" :background "Blue")))=0A= + "Face used for buffers to save mark (S) in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-save-mark 'buffer-menu-save-mark)=0A= + =0A= + (defface buffer-menu-modified-mark=0A= + '((t (:foreground "DarkOrange")))=0A= + "Face used for modified buffers mark (*) in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-modified-mark 'buffer-menu-modified-mark)=0A= + =0A= + (defface buffer-menu-read-only-mark=0A= + '((t (:foreground "Yellow")))=0A= + "Face used for read-only buffers mark (%) in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-read-only-mark 'buffer-menu-read-only-mark)=0A= + =0A= + (defface buffer-menu-mode=0A= + '((t (:foreground "DarkGreen")))=0A= + "Face used for buffer modes in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-mode 'buffer-menu-mode)=0A= + =0A= + (defface buffer-menu-size=0A= + '((t (:foreground "DarkRed")))=0A= + "Face used for buffer sizes in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-size 'buffer-menu-size)=0A= + =0A= + (defface buffer-menu-time=0A= + '((t (:foreground "DarkGoldenrod4")))=0A= + "Face used for buffer time in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-time 'buffer-menu-time)=0A= + =0A= + (defface buffer-menu-file-name=0A= + '((t (:foreground "DarkMagenta")))=0A= + "Face used for file names in *Buffer List* buffer."=0A= + :group 'Buffer-menu)=0A= + (defvar buffer-menu-file-name 'buffer-menu-file-name)=0A= + =0A= + (defcustom Buffer-menu-use-header-line t=0A= + "*Non-nil means to use an immovable header-line."=0A= + :type 'boolean=0A= + :group 'Buffer-menu)=0A= + =0A= (defcustom Buffer-menu-buffer+size-width 26=0A= "*How wide to jointly make the buffer name and size columns."=0A= :type 'number=0A= ***************=0A= *** 100,115 ****=0A= :group 'Buffer-menu=0A= :version "22.1")=0A= =0A= ! ;; This should get updated & resorted when you click on a column = heading=0A= ! (defvar Buffer-menu-sort-column nil=0A= ! "Which column to sort the menu on.=0A= ! Use 2 to sort by buffer names, or 5 to sort by file names.=0A= ! nil means sort by visited order (the default).")=0A= =0A= (defconst Buffer-menu-buffer-column 4)=0A= =0A= ! (defvar Buffer-menu-mode-map nil=0A= ! "Local keymap for `Buffer-menu-mode' buffers.")=0A= =0A= (defvar Buffer-menu-files-only nil=0A= "Non-nil if the current buffer-menu lists only file buffers.=0A= --- 193,235 ----=0A= :group 'Buffer-menu=0A= :version "22.1")=0A= =0A= ! (defvar Buffer-menu-sort-column 1=0A= ! "Which column to sort the buffer menu on.=0A= ! Sorted by (1) visit, (2) buffer, (3) size, (4) time, (5) mode, (6) = file.=0A= ! This is updated when you click a column heading.")=0A= ! =0A= ! (defvar buffer-menu-font-lock-keywords=0A= ! (list=0A= ! (list "^\\(CRM.*\\)" 1 'buffer-menu-headings)=0A= ! (list "^....\\(.*[^ \t\n]\\)[ \t]+[0-9]+[ \t]+\\(.* = \\(AM\\|PM\\)\\)?\\([^/\n]+\\)"=0A= ! (list 1 'buffer-menu-buffer-name)) ; Default buffer name=0A= ! (list "^....\\(.*[^ \t\n]\\)[ \t]+[0-9]+[ \t]+[a-zA-Z :0-9]*[ = \t]+Dired"=0A= ! 1 'buffer-menu-directory-buffer t t) ; Directory buffer name=0A= ! (list "^....\\(\\*.*[^ \t\n]\\*\\)[ \t]+" 1 = 'buffer-menu-star-buffer t t) ; Star buffer name=0A= ! (list "^.*[ \t][0-9]+[ \t]+\\(.* \\(AM\\|PM\\)\\)?\\([^\n]+\\)"=0A= ! (list 1 'buffer-menu-time t t) ; Time=0A= ! (list 3 'buffer-menu-mode t t)) ; Mode=0A= ! (list "^.*[ \t]\\([0-9]+\\)[ \t]+[^/\n]+" 1 'buffer-menu-size t t) = ; Size=0A= ! (list "^.*[ \t][0-9]+[ \t]+[^/\n]+[ = \t\n]\\(\\([~]\\|\\([a-zA-Z]:\\)\\)*/.*\\)$"=0A= ! 1 'buffer-menu-file-name t t) ; File name=0A= ! (list "^\\([.]\\)" 1 'buffer-menu-current-buffer t t) ; Current = buffer mark (.)=0A= ! (list "^\\(>\\)" 1 'buffer-menu-view-mark t t) ; To view mark (>)=0A= ! (list "^>...\\(.*[^ \t\n]\\)[ \t]+[0-9]+[ \t]+\\(.* = \\(AM\\|PM\\)\\)?\\([^/\n]+\\)"=0A= ! (list 1 'buffer-menu-marked-buffer 'prepend t)) ; Buffer name = when marked (>)=0A= ! (list "^D...\\(.*[^ \t\n]\\)[ \t]+[0-9]+[ \t]+\\(.* = \\(AM\\|PM\\)\\)?\\([^/\n]+\\)"=0A= ! (list 1 'buffer-menu-flagged-buffer t t)) ; Buffer name when = flagged (D)=0A= ! (list "^\\(D\\)" 1 'buffer-menu-delete-mark t t) ; Deletion flag (D)=0A= ! (list "^..\\(S\\)" 1 'buffer-menu-save-mark t t) ; Save flag (S)=0A= ! (list "^..\\([*]\\)" 1 'buffer-menu-modified-mark t t) ; = Buffer-modified-p (*)=0A= ! (list "^.\\(%\\)" 1 'buffer-menu-read-only-mark t t) ; Read-only-p = (%)=0A= ! ) "*Expressions to highlight in Buffer Menu mode.")=0A= ! =0A= ! (defvar Buffer-menu-overlay nil=0A= ! "Overlay to highlight line of buffer during popup of `mouse-3' = menu.")=0A= =0A= (defconst Buffer-menu-buffer-column 4)=0A= =0A= ! (defvar Buffer-menu-mode-map nil "Local keymap for `Buffer-menu-mode' = buffers.")=0A= =0A= (defvar Buffer-menu-files-only nil=0A= "Non-nil if the current buffer-menu lists only file buffers.=0A= ***************=0A= *** 157,162 ****=0A= --- 277,284 ----=0A= (define-key Buffer-menu-mode-map "T" 'Buffer-menu-toggle-files-only)=0A= (define-key Buffer-menu-mode-map [mouse-2] 'Buffer-menu-mouse-select)=0A= (define-key Buffer-menu-mode-map [follow-link] 'mouse-face)=0A= + (define-key Buffer-menu-mode-map [down-mouse-3] = 'Buffer-menu-mouse-3-menu)=0A= + (define-key Buffer-menu-mode-map [mouse-3] 'ignore)=0A= )=0A= =0A= ;; Buffer Menu mode is suitable only for specially formatted data.=0A= ***************=0A= *** 165,209 ****=0A= (defun Buffer-menu-mode ()=0A= "Major mode for editing a list of buffers.=0A= Each line describes one of the buffers in Emacs.=0A= ! Letters do not insert themselves; instead, they are commands.=0A= \\=0A= ! \\[Buffer-menu-mouse-select] -- select buffer you click on, in place = of the buffer menu.=0A= ! \\[Buffer-menu-this-window] -- select current line's buffer in place = of the buffer menu.=0A= ! \\[Buffer-menu-other-window] -- select that buffer in another window,=0A= ! so the buffer menu buffer remains visible in its window.=0A= \\[Buffer-menu-view] -- select current line's buffer, but in view-mode.=0A= \\[Buffer-menu-view-other-window] -- select that buffer in=0A= another window, in view-mode.=0A= - \\[Buffer-menu-switch-other-window] -- make another window display = that buffer.=0A= - \\[Buffer-menu-mark] -- mark current line's buffer to be displayed.=0A= - \\[Buffer-menu-select] -- select current line's buffer.=0A= - Also show buffers marked with m, in other windows.=0A= - \\[Buffer-menu-1-window] -- select that buffer in full-frame window.=0A= - \\[Buffer-menu-2-window] -- select that buffer in one window,=0A= - together with buffer selected before this one in another window.=0A= - \\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer.=0A= - \\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.=0A= - \\[Buffer-menu-save] -- mark that buffer to be saved, and move down.=0A= - \\[Buffer-menu-delete] -- mark that buffer to be deleted, and move = down.=0A= - \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, = and move up.=0A= - \\[Buffer-menu-execute] -- delete or save marked buffers.=0A= - \\[Buffer-menu-unmark] -- remove all kinds of marks from current line.=0A= - With prefix argument, also move up one line.=0A= - \\[Buffer-menu-backup-unmark] -- back up a line and remove marks.=0A= - \\[Buffer-menu-toggle-read-only] -- toggle read-only status of buffer = on this line.=0A= - \\[Buffer-menu-revert] -- update the list of buffers.=0A= \\[Buffer-menu-toggle-files-only] -- toggle whether the menu displays = only file buffers.=0A= ! \\[Buffer-menu-bury] -- bury the buffer listed on this line."=0A= (kill-all-local-variables)=0A= (use-local-map Buffer-menu-mode-map)=0A= (setq major-mode 'Buffer-menu-mode)=0A= (setq mode-name "Buffer Menu")=0A= ! (set (make-local-variable 'revert-buffer-function)=0A= ! 'Buffer-menu-revert-function)=0A= ! (set (make-local-variable 'buffer-stale-function)=0A= ! #'(lambda (&optional noconfirm) 'fast))=0A= (setq truncate-lines t)=0A= (setq buffer-read-only t)=0A= (run-mode-hooks 'buffer-menu-mode-hook))=0A= =0A= ;; This function exists so we can make the doc string of = Buffer-menu-mode=0A= --- 287,376 ----=0A= (defun Buffer-menu-mode ()=0A= "Major mode for editing a list of buffers.=0A= Each line describes one of the buffers in Emacs.=0A= ! In Buffer menu mode, chars do not insert themselves, but are commands.=0A= \\=0A= ! \(\"Current line\" here is the line of the text cursor or the mouse.)=0A= ! =0A= ! If `Buffer-menu-use-header-line' is non-nil, you can click a column=0A= ! heading to sort by that column. Clicking again reverses the sort=0A= ! direction. The current sort column is indicated by an underlined or=0A= ! overlined column heading. Note that sorting by column `CRM' depends=0A= ! on the value of option `Buffer-menu-use-frame-buffer-list'. (Column=0A= ! sorting is not available in Emacs prior to release 22.)=0A= ! =0A= ! Press `mouse-3' for a popup menu that provides most of the functions=0A= ! listed below.=0A= ! =0A= ! Display buffers:=0A= ! ---------------=0A= ! \\[Buffer-menu-mouse-select], \\[Buffer-menu-select], = \\[Buffer-menu-this-window] -- \=0A= ! Select current line's buffer.=0A= ! \\[Buffer-menu-mark]\t-- Mark current line's buffer `>' to be = displayed (via \=0A= ! `\\[Buffer-menu-select]').=0A= ! \\[Buffer-menu-select]\t-- Show buffers marked `>'. Select current = line's \=0A= ! buffer.=0A= ! \\[Buffer-menu-1-window]\t-- Select current line's buffer (only) in a \=0A= ! full-frame window.=0A= ! \\[Buffer-menu-2-window]\t-- Select current line's buffer in one = window.=0A= ! \t Display previous buffer in a second window.=0A= ! \\[Buffer-menu-switch-other-window]\t-- Display current line's buffer = in \=0A= ! another window. No select.=0A= \\[Buffer-menu-view] -- select current line's buffer, but in view-mode.=0A= \\[Buffer-menu-view-other-window] -- select that buffer in=0A= another window, in view-mode.=0A= \\[Buffer-menu-toggle-files-only] -- toggle whether the menu displays = only file buffers.=0A= ! =0A= ! Mark/Unmark buffers to be Saved/Deleted:=0A= ! ---------------------------------------=0A= ! \\[Buffer-menu-save]\t-- Mark current line's buffer `S' to be saved. = \=0A= ! Cursor down.=0A= ! \\[Buffer-menu-delete]\t-- Mark current line's buffer `D' to be = deleted. \=0A= ! Cursor down.=0A= ! \\[Buffer-menu-delete-backwards]\t-- Mark current line's buffer `D' to = be \=0A= ! deleted. Cursor up.=0A= ! \\[Buffer-menu-unmark]\t-- Unmark current line. Cursor down. (Prefix = arg: \=0A= ! Cursor up.)=0A= ! \\[Buffer-menu-backup-unmark]\t-- Cursor up, then unmark line.=0A= ! =0A= ! Save/Delete buffers:=0A= ! -------------------=0A= ! \\[Buffer-menu-execute]\t-- Save / Delete marked buffers (marks `S', = `D').=0A= ! =0A= ! Miscellaneous:=0A= ! -------------=0A= ! \\[Buffer-menu-revert] -- Update the list of buffers.=0A= ! \\[Buffer-menu-not-modified]\t-- Clear modified-flag on current line's = buffer.=0A= ! \\[Buffer-menu-toggle-read-only]\t-- Toggle read-only status of = current \=0A= ! line's buffer.=0A= ! \\[Buffer-menu-visit-tags-table]\t-- `visit-tags-table' using current = line's \=0A= ! buffer.=0A= ! =0A= ! =0A= ! Bindings in Buffer Menu mode:=0A= ! ----------------------------=0A= ! =0A= ! \\{Buffer-menu-mode-map}"=0A= (kill-all-local-variables)=0A= (use-local-map Buffer-menu-mode-map)=0A= (setq major-mode 'Buffer-menu-mode)=0A= (setq mode-name "Buffer Menu")=0A= ! (save-excursion=0A= ! (goto-char (point-min))=0A= ! (unless Buffer-menu-use-header-line (forward-line 2)) ; First two = lines are title, unless use header line.=0A= ! (while (not (eobp))=0A= ! (put-text-property (point) (save-excursion (end-of-line) = (point)) 'mouse-face 'highlight)=0A= ! (forward-line 1)))=0A= ! (set (make-local-variable 'revert-buffer-function) = 'Buffer-menu-revert-function)=0A= ! (set (make-local-variable 'buffer-stale-function) #'(lambda = (&optional noconfirm) 'fast))=0A= (setq truncate-lines t)=0A= (setq buffer-read-only t)=0A= + (save-window-excursion=0A= + (save-excursion=0A= + (pop-to-buffer "*Buffer List*")=0A= + (setq font-lock-defaults '(buffer-menu-font-lock-keywords t))=0A= + (turn-on-font-lock)=0A= + (when (and (fboundp 'fit-frame) (one-window-p t)) (fit-frame))=0A= + (raise-frame)))=0A= (run-mode-hooks 'buffer-menu-mode-hook))=0A= =0A= ;; This function exists so we can make the doc string of = Buffer-menu-mode=0A= ***************=0A= *** 269,293 ****=0A= =0C=0A= (defun buffer-menu (&optional arg)=0A= "Make a menu of buffers so you can save, delete or select them.=0A= ! With argument, show only buffers that are visiting files.=0A= ! Type ? after invocation to get help on commands available.=0A= ! Type q to remove the buffer menu from the display.=0A= ! =0A= ! The first column shows `>' for a buffer you have=0A= ! marked to be displayed, `D' for one you have marked for=0A= ! deletion, and `.' for the current buffer.=0A= ! =0A= ! The C column has a `.' for the buffer from which you came.=0A= ! The R column has a `%' if the buffer is read-only.=0A= ! The M column has a `*' if it is modified,=0A= ! or `S' if you have marked it for saving.=0A= After this come the buffer name, its size in characters,=0A= ! its major mode, and the visited file name (if any)."=0A= (interactive "P")=0A= ! ;;; (setq Buffer-menu-window-config (current-window-configuration))=0A= ! (switch-to-buffer (list-buffers-noselect arg))=0A= ! (message=0A= ! "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for = help."))=0A= =0A= (defun buffer-menu-other-window (&optional arg)=0A= "Display a list of buffers in another window.=0A= --- 436,478 ----=0A= =0C=0A= (defun buffer-menu (&optional arg)=0A= "Make a menu of buffers so you can save, delete or select them.=0A= ! By default (no or null prefix arg), the buffers are listed in order of=0A= ! last access (visit). With a non-nil prefix ARG:=0A= ! ARG >=3D 0 means only buffers visiting files are listed.=0A= ! ARG <=3D 0 means the buffers are listed alphabetically.=0A= ! (ARG =3D 0 means only buffers visiting files, listed = alphabetically.)=0A= ! =0A= ! You can click a column heading to sort by that column. Clicking again=0A= ! reverses the sort direction. The current sort column is indicated by=0A= ! an underlined or overlined column heading.=0A= ! =0A= ! The C column shows `>' if you have marked the buffer to be displayed,=0A= ! `D' if you have marked it for deletion, and `.' for the buffer=0A= ! from which you came.=0A= ! The R column shows `%' if the buffer is read-only.=0A= ! The M column shows `*' if the buffer is modified, or `S' if you have=0A= ! marked it for saving.=0A= After this come the buffer name, its size in characters,=0A= ! its major mode, and the visited file name (if any).=0A= ! =0A= ! Type `?' in buffer \"*Buffer List*\" to get help on available commands.=0A= ! Type `q' there to quit the buffer menu."=0A= (interactive "P")=0A= ! (let ((num-arg (prefix-numeric-value arg)))=0A= ! (if (and arg (< num-arg 0)) (list-buffers) (list-buffers arg))=0A= ! (let ((newpoint (save-excursion (set-buffer "*Buffer List*") = (point))))=0A= ! (pop-to-buffer "*Buffer List*")=0A= ! (when (and arg (not (> num-arg 0))) ; Sort lines after header.=0A= ! (let ((buffer-read-only nil))=0A= ! (goto-char (point-min))=0A= ! (unless Buffer-menu-use-header-line (forward-line 2)) ; = Header.=0A= ! (forward-char 4)=0A= ! (sort-columns nil (point) (save-excursion (goto-char = (point-max))=0A= ! (when (bolp) = (backward-char 1))=0A= ! (point)))))=0A= ! (goto-char newpoint)))=0A= ! (message "Help: ?; Menu: mouse-3; Show: v; Mark: u,m,s,d; \=0A= ! Save/Delete: x; Misc: g,~,%%,t"))=0A= =0A= (defun buffer-menu-other-window (&optional arg)=0A= "Display a list of buffers in another window.=0A= ***************=0A= *** 397,403 ****=0A= (forward-line)))=0A= =0A= (defun Buffer-menu-execute ()=0A= ! "Save and/or delete buffers marked with = \\\\[Buffer-menu-save] or = \\\\[Buffer-menu-delete] commands."=0A= (interactive)=0A= (save-excursion=0A= (Buffer-menu-beginning)=0A= --- 582,592 ----=0A= (forward-line)))=0A= =0A= (defun Buffer-menu-execute ()=0A= ! "Save or delete buffers marked `S' or `D', respectively.=0A= ! Buffers can be marked using commands `\\\=0A= ! \\[Buffer-menu-save]' and = `\\\\[Buffer-menu-delete]'=0A= ! \(or `\\\\[Buffer-menu-mouse-save]' and \=0A= ! `\\\\[Buffer-menu-mouse-delete]')."=0A= (interactive)=0A= (save-excursion=0A= (Buffer-menu-beginning)=0A= ***************=0A= *** 429,437 ****=0A= =0A= (defun Buffer-menu-select ()=0A= "Select this line's buffer; also display buffers marked with `>'.=0A= ! You can mark buffers with the = \\\\[Buffer-menu-mark] command.=0A= ! This command deletes and replaces all the previously existing windows=0A= ! in the selected frame."=0A= (interactive)=0A= (let ((buff (Buffer-menu-buffer t))=0A= (menu (current-buffer))=0A= --- 618,626 ----=0A= =0A= (defun Buffer-menu-select ()=0A= "Select this line's buffer; also display buffers marked with `>'.=0A= ! You can mark buffers with command = `\\\\[Buffer-menu-mark]'.=0A= ! If the window is `window-dedicated-p', then another window is used;=0A= ! else, all windows previously in the frame are replaced by this one."=0A= (interactive)=0A= (let ((buff (Buffer-menu-buffer t))=0A= (menu (current-buffer))=0A= ***************=0A= *** 444,462 ****=0A= (delete-char -1)=0A= (insert ?\s))=0A= (or (eq tem buff) (memq tem others) (setq others (cons tem = others))))=0A= ! (setq others (nreverse others)=0A= ! tem (/ (1- (frame-height)) (1+ (length others))))=0A= (delete-other-windows)=0A= (switch-to-buffer buff)=0A= ! (or (eq menu buff)=0A= ! (bury-buffer menu))=0A= (if (equal (length others) 0)=0A= (progn=0A= ;;; ;; Restore previous window configuration before displaying=0A= ;;; ;; selected buffers.=0A= ;;; (if Buffer-menu-window-config=0A= ! ;;; (progn=0A= ! ;;; (set-window-configuration Buffer-menu-window-config)=0A= ;;; (setq Buffer-menu-window-config nil)))=0A= (switch-to-buffer buff))=0A= (while others=0A= --- 633,657 ----=0A= (delete-char -1)=0A= (insert ?\s))=0A= (or (eq tem buff) (memq tem others) (setq others (cons tem = others))))=0A= ! (setq others (nreverse others))=0A= ! (cond ((window-dedicated-p (selected-window)) ; Can't split = dedicated win.=0A= ! (pop-to-buffer buff)=0A= ! (unless (eq menu buff) (bury-buffer menu))=0A= ! (while others=0A= ! (pop-to-buffer (car others))=0A= ! (pop others)))=0A= ! (t=0A= ! (setq tem (/ (1- (frame-height)) (1+ (length others))))=0A= (delete-other-windows)=0A= (switch-to-buffer buff)=0A= ! (unless (eq menu buff) (bury-buffer menu))=0A= (if (equal (length others) 0)=0A= (progn=0A= ;;; ;; Restore previous window configuration before = displaying=0A= ;;; ;; selected buffers.=0A= ;;; (if Buffer-menu-window-config=0A= ! ;;; (progn (set-window-configuration=0A= ! ;;; Buffer-menu-window-config)=0A= ;;; (setq Buffer-menu-window-config nil)))=0A= (switch-to-buffer buff))=0A= (while others=0A= ***************=0A= *** 464,471 ****=0A= (other-window 1)=0A= (switch-to-buffer (car others))=0A= (setq others (cdr others)))=0A= ! (other-window 1) ;back to the beginning!=0A= ! )))=0A= =0A= =0A= =0C=0A= --- 659,665 ----=0A= (other-window 1)=0A= (switch-to-buffer (car others))=0A= (setq others (cdr others)))=0A= ! (other-window 1))))))=0A= =0A= =0A= =0C=0A= ***************=0A= *** 561,573 ****=0A= (insert line))=0A= (message "Buried buffer moved to the end"))))=0A= =0A= - =0A= (defun Buffer-menu-view ()=0A= "View this line's buffer in View mode."=0A= (interactive)=0A= (view-buffer (Buffer-menu-buffer t)))=0A= =0A= - =0A= (defun Buffer-menu-view-other-window ()=0A= "View this line's buffer in View mode in another window."=0A= (interactive)=0A= --- 755,765 ----=0A= ***************=0A= *** 615,627 ****=0A= size))=0A= =0A= (defun Buffer-menu-sort (column)=0A= ! "Sort the buffer menu by COLUMN."=0A= (interactive "P")=0A= (when column=0A= (setq column (prefix-numeric-value column))=0A= ! (if (< column 2) (setq column 2))=0A= ! (if (> column 5) (setq column 5)))=0A= ! (setq Buffer-menu-sort-column column)=0A= (let (buffer-read-only l buf m1 m2)=0A= (save-excursion=0A= (Buffer-menu-beginning)=0A= --- 807,823 ----=0A= size))=0A= =0A= (defun Buffer-menu-sort (column)=0A= ! "Sort the buffer menu by COLUMN.=0A= ! Consecutive executions of the same COLUMN reverse the sort order."=0A= (interactive "P")=0A= (when column=0A= (setq column (prefix-numeric-value column))=0A= ! (when (=3D column 0) (setq column 1))=0A= ! (when (> column 6) (setq column 6))=0A= ! (when (< column -6) (setq column -6)))=0A= ! (if (equal Buffer-menu-sort-column column)=0A= ! (setq Buffer-menu-sort-column (- column))=0A= ! (setq Buffer-menu-sort-column column))=0A= (let (buffer-read-only l buf m1 m2)=0A= (save-excursion=0A= (Buffer-menu-beginning)=0A= ***************=0A= *** 650,656 ****=0A= (forward-char 2)=0A= (delete-char 1)=0A= (insert m2)))=0A= ! (forward-line)))))=0A= =0A= (defun Buffer-menu-sort-by-column (&optional e)=0A= "Sort the buffer menu by the column clicked on."=0A= --- 846,861 ----=0A= (forward-char 2)=0A= (delete-char 1)=0A= (insert m2)))=0A= ! (forward-line))))=0A= ! (message "Buffers are now sorted %s%s."=0A= ! (case (abs column)=0A= ! (1 "by time of last visit - see = `Buffer-menu-use-frame-buffer-list'")=0A= ! (2 "by buffer name")=0A= ! (3 "by size")=0A= ! (4 "by time of last display")=0A= ! (5 "by major-mode name")=0A= ! (otherwise "by associated file (including path)"))=0A= ! (if (natnump Buffer-menu-sort-column) ", ascending" ", = descending")))=0A= =0A= (defun Buffer-menu-sort-by-column (&optional e)=0A= "Sort the buffer menu by the column clicked on."=0A= ***************=0A= *** 675,691 ****=0A= map)=0A= "Local keymap for Buffer menu sort buttons.")=0A= =0A= ! (defun Buffer-menu-make-sort-button (name column)=0A= ! (if (equal column Buffer-menu-sort-column) (setq column nil))=0A= (propertize name=0A= ! 'column column=0A= ! 'help-echo (concat=0A= ! (if Buffer-menu-use-header-line=0A= ! "mouse-1, mouse-2: sort by "=0A= ! "mouse-2, RET: sort by ")=0A= ! (if column (downcase name) "visited order"))=0A= 'mouse-face 'highlight=0A= ! 'keymap Buffer-menu-sort-button-map))=0A= =0A= (defun list-buffers-noselect (&optional files-only buffer-list)=0A= "Create and return a buffer with a list of names of existing buffers.=0A= --- 880,913 ----=0A= map)=0A= "Local keymap for Buffer menu sort buttons.")=0A= =0A= ! (defun Buffer-menu-make-sort-button (name button-column)=0A= ! (let ((the-sort-column-p nil))=0A= ! (when (equal button-column (abs Buffer-menu-sort-column))=0A= ! (setq the-sort-column-p t)=0A= ! (setq button-column (- button-column)))=0A= (propertize name=0A= ! 'column button-column=0A= ! 'help-echo=0A= ! (case (abs button-column)=0A= ! (1 (if Buffer-menu-use-header-line=0A= ! "mouse-1, mouse-2: sort by time of last visit = - \=0A= ! see `Buffer-menu-use-frame-buffer-list'"=0A= ! "mouse-2, RET: sort by time of last visit - \=0A= ! see `Buffer-menu-use-frame-buffer-list'"))=0A= ! (2 (if Buffer-menu-use-header-line=0A= ! "mouse-1, mouse-2: sort by buffer name"=0A= ! "mouse-2, RET: sort by buffer name"))=0A= ! (4 "mouse-1, mouse-2: sort by time of last = display/access")=0A= ! (t (if Buffer-menu-use-header-line=0A= ! (concat "mouse-1, mouse-2: sort by " = (downcase name))=0A= ! (concat "mouse-2, RET: sort by " (downcase = name)))))=0A= 'mouse-face 'highlight=0A= ! (when the-sort-column-p 'face)=0A= ! (when the-sort-column-p=0A= ! (if (natnump Buffer-menu-sort-column)=0A= ! '(:underline t)=0A= ! '(:overline t)))=0A= ! 'keymap Buffer-menu-sort-button-map)))=0A= =0A= (defun list-buffers-noselect (&optional files-only buffer-list)=0A= "Create and return a buffer with a list of names of existing buffers.=0A= ***************=0A= *** 700,713 ****=0A= (let* ((old-buffer (current-buffer))=0A= (standard-output standard-output)=0A= (mode-end (make-string (- Buffer-menu-mode-width 2) ?\s))=0A= ! (header (concat "CRM "=0A= (Buffer-menu-buffer+size=0A= (Buffer-menu-make-sort-button "Buffer" 2)=0A= (Buffer-menu-make-sort-button "Size" 3))=0A= " "=0A= ! (Buffer-menu-make-sort-button "Mode" 4) mode-end=0A= ! (Buffer-menu-make-sort-button "File" 5) "\n"))=0A= ! list desired-point)=0A= (when Buffer-menu-use-header-line=0A= (let ((pos 0))=0A= ;; Turn whitespace chars in the header into stretch specs so=0A= --- 922,936 ----=0A= (let* ((old-buffer (current-buffer))=0A= (standard-output standard-output)=0A= (mode-end (make-string (- Buffer-menu-mode-width 2) ?\s))=0A= ! (header (concat (Buffer-menu-make-sort-button "CRM" 1) " "=0A= (Buffer-menu-buffer+size=0A= (Buffer-menu-make-sort-button "Buffer" 2)=0A= (Buffer-menu-make-sort-button "Size" 3))=0A= " "=0A= ! (Buffer-menu-make-sort-button "Time" 4) " = "=0A= ! (Buffer-menu-make-sort-button "Mode" 5) mode-end=0A= ! (Buffer-menu-make-sort-button "File" 6) "\n"))=0A= ! list desired-point name buffer-time mode file)=0A= (when Buffer-menu-use-header-line=0A= (let ((pos 0))=0A= ;; Turn whitespace chars in the header into stretch specs so=0A= ***************=0A= *** 718,725 ****=0A= ;; Assume fixed-size chars in the buffer.=0A= (list 'space :align-to pos)=0A= header)))=0A= - ;; Try to better align the one-char headers.=0A= - (put-text-property 0 3 'face 'fixed-pitch header)=0A= ;; Add a "dummy" leading space to align the beginning of the = header=0A= ;; line with the beginning of the text (rather than with the left=0A= ;; scrollbar or the left fringe). --Stef=0A= --- 941,946 ----=0A= ***************=0A= *** 730,747 ****=0A= (erase-buffer)=0A= (setq standard-output (current-buffer))=0A= (unless Buffer-menu-use-header-line=0A= ;; Use U+2014 (EM DASH) to underline if possible, else use = ASCII=0A= ;; (i.e. U+002D, HYPHEN-MINUS).=0A= ! (let ((underline (if (char-displayable-p ?\u2014) ?\u2014 ?-)))=0A= (insert header=0A= (apply 'string=0A= (mapcar (lambda (c)=0A= (if (memq c '(?\n ?\s)) c underline))=0A= header)))))=0A= ;; Collect info for every buffer we're interested in.=0A= (dolist (buffer (or buffer-list=0A= (buffer-list=0A= ! (when Buffer-menu-use-frame-buffer-list=0A= (selected-frame)))))=0A= (with-current-buffer buffer=0A= (let ((name (buffer-name))=0A= --- 951,974 ----=0A= (erase-buffer)=0A= (setq standard-output (current-buffer))=0A= (unless Buffer-menu-use-header-line=0A= + ;; Only Emacs > 21 has `char-displayable' and U+2014.=0A= ;; Use U+2014 (EM DASH) to underline if possible, else use = ASCII=0A= ;; (i.e. U+002D, HYPHEN-MINUS).=0A= ! (let ((underline (if (and (fboundp 'char-displayable-p)=0A= ! (char-displayable-p ?\u2014))=0A= ! ?\u2014 ; EM dash=0A= ! ?-))) ; regular dash=0A= (insert header=0A= (apply 'string=0A= (mapcar (lambda (c)=0A= (if (memq c '(?\n ?\s)) c underline))=0A= header)))))=0A= + (if buffer-list=0A= + (setq list buffer-list)=0A= ;; Collect info for every buffer we're interested in.=0A= (dolist (buffer (or buffer-list=0A= (buffer-list=0A= ! (and Buffer-menu-use-frame-buffer-list=0A= (selected-frame)))))=0A= (with-current-buffer buffer=0A= (let ((name (buffer-name))=0A= ***************=0A= *** 754,761 ****=0A= (and files-only (not file))=0A= (string=3D name "*Buffer List*")))=0A= ;; Otherwise output info.=0A= ! (let ((mode (concat (format-mode-line mode-name nil nil buffer)=0A= ! (if mode-line-process=0A= (format-mode-line mode-line-process=0A= nil nil buffer))))=0A= (bits (string=0A= --- 981,996 ----=0A= (and files-only (not file))=0A= (string=3D name "*Buffer List*")))=0A= ;; Otherwise output info.=0A= ! (let (;; Need to record two values for time: numerical = time value, for=0A= ! ;; sorting, and string time value, for display.=0A= ! (buffer-time (cons (or (float-time = buffer-display-time) 0)=0A= ! (if buffer-display-time=0A= ! (format-time-string=0A= ! "%_3a %_2k:%02M:%02S = %_2p"=0A= ! buffer-display-time)=0A= ! " ")))=0A= ! (mode (concat (format-mode-line mode-name nil = nil buffer)=0A= ! (and mode-line-process=0A= (format-mode-line = mode-line-process=0A= nil nil = buffer))))=0A= (bits (string=0A= ***************=0A= *** 788,818 ****=0A= (setq file "*Info History*"))=0A= ((eq file 'toc)=0A= (setq file "*Info TOC*"))=0A= ! ((not (stringp file)) ;; avoid errors=0A= (setq file nil))=0A= (t=0A= (setq file (concat "("=0A= (file-name-nondirectory file)=0A= ")"=0A= Info-current-node)))))))=0A= ! (push (list buffer bits name (buffer-size) mode file)=0A= list))))))=0A= ! ;; Preserve the original buffer-list ordering, just in case.=0A= ! (setq list (nreverse list))=0A= ;; Place the buffers's info in the output buffer, sorted if = necessary.=0A= (dolist (buffer=0A= ! (if Buffer-menu-sort-column=0A= (sort list=0A= ! (if (eq Buffer-menu-sort-column 3)=0A= (lambda (a b)=0A= ! (< (nth Buffer-menu-sort-column a)=0A= (nth Buffer-menu-sort-column b)))=0A= (lambda (a b)=0A= ! (string< (nth Buffer-menu-sort-column a)=0A= ! (nth Buffer-menu-sort-column b)))))=0A= ! list))=0A= ! (if (eq (car buffer) old-buffer)=0A= ! (setq desired-point (point)))=0A= (insert (cadr buffer)=0A= ;; Put the buffer name into a text property=0A= ;; so we don't have to extract it from the text.=0A= --- 1023,1064 ----=0A= (setq file "*Info History*"))=0A= ((eq file 'toc)=0A= (setq file "*Info TOC*"))=0A= ! ((not (stringp file));; avoid errors=0A= (setq file nil))=0A= (t=0A= (setq file (concat "("=0A= = (file-name-nondirectory file)=0A= ")"=0A= = Info-current-node)))))))=0A= ! (push (list buffer bits name (buffer-size) = buffer-time mode file)=0A= list))))))=0A= ! ;; Preserve original list order (by reversing).=0A= ! ;; Flip it if Buffer-menu-sort-column =3D -1.=0A= ! (unless (eq -1 Buffer-menu-sort-column) (setq list (nreverse = list))))=0A= ;; Place the buffers's info in the output buffer, sorted if = necessary.=0A= (dolist (buffer=0A= ! (if (eq 1 (abs Buffer-menu-sort-column))=0A= ! list=0A= ! (let* ((descending-p (natnump = Buffer-menu-sort-column))=0A= ! (Buffer-menu-sort-column (abs = Buffer-menu-sort-column)))=0A= (sort list=0A= ! (cond ((eq Buffer-menu-sort-column 3) ; Size=0A= ! (if descending-p=0A= ! (lambda (a b) (< (nth 3 a) (nth 3 = b)))=0A= ! (lambda (a b) (< (nth 3 b) (nth 3 = a)))))=0A= ! ((eq Buffer-menu-sort-column 4) ; Time = (value)=0A= ! (if descending-p=0A= ! (lambda (a b) (< (car (nth 4 a)) = (car (nth 4 b))))=0A= ! (lambda (a b) (< (car (nth 4 b)) = (car (nth 4 a))))))=0A= ! (t=0A= ! (if descending-p=0A= (lambda (a b)=0A= ! (string< (nth = Buffer-menu-sort-column a)=0A= (nth = Buffer-menu-sort-column b)))=0A= (lambda (a b)=0A= ! (string< (nth = Buffer-menu-sort-column b)=0A= ! (nth = Buffer-menu-sort-column a))))))))))=0A= ! (when (eq (car buffer) old-buffer) (setq desired-point = (point)))=0A= (insert (cadr buffer)=0A= ;; Put the buffer name into a text property=0A= ;; so we don't have to extract it from the text.=0A= ***************=0A= *** 825,848 ****=0A= mouse-face highlight=0A= help-echo "mouse-2: select this buffer"))=0A= " "=0A= ! (if (> (length (nth 4 buffer)) Buffer-menu-mode-width)=0A= ! (substring (nth 4 buffer) 0 Buffer-menu-mode-width)=0A= ! (nth 4 buffer)))=0A= ! (when (nth 5 buffer)=0A= (indent-to (+ Buffer-menu-buffer-column = Buffer-menu-buffer+size-width=0A= ! Buffer-menu-mode-width 4) 1)=0A= ! (princ (abbreviate-file-name (nth 5 buffer))))=0A= (princ "\n"))=0A= (Buffer-menu-mode)=0A= (when Buffer-menu-use-header-line=0A= (setq header-line-format header))=0A= ! ;; DESIRED-POINT doesn't have to be set; it is not when the=0A= ;; current buffer is not displayed for some reason.=0A= ! (and desired-point=0A= ! (goto-char desired-point))=0A= (setq Buffer-menu-files-only files-only)=0A= (set-buffer-modified-p nil)=0A= (current-buffer))))=0A= =0A= ;; arch-tag: e7dfcfc9-6cb2-46e4-bf55-8ef1936d83c6=0A= ;;; buff-menu.el ends here=0A= --- 1071,1245 ----=0A= mouse-face highlight=0A= help-echo "mouse-2: select = this buffer"))=0A= " "=0A= ! (cdr (nth 4 buffer)) " " ; Time=0A= ! (if (> (length (nth 5 buffer)) Buffer-menu-mode-width) = ; Mode=0A= ! (substring (nth 5 buffer) 0 Buffer-menu-mode-width)=0A= ! (nth 5 buffer)))=0A= ! (when (nth 6 buffer)=0A= (indent-to (+ Buffer-menu-buffer-column = Buffer-menu-buffer+size-width=0A= ! Buffer-menu-mode-width 17 4) 1)=0A= ! (princ (abbreviate-file-name (nth 6 buffer))))=0A= (princ "\n"))=0A= (Buffer-menu-mode)=0A= (when Buffer-menu-use-header-line=0A= (setq header-line-format header))=0A= ! ;; DESIRED-POINT doesn't have to be set; it is not set when the=0A= ;; current buffer is not displayed for some reason.=0A= ! (goto-char (or desired-point (point-min)))=0A= (setq Buffer-menu-files-only files-only)=0A= (set-buffer-modified-p nil)=0A= (current-buffer))))=0A= =0C=0A= + =0A= + (defun Buffer-menu-mouse-3-menu (event)=0A= + "Pop up menu for Mouse-3 for buffer listed in buffer menu."=0A= + (interactive "e")=0A= + (let* ((mouse-pos (event-start event))=0A= + bol eol temp=0A= + (buffer-name=0A= + (save-excursion=0A= + (set-buffer (window-buffer (posn-window mouse-pos)))=0A= + (save-excursion=0A= + (goto-char (posn-point mouse-pos))=0A= + (save-excursion=0A= + (setq bol (progn (beginning-of-line) (point)))=0A= + (setq eol (progn (end-of-line) (point))))=0A= + (if Buffer-menu-overlay ; Don't recreate if exists.=0A= + (move-overlay Buffer-menu-overlay bol eol = (current-buffer))=0A= + (setq Buffer-menu-overlay (make-overlay bol eol))=0A= + (overlay-put Buffer-menu-overlay 'face 'region))=0A= + (setq temp (and (not (eobp)) (Buffer-menu-buffer nil)))=0A= + ;; Nil if mouse is not on a buffer name.=0A= + (and temp (buffer-name temp)))))) ; temp no longer used.=0A= + (sit-for 0)=0A= + (let ((selection=0A= + (x-popup-menu=0A= + event=0A= + (list=0A= + "Menu"=0A= + (if buffer-name=0A= + (list=0A= + buffer-name=0A= + '("Select Buffer" . Buffer-menu-mouse-select)=0A= + '("Unmark Buffer" . Buffer-menu-mouse-unmark)=0A= + '("Mark to Save Buffer (S)" . Buffer-menu-mouse-save)=0A= + '("Mark to Delete Buffer (D)" . = Buffer-menu-mouse-delete)=0A= + '("Mark as Modified/Unmodified (*)" .=0A= + Buffer-menu-mouse-modified)=0A= + '("--") ; Separator: next not = buffer-specific.=0A= + '("Execute: Save/Delete Marked Buffers" .=0A= + Buffer-menu-mouse-execute))=0A= + (list "" '("Execute: Save/Delete Marked Buffers" .=0A= + Buffer-menu-mouse-execute)))))))=0A= + (when Buffer-menu-overlay (delete-overlay Buffer-menu-overlay))=0A= + (and selection (call-interactively selection)))))=0A= + =0A= + (defun Buffer-menu-mouse-unmark (event)=0A= + "Cancel all requested operations on buffer."=0A= + (interactive "e")=0A= + (let (buffer)=0A= + (save-excursion=0A= + (set-buffer (window-buffer (posn-window (event-end event))))=0A= + (save-excursion=0A= + (goto-char (posn-point (event-end event)))=0A= + (setq buffer (Buffer-menu-buffer t))))=0A= + (select-window (posn-window (event-end event)))=0A= + (goto-char (posn-point (event-end event)))=0A= + (beginning-of-line)=0A= + (if (looking-at " [-M]") ;header lines=0A= + (ding)=0A= + (let* ((mod (buffer-modified-p buffer))=0A= + (readonly (save-excursion (set-buffer buffer) = buffer-read-only))=0A= + (buffer-read-only nil))=0A= + (delete-char 3)=0A= + (insert (if readonly (if mod " *%" " %") (if mod " * " " = ")))))=0A= + (beginning-of-line)))=0A= + =0A= + (defun Buffer-menu-mouse-save (event)=0A= + "Mark buffer to be saved.=0A= + Actual deletion is done via = `\\\\[Buffer-menu-execute]' \=0A= + or `\\\\[Buffer-menu-mouse-execute]'."=0A= + (interactive "e")=0A= + (select-window (posn-window (event-end event)))=0A= + (goto-char (posn-point (event-end event)))=0A= + (beginning-of-line)=0A= + (forward-char 1)=0A= + (if (looking-at " [-M]") ;header lines=0A= + (ding)=0A= + (let ((buffer-read-only nil))=0A= + (delete-char 1)=0A= + (insert ?S)))=0A= + (beginning-of-line))=0A= + =0A= + (defun Buffer-menu-mouse-delete (event)=0A= + "Mark buffer to be deleted.=0A= + Actual deletion is done via = `\\\\[Buffer-menu-execute]' \=0A= + or `\\\\[Buffer-menu-mouse-execute]'."=0A= + (interactive "e")=0A= + (select-window (posn-window (event-end event)))=0A= + (goto-char (posn-point (event-end event)))=0A= + (beginning-of-line)=0A= + (if (looking-at " [-M]") ;header lines=0A= + (ding)=0A= + (let ((buffer-read-only nil))=0A= + (delete-char 1)=0A= + (insert ?D)))=0A= + (beginning-of-line))=0A= + =0A= + (defun Buffer-menu-mouse-modified (event)=0A= + "Mark buffer as unmodified (no changes to save) if modified, and = vice versa."=0A= + (interactive "e")=0A= + (select-window (posn-window (event-end event)))=0A= + (goto-char (posn-point (event-end event)))=0A= + (beginning-of-line)=0A= + (forward-char 1)=0A= + (let ((buffer-read-only nil)=0A= + modified-p)=0A= + (save-excursion=0A= + (set-buffer (Buffer-menu-buffer t))=0A= + (set-buffer-modified-p (not (buffer-modified-p))))=0A= + (cond ((=3D ?\* (char-after (point)))=0A= + (delete-char 1)=0A= + (insert ?\ ))=0A= + (t=0A= + (delete-char 1)=0A= + (insert ?\*))))=0A= + (beginning-of-line))=0A= + =0A= + (defun Buffer-menu-mouse-execute (event)=0A= + "Save and/or delete buffers marked `S' or `D', respectively.=0A= + Buffers can be marked via commands `\\\=0A= + \\[Buffer-menu-save]' and = `\\\\[Buffer-menu-delete]'=0A= + \(or `\\\\[Buffer-menu-mouse-save]' and \=0A= + `\\\\[Buffer-menu-mouse-delete]')."=0A= + (interactive "e")=0A= + (select-window (posn-window (event-end event)))=0A= + (save-excursion=0A= + (Buffer-menu-beginning)=0A= + (while (if (> emacs-major-version 21)=0A= + (re-search-forward "^..S" nil t)=0A= + (re-search-forward "^.S" nil t))=0A= + (let ((modp nil))=0A= + (save-excursion=0A= + (set-buffer (Buffer-menu-buffer t))=0A= + (save-buffer)=0A= + (setq modp (buffer-modified-p)))=0A= + (let ((buffer-read-only nil))=0A= + (delete-char -1)=0A= + (insert (if modp ?* ? ))))))=0A= + (save-excursion=0A= + (Buffer-menu-beginning)=0A= + (let ((buff-menu-buffer (current-buffer))=0A= + (buffer-read-only nil))=0A= + (while (re-search-forward "^D" nil t)=0A= + (forward-char -1)=0A= + (let ((buf (Buffer-menu-buffer nil)))=0A= + (or (eq buf nil) (eq buf buff-menu-buffer)=0A= + (save-excursion (kill-buffer buf)))=0A= + (if (and buf (buffer-name buf))=0A= + (progn (delete-char 1) (insert ? ))=0A= + (delete-region (point) (progn (forward-line 1) (point)))=0A= + (unless (bobp) (forward-char -1))))))))=0A= + =0A= ;; arch-tag: e7dfcfc9-6cb2-46e4-bf55-8ef1936d83c6=0A= ;;; buff-menu.el ends here=0A= =0A= Diff finished at Mon Jul 09 16:13:02=0A= ------=_NextPart_000_002A_01C7C249.96519A80 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_NextPart_000_002A_01C7C249.96519A80--