summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paredit.el21
-rw-r--r--test.el8
2 files changed, 24 insertions, 5 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
diff --git a/test.el b/test.el
index 229c0bf..f3444af 100644
--- a/test.el
+++ b/test.el
@@ -287,7 +287,9 @@ Four arguments: the paredit command, the text of the buffer
("|\\\\\\\\" "|\\\\" "|" error)
("\\\\|\\\\" "\\\\|" error)
("(|\\\\\\\\)" "(|\\\\)" "(|)" "|" error)
- ("(\\\\|\\\\)" "(\\\\|)" "(\\\\|)")))
+ ("(\\\\|\\\\)" "(\\\\|)" "(\\\\|)")
+ ("|(" "|" error)
+ ("|)" "|" error)))
(paredit-test 'paredit-backward-delete
'(("fo|o" "f|o")
@@ -304,7 +306,9 @@ Four arguments: the paredit command, the text of the buffer
("\\\\\\\\|" "\\\\|" "|" error)
("\\\\|\\\\" "|\\\\" error)
("(\\\\\\\\|)" "(\\\\|)" "(|)" "|" error)
- ("(\\\\|\\\\)" "(|\\\\)" "(|\\\\)")))
+ ("(\\\\|\\\\)" "(|\\\\)" "(|\\\\)")
+ ("(|" "|" error)
+ (")|" "|" error)))
(dolist (command '(paredit-delete-region paredit-kill-region))
;++ Need to check whether `paredit-kill-region' updates the kill ring