Function: strokes-execute-stroke

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

Signature

(strokes-execute-stroke STROKE)

Documentation

Given STROKE, execute the command which corresponds to it.

The command will be executed provided one exists for that stroke, based on the variable strokes-minimum-match-score. If no stroke matches, nothing is done and return value is nil.

Source Code

;; Defined in /usr/src/emacs/lisp/strokes.el.gz
(defun strokes-execute-stroke (stroke)
  "Given STROKE, execute the command which corresponds to it.
The command will be executed provided one exists for that stroke,
based on the variable `strokes-minimum-match-score'.
If no stroke matches, nothing is done and return value is nil."
  ;; FIXME: Undocument return value.  It is not documented for all cases,
  ;; and doesn't allow differentiating between no stroke matches and
  ;; command-execute returning nil, anyway.
  (let* ((match (strokes-match-stroke stroke strokes-global-map))
	 (command (car match))
	 (score (cdr match)))
    (cond ((and match (<= score strokes-minimum-match-score))
	   (message "%s" command)
	   (command-execute command))
	  ((null strokes-global-map)
	   (if (file-exists-p strokes-file)
	       (and (y-or-n-p
		     (format-message "No strokes loaded.  Load `%s'? "
				     strokes-file))
		    (strokes-load-user-strokes))
	     (error "No strokes defined; use `strokes-global-set-stroke'")))
	  (t
	   (error
	    "No stroke matches; see variable `strokes-minimum-match-score'")
	   nil))))