文件路径到剪贴板在Emacs [英] File path to clipboard in Emacs

查看:72
本文介绍了文件路径到剪贴板在Emacs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我现在使用的是消息缓冲区:我复制文件名,这个文件名是保存文件后出现。但是,我想,应该有更简单的方法。

解决方案

我使用这个:

 (defun my-put-file-name-on-clipboard()
将当前文件名放在剪贴板上
交互式)
(let((如果(等于主模式'dired模式)
default-directory
(buffer-file-name))))
filename
(with-temp-buffer
(insert filename)
(clipboard-kill-region(point-min)(point-max)))
(message filename)) ))


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.

解决方案

I use this:

(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆