Skip to content

Commit

Permalink
fix: allow uncommenting by delete-char commands
Browse files Browse the repository at this point in the history
Close #65.
  • Loading branch information
AmaiKinono committed Oct 7, 2024
1 parent f6ffca0 commit 0018cf2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions puni.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 0018cf2

Please sign in to comment.