summaryrefslogtreecommitdiff
path: root/paredit.el
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell@mumble.net>2014-01-28 20:48:18 +0000
committerTaylor R Campbell <campbell@mumble.net>2014-01-28 20:48:18 +0000
commit67d6a4f5ad505af98a311bd955dbe7bd2fc4e0b1 (patch)
tree494d8d2c42d140fb6b0eb7d98d623cf3211a9337 /paredit.el
parentc39e4853d30b281a35bb0f376893735fd0d5cb99 (diff)
Let C-d and DEL delete the other spurious delimiters too.
Diffstat (limited to 'paredit.el')
-rw-r--r--paredit.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/paredit.el b/paredit.el
index 773e047..61a7050 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1228,11 +1228,18 @@ With a `C-u' prefix argument, simply delete a character forward,
(delete-char +1)) ; delimiters.
((eq ?\; (char-after))
(paredit-forward-delete-comment-start))
+ ((eq (char-syntax (char-after)) ?\) )
+ (if (paredit-handle-sexp-errors
+ (save-excursion (forward-char) (backward-sexp) t)
+ nil)
+ (message "End of list!")
+ (progn
+ (message "Deleting spurious closing delimiter.")
+ (delete-char +1))))
;; Just delete a single character, if it's not a closing
;; delimiter. (The character literal case is already handled
;; by now.)
- ((not (eq (char-syntax (char-after)) ?\) ))
- (delete-char +1))))
+ (t (delete-char +1))))
(defun paredit-forward-delete-in-string ()
(let ((start+end (paredit-string-start+end-points)))
@@ -1320,9 +1327,17 @@ With a `C-u' prefix argument, simply delete a character backward,
(delete-char +1)) ; delimiters.
((bolp)
(paredit-backward-delete-maybe-comment-end))
+ ((eq (char-syntax (char-before)) ?\( )
+ (if (paredit-handle-sexp-errors
+ (save-excursion (backward-char) (forward-sexp) t)
+ nil)
+ (message "Beginning of list!")
+ (progn
+ (message "Deleting spurious closing delimiter.")
+ (delete-char -1))))
;; Delete it, unless it's an opening delimiter. The case of
;; character literals is already handled by now.
- ((not (eq (char-syntax (char-before)) ?\( ))
+ (t
;; Turn off the @#&*&!^&(%^ botch in GNU Emacs 24 that changed
;; `backward-delete-char' and `backward-delete-char-untabify'
;; semantically so that they delete the region in transient