summaryrefslogtreecommitdiff
path: root/lisp/ibuf-ext.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2016-07-08 17:22:56 +0900
committerTino Calancha <tino.calancha@gmail.com>2016-07-08 17:22:56 +0900
commit56c8551219ecace0157ce813733adf8eecb38c32 (patch)
treec7902df718f37216c749a1b6dabc80f8c8dc61f8 /lisp/ibuf-ext.el
parent0e6fa2ddf76a1d702d836db3786ec1e34f7dcf54 (diff)
downloademacs-56c8551219ecace0157ce813733adf8eecb38c32.tar.gz
Copy buffer names to kill ring
* ibuf-ext.el (ibuffer-copy-buffername-as-kill): New command. * lisp/ibuffer (ibuffer-mode-map): Bound it to 'B'. ;* etc/NEWS: Add entry for this new feature.
Diffstat (limited to 'lisp/ibuf-ext.el')
-rw-r--r--lisp/ibuf-ext.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 2444dac5805..6102e1f7400 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1462,6 +1462,23 @@ You can then feed the file name(s) to other commands with \\[yank]."
(kill-new result)
(message "%s" result))))
+;;;###autoload
+(defun ibuffer-copy-buffername-as-kill ()
+ "Copy buffer names of marked buffers into the kill ring.
+The names are separated by a space.
+You can then feed the file name(s) to other commands with \\[yank]."
+ (interactive)
+ (if (zerop (ibuffer-count-marked-lines))
+ (message "No buffers marked; use 'm' to mark a buffer")
+ (let ((res ""))
+ (ibuffer-map-marked-lines
+ #'(lambda (buf _mark)
+ (setq res (concat res (buffer-name buf) " "))))
+ (when (not (zerop (length res)))
+ (setq res (substring res 0 -1)))
+ (kill-new res)
+ (message res))))
+
(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
(let ((count
(ibuffer-map-lines