File: strokes.el.html

This is the strokes package. It is intended to allow the user to control Emacs by means of mouse strokes. Once strokes is loaded, you can always get help be invoking strokes-help:

> M-x strokes-help

and you can learn how to use the package. A mouse stroke, for now, can be defined as holding the shift key and the middle button, for instance, and then moving the mouse in whatever pattern you wish, which you have set Emacs to understand as mapping to a given command. For example, you may wish the have a mouse stroke that looks like a capital C which means copy-region-as-kill. Treat strokes just like you do key bindings. For example, Emacs sets key bindings globally with the global-set-key command. Likewise, you can do

> M-x strokes-global-set-stroke

to interactively program in a stroke. It would be wise to set the first one to this very command, so that from then on, you invoke strokes-global-set-stroke with a stroke. Likewise, there may eventually be a strokes-local-set-stroke command, also analogous to local-set-key.

You can always unset the last stroke definition with the command

> M-x strokes-unset-last-stroke

and the last stroke that was added to strokes-global-map will be removed.

Other analogies between strokes and key bindings are as follows:

   1) To describe a stroke binding, you can type

      > M-x strokes-describe-stroke

      analogous to describe-key. It's also wise to have a stroke,
      like an h, for help, or a ?, mapped to describe-stroke.

   2) stroke bindings are set internally through the Lisp function
      strokes-define-stroke, similar to the define-key function.
      some examples for a 3x3 stroke grid would be

      (strokes-define-stroke c-mode-stroke-map
                     '((0 . 0) (1 . 1) (2 . 2))
                     'kill-region)
      (strokes-define-stroke strokes-global-map
                     '((0 . 0) (0 . 1) (0 . 2) (1 . 2) (2 . 2))
                     'list-buffers)

      however, if you would probably just have the user enter in the
      stroke interactively and then set the stroke to whatever he/she
      entered. The Lisp function to interactively read a stroke is
      strokes-read-stroke. This is especially helpful when you're
      on a fast computer that can handle a 9x9 stroke grid.

      NOTE: only global stroke bindings are currently implemented,
      however mode- and buffer-local stroke bindings may eventually
      be implemented in a future version.

The important variables to be aware of for this package are listed below. They can all be altered through the customizing package via

> M-x customize

and customizing the group named strokes. You can also read documentation on the variables there.

strokes-minimum-match-score (determines the threshold of error that makes a stroke acceptable or unacceptable. If your strokes aren't matching, then you should raise this variable.

strokes-grid-resolution (determines the grid dimensions that you use when defining/reading strokes. The finer the grid your computer can handle, the more you can do, but even a 3x3 grid is pretty cool.) The default value (9) should be fine for most decent computers. NOTE: This variable should not be set to a number less than 3.

strokes-use-strokes-buffer will allow you to hide the strokes buffer when doing simple strokes. This is a speedup for slow computers as well as people who don't want to see their strokes.

If you find that your mouse is accelerating too fast, you can execute an X command to slow it down. A good possibility is

% xset m 5/4 8

which seems, heuristically, to work okay, without much disruption.

Whenever you load in the strokes package, you will be able to save what you've done upon exiting Emacs. You can also do

> M-x strokes-prompt-user-save-strokes

and it will save your strokes in your strokes-file.

Note that internally, all of the routines that are part of this package are able to deal with complex strokes, as they are a superset of simple strokes. However, the default of this package will map S-mouse-2 to the command strokes-do-stroke, and M-mouse-2 to strokes-do-complex-stroke. Complex strokes are terminated with mouse button 3.

You can also toggle between strokes mode by simple typing

> M-x strokes-mode

I hope that, with the help of others, this package will be useful in entering in pictographic-like language text using the mouse
(i.e. Korean). Japanese and Chinese are a bit trickier, but I'm
sure that with help it can be done. The next version will allow the user to enter strokes which "remove the pencil from the paper" so to speak, so one character can have multiple strokes.

You can read more about strokes at:

https://web.archive.org/web/20041209171947/http://www.mit.edu/people/cadet/strokes-help.html

If you're interested in using strokes for writing English into Emacs using strokes, then you'll want to read about it on the web page above or just download from: https://web.archive.org/web/20041204163338/http://www.mit.edu/people/cadet/strokes-abc.el which is nothing but a file with some helper commands for inserting alphanumerics and punctuation.

Great thanks to Rob Ristroph for his generosity in letting me use his PC to develop this, Jason Johnson for his help in algorithms, Euna Kim for her help in Korean, and massive thanks to the helpful guys on the help instance on athena (zeno, jered, amu, gsstark, ghudson, etc) Special thanks to Steve Baur, Kyle Jones, and Hrvoje Nikšić for all their help. And special thanks to Dave Gillespie for all the elisp help--he is responsible for helping me use the cl macros at (near) max speed.

Tasks: (what I'm getting ready for future version)...
2) use 'strokes-read-complex-stroke for Korean, etc.
4) buffer-local 'strokes-local-map, and mode-stroke-maps would be nice
6) add some hooks, like strokes-read-stroke-hook
7) See what people think of the factory settings. Should I change
   them? They're all pretty arbitrary in a way. I guess they
   should be minimal, but computers are getting lots faster, and
   if I choose the defaults too conservatively, then strokes will
   surely disappoint some people on decent machines (until they
   figure out M-x customize). I need feedback.
Other: I always have the most beta version of strokes, so if you
       want it just let me know.

Fixme: Use pbm instead of xpm for pixmaps to work generally.

Defined variables (17)

strokes-base64-charsCharacter vector for fast lookup of base-64 encoding of numbers in [0,61].
strokes-buffer-nameThe name of the buffer that the strokes take place in.
strokes-char-tableThe table which stores values for the character keys.
strokes-characterCharacter used when drawing strokes in the strokes buffer.
strokes-fileFile containing saved strokes for Strokes mode.
strokes-global-mapAssociation list of strokes and their definitions.
strokes-grid-resolutionInteger defining dimensions of the stroke grid.
strokes-last-strokeLast stroke entered by the user.
strokes-liftSymbol representing a stroke lift event for complex strokes.
strokes-lighterMode line identifier for Strokes mode.
strokes-load-hookFunctions to be called when Strokes is loaded.
strokes-minimum-match-scoreMinimum score for a stroke to be considered a possible match.
strokes-modeNon-nil if Strokes mode is enabled.
strokes-mode-hookHook run after entering or leaving ‘strokes-mode’.
strokes-use-strokes-bufferIf non-nil, the strokes buffer is used and strokes are displayed.
strokes-window-configurationThe special window configuration used when entering strokes.
strokes-xpm-headerThe header to all XPM buffers created by strokes.

Defined functions (48)

strokes-alphabetic-lessp(STROKE1 STROKE2)
strokes-button-press-event-p(EVENT)
strokes-button-release-event-p(EVENT)
strokes-click-p(STROKE)
strokes-compose-complex-stroke()
strokes-decode-buffer(&optional BUFFER FORCE)
strokes-define-stroke(STROKE-MAP STROKE DEF)
strokes-describe-stroke(STROKE)
strokes-distance-squared(P1 P2)
strokes-do-complex-stroke(EVENT)
strokes-do-stroke(EVENT)
strokes-eliminate-consecutive-redundancies(ENTRIES)
strokes-encode-buffer(&optional BUFFER FORCE)
strokes-event-closest-point(EVENT &optional START-WINDOW)
strokes-event-closest-point-1(WINDOW &optional LINE)
strokes-execute-stroke(STROKE)
strokes-fill-current-buffer-with-whitespace()
strokes-fill-stroke(UNFILLED-STROKE &optional FORCE)
strokes-get-grid-position(STROKE-EXTENT POSITION &optional GRID-RESOLUTION)
strokes-get-stroke-extent(PIXEL-POSITIONS)
strokes-global-set-stroke(STROKE COMMAND)
strokes-global-set-stroke-string(STROKE STRING)
strokes-help()
strokes-lift-p(OBJECT)
strokes-list-strokes(&optional CHRONOLOGICAL STROKES-MAP)
strokes-load-user-strokes()
strokes-match-stroke(STROKE STROKE-MAP)
strokes-mode(&optional ARG)
strokes-mouse-event-p(EVENT)
strokes-prompt-user-save-strokes()
strokes-rate-stroke(STROKE1 STROKE2)
strokes-read-complex-stroke(&optional PROMPT EVENT)
strokes-read-stroke(&optional PROMPT EVENT)
strokes-remassoc(KEY LIST)
strokes-renormalize-to-grid(POSITIONS &optional GRID-RESOLUTION)
strokes-square(X)
strokes-toggle-strokes-buffer(&optional ARG)
strokes-unload-function()
strokes-unset-last-stroke()
strokes-update-window-configuration()
strokes-window-configuration-changed-p()
strokes-xpm-char-bit-p(CHAR)
strokes-xpm-char-on-p(CHAR)
strokes-xpm-decode-char(CHARACTER)
strokes-xpm-encode-length-as-string(LENGTH)
strokes-xpm-for-compressed-string(COMPRESSED-STRING &optional BUFNAME)
strokes-xpm-for-stroke(&optional STROKE BUFNAME B/W-ONLY)
strokes-xpm-to-compressed-string(&optional XPM-BUFFER)

Defined faces (1)

strokes-charFace for strokes characters.