From 08dac1400fe20a526acb5d66af384a5261a15fb9 Mon Sep 17 00:00:00 2001 From: Daanturo Date: Tue, 12 Apr 2022 22:50:08 +0700 Subject: [PATCH] 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". --- modules/config/default/autoload/text.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index 9b1510e67..f4dd9b76b 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -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 - (if root - (file-relative-name filename root) - filename)))) + (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