summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2011-03-22 07:44:46 +0000
committerTaylor R Campbell <campbell@mumble.net>2011-03-22 07:44:46 +0000
commita26a9a75e0472abc35ae877fcfc2a4b10745c588 (patch)
tree3e75bec801d1cbcd212e2f0f06fd90fb58a5a11b /paredit.el
parentace4f62faec2aa1f157ab9c647d023df15d44888 (diff)
Permit joining adjacent lists without intervening whitespace.
Ignore-this: c058945ef1f3c5590c36a034121811e8 Insert whitespace if it may be necessary. Thanks to Eitan Postavsky for the bug report. darcs-hash:20110322074446-00fcc-e3303edd5c9055a9687d22f99379d23f8879eba7
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/paredit.el b/paredit.el
index 6d8d827..cbbbafb 100644
--- a/paredit.el
+++ b/paredit.el
@@ -2282,7 +2282,7 @@ Both must be lists, strings, or atoms; error if there is a mismatch."
(right-char (char-after right-point)))
(let ((left-syntax (char-syntax left-char))
(right-syntax (char-syntax right-char)))
- (cond ((>= left-point right-point)
+ (cond ((< right-point left-point)
(error "Can't join a datum with itself."))
((and (eq left-syntax ?\) )
(eq right-syntax ?\( )
@@ -2293,6 +2293,11 @@ Both must be lists, strings, or atoms; error if there is a mismatch."
(delete-char 1)
(goto-char left-point)
(backward-delete-char 1)
+ ;; Heuristic kludge: (foo)(bar) => (foo bar).
+ (if (and (= left-point right-point)
+ (not (or (eq ?\s (char-syntax (char-before)))
+ (eq ?\s (char-syntax (char-after))))))
+ (insert ?\s))
(backward-up-list)
(indent-sexp))
((and (eq left-syntax ?\" )