From 0bb4e47a6caeaa30279ffb4e1b04271b5a0c7a40 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 23 Dec 2020 19:30:47 -0500 Subject: Fix km/magit-copy-{commit-message,hunk} 2f209622 (km-magit: Don't use obsolete magit-section-when, 2018-12-09) botched the magit-section-when to magit-section-match conversion. Before that, I missed adjusting km/magit-copy-commit-message for the `message' to `commit-message' rename in cfed6f5b (Bind RET to magit-show-commit on commit messages in rev buffers, 2017-11-08). That I didn't notice until now is probably a sign I don't use these enough to keep them around. --- lisp/km-magit.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lisp') diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 11584c1..91c03b8 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -988,9 +988,10 @@ COMMIT." (t (concat (car msg-lines) "[...]")))))) (defun km/magit-copy-commit-message (&optional _) - (when (magit-section-match 'message) - (let ((msg (buffer-substring-no-properties (oref it start) - (oref it end)))) + (when (magit-section-match 'commit-message) + (let* ((section (magit-current-section)) + (msg (buffer-substring-no-properties (oref section start) + (oref section end)))) (kill-new msg) (km/magit-copy--truncated-message msg)))) @@ -1008,11 +1009,12 @@ COMMIT." (defun km/magit-copy-hunk (&optional _) (when (magit-section-match 'hunk) - (kill-new (buffer-substring-no-properties - (save-excursion (goto-char (oref it start)) - (1+ (point-at-eol))) - (oref it end))) - (message "Copied hunk: %s" (oref it value)))) + (let ((section (magit-current-section))) + (kill-new (buffer-substring-no-properties + (save-excursion (goto-char (oref section start)) + (1+ (point-at-eol))) + (oref section end))) + (message "Copied hunk: %s" (oref section value))))) (defun km/magit-copy-as-kill () "Try `km/magit-copy-functions' before calling `magit-copy-section-value'. -- cgit v1.2.3