@@ -730,8 +730,8 @@ You can enable pre-set bindings by customizing
730
730
;; `self-insert-command', rather, they insert via `insert'.
731
731
;; Therefore, we need to call this handler in
732
732
;; `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
735
735
;; to handle specially.
736
736
(add-hook 'post-self-insert-hook 'sp--post-self-insert-hook-handler nil 'local)
737
737
(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
2111
2111
to distinguish these to properly handle insertion and reinsertion
2112
2112
of pairs and wraps.")
2113
2113
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
-
2138
2114
(defun sp--self-insert-command-p ()
2139
2115
"Return non-nil if `this-command' is some sort of `self-insert-command'."
2140
2116
(memq this-command sp--self-insert-commands))
2141
2117
2142
2118
(defun sp--special-self-insert-command-p ()
2143
2119
"Return non-nil if `this-command' is \"special\" self insert command.
2144
2120
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)))
2148
2146
2149
2147
(defun sp--signum (x)
2150
2148
"Return 1 if X is positive, -1 if negative, 0 if zero."
0 commit comments