Skip to content

Commit 0849801

Browse files
authored
Merge pull request #976 from tangxinfa/fix-org-checkbox
fix: avoid insert slash pair in org-mode checkbox.
2 parents b1bc0f6 + 97a4b95 commit 0849801

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

smartparens-org.el

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,18 @@
5252
(not (memq (syntax-class (syntax-after (point))) '(2 3)))
5353
(<= me (point))))))
5454

55+
(defun sp-org-point-after-left-square-bracket-p (id action _context)
56+
"Return t if point is after a left square bracket, nil otherwise.
57+
This predicate is only tested on \"insert\" action."
58+
(when (eq action 'insert)
59+
(sp--looking-back-p (concat "\\[" (regexp-quote id)))))
60+
5561
(sp-with-modes 'org-mode
5662
(sp-local-pair "*" "*"
5763
:unless '(sp-point-after-word-p sp-point-at-bol-p)
5864
:skip-match 'sp--org-skip-asterisk)
5965
(sp-local-pair "_" "_" :unless '(sp-point-after-word-p))
60-
(sp-local-pair "/" "/" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
66+
(sp-local-pair "/" "/" :unless '(sp-point-after-word-p sp-org-point-after-left-square-bracket-p) :post-handlers '(("[d1]" "SPC")))
6167
(sp-local-pair "~" "~" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
6268
(sp-local-pair "=" "=" :unless '(sp-point-after-word-p) :post-handlers '(("[d1]" "SPC")))
6369
(sp-local-pair "«" "»"))

0 commit comments

Comments
 (0)