emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/paredit adfccc5 123/224: Check `paredit-kill' in a comment


From: ELPA Syncer
Subject: [nongnu] elpa/paredit adfccc5 123/224: Check `paredit-kill' in a comment more carefully.
Date: Sat, 7 Aug 2021 09:22:33 -0400 (EDT)

branch: elpa/paredit
commit adfccc519e17f3e7a3596fe20480398d9ea0956a
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>

    Check `paredit-kill' in a comment more carefully.
    
    Ignore-this: 15f19e277834ce01b503d4adde69f56e
    
    darcs-hash:20110411180857-00fcc-c3b0a9464be06835aaf1ce7fb06034c31705ea37
---
 paredit.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]