If both default and initial are nil and the buffer is visiting a file, read-file-name uses the. read-file-name returns the file name as the string '/gp/gnu/elisp.
The function to show current file's full path in mini buffer. 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.
- Buffer File Name. The buffer file name is the name of the file that is visited in that buffer. When a buffer is not visiting a file, its buffer file name is nil.
- Variable: buffer-file-name このバッファローカルな変数は、 カレントバッファで訪問しているファイルの名前を保持する。.
- Function: read-file-name prompt &optional directory default existing initial. Minibuffer ----- The file is /gp/gnu/elisp/-!- ----- Buffer: Minibuffer -----.
- 27.4 Buffer File Name. The buffer file name is the name of the file that is visited in that buffer. When a buffer is not visiting a file, its buffer file name is nil.
Variable: buffer-file-name. This buffer-local variable contains the name of the file being visited in the current buffer, or nil if it is not visiting a file.
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.