Skip to content

Instantly share code, notes, and snippets.

@kyanagi
Created January 22, 2014 16:43
Show Gist options
  • Save kyanagi/8562198 to your computer and use it in GitHub Desktop.
Save kyanagi/8562198 to your computer and use it in GitHub Desktop.
(defun kill-buffer-file-name (nondirectory-p)
(interactive "P")
(let ((file-name (buffer-file-name)))
(if (stringp file-name)
(progn
(when nondirectory-p
(setq file-name (file-name-nondirectory file-name)))
(message "%s" file-name)
(kill-new file-name))
(error "This buffer does not visit a file"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment