summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-07-01 00:45:22 -0400
committerKyle Meyer <kyle@kyleam.com>2017-07-01 00:48:11 -0400
commitf6de4198f4edfda6468e10d55123e823528543f5 (patch)
tree50c60d0a6948bac31355bbd510bdf678b5db8ba7
parent17d7a40875861a198e4eb75bd509be8ea270f0b2 (diff)
downloademacs.d-f6de4198f4edfda6468e10d55123e823528543f5.tar.gz
diff-review: Add open-line variant
-rw-r--r--lisp/km-diff.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/km-diff.el b/lisp/km-diff.el
index f1801e9..19afba9 100644
--- a/lisp/km-diff.el
+++ b/lisp/km-diff.el
@@ -83,6 +83,7 @@
(define-key map (kbd "C-w") #'km/diff-review-copy-comment)
(define-key map (kbd "C-c C-n") #'km/diff-review-next-comment)
(define-key map (kbd "C-c C-p") #'km/diff-review-previous-comment)
+ (define-key map (kbd "M-o") #'km/diff-review-open-line)
map)
"Keymap for Diff Review mode.")
@@ -202,5 +203,18 @@ If N is negative, move to forward instead."
(interactive "p")
(km/diff-review-next-comment (- n)))
+(defun km/diff-review-open-line ()
+ "Insert a comment line above point.
+If point is currently on a comment block, insert a single line.
+Otherwise, insert a block of three comment lines and position
+point at the middle line."
+ (interactive)
+ (goto-char (point-at-bol))
+ (if (eq ?: (char-after))
+ (progn (insert ": \n")
+ (backward-char))
+ (insert ": \n: \n: \n")
+ (backward-char 4)))
+
(provide 'km-diff)
;;; km-diff.el ends here