aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-08-20 22:57:48 -0400
committerKyle Meyer <kyle@kyleam.com>2015-08-20 23:00:31 -0400
commit147bedff820cd04274eb32ab3fa25d3d75b78ce3 (patch)
tree841d008a6c82f4b528a266c26e72744b0eea2ce3 /lisp
parentad2575ed8a73f070c635e33ad7c81bab6e28ac71 (diff)
magit-copy-as-kill: don't kill nil values
Diffstat (limited to 'lisp')
-rw-r--r--lisp/magit.el27
1 files changed, 13 insertions, 14 deletions
diff --git a/lisp/magit.el b/lisp/magit.el
index af1adcc..66794d7 100644
--- a/lisp/magit.el
+++ b/lisp/magit.el
@@ -2126,20 +2126,19 @@ When the region is active, then behave like `kill-ring-save'."
(interactive)
(if (region-active-p)
(copy-region-as-kill (mark) (point) 'region)
- (-when-let (section (magit-current-section))
- (let ((value (magit-section-value section)))
- (magit-section-case
- (branch (when current-prefix-arg
- (setq value (magit-rev-parse value))))
- (commit (setq value (magit-rev-parse value)))
- (module-commit (let ((default-directory
- (file-name-as-directory
- (expand-file-name
- (magit-section-parent-value section)
- (magit-toplevel)))))
- (setq value (magit-rev-parse value))))
- (t value))
- (kill-new (message "%s" value))))))
+ (-when-let* ((section (magit-current-section))
+ (value (magit-section-value section)))
+ (magit-section-case
+ (branch (when current-prefix-arg
+ (setq value (magit-rev-parse value))))
+ (commit (setq value (magit-rev-parse value)))
+ (module-commit (let ((default-directory
+ (file-name-as-directory
+ (expand-file-name
+ (magit-section-parent-value section)
+ (magit-toplevel)))))
+ (setq value (magit-rev-parse value)))))
+ (kill-new (message "%s" value)))))
(defun magit-copy-buffer-thing-as-kill ()
"Save the thing displayed in the current buffer to the kill ring.