summaryrefslogtreecommitdiffhomepage
path: root/lib/eos/jao-buffers.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-12-01 12:04:14 +0000
committerjao <jao@gnu.org>2026-12-01 12:04:14 +0000
commit855db2c9c439e9be1c66520f44615369b648a914 (patch)
treece8623ffc3896fbf2acf6b4502ab7aa76c299ff1 /lib/eos/jao-buffers.el
parentbca51e1655d5a305745b7826cf5134f37f6a960a (diff)
downloadelibs-855db2c9c439e9be1c66520f44615369b648a914.tar.gz
elibs-855db2c9c439e9be1c66520f44615369b648a914.tar.bz2
nits
Diffstat (limited to 'lib/eos/jao-buffers.el')
-rw-r--r--lib/eos/jao-buffers.el21
1 files changed, 21 insertions, 0 deletions
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