diff options
| author | Juanma Barranquero | 2014-03-04 14:01:48 +0100 |
|---|---|---|
| committer | Juanma Barranquero | 2014-03-04 14:01:48 +0100 |
| commit | 4242d21d559884e08e5b1bf13fbf8749de9b62d9 (patch) | |
| tree | 27191deb04a18a7ba978d1e9d068ffb3fe6fc2a9 | |
| parent | a55130ca1052ba7ddcd9ef22db986cef053f4e00 (diff) | |
| download | emacs-4242d21d559884e08e5b1bf13fbf8749de9b62d9.tar.gz emacs-4242d21d559884e08e5b1bf13fbf8749de9b62d9.zip | |
lisp/strokes.el: Fix typos.
(strokes-xpm-header, strokes-rate-stroke): Fix typos.
(strokes-character, strokes-get-grid-position, strokes-list-strokes):
Remove superfluous backslashes.
(strokes-last-stroke, strokes-global-map, strokes-mode):
Reflow docstrings.
(strokes-xpm-for-stroke, strokes-xpm-to-compressed-string)
(strokes-xpm-for-compressed-string): Use quotes with buffer name.
(strokes-distance-squared, strokes-global-set-stroke)
(strokes-global-set-stroke-string): Doc fixes.
(strokes-help): Fix typos; reflow docstring.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/strokes.el | 54 |
2 files changed, 41 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5cc5291adc8..4b4b85b4a47 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2014-03-04 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * strokes.el (strokes-xpm-header, strokes-rate-stroke): Fix typos. | ||
| 4 | (strokes-character, strokes-get-grid-position, strokes-list-strokes): | ||
| 5 | Remove superfluous backslashes. | ||
| 6 | (strokes-last-stroke, strokes-global-map, strokes-mode): | ||
| 7 | Reflow docstrings. | ||
| 8 | (strokes-xpm-for-stroke, strokes-xpm-to-compressed-string) | ||
| 9 | (strokes-xpm-for-compressed-string): Use quotes with buffer name. | ||
| 10 | (strokes-distance-squared, strokes-global-set-stroke) | ||
| 11 | (strokes-global-set-stroke-string): Doc fixes. | ||
| 12 | (strokes-help): Fix typos; reflow docstring. | ||
| 13 | |||
| 1 | 2014-03-04 Martin Rudalics <rudalics@gmx.at> | 14 | 2014-03-04 Martin Rudalics <rudalics@gmx.at> |
| 2 | 15 | ||
| 3 | * window.el (window-in-direction): Fix doc-string. | 16 | * window.el (window-in-direction): Fix doc-string. |
diff --git a/lisp/strokes.el b/lisp/strokes.el index fdaf31a9312..040b4e7135a 100644 --- a/lisp/strokes.el +++ b/lisp/strokes.el | |||
| @@ -202,7 +202,7 @@ static char * stroke_xpm[] = { | |||
| 202 | \"P c #FFFF0000FFFF\", | 202 | \"P c #FFFF0000FFFF\", |
| 203 | \". c #45458B8B0000\", | 203 | \". c #45458B8B0000\", |
| 204 | /* pixels */\n" | 204 | /* pixels */\n" |
| 205 | "The header to all xpm buffers created by strokes.") | 205 | "The header to all XPM buffers created by strokes.") |
| 206 | 206 | ||
| 207 | ;;; user variables... | 207 | ;;; user variables... |
| 208 | 208 | ||
| @@ -221,7 +221,7 @@ static char * stroke_xpm[] = { | |||
| 221 | 221 | ||
| 222 | (defcustom strokes-character ?@ | 222 | (defcustom strokes-character ?@ |
| 223 | "Character used when drawing strokes in the strokes buffer. | 223 | "Character used when drawing strokes in the strokes buffer. |
| 224 | \(The default is `@', which works well.\)" | 224 | \(The default is `@', which works well.)" |
| 225 | :type 'character | 225 | :type 'character |
| 226 | :group 'strokes) | 226 | :group 'strokes) |
| 227 | 227 | ||
| @@ -284,16 +284,15 @@ This is set properly in the function `strokes-update-window-configuration'.") | |||
| 284 | 284 | ||
| 285 | (defvar strokes-last-stroke nil | 285 | (defvar strokes-last-stroke nil |
| 286 | "Last stroke entered by the user. | 286 | "Last stroke entered by the user. |
| 287 | Its value gets set every time the function | 287 | Its value gets set every time the function `strokes-fill-stroke' |
| 288 | `strokes-fill-stroke' gets called, | 288 | gets called, since that is the best time to set the variable.") |
| 289 | since that is the best time to set the variable.") | ||
| 290 | 289 | ||
| 291 | (defvar strokes-global-map '() | 290 | (defvar strokes-global-map '() |
| 292 | "Association list of strokes and their definitions. | 291 | "Association list of strokes and their definitions. |
| 293 | Each entry is (STROKE . COMMAND) where STROKE is itself a list of | 292 | Each entry is (STROKE . COMMAND) where STROKE is itself a list of |
| 294 | coordinates (X . Y) where X and Y are lists of positions on the | 293 | coordinates (X . Y) where X and Y are lists of positions on the |
| 295 | normalized stroke grid, with the top left at (0 . 0). COMMAND is the | 294 | normalized stroke grid, with the top left at (0 . 0). COMMAND is |
| 296 | corresponding interactive function.") | 295 | the corresponding interactive function.") |
| 297 | 296 | ||
| 298 | (defvar strokes-load-hook nil | 297 | (defvar strokes-load-hook nil |
| 299 | "Functions to be called when Strokes is loaded.") | 298 | "Functions to be called when Strokes is loaded.") |
| @@ -349,7 +348,7 @@ corresponding interactive function.") | |||
| 349 | (* x x)) | 348 | (* x x)) |
| 350 | 349 | ||
| 351 | (defsubst strokes-distance-squared (p1 p2) | 350 | (defsubst strokes-distance-squared (p1 p2) |
| 352 | "Gets the distance (squared) between to points P1 and P2. | 351 | "Compute the distance (squared) between to points P1 and P2. |
| 353 | P1 and P2 are cons cells in the form (X . Y)." | 352 | P1 and P2 are cons cells in the form (X . Y)." |
| 354 | (let ((x1 (car p1)) | 353 | (let ((x1 (car p1)) |
| 355 | (y1 (cdr p1)) | 354 | (y1 (cdr p1)) |
| @@ -434,9 +433,9 @@ or for window START-WINDOW if that is specified." | |||
| 434 | ;;;###autoload | 433 | ;;;###autoload |
| 435 | (defun strokes-global-set-stroke (stroke command) | 434 | (defun strokes-global-set-stroke (stroke command) |
| 436 | "Interactively give STROKE the global binding as COMMAND. | 435 | "Interactively give STROKE the global binding as COMMAND. |
| 437 | Operated just like `global-set-key', except for strokes. | 436 | Works just like `global-set-key', except for strokes. COMMAND is |
| 438 | COMMAND is a symbol naming an interactively-callable function. STROKE | 437 | a symbol naming an interactively-callable function. STROKE is a |
| 439 | is a list of sampled positions on the stroke grid as described in the | 438 | list of sampled positions on the stroke grid as described in the |
| 440 | documentation for the `strokes-define-stroke' function. | 439 | documentation for the `strokes-define-stroke' function. |
| 441 | 440 | ||
| 442 | See also `strokes-global-set-stroke-string'." | 441 | See also `strokes-global-set-stroke-string'." |
| @@ -450,7 +449,7 @@ See also `strokes-global-set-stroke-string'." | |||
| 450 | 449 | ||
| 451 | (defun strokes-global-set-stroke-string (stroke string) | 450 | (defun strokes-global-set-stroke-string (stroke string) |
| 452 | "Interactively give STROKE the global binding as STRING. | 451 | "Interactively give STROKE the global binding as STRING. |
| 453 | Operated just like `global-set-key', except for strokes. STRING | 452 | Works just like `global-set-key', except for strokes. STRING |
| 454 | is a string to be inserted by the stroke. STROKE is a list of | 453 | is a string to be inserted by the stroke. STROKE is a list of |
| 455 | sampled positions on the stroke grid as described in the | 454 | sampled positions on the stroke grid as described in the |
| 456 | documentation for the `strokes-define-stroke' function. | 455 | documentation for the `strokes-define-stroke' function. |
| @@ -476,7 +475,7 @@ Compare `strokes-global-set-stroke'." | |||
| 476 | (defun strokes-get-grid-position (stroke-extent position &optional grid-resolution) | 475 | (defun strokes-get-grid-position (stroke-extent position &optional grid-resolution) |
| 477 | "Map POSITION to a new grid position. | 476 | "Map POSITION to a new grid position. |
| 478 | Do so based on its STROKE-EXTENT and GRID-RESOLUTION. | 477 | Do so based on its STROKE-EXTENT and GRID-RESOLUTION. |
| 479 | STROKE-EXTENT as a list \(\(XMIN . YMIN\) \(XMAX . YMAX\)\). | 478 | STROKE-EXTENT is a list ((XMIN . YMIN) (XMAX . YMAX)). |
| 480 | If POSITION is a `strokes-lift', then it is itself returned. | 479 | If POSITION is a `strokes-lift', then it is itself returned. |
| 481 | Optional GRID-RESOLUTION may be used in place of `strokes-grid-resolution'. | 480 | Optional GRID-RESOLUTION may be used in place of `strokes-grid-resolution'. |
| 482 | The grid is a square whose dimension is [0,GRID-RESOLUTION)." | 481 | The grid is a square whose dimension is [0,GRID-RESOLUTION)." |
| @@ -651,7 +650,7 @@ NOTE: This is where the global variable `strokes-last-stroke' is set." | |||
| 651 | y)))))))))) | 650 | y)))))))))) |
| 652 | 651 | ||
| 653 | (defun strokes-rate-stroke (stroke1 stroke2) | 652 | (defun strokes-rate-stroke (stroke1 stroke2) |
| 654 | "Rates STROKE1 with STROKE2 and return a score based on a distance metric. | 653 | "Rate STROKE1 with STROKE2 and return a score based on a distance metric. |
| 655 | Note: the rating is an error rating, and therefore, a return of 0 | 654 | Note: the rating is an error rating, and therefore, a return of 0 |
| 656 | represents a perfect match. Also note that the order of stroke | 655 | represents a perfect match. Also note that the order of stroke |
| 657 | arguments is order-independent for the algorithm used here." | 656 | arguments is order-independent for the algorithm used here." |
| @@ -857,6 +856,9 @@ Optional EVENT is acceptable as the starting event of the stroke." | |||
| 857 | The command will be executed provided one exists for that stroke, | 856 | The command will be executed provided one exists for that stroke, |
| 858 | based on the variable `strokes-minimum-match-score'. | 857 | based on the variable `strokes-minimum-match-score'. |
| 859 | If no stroke matches, nothing is done and return value is nil." | 858 | If no stroke matches, nothing is done and return value is nil." |
| 859 | ;; FIXME: Undocument return value. It is not documented for all cases, | ||
| 860 | ;; and doesn't allow to difference between no stroke matches and | ||
| 861 | ;; command-execute returning nil, anyway. | ||
| 860 | (let* ((match (strokes-match-stroke stroke strokes-global-map)) | 862 | (let* ((match (strokes-match-stroke stroke strokes-global-map)) |
| 861 | (command (car match)) | 863 | (command (car match)) |
| 862 | (score (cdr match))) | 864 | (score (cdr match))) |
| @@ -969,8 +971,8 @@ and you can enter in any arbitrary stroke. Remember: The strokes | |||
| 969 | package lets you program in simple and complex (multi-lift) strokes. | 971 | package lets you program in simple and complex (multi-lift) strokes. |
| 970 | The only difference is how you *invoke* the two. You will most likely | 972 | The only difference is how you *invoke* the two. You will most likely |
| 971 | use simple strokes, as complex strokes were developed for | 973 | use simple strokes, as complex strokes were developed for |
| 972 | Chinese/Japanese/Korean. So the shifted middle mouse button (S-mouse-2) will | 974 | Chinese/Japanese/Korean. So the shifted middle mouse button (S-mouse-2) |
| 973 | invoke the command `strokes-do-stroke'. | 975 | will invoke the command `strokes-do-stroke'. |
| 974 | 976 | ||
| 975 | If ever you define a stroke which you don't like, then you can unset | 977 | If ever you define a stroke which you don't like, then you can unset |
| 976 | it with the command | 978 | it with the command |
| @@ -993,8 +995,8 @@ down, then use a prefix argument: | |||
| 993 | 995 | ||
| 994 | Your strokes are stored as you enter them. They get saved into the | 996 | Your strokes are stored as you enter them. They get saved into the |
| 995 | file specified by the `strokes-file' variable, along with other strokes | 997 | file specified by the `strokes-file' variable, along with other strokes |
| 996 | configuration variables. You will be prompted to save them when | 998 | configuration variables. You will be prompted to save them when you |
| 997 | you exit Emacs, or you can save them with | 999 | exit Emacs, or you can save them with |
| 998 | 1000 | ||
| 999 | > M-x strokes-prompt-user-save-strokes | 1001 | > M-x strokes-prompt-user-save-strokes |
| 1000 | 1002 | ||
| @@ -1009,7 +1011,7 @@ If you'd like to create graphical files with strokes, you'll have to | |||
| 1009 | be running a version of Emacs with XPM support. You use the binding | 1011 | be running a version of Emacs with XPM support. You use the binding |
| 1010 | to `strokes-compose-complex-stroke' to start drawing your strokes. | 1012 | to `strokes-compose-complex-stroke' to start drawing your strokes. |
| 1011 | These are just complex strokes, and thus continue drawing with mouse-1 | 1013 | These are just complex strokes, and thus continue drawing with mouse-1 |
| 1012 | or mouse-2 and end with mouse-3. Then the stroke image gets inserted | 1014 | or mouse-2 and end with mouse-3. Then the stroke image gets inserted |
| 1013 | into the buffer. You treat it somewhat like any other character, | 1015 | into the buffer. You treat it somewhat like any other character, |
| 1014 | which you can copy, paste, delete, move, etc. When all is done, you | 1016 | which you can copy, paste, delete, move, etc. When all is done, you |
| 1015 | may want to send the file, or save it. This is done with | 1017 | may want to send the file, or save it. This is done with |
| @@ -1147,7 +1149,7 @@ Returns value of `strokes-use-strokes-buffer'." | |||
| 1147 | (not strokes-use-strokes-buffer)))) | 1149 | (not strokes-use-strokes-buffer)))) |
| 1148 | 1150 | ||
| 1149 | (defun strokes-xpm-for-stroke (&optional stroke bufname b/w-only) | 1151 | (defun strokes-xpm-for-stroke (&optional stroke bufname b/w-only) |
| 1150 | "Create an XPM pixmap for the given STROKE in buffer ` *strokes-xpm*'. | 1152 | "Create an XPM pixmap for the given STROKE in buffer \" *strokes-xpm*\". |
| 1151 | If STROKE is not supplied, then `strokes-last-stroke' will be used. | 1153 | If STROKE is not supplied, then `strokes-last-stroke' will be used. |
| 1152 | Optional BUFNAME to name something else. | 1154 | Optional BUFNAME to name something else. |
| 1153 | The pixmap will contain time information via rainbow dot colors | 1155 | The pixmap will contain time information via rainbow dot colors |
| @@ -1318,8 +1320,8 @@ the stroke as a character in some language." | |||
| 1318 | ;;;###autoload | 1320 | ;;;###autoload |
| 1319 | (defun strokes-list-strokes (&optional chronological strokes-map) | 1321 | (defun strokes-list-strokes (&optional chronological strokes-map) |
| 1320 | "Pop up a buffer containing an alphabetical listing of strokes in STROKES-MAP. | 1322 | "Pop up a buffer containing an alphabetical listing of strokes in STROKES-MAP. |
| 1321 | With CHRONOLOGICAL prefix arg \(\\[universal-argument]\) list strokes | 1323 | With CHRONOLOGICAL prefix arg (\\[universal-argument]) list strokes chronologically |
| 1322 | chronologically by command name. | 1324 | by command name. |
| 1323 | If STROKES-MAP is not given, `strokes-global-map' will be used instead." | 1325 | If STROKES-MAP is not given, `strokes-global-map' will be used instead." |
| 1324 | (interactive "P") | 1326 | (interactive "P") |
| 1325 | (setq strokes-map (or strokes-map | 1327 | (setq strokes-map (or strokes-map |
| @@ -1386,8 +1388,8 @@ If STROKES-MAP is not given, `strokes-global-map' will be used instead." | |||
| 1386 | (define-minor-mode strokes-mode | 1388 | (define-minor-mode strokes-mode |
| 1387 | "Toggle Strokes mode, a global minor mode. | 1389 | "Toggle Strokes mode, a global minor mode. |
| 1388 | With a prefix argument ARG, enable Strokes mode if ARG is | 1390 | With a prefix argument ARG, enable Strokes mode if ARG is |
| 1389 | positive, and disable it otherwise. If called from Lisp, enable | 1391 | positive, and disable it otherwise. If called from Lisp, |
| 1390 | the mode if ARG is omitted or nil. | 1392 | enable the mode if ARG is omitted or nil. |
| 1391 | 1393 | ||
| 1392 | \\<strokes-mode-map> | 1394 | \\<strokes-mode-map> |
| 1393 | Strokes are pictographic mouse gestures which invoke commands. | 1395 | Strokes are pictographic mouse gestures which invoke commands. |
| @@ -1540,7 +1542,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer], | |||
| 1540 | 1542 | ||
| 1541 | (defun strokes-xpm-to-compressed-string (&optional xpm-buffer) | 1543 | (defun strokes-xpm-to-compressed-string (&optional xpm-buffer) |
| 1542 | "Convert XPM in XPM-BUFFER to compressed string representing the stroke. | 1544 | "Convert XPM in XPM-BUFFER to compressed string representing the stroke. |
| 1543 | XPM-BUFFER defaults to ` *strokes-xpm*'." | 1545 | XPM-BUFFER defaults to \" *strokes-xpm*\"." |
| 1544 | (with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")) | 1546 | (with-current-buffer (setq xpm-buffer (or xpm-buffer " *strokes-xpm*")) |
| 1545 | (goto-char (point-min)) | 1547 | (goto-char (point-min)) |
| 1546 | (search-forward "/* pixels */") ; skip past header junk | 1548 | (search-forward "/* pixels */") ; skip past header junk |
| @@ -1707,7 +1709,7 @@ Optional FORCE non-nil will ignore the buffer's read-only status." | |||
| 1707 | 1709 | ||
| 1708 | (defun strokes-xpm-for-compressed-string (compressed-string &optional bufname) | 1710 | (defun strokes-xpm-for-compressed-string (compressed-string &optional bufname) |
| 1709 | "Convert the stroke represented by COMPRESSED-STRING into an XPM. | 1711 | "Convert the stroke represented by COMPRESSED-STRING into an XPM. |
| 1710 | Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)" | 1712 | Store XPM in buffer BUFNAME if supplied (default is \" *strokes-xpm*\")" |
| 1711 | (or bufname (setq bufname " *strokes-xpm*")) | 1713 | (or bufname (setq bufname " *strokes-xpm*")) |
| 1712 | (with-current-buffer (get-buffer-create bufname) | 1714 | (with-current-buffer (get-buffer-create bufname) |
| 1713 | (erase-buffer) | 1715 | (erase-buffer) |