@@ -225,36 +225,19 @@ Gets updated by `aas-post-self-insert-hook'.")
225225Use for the typing history, `aas--current-prefix-maps' and
226226`this-command-keys' for the current typed key.."
227227 (cl-callf nconc (cdr aas--current-prefix-maps) (list aas--prefix-map))
228- (let ((current-map-sublist (cdr aas--current-prefix-maps))
229- (prev aas--current-prefix-maps)
230- current-map
231- key-result)
228+ (let ((current-map-sublist (cdr aas--current-prefix-maps)))
232229 (while current-map-sublist
233- (setq current-map (car current-map-sublist)
234- key-result (lookup-key current-map (this-command-keys )))
235- (cond ((null key-result)
236- ; ; remove dead end from the list
237- (cl-callf cdr current-map-sublist)
238- (setcdr prev current-map-sublist))
239- ((keymapp key-result)
240- ; ; update tree
241- (setcar current-map-sublist key-result)
242- (setq prev current-map-sublist)
243- (cl-callf cdr current-map-sublist))
244- ((functionp key-result)
245- ; ; an ending! no need to call interactively,`aas-expand-snippet-maybe'
246- ; ; takes care of that
247- (if (funcall key-result)
248- ; ; condition evaluated to true, and snippet expanded!
249- (setq current-map-sublist nil ; stop the loop
250- aas--current-prefix-maps (list nil )) ; abort all other snippet
251- ; ; unseccesfull. remove dead end from the list
252- (cl-callf cdr current-map-sublist)
253- (setcdr prev current-map-sublist)))
254- ; ; Make sure the loop progress even in the face of objectionable output from
255- ; ; (this-command-keys)
256- (t (cl-callf cdr current-map-sublist)
257- (setcdr prev current-map-sublist))))))
230+ (let* ((current-map (car current-map-sublist))
231+ (key-result (lookup-key current-map (this-command-keys ))))
232+ (cond ((keymapp key-result)
233+ ; ; update tree
234+ (setcar current-map-sublist key-result))
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 current-map-sublist nil ; stop the loop
239+ aas--current-prefix-maps (list nil )))); abort all other snippets
240+ (cl-callf cdr current-map-sublist)))))
258241
259242;;;### autoload
260243(defun aas-activate-keymap (keymap-symbol )
0 commit comments