@@ -730,8 +730,8 @@ You can enable pre-set bindings by customizing
730730 ;; `self-insert-command', rather, they insert via `insert'.
731731 ;; Therefore, we need to call this handler in
732732 ;; `post-command-hook' too (inside
733- ;; `sp--post-command-hook-handler'). The list
734- ;; `sp--special-self-insert-commands ' specifies which commands
733+ ;; `sp--post-command-hook-handler'). The function
734+ ;; `sp--special-self-insert-command-p ' specifies which commands
735735 ;; to handle specially.
736736 (add-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler nil 'local)
737737 (add-hook 'pre-command-hook 'sp--save-pre-command-state nil 'local)
@@ -2111,40 +2111,38 @@ insertion to `self-insert-command'. Smartparens needs to be able
21112111to distinguish these to properly handle insertion and reinsertion
21122112of pairs and wraps.")
21132113
2114- ;; Please contribute these if you come across some!
2115- (defvar sp--special-self-insert-commands
2116- '(
2117- tex-insert-quote
2118- TeX-insert-quote
2119- quack-insert-opening-paren
2120- quack-insert-closing-paren
2121- quack-insert-opening-bracket
2122- quack-insert-closing-bracket
2123- racket-insert-closing-paren
2124- racket-insert-closing-bracket
2125- racket-insert-closing-brace
2126- )
2127- "List of commands which are handled as if they were `self-insert-command's.
2128-
2129- Some modes redefine \"self-inserting\" keys to \"smart\" versions
2130- which do some additional processing but do _not_ delegate the
2131- insertion to `self-insert-command', instead inserting via
2132- `insert'. Smartparens needs to be able to distinguish these to
2133- properly handle insertion and reinsertion of pairs and wraps.
2134-
2135- The `sp--post-self-insert-hook-handler' is called in the
2136- `post-command-hook' for these commands.")
2137-
21382114(defun sp--self-insert-command-p ()
21392115 "Return non-nil if `this-command' is some sort of `self-insert-command'."
21402116 (memq this-command sp--self-insert-commands))
21412117
21422118(defun sp--special-self-insert-command-p ()
21432119 "Return non-nil if `this-command' is \"special\" self insert command.
21442120
2145- A special self insert command is one that inserts a character but
2146- does not trigger `post-self-insert-hook'."
2147- (memq this-command sp--special-self-insert-commands))
2121+ Some modes redefine \"self-inserting\" keys to \"smart\" versions
2122+ which do some additional processing but do _not_ delegate the
2123+ insertion to `self-insert-command', instead inserting via
2124+ `insert' and not triggering the `post-self-insert-hook'.
2125+ Smartparens needs to be able to distinguish these to properly
2126+ handle insertion and reinsertion of pairs and wraps.
2127+
2128+ The `sp--post-self-insert-hook-handler' is called in the
2129+ `post-command-hook' for these commands."
2130+ (let ((special-self-insert-commands
2131+ `(
2132+ ,@(when (and (boundp 'AUCTeX-version)
2133+ (version<= AUCTeX-version "14.0.5"))
2134+ '(TeX-insert-dollar))
2135+ tex-insert-quote
2136+ TeX-insert-quote
2137+ quack-insert-opening-paren
2138+ quack-insert-closing-paren
2139+ quack-insert-opening-bracket
2140+ quack-insert-closing-bracket
2141+ racket-insert-closing-paren
2142+ racket-insert-closing-bracket
2143+ racket-insert-closing-brace
2144+ )))
2145+ (memq this-command special-self-insert-commands)))
21482146
21492147(defun sp--signum (x)
21502148 "Return 1 if X is positive, -1 if negative, 0 if zero."
0 commit comments