(provide 'cut-file) (defun cut-filename () "Store the current filename in the X Window System cut buffer. Nothing is done if the filename is nil, which happens if no filename has yet been associated with the buffer." (interactive) (let ((the-name (buffer-file-name))) (if (not (null the-name)) (progn (x-set-selection nil the-name) (message "Cut filename: %s" the-name))))) (global-set-key [f22] 'cut-filename) ;Sun Print-Screen key (defun cut-filename-as-URL () "Store the current filename as a local URL in the X Window System cut buffer. Nothing is done if the filename is nil, which happens if no filename has yet been associated with the buffer." (interactive) (let ((the-name (concat "file://localhost" (buffer-file-name)))) (if (not (null the-name)) (progn (x-set-selection nil the-name) (message "Cut URL: %s" the-name))))) (global-set-key [S-f22] 'cut-filename-as-URL) ;Sun Shift Print-Screen key