;;; buff-menu.el --- buffer menu main function and support functions -*- coding:utf-8 -*-
-;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 2000, 2001, 2002,
-;; 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 1985-1987, 1993-1995, 2000-2011
;; Free Software Foundation, Inc.
;; Maintainer: FSF
This variable determines whether reverting the buffer lists only
file buffers. It affects both manual reverting and reverting by
Auto Revert Mode.")
-
(make-variable-buffer-local 'Buffer-menu-files-only)
+(defvar Buffer-menu--buffers nil
+ "If non-nil, list of buffers shown in the current buffer-menu.
+This variable determines whether reverting the buffer lists only
+these buffers. It affects both manual reverting and reverting by
+Auto Revert Mode.")
+(make-variable-buffer-local 'Buffer-menu--buffers)
+
(defvar Info-current-file) ;; from info.el
(defvar Info-current-node) ;; from info.el
(set (make-local-variable 'revert-buffer-function)
'Buffer-menu-revert-function)
(set (make-local-variable 'buffer-stale-function)
- #'(lambda (&optional noconfirm) 'fast))
+ (lambda (&optional _noconfirm) 'fast))
(setq truncate-lines t)
- (setq buffer-read-only t))
+ (setq buffer-read-only t)
+ ;; Force L2R direction, to avoid messing the display if the first
+ ;; buffer in the list happens to begin with a strong R2L character.
+ (setq bidi-paragraph-direction 'left-to-right))
(define-obsolete-variable-alias 'buffer-menu-mode-hook
'Buffer-menu-mode-hook "23.1")
-(defun Buffer-menu-revert-function (ignore1 ignore2)
+(defun Buffer-menu-revert-function (_ignore1 _ignore2)
(or (eq buffer-undo-list t)
(setq buffer-undo-list nil))
;; We can not use save-excursion here. The buffer gets erased.
(let ((opoint (point))
(eobp (eobp))
(ocol (current-column))
- (oline (progn (move-to-column 4)
+ (oline (progn (move-to-column Buffer-menu-buffer-column)
(get-text-property (point) 'buffer)))
(prop (point-min))
;; do not make undo records for the reversion.
;; interactively current buffer is correctly identified with a `.'
;; by `list-buffers-noselect'.
(with-current-buffer (window-buffer)
- (list-buffers-noselect Buffer-menu-files-only))
+ (list-buffers-noselect Buffer-menu-files-only Buffer-menu--buffers))
(if oline
(while (setq prop (next-single-property-change prop 'buffer))
(when (eq (get-text-property prop 'buffer) oline)
(concat name
(propertize (make-string (- name+space-width (string-width name))
?\s)
- 'display `(space :align-to ,(+ 4 name+space-width)))
+ 'display `(space :align-to
+ ,(+ Buffer-menu-buffer-column
+ name+space-width)))
size)))
(defun Buffer-menu-sort (column)
(save-excursion
(Buffer-menu-beginning)
(while (not (eobp))
- (when (buffer-live-p (setq buf (get-text-property (+ (point) 4) 'buffer)))
+ (when (buffer-live-p
+ (setq buf (get-text-property
+ (+ (point)
+ Buffer-menu-buffer-column)
+ 'buffer)))
(setq m1 (char-after)
m1 (if (memq m1 '(?> ?D)) m1)
m2 (char-after (+ (point) 2))
(save-excursion
(Buffer-menu-beginning)
(while (not (eobp))
- (when (setq buf (assq (get-text-property (+ (point) 4) 'buffer) l))
+ (when (setq buf (assq (get-text-property (+ (point)
+ Buffer-menu-buffer-column)
+ 'buffer) l))
(setq m1 (cadr buf)
m2 (cadr (cdr buf)))
(when m1
(setq buffer-read-only nil)
(erase-buffer)
(setq standard-output (current-buffer))
+ ;; Force L2R direction, to avoid messing the display if the
+ ;; first buffer in the list happens to begin with a strong R2L
+ ;; character.
+ (setq bidi-paragraph-direction 'left-to-right)
(unless Buffer-menu-use-header-line
;; Use U+2014 (EM DASH) to underline if possible, else use ASCII
;; (i.e. U+002D, HYPHEN-MINUS).
(and desired-point
(goto-char desired-point))
(setq Buffer-menu-files-only files-only)
+ (setq Buffer-menu--buffers buffer-list)
(set-buffer-modified-p nil)
(current-buffer))))