fix(default): +default/yank-buffer-path echos the file name as nil

Emacs 29 with PGTK's kill-new doesn't return its STRING argument (with
the default settings) anymore, so we explicitly pass the file path to
prevent the confusing message "Copied path to clipboard: nil".
This commit is contained in:
Daanturo 2022-04-12 22:50:08 +07:00 committed by Henrik Lissner
parent 00f3928052
commit 08dac1400f

View file

@ -44,11 +44,14 @@
(interactive)
(if-let (filename (or (buffer-file-name (buffer-base-buffer))
(bound-and-true-p list-buffers-directory)))
(message "Copied path to clipboard: %s"
(kill-new (abbreviate-file-name
(let ((path (abbreviate-file-name
(if root
(file-relative-name filename root)
filename))))
(kill-new path)
(if (string= path (car kill-ring))
(message "Copied path: %s" path)
(user-error "Couldn't copy filename in current buffer")))
(error "Couldn't find filename in current buffer")))
;;;###autoload