summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@paredit.org>2022-11-26 23:19:43 +0000
committerTaylor R Campbell <campbell@paredit.org>2022-11-26 23:42:35 +0000
commit45209275259c71b1f68cce4760747fa0ccc93b9b (patch)
tree866f72f794c4fc48c6e275eb18c9490142186962 /paredit.el
parent4aed723112fb69e52b51b626ee1e4621ed03631b (diff)
paredit-kill: Tweak rule for adding space if kill-whole-line is t.
For now, disable the yank part of the test -- with kill-whole-line, killing and then yanking is not always a noop and it's not clear making it a noop is the right approach. I don't use kill-whole-line so I'm not sure what expectations are and I'm reluctant to change it, except to fix obviously-wrong outcomes like (x|(y)) that should be (x| (y)). While here, document the effect of kill-whole-line on paredit-kill.
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/paredit.el b/paredit.el
index 8522421..ea14a15 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1509,7 +1509,12 @@ On a line with no S-expressions on it starting after the point or
within a comment, act exactly as `kill-line'.
Otherwise, kill all S-expressions that start after the point.
With a `C-u' prefix argument, just do the standard `kill-line'.
-With a numeric prefix argument N, do `kill-line' that many times."
+With a numeric prefix argument N, do `kill-line' that many times.
+
+If `kill-whole-line' is true, kills the newline character and
+ indentation on the next line as well.
+In that case, ensure there is at least one space between the
+ preceding S-expression and whatever follows on the next line."
(interactive "P")
(cond (argument
(kill-line (if (integerp argument) argument 1)))
@@ -1623,13 +1628,9 @@ With a numeric prefix argument N, do `kill-line' that many times."
;; Insert a space to avoid invalid joining if necessary.
((let ((syn-before (char-syntax (char-before)))
(syn-after (char-syntax (char-after))))
- (or (and (eq syn-before ?\) ) ; Separate opposing
- (eq syn-after ?\( )) ; parentheses,
- (and (eq syn-before ?\" ) ; string delimiter
- (eq syn-after ?\" )) ; pairs,
- (and (memq syn-before '(?_ ?w)) ; or word or symbol
- (memq syn-after '(?_ ?w))))) ; constituents.
- (insert " "))))
+ (and (memq syn-before '(?\) ?\" ?_ ?w))
+ (memq syn-after '(?\( ?\" ?_ ?w))))
+ (save-excursion (insert " ")))))
;;;;; Killing Words