used kill-new instead of temp buffer in prelude-copy-file-name-to-clipboard

This commit is contained in:
Bozhidar Batsov 2012-02-23 16:21:19 +02:00
parent 74a6b44884
commit c8d307d8cc

View file

@ -175,16 +175,14 @@ the curson at its beginning, according to the current mode."
'display '(left-fringe right-triangle))))))) 'display '(left-fringe right-triangle)))))))
(defun prelude-copy-file-name-to-clipboard () (defun prelude-copy-file-name-to-clipboard ()
"Put the current file name on the clipboard." "Copy the current buffer file name to the clipboard."
(interactive) (interactive)
(let ((filename (if (equal major-mode 'dired-mode) (let ((filename (if (equal major-mode 'dired-mode)
default-directory default-directory
(buffer-file-name)))) (buffer-file-name))))
(when filename (when filename
(with-temp-buffer (kill-new filename)
(insert filename) (message "Copied buffer file name '%s' to the clipboard." filename))))
(clipboard-kill-region (point-min) (point-max)))
(message filename))))
(defun prelude-duplicate-current-line-or-region (arg) (defun prelude-duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times. "Duplicates the current line or region ARG times.