diff options
-rw-r--r-- | paredit.el | 21 | ||||
-rw-r--r-- | test.el | 8 |
2 files changed, 24 insertions, 5 deletions
@@ -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 @@ -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 |