在mini缓冲区中显示当前文件的完整路径的功能 [英] The function to show current file's full path in mini buffer

查看:214
本文介绍了在mini缓冲区中显示当前文件的完整路径的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • 是否有一个功能?

  • 如果没有,这个elisp的功能是什么?

  • 如何将结果(路径名称)复制到剪贴板,以便我可以重用吗?



我使用的是Mac OS X和Aqumacs。

 (setq filepath(get-fullpath-current-file)) 
(copy-to-clipboard'filepath)???



ADDED



 
(defun show-file-name()
在minibuffer中显示完整路径文件名
(interactive)
(message(buffer-file-name))
(kill-new(file-truename buffer-file-name))

(全局设置键\C-cz'show-file-name)

结合我得到的两个答案,我可以得到我想要的。感谢您的答案。还有一些问题。




  • 什么是(文件名称)?

  • 我可以复制路径名称系统(OS)的剪贴板,而不是杀死戒指,以便我可以使用信息与其他应用程序?


解决方案

它是内置函数 buffer-file-name ,它为您提供了文件的完整路径。



最好的办法是让您的emacs窗口始终显示您正在编辑的缓冲区的系统名称和完整路径:

 (setq frame-title-format 
(list(format%s %% S:%% j(system-name))
'(buffer-file-name'%f(dired-directory dired-directory%b))))

你也可以这样做:

 (defun show-file-name()

(interactive)
(message(buffer-file-name)))

(global-set-key [ C-f1]'show-file-name);或者您想要的任何其他键


I need to get the full path of the file that I'm editing with emacs.

  • Is there a function for that?
  • If not, what would be the elisp function for getting that?
  • How can I copy the result (path name) to a clipboard so that I can reuse it?

I'm using Mac OS X and Aqumacs.

(setq filepath (get-fullpath-current-file)) ???
(copy-to-clipboard 'filepath) ???

ADDED

(defun show-file-name ()
  "Show the full path file name in the minibuffer."
  (interactive)
  (message (buffer-file-name))
  (kill-new (file-truename buffer-file-name))
)
(global-set-key "\C-cz" 'show-file-name)

Combining the two answers that I got, I could get what I want. Thanks for the answers. And some more questions.

  • What's for (file-truename)?
  • Can I copy the path name to System(OS)'s clipboard, not the kill ring so that I can use the info with the other apps?

解决方案

It's the built-in function buffer-file-name that gives you the full path of your file.

The best thing to do is to have your emacs window to always show your system-name and the full path of the buffer you're currently editing :

(setq frame-title-format
      (list (format "%s %%S: %%j " (system-name))
        '(buffer-file-name "%f" (dired-directory dired-directory "%b"))))

You can also do something like this :

(defun show-file-name ()
  "Show the full path file name in the minibuffer."
  (interactive)
  (message (buffer-file-name)))

(global-set-key [C-f1] 'show-file-name) ; Or any other key you want

这篇关于在mini缓冲区中显示当前文件的完整路径的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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