summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2013-04-07 16:19:33 +0000
committerTaylor R Campbell <campbell@mumble.net>2013-04-07 16:19:33 +0000
commitf25cd3bc40865d2a61485a556e1041eff3e28892 (patch)
tree65da410af39622a8961851c778ec58d929329b57 /paredit.el
parentb647a1a7ec2e5c7fcf7f6c7f4b612349b1d5b025 (diff)
Add a zillion paredit-kill tests. Fix a tiny bug they revealed.
`paredit-kill' at the end of the line in a comment failed to put the string `\n' into the kill ring, as revealed by these tests.
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/paredit.el b/paredit.el
index f676ad3..3e54481 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1248,14 +1248,18 @@ With a `C-u' prefix argument, simply delete a character forward,
(backward-delete-char 1)
(delete-char 1)))))
-(defun paredit-forward-delete-in-comment ()
- ;; Point is in a comment, possibly at eol. Refuse to delete a
- ;; comment end if moving the next line into the comment would break
- ;; structure.
+(defun paredit-check-forward-delete-in-comment ()
+ ;; Point is in a comment, possibly at eol. We are about to delete
+ ;; some characters forward; if we are at eol, we are about to delete
+ ;; the line break. Refuse to do so if if moving the next line into
+ ;; the comment would break structure.
(if (eolp)
(let ((next-line-start (point-at-bol 2))
(next-line-end (point-at-eol 2)))
- (paredit-check-region next-line-start next-line-end)))
+ (paredit-check-region next-line-start next-line-end))))
+
+(defun paredit-forward-delete-in-comment ()
+ (paredit-check-forward-delete-in-comment)
(delete-char 1))
(defun paredit-forward-delete-comment-start ()
@@ -1397,13 +1401,10 @@ With a numeric prefix argument N, do `kill-line' that many times."
(cdr (paredit-string-start+end-points)))))))
(defun paredit-kill-line-in-comment ()
- ;; If we're at the end of line, this is the same as deleting the line
- ;; end, which `paredit-forward-delete-in-comment' handles carefully.
;; The variable `kill-whole-line' is not relevant: the point is in a
;; comment, and hence not at the beginning of the line.
- (if (eolp)
- (paredit-forward-delete-in-comment)
- (kill-line)))
+ (paredit-check-forward-delete-in-comment)
+ (kill-line))
(defun paredit-kill-sexps-on-line ()
(if (paredit-in-char-p) ; Move past the \ and prefix.