aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2016-07-08 17:22:56 +0900
committerTino Calancha2016-07-08 17:22:56 +0900
commit56c8551219ecace0157ce813733adf8eecb38c32 (patch)
treec7902df718f37216c749a1b6dabc80f8c8dc61f8
parent0e6fa2ddf76a1d702d836db3786ec1e34f7dcf54 (diff)
downloademacs-56c8551219ecace0157ce813733adf8eecb38c32.tar.gz
emacs-56c8551219ecace0157ce813733adf8eecb38c32.zip
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.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ibuf-ext.el17
-rw-r--r--lisp/ibuffer.el1
3 files changed, 22 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index f9fbe03e086..54b62f02ee3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -199,6 +199,10 @@ same as in modes where the character is not whitespace.
199** Ibuffer 199** Ibuffer
200 200
201--- 201---
202*** A new command 'ibuffer-copy-buffername-as-kill'; bound
203to 'B'.
204
205---
202*** New command 'ibuffer-change-marks'; bound to '* c'. 206*** New command 'ibuffer-change-marks'; bound to '* c'.
203 207
204--- 208---
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]."
1462 (kill-new result) 1462 (kill-new result)
1463 (message "%s" result)))) 1463 (message "%s" result))))
1464 1464
1465;;;###autoload
1466(defun ibuffer-copy-buffername-as-kill ()
1467 "Copy buffer names of marked buffers into the kill ring.
1468The names are separated by a space.
1469You can then feed the file name(s) to other commands with \\[yank]."
1470 (interactive)
1471 (if (zerop (ibuffer-count-marked-lines))
1472 (message "No buffers marked; use 'm' to mark a buffer")
1473 (let ((res ""))
1474 (ibuffer-map-marked-lines
1475 #'(lambda (buf _mark)
1476 (setq res (concat res (buffer-name buf) " "))))
1477 (when (not (zerop (length res)))
1478 (setq res (substring res 0 -1)))
1479 (kill-new res)
1480 (message res))))
1481
1465(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group) 1482(defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group)
1466 (let ((count 1483 (let ((count
1467 (ibuffer-map-lines 1484 (ibuffer-map-lines
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index fde17573dd7..37f72bc1aaa 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -586,6 +586,7 @@ directory, like `default-directory'."
586 586
587 (define-key map (kbd "k") 'ibuffer-do-kill-lines) 587 (define-key map (kbd "k") 'ibuffer-do-kill-lines)
588 (define-key map (kbd "w") 'ibuffer-copy-filename-as-kill) 588 (define-key map (kbd "w") 'ibuffer-copy-filename-as-kill)
589 (define-key map (kbd "B") 'ibuffer-copy-buffername-as-kill)
589 590
590 (define-key map (kbd "RET") 'ibuffer-visit-buffer) 591 (define-key map (kbd "RET") 'ibuffer-visit-buffer)
591 (define-key map (kbd "e") 'ibuffer-visit-buffer) 592 (define-key map (kbd "e") 'ibuffer-visit-buffer)