aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-17 01:58:05 +0000
committerRichard M. Stallman2001-12-17 01:58:05 +0000
commita3f4a3ef81488a32a7bcc9399f9226d6e081bb45 (patch)
treeac268be2a261d1a46252a37842dc33440c5c1949 /lisp
parent34630d66e173520221d918cb461346d3adad05be (diff)
downloademacs-a3f4a3ef81488a32a7bcc9399f9226d6e081bb45.tar.gz
emacs-a3f4a3ef81488a32a7bcc9399f9226d6e081bb45.zip
(dired-copy-filename-as-kill): Moved from dired-x.el.
(dired-mode-map): Bind w to dired-copy-filename-as-kill.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/dired.el30
1 files changed, 30 insertions, 0 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index bc49f0bf301..d4cbe4f936e 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -962,6 +962,7 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
962 (define-key map "t" 'dired-do-toggle) 962 (define-key map "t" 'dired-do-toggle)
963 (define-key map "u" 'dired-unmark) 963 (define-key map "u" 'dired-unmark)
964 (define-key map "v" 'dired-view-file) 964 (define-key map "v" 'dired-view-file)
965 (define-key map "w" 'dired-copy-filename-as-kill)
965 (define-key map "x" 'dired-do-flagged-delete) 966 (define-key map "x" 'dired-do-flagged-delete)
966 (define-key map "y" 'dired-show-file-type) 967 (define-key map "y" 'dired-show-file-type)
967 (define-key map "+" 'dired-create-directory) 968 (define-key map "+" 'dired-create-directory)
@@ -1632,6 +1633,35 @@ regardless of the language.")
1632 (point)))) 1633 (point))))
1633 1634
1634 1635
1636;;; COPY NAMES OF MARKED FILES INTO KILL-RING.
1637
1638(defun dired-copy-filename-as-kill (&optional arg)
1639 "Copy names of marked (or next ARG) files into the kill ring.
1640The names are separated by a space.
1641With a zero prefix arg, use the complete pathname of each marked file.
1642With \\[universal-argument], use the relative pathname of each marked file.
1643
1644If on a subdir headerline, use subdirname instead; prefix arg is ignored
1645in this case.
1646
1647You can then feed the file name(s) to other commands with \\[yank]."
1648 (interactive "P")
1649 (let ((string
1650 (or (dired-get-subdir)
1651 (mapconcat (function identity)
1652 (if arg
1653 (cond ((zerop (prefix-numeric-value arg))
1654 (dired-get-marked-files))
1655 ((integerp arg)
1656 (dired-get-marked-files 'no-dir arg))
1657 (t ; else a raw arg
1658 (dired-get-marked-files t)))
1659 (dired-get-marked-files 'no-dir))
1660 " "))))
1661 (kill-new string)
1662 (message "%s" string)))
1663
1664
1635;; Keeping Dired buffers in sync with the filesystem and with each other 1665;; Keeping Dired buffers in sync with the filesystem and with each other
1636 1666
1637(defun dired-buffers-for-dir (dir &optional file) 1667(defun dired-buffers-for-dir (dir &optional file)