summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2011-04-11 18:08:57 +0000
committerTaylor R Campbell <campbell@mumble.net>2011-04-11 18:08:57 +0000
commitadfccc519e17f3e7a3596fe20480398d9ea0956a (patch)
treeed88a5ff343ed73e21935476f9cb5791c9cd2f88
parent3c48233833f8afcf42b6e2e6722ae0badf28183d (diff)
Check `paredit-kill' in a comment more carefully.
Ignore-this: 15f19e277834ce01b503d4adde69f56e darcs-hash:20110411180857-00fcc-c3b0a9464be06835aaf1ce7fb06034c31705ea37
-rw-r--r--paredit.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/paredit.el b/paredit.el
index 72d7544..0541382 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1400,7 +1400,7 @@ With a numeric prefix argument N, do `kill-line' that many times."
((paredit-in-string-p)
(paredit-kill-line-in-string))
((paredit-in-comment-p)
- (kill-line))
+ (paredit-kill-line-in-comment))
((save-excursion (paredit-skip-whitespace t (point-at-eol))
(or (eolp) (eq (char-after) ?\; )))
;** Be careful about trailing backslashes.
@@ -1421,6 +1421,15 @@ With a numeric prefix argument N, do `kill-line' that many times."
(min (point-at-eol)
(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)))
+
(defun paredit-kill-sexps-on-line ()
(if (paredit-in-char-p) ; Move past the \ and prefix.
(backward-char 2)) ; (# in Scheme/CL, ? in elisp)