Function: strokes-match-stroke

strokes-match-stroke is a byte-compiled function defined in strokes.el.gz.

Signature

(strokes-match-stroke STROKE STROKE-MAP)

Documentation

Find the best matching command of STROKE in STROKE-MAP.

Returns the corresponding match as (COMMAND . SCORE).

Source Code

;; Defined in /usr/src/emacs/lisp/strokes.el.gz
(defun strokes-match-stroke (stroke stroke-map)
  "Find the best matching command of STROKE in STROKE-MAP.
Returns the corresponding match as (COMMAND . SCORE)."
  (if (and stroke stroke-map)
      (let ((score (strokes-rate-stroke stroke (caar stroke-map)))
	    (command (cdar stroke-map))
	    (map (cdr stroke-map)))
	(while map
	  (let ((newscore (strokes-rate-stroke stroke (caar map))))
	    (if (or (and newscore score (< newscore score))
		    (and newscore (null score)))
		(setq score newscore
		      command (cdar map)))
	    (setq map (cdr map))))
	(if score
	    (cons command score)
	  nil))
    nil))