@@ -220,25 +220,21 @@ the first element always nil for update logic simplicity.
220
220
Gets updated by `aas-post-self-insert-hook' ." )
221
221
222
222
(defun aas-post-self-insert-hook ()
223
- " Try to expand snippets automatically.
223
+ " Try to expand snippets automatically for KEYS .
224
224
225
225
Use for the typing history, `aas--current-prefix-maps' and
226
226
`this-command-keys' for the current typed key.."
227
227
(cl-callf nconc aas--current-prefix-maps (list aas--prefix-map))
228
- (let ((next-maps nil ))
229
- (while aas--current-prefix-maps
230
- (let* ((candidate (car aas--current-prefix-maps))
231
- (key-result (lookup-key candidate (this-command-keys ))))
232
- (cond ((keymapp key-result)
233
- ; ; Collect the keymap for the next call
234
- (cl-callf2 cons key-result next-maps))
235
- ((and (functionp key-result) (funcall key-result))
236
- ; ; an ending! no need to call interactively,`aas-expand-snippet-maybe'
237
- ; ; takes care of that
238
- (setq aas--current-prefix-maps nil ; stop the loop
239
- next-maps nil ))) ; abort the collected snippets
240
- (cl-callf cdr aas--current-prefix-maps)))
241
- (setq aas--current-prefix-maps next-maps)))
228
+ (cl-loop for candidate in-ref aas--current-prefix-maps do
229
+ (let ((key-result (lookup-key candidate (this-command-keys ))))
230
+ (cond ((keymapp key-result)
231
+ ; ; Collect the keymap for the next call
232
+ (setf candidate key-result))
233
+ ((and (functionp key-result) (funcall key-result))
234
+ ; ; an ending! no need to call interactively,`aas-expand-snippet-maybe'
235
+ ; ; takes care of that. Clear the map so we start over next time.
236
+ (cl-return (setq aas--current-prefix-maps nil )))))
237
+ finally do (cl-callf2 delq nil aas--current-prefix-maps)))
242
238
243
239
;;;### autoload
244
240
(defun aas-activate-keymap (keymap-symbol )
0 commit comments