diff options
author | Tino Calancha <f92capac@gmail.com> | 2016-02-23 20:12:59 +1100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2016-02-23 20:12:59 +1100 |
commit | b8dfc7beeb49d3fe673966f630126a38397e8d78 (patch) | |
tree | 284b19319f51b5487c201afe8b59f260300d3666 /lisp/ibuf-ext.el | |
parent | ed91405a07f694b0061ff5ebf9972a726cb1cb6e (diff) | |
download | emacs-b8dfc7beeb49d3fe673966f630126a38397e8d78.tar.gz |
Completely ignore buffers with no name when copying file names
* lisp/ibuf-ext.el (ibuffer-copy-filename-as-kill): Completely
ignore buffers with no file name. (bug#21577).
Diffstat (limited to 'lisp/ibuf-ext.el')
-rw-r--r-- | lisp/ibuf-ext.el | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 1d6182596ed..aa3ccbd40f7 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -1412,20 +1412,23 @@ You can then feed the file name(s) to other commands with \\[yank]." (ibuffer-map-marked-lines #'(lambda (buf _mark) (setq ibuffer-copy-filename-as-kill-result - (concat ibuffer-copy-filename-as-kill-result - (let ((name (buffer-file-name buf))) - (if name - (pcase type - (`full - name) - (`relative - (file-relative-name - name (or ibuffer-default-directory - default-directory))) - (_ - (file-name-nondirectory name))) - "")) - " ")))) + (concat ibuffer-copy-filename-as-kill-result + (let ((name (buffer-file-name buf))) + (cond (name + (concat + (pcase type + (`full + name) + (`relative + (file-relative-name + name (or ibuffer-default-directory + default-directory))) + (_ + (file-name-nondirectory name))) " ")) + (t ""))))))) + (when (not (zerop (length ibuffer-copy-filename-as-kill-result))) + (setq ibuffer-copy-filename-as-kill-result + (substring ibuffer-copy-filename-as-kill-result 0 -1))) (kill-new ibuffer-copy-filename-as-kill-result)))) (defun ibuffer-mark-on-buffer (func &optional ibuffer-mark-on-buffer-mark group) |