Eval this code:
(defun xx-display-filename (filename)
""
(interactive "Ffilename: ")
(message (concat "Filename is: " filename)))
Let's assume that I am editing a ~/.emacs.d/personal/custom.el
file in the current buffer.
The function above, when invoked with M-x xx-display-filename
displays a following text in a minibuffer:
filename: ~/.emacs.d/personal/
This is confusing. I can see a valid path but name of the file is missing. I would expect to see this:
filename: ~/.emacs.d/personal/custom.el
This is confusing even more. When executed, this function writes a following line in
*Messages*
buffer:Filename is: ~/.emacs.d/personal/custom.el
I would expect to see the same text as in a minibuffer:
Filename is: ~/.emacs.d/personal/
So, the question is, How can I display whole path and filename of the currently edited file in a minibuffer and pass it as an argument to an interactive function?