emacselispclipboardaquamacs

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


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

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.


Solution

  • 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