diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-09-24 04:32:08 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-09-24 04:32:08 +0000 |
commit | 6cefcd9c163d68dcbffb266fd9a15e3ef5349ef4 (patch) | |
tree | 1a681ba5b985f1d1daa2276c977b6c80e4591f6b /lisp/buff-menu.el | |
parent | 4c64051dac71073ec610ba6701a851f384ee634f (diff) | |
download | emacs-6cefcd9c163d68dcbffb266fd9a15e3ef5349ef4.tar.gz |
(Buffer-menu-delete): Handle prefix arg.
(Buffer-menu-delete-backwards): Handle prefix; use Buffer-menu-delete.
Diffstat (limited to 'lisp/buff-menu.el')
-rw-r--r-- | lisp/buff-menu.el | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index cafd2c2e804..f766c0da8fb 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el @@ -213,24 +213,35 @@ Optional ARG means move up." (Buffer-menu-unmark) (forward-line -1)) -(defun Buffer-menu-delete () - "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command." - (interactive) +(defun Buffer-menu-delete (&optional arg) + "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command. +Prefix arg is how many buffers to delete. +Negative arg means delete backwards." + (interactive "p") (beginning-of-line) (if (looking-at " [-M]") ;header lines (ding) (let ((buffer-read-only nil)) - (delete-char 1) - (insert ?D) - (forward-line 1)))) - -(defun Buffer-menu-delete-backwards () + (if (or (null arg) (= arg 0)) + (setq arg 1)) + (while (> arg 0) + (delete-char 1) + (insert ?D) + (forward-line 1) + (setq arg (1- arg))) + (while (< arg 0) + (delete-char 1) + (insert ?D) + (forward-line -1) + (setq arg (1+ arg)))))) + +(defun Buffer-menu-delete-backwards (&optional arg) "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command -and then move up one line" - (interactive) - (Buffer-menu-delete) - (forward-line -2) - (if (looking-at " [-M]") (forward-line 1))) +and then move up one line. Prefix arg means move that many lines." + (interactive "p") + (Buffer-menu-delete (- (or arg 1))) + (while (looking-at " [-M]") + (forward-line 1))) (defun Buffer-menu-save () "Mark buffer on this line to be saved by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command." |