From 0018cf25831e75e59cfb6069e1b5597e96a0a00f Mon Sep 17 00:00:00 2001 From: AmaiKinono Date: Tue, 8 Oct 2024 00:03:09 +0800 Subject: [PATCH] fix: allow uncommenting by delete-char commands Close #65. --- puni.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/puni.el b/puni.el index 44f4efb..8ba2e4e 100644 --- a/puni.el +++ b/puni.el @@ -1590,6 +1590,12 @@ This respects the variable `delete-active-region'." (when (puni-dangling-delimiter-p (1- (point))) (delete-char -1) t) + ;; We allow uncommenting by deleting. Deleting the opening char of a + ;; single line comment will just uncomment it. + (when (save-excursion (backward-char) + (puni--begin-of-single-line-comment-p)) + (delete-char -1) + t) ;; Maybe we are inside an empty sexp, so we delete it. (unless (or (puni-before-sexp-p) (puni-after-sexp-p)) @@ -1625,6 +1631,9 @@ This respects the variable `delete-active-region'." (when (puni-dangling-delimiter-p) (delete-char 1) t) + (when (puni--begin-of-single-line-comment-p) + (delete-char 1) + t) (unless (or (puni-before-sexp-p) (puni-after-sexp-p)) (when-let ((sexp-bounds (puni-bounds-of-sexp-around-point)))