APPROVE COMMIT 21.5
This is a small feature that I've been running with for a while that I
find quite useful for turning uniquified buffer names into file names
after I've killed the other buffers of those names.
I'll take it back out if anybody objects or changes the binding if
they want the keystroke.
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.711
diff -u -U0 -r1.711 ChangeLog
--- lisp/ChangeLog 18 Dec 2005 19:05:56 -0000 1.711
+++ lisp/ChangeLog 23 Dec 2005 11:36:54 -0000
@@ -0,0 +1,5 @@
+2005-12-22 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * buff-menu.el (Buffer-menu-rename): New command.
+ (Buffer-menu-mode-map): Bind it to ?r.
+
Index: lisp/buff-menu.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/buff-menu.el,v
retrieving revision 1.9
diff -u -r1.9 buff-menu.el
--- lisp/buff-menu.el 15 Mar 2002 07:43:18 -0000 1.9
+++ lisp/buff-menu.el 23 Dec 2005 11:37:40 -0000
@@ -91,6 +91,7 @@
(define-key Buffer-menu-mode-map "k" 'Buffer-menu-delete)
(define-key Buffer-menu-mode-map "\C-d" 'Buffer-menu-delete-backwards)
(define-key Buffer-menu-mode-map "\C-k" 'Buffer-menu-delete)
+ (define-key Buffer-menu-mode-map "r" 'Buffer-menu-rename)
(define-key Buffer-menu-mode-map "x" 'Buffer-menu-execute)
(define-key Buffer-menu-mode-map " " 'next-line)
(define-key Buffer-menu-mode-map "n" 'next-line)
@@ -260,6 +261,18 @@
(Buffer-menu-delete (- (or arg 1)))
(while (looking-at " [-M]")
(forward-line 1)))
+
+(defun Buffer-menu-rename (newname unique)
+ "Rename buffer on this line to NEWNAME, immediately.
+If given a prefix argument, automatically uniquify. See `rename-buffer'."
+ (interactive "sNew name for buffer: \np")
+ (beginning-of-line)
+ (if (looking-at " [-M]") ;header lines
+ (ding)
+ (save-excursion
+ (set-buffer (Buffer-menu-buffer t))
+ (rename-buffer newname unique))
+ (revert-buffer)))
(defun Buffer-menu-save ()
"Mark buffer on this line to be saved by
\\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command."
--
School of Systems and Information Engineering
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.