[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 3c48233 122/224: Fix checks on deletion of comment
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 3c48233 122/224: Fix checks on deletion of comment boundaries. |
Date: |
Sat, 7 Aug 2021 09:22:33 -0400 (EDT) |
branch: elpa/paredit
commit 3c48233833f8afcf42b6e2e6722ae0badf28183d
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Fix checks on deletion of comment boundaries.
Ignore-this: db6c2b72e92eadc7b98d3c0613916f9d
darcs-hash:20110411180500-00fcc-5e23c6d9675a260d692830ecdc40302d4ab52141
---
paredit.el | 54 +++++++++++++++++++++++-------------------------------
1 file changed, 23 insertions(+), 31 deletions(-)
diff --git a/paredit.el b/paredit.el
index 3a05af6..72d7544 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1274,25 +1274,19 @@ With a `C-u' prefix argument, simply delete a character
forward,
(delete-char 1)))))
(defun paredit-forward-delete-in-comment ()
- ;; Refuse to delete a comment end if moving the next line into the
- ;; comment would break structure.
+ ;; Point is in a comment, possibly at eol. Refuse to delete a
+ ;; comment end if moving the next line into the comment would break
+ ;; structure.
(if (eolp)
- (save-excursion
- (forward-char)
- (let ((line-start-state (paredit-current-parse-state)))
- (if (not (comment-search-forward (point-at-eol) t))
- (goto-char (point-at-eol)))
- (let ((line-end-state (paredit-current-parse-state)))
- (paredit-check-region-state line-start-state line-end-state)))))
+ (let ((next-line-start (point-at-bol 2))
+ (next-line-end (point-at-eol 2)))
+ (paredit-check-region next-line-start next-line-end)))
(delete-char 1))
(defun paredit-forward-delete-comment-start ()
- ;; Refuse to delete a comment start if the comment contains
- ;; unbalanced junk. Kludge: `paredit-check-region' moves the point
- ;; even if the region is OK. But if we use `save-excursion', then
- ;; `check-parens' can't put the point at the bad part.
- (if (not (paredit-region-ok-p (+ (point) 1) (point-at-eol)))
- (paredit-check-region (+ (point) 1) (point-at-eol)))
+ ;; Point precedes a comment start (not at eol). Refuse to delete a
+ ;; comment start if the comment contains unbalanced junk.
+ (paredit-check-region (+ (point) 1) (point-at-eol))
(delete-char 1))
(defun paredit-backward-delete (&optional argument)
@@ -1367,28 +1361,26 @@ With a `C-u' prefix argument, simply delete a character
backward,
(delete-char 1)))))
(defun paredit-backward-delete-in-comment ()
+ ;; Point is in a comment, possibly just after the comment start.
;; Refuse to delete a comment start if the comment contains
;; unbalanced junk.
- (if (and (save-excursion
- (backward-char)
- ;; Must call `paredit-in-string-p' before
- ;; `paredit-in-comment-p'.
- (not (or (paredit-in-string-p)
- (paredit-in-comment-p))))
- (not (paredit-region-ok-p (point) (point-at-eol))))
+ (if (save-excursion
+ (backward-char)
+ ;; Must call `paredit-in-string-p' before
+ ;; `paredit-in-comment-p'.
+ (not (or (paredit-in-string-p) (paredit-in-comment-p))))
(paredit-check-region (point) (point-at-eol)))
(backward-delete-char-untabify +1))
(defun paredit-backward-delete-maybe-comment-end ()
- ;; Refuse to delete a comment end if moving the line into the comment
- ;; would break structure.
- (let* ((line-start-state (paredit-current-parse-state))
- (line-end-state
- (save-excursion
- (if (not (comment-search-forward (point-at-eol) t))
- (goto-char (point-at-eol)))
- (paredit-current-parse-state))))
- (paredit-check-region-state line-start-state line-end-state))
+ ;; Point is at bol, possibly just after a comment end (i.e., the
+ ;; previous line may have had a line comment). Refuse to delete a
+ ;; comment end if moving the current line into the previous line's
+ ;; comment would break structure.
+ (if (save-excursion
+ (backward-char)
+ (and (not (paredit-in-string-p)) (paredit-in-comment-p)))
+ (paredit-check-region (point-at-eol) (point-at-bol)))
(backward-delete-char 1))
;;;; Killing
- [nongnu] elpa/paredit 980a4f4 091/224: Add rudimentary and preliminary test suite., (continued)
- [nongnu] elpa/paredit 980a4f4 091/224: Add rudimentary and preliminary test suite., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 33f9c67 100/224: Use `error', not `message', to report test failures in test.el., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 79e7555 086/224: Be more careful about deleting comment starts & ends., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 121a8b4 104/224: Make backslash escape prompt less confusing., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 41bbc20 078/224: Make `paredit-comment-dwim' code comment example work in isolation., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5e210b2 087/224: Fix bug in recent change to more carefully delete comment ends., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d9ecc6d 094/224: Handle scan errors in `paredit-scan-sexps-hack'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 6c14694 113/224: Use `call-interactively' rather than `funcall' in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 9cac6fa 106/224: Specify that paredit should work in XEmacs 21.5.28 or later., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0bb4b62 110/224: Check for expected errors in `paredit-close-FOO'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3c48233 122/224: Fix checks on deletion of comment boundaries.,
ELPA Syncer <=
- [nongnu] elpa/paredit 620c3a2 116/224: Break page in test.el before indentation regression tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d681e3c 111/224: Check for expected errors in `paredit-forward-delete'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5dc93f9 114/224: Omit redundant `paredit-forward-delete' test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0cd0011 109/224: Implement expected errors in test suite., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8ee8f13 118/224: Fix `paredit-insert-pair' when buffer ends with no-newline comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fc78011 121/224: Tweak `paredit-check-region' and `paredit-region-ok-p'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 621be23 124/224: Add some tests for recent changes to deletion and killing commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit fac925d 125/224: Tweak safe region deletion., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8d87576 129/224: Fix logic in checking region deletion across comment boundaries., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 4723fb3 132/224: Add and fix some tests for `(' and `)' while in a character literal., ELPA Syncer, 2021/08/07