add function to get filename of buffer

This commit is contained in:
2025-06-15 22:55:25 +02:00
parent a310ee8795
commit 79b15d7822

View File

@@ -282,6 +282,22 @@ Examples:
(my-interpolate (nth 2 (car rgbsteps)) (nth 2 (cadr rgbsteps)) position (caar rgbsteps) (caadr rgbsteps))
(my-interpolate (nth 3 (car rgbsteps)) (nth 3 (cadr rgbsteps)) position (caar rgbsteps) (caadr rgbsteps))))))
(defun my-filename ()
"Copy the full path of the current buffer into the `kill-ring' and
print it in the message buffer."
(interactive)
(let ((fn (buffer-file-name (window-buffer (minibuffer-selected-window)))))
(kill-new fn)
(message fn)))
(defun my-filename-basename ()
"Copy the basename of the current buffer into the `kill-ring' and
print it in the message buffer."
(interactive)
(let ((fn (file-name-nondirectory (my-filename))))
(kill-new fn)
(message fn)))
(defun my-gui-elements-toggle ()
"Function to toggle gui elements on/off."
(interactive)