Emacs 中剪贴板的文件路径 [英] File path to clipboard in Emacs
本文介绍了Emacs 中剪贴板的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将当前完整文件名和文件路径发送到剪贴板的最简单方法是什么?
What is the most simple way to send current full file name with file path to clipboard?
我现在使用的是消息缓冲区:我复制保存文件后出现在那里的文件名.但是,我想,应该有更简单的方法.
What I am using now is messages buffer: I copy file name that appears there after saving a file. But, I suppose, there should be much more simple way.
推荐答案
我用这个:
(defun my-put-file-name-on-clipboard ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name))))
(when filename
(with-temp-buffer
(insert filename)
(clipboard-kill-region (point-min) (point-max)))
(message filename))))
这篇关于Emacs 中剪贴板的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文