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:
parent
00f3928052
commit
08dac1400f
1 changed files with 8 additions and 5 deletions
|
@ -44,11 +44,14 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(if-let (filename (or (buffer-file-name (buffer-base-buffer))
|
(if-let (filename (or (buffer-file-name (buffer-base-buffer))
|
||||||
(bound-and-true-p list-buffers-directory)))
|
(bound-and-true-p list-buffers-directory)))
|
||||||
(message "Copied path to clipboard: %s"
|
(let ((path (abbreviate-file-name
|
||||||
(kill-new (abbreviate-file-name
|
(if root
|
||||||
(if root
|
(file-relative-name filename root)
|
||||||
(file-relative-name filename root)
|
filename))))
|
||||||
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")))
|
(error "Couldn't find filename in current buffer")))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue