I am looking for a way to save the current full name of the file I am working in to my copy-paste buffer so that I can switch to another program and paste, for example .. 'C: \ some \ path \ file.txt'
I tried the following method, but actually does nothing:
(defun clip-file () "Put the current file name on the clipboard" (interactive) (let ((filename (if (equal major-mode 'dired-mode) (file-name-directory default-directory) (buffer-file-name)))) (when filename (x-select-text filename))))
The x-select-text interprogram-cut-function comes from the interprogram-cut-function , which is mentioned in the Copy-shortcut Mw help file as a variable containing a function that is called to save the kill-ring for external programs, so the text can be copied from Emacs to, for example , Firefox.
I use Emacs on my Windows PC, and therefore not sure if x-select-text will work, since AFAIK has something to do with X-Server from Linux?
source share