From 855db2c9c439e9be1c66520f44615369b648a914 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 1 Dec 2026 12:04:14 +0000 Subject: nits --- lib/eos/jao-buffers.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/eos/jao-buffers.el') diff --git a/lib/eos/jao-buffers.el b/lib/eos/jao-buffers.el index 800b264..5665117 100644 --- a/lib/eos/jao-buffers.el +++ b/lib/eos/jao-buffers.el @@ -21,7 +21,28 @@ ;;; deps (require 'eldoc) +(require 'dired) +;;; copy buffer file name +;; https://stackoverflow.com/questions/18812938/copy-full-file-path-into-copy-paste-clipboard +;;;###autoload +(defun copy-buffer-file-name-as-kill (choice) + "Copy the buffer-file-name to the kill-ring" + (interactive "cCopy buffer name: (f)ull, (d)irectory, (n)ame") + (let ((new-kill-string) + (name (if (eq major-mode 'dired-mode) + (dired-get-filename) + (or (buffer-file-name) "")))) + (cond ((eq choice ?f) + (setq new-kill-string name)) + ((eq choice ?d) + (setq new-kill-string (file-name-directory name))) + ((eq choice ?n) + (setq new-kill-string (file-name-nondirectory name))) + (t (message "Quit"))) + (when new-kill-string + (message "%s copied" new-kill-string) + (kill-new new-kill-string)))) ;;; lines ;;;###autoload -- cgit v1.2.3