diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-12-23 19:30:47 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-12-24 00:25:22 -0500 |
commit | 0bb4e47a6caeaa30279ffb4e1b04271b5a0c7a40 (patch) | |
tree | 75a82752a12d717d1e7cc14bd40dc108b592ec9b /lisp | |
parent | 4b76b0fd88d488ed2896138a957a68cfbb951582 (diff) | |
download | emacs.d-0bb4e47a6caeaa30279ffb4e1b04271b5a0c7a40.tar.gz |
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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/km-magit.el | 18 |
1 files changed, 10 insertions, 8 deletions
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'. |