Skip to content

Commit

Permalink
fix(latex): add renamed lowercase function variants
Browse files Browse the repository at this point in the history
latex mode renamed some functions which used TeX and LaTeX to just all
lowercase.  We added these functions to the list of "special self
insert commands" so smartparens runs the appropriate hooks afterwards.

Fixes #834
  • Loading branch information
Fuco1 committed Mar 30, 2024
1 parent 0bbd854 commit 8459f2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion smartparens.el
Original file line number Diff line number Diff line change
Expand Up @@ -2027,7 +2027,8 @@ BODY, do nothing."
(defvar sp--self-insert-commands
'(self-insert-command
org-self-insert-command
LaTeX-insert-left-brace)
LaTeX-insert-left-brace
latex-insert-left-brace)
"List of commands that are some sort of `self-insert-command'.

Many modes rebind \"self-inserting\" keys to \"smart\" versions
Expand All @@ -2041,6 +2042,12 @@ of pairs and wraps.")
'(
TeX-insert-dollar
TeX-insert-quote
;; At some point the TeX and LaTeX functions were renamed to
;; lower-case names. This broke some code dealing with these
;; modes, so we just add both versions for now.
tex-insert-dollar
tex-insert-quote
latex-insert-quote
quack-insert-opening-paren
quack-insert-closing-paren
quack-insert-opening-bracket
Expand Down
8 changes: 8 additions & 0 deletions test/smartparens-latex-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,11 @@ thesmeves and would not break unrelated pair)"
(latex-mode)
(execute-kbd-macro "``")
(sp-buffer-equals "$foo ``| baz$")))

;; #834
(ert-deftest sp-test-latex-wrap-with-trigger ()
"A region should be wrapped with a pair if trigger key is pressed."
(sp-test-with-temp-buffer "foo Mbar baz| bam"
(latex-mode)
(execute-kbd-macro "\"")
(sp-buffer-equals "foo ``bar baz''| bam")))

0 comments on commit 8459f2f

Please sign in to comment.