when editing a file (for example a .pl file)
Whats the quickest way to get the full path (path + filename) of the currently editing file in to the OS clipboard.
I'm on macOS, where
echo "hello" | pbcopy works btw
Here's the function I use, which you can bind to a keybinding. The link to the original author of the function is also provided.
;; http://camdez.com/blog/2013/11/14/emacs-show-buffer-file-name/ (defun cpm/show-and-copy-buffer-filename () "Show the full path to the current file in the minibuffer and copy to clipboard." (interactive) (let ((file-name (buffer-file-name))) (if file-name (progn (message file-name) (kill-new file-name)) (error "Buffer not visiting a file"))))