From 601ed8a0b1e5238534acf1799332d7ef1040750a Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Tue, 15 Aug 2000 21:28:08 +0000 Subject: [PATCH] (list-buffers-noselect): Set `buffer' as well as 'buffer-menu' property. (Buffer-menu-buffer): Use `buffer' property if `buffer-name' fails. (Buffer-menu-execute): When deleting, test `(and buf (buffer-name buf))', instead of `(Buffer-menu-buffer nil)', to see if buffer wasn't killed. --- lisp/buff-menu.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index cd7c8debcbd..c84ed105d9b 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -158,15 +158,18 @@ Letters do not insert themselves; instead, they are commands. (let* ((where (save-excursion (beginning-of-line) (+ (point) Buffer-menu-buffer-column))) - (name (and (not (eobp)) (get-text-property where 'buffer-name)))) + (name (and (not (eobp)) (get-text-property where 'buffer-name))) + (buf (and (not (eobp)) (get-text-property where 'buffer)))) (if name (or (get-buffer name) + (and buf (buffer-name buf) buf) (if error-if-non-existent-p (error "No buffer named `%s'" name) nil)) + (or (and buf (buffer-name buf) buf) (if error-if-non-existent-p (error "No buffer on this line") - nil)))) + nil))))) (defun buffer-menu (&optional arg) "Make a menu of buffers so you can save, delete or select them. @@ -305,12 +308,12 @@ and then move up one line. Prefix arg means move that many lines." (let ((buf (Buffer-menu-buffer nil))) (or (eq buf nil) (eq buf buff-menu-buffer) - (save-excursion (kill-buffer buf)))) - (if (Buffer-menu-buffer nil) + (save-excursion (kill-buffer buf))) + (if (and buf (buffer-name buf)) (progn (delete-char 1) (insert ? )) (delete-region (point) (progn (forward-line 1) (point))) - (forward-char -1)))))) + (forward-char -1))))))) (defun Buffer-menu-select () "Select this line's buffer; also display buffers marked with `>'. @@ -548,6 +551,8 @@ The R column contains a % for buffers that are read-only." (indent-to 17 2) (put-text-property this-buffer-line-start name-end 'buffer-name name) + (put-text-property this-buffer-line-start (point) + 'buffer buffer) (put-text-property this-buffer-line-start name-end 'mouse-face 'highlight)) (let (size -- 2.39.2