The function to show current file's full path in mini buffer

前端 未结 12 500
醉梦人生
醉梦人生 2020-12-12 11:58

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 getti
12条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 12:43

    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?

    You can if you shell out to something like xclip (Linux), pbcopy (Mac), putclip (Cygwin).

    I personally use wrapper scripts c and p for copy and paste respectively, the first reading from standard input, the latter writing to standard output. That way, this works on all my development platforms:

    (shell-command (format "echo '%s' | c" buffer-file-name))
    

    I find this more reliable and configurable than using the Emacs clipboard support. For example, my c command copies the input to all 3 clipboards on Linux (primary, secondary, clipboard), so I can paste with either Ctrl-V or middle click.

提交回复
热议问题