comparison lisp/strokes.el @ 64023:22c5a8628828

(strokes): Finish `defgroup' description with period. (strokes-read-stroke, strokes-read-complex-stroke, strokes-fill-current-buffer-with-whitespace, strokes-xpm-for-stroke, strokes-list-strokes, strokes-xpm-char-bit-p, strokes-xpm-for-compressed-string): "?\ " -> "?\s".
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 04 Jul 2005 02:33:29 +0000
parents cf36e45beb9c
children 6fb026ad601f
comparison
equal deleted inserted replaced
64022:9a64c5484f9b 64023:22c5a8628828
206 "The header to all xpm buffers created by strokes.") 206 "The header to all xpm buffers created by strokes.")
207 207
208 ;;; user variables... 208 ;;; user variables...
209 209
210 (defgroup strokes nil 210 (defgroup strokes nil
211 "Control Emacs through mouse strokes" 211 "Control Emacs through mouse strokes."
212 :link '(emacs-commentary-link "strokes") 212 :link '(emacs-commentary-link "strokes")
213 :link '(url-link "http://www.mit.edu/people/cadet/strokes-help.html") 213 :link '(url-link "http://www.mit.edu/people/cadet/strokes-help.html")
214 :group 'mouse) 214 :group 'mouse)
215 215
216 (defcustom strokes-modeline-string " Strokes" 216 (defcustom strokes-modeline-string " Strokes"
751 (if (and point safe-to-draw-p) 751 (if (and point safe-to-draw-p)
752 ;; we can draw that point 752 ;; we can draw that point
753 (progn 753 (progn
754 (goto-char point) 754 (goto-char point)
755 (subst-char-in-region point (1+ point) 755 (subst-char-in-region point (1+ point)
756 ?\ strokes-character)) 756 ?\s strokes-character))
757 ;; otherwise, we can start drawing the next time... 757 ;; otherwise, we can start drawing the next time...
758 (setq safe-to-draw-p t)) 758 (setq safe-to-draw-p t))
759 (push (cdr (mouse-pixel-position)) 759 (push (cdr (mouse-pixel-position))
760 pix-locs))) 760 pix-locs)))
761 (setq event (read-event))))) 761 (setq event (read-event)))))
762 ;; protected 762 ;; protected
763 ;; clean up strokes buffer and then bury it. 763 ;; clean up strokes buffer and then bury it.
764 (when (equal (buffer-name) strokes-buffer-name) 764 (when (equal (buffer-name) strokes-buffer-name)
765 (subst-char-in-region (point-min) (point-max) 765 (subst-char-in-region (point-min) (point-max)
766 strokes-character ?\ ) 766 strokes-character ?\s)
767 (goto-char (point-min)) 767 (goto-char (point-min))
768 (bury-buffer)))) 768 (bury-buffer))))
769 ;; Otherwise, don't use strokes buffer and read stroke silently 769 ;; Otherwise, don't use strokes buffer and read stroke silently
770 (when prompt 770 (when prompt
771 (message prompt) 771 (message prompt)
811 (if (strokes-mouse-event-p event) 811 (if (strokes-mouse-event-p event)
812 (let ((point (strokes-event-closest-point event))) 812 (let ((point (strokes-event-closest-point event)))
813 (when point 813 (when point
814 (goto-char point) 814 (goto-char point)
815 (subst-char-in-region point (1+ point) 815 (subst-char-in-region point (1+ point)
816 ?\ strokes-character)) 816 ?\s strokes-character))
817 (push (cdr (mouse-pixel-position)) 817 (push (cdr (mouse-pixel-position))
818 pix-locs))) 818 pix-locs)))
819 (setq event (read-event))) 819 (setq event (read-event)))
820 (push strokes-lift pix-locs) 820 (push strokes-lift pix-locs)
821 (while (not (strokes-button-press-event-p event)) 821 (while (not (strokes-button-press-event-p event))
829 (strokes-fill-stroke 829 (strokes-fill-stroke
830 (strokes-eliminate-consecutive-redundancies grid-locs))) 830 (strokes-eliminate-consecutive-redundancies grid-locs)))
831 ;; protected 831 ;; protected
832 (when (equal (buffer-name) strokes-buffer-name) 832 (when (equal (buffer-name) strokes-buffer-name)
833 (subst-char-in-region (point-min) (point-max) 833 (subst-char-in-region (point-min) (point-max)
834 strokes-character ?\ ) 834 strokes-character ?\s)
835 (goto-char (point-min)) 835 (goto-char (point-min))
836 (bury-buffer))))))) 836 (bury-buffer)))))))
837 837
838 (defun strokes-execute-stroke (stroke) 838 (defun strokes-execute-stroke (stroke)
839 "Given STROKE, execute the command which corresponds to it. 839 "Given STROKE, execute the command which corresponds to it.
1033 1033
1034 (defsubst strokes-fill-current-buffer-with-whitespace () 1034 (defsubst strokes-fill-current-buffer-with-whitespace ()
1035 "Erase the contents of the current buffer and fill it with whitespace." 1035 "Erase the contents of the current buffer and fill it with whitespace."
1036 (erase-buffer) 1036 (erase-buffer)
1037 (loop repeat (frame-height) do 1037 (loop repeat (frame-height) do
1038 (insert-char ?\ (1- (frame-width))) 1038 (insert-char ?\s (1- (frame-width)))
1039 (newline)) 1039 (newline))
1040 (goto-char (point-min))) 1040 (goto-char (point-min)))
1041 1041
1042 (defun strokes-window-configuration-changed-p () 1042 (defun strokes-window-configuration-changed-p ()
1043 "Non-nil if the `strokes-window-configuration' frame properties changed. 1043 "Non-nil if the `strokes-window-configuration' frame properties changed.
1167 (set-buffer buf) 1167 (set-buffer buf)
1168 (erase-buffer) 1168 (erase-buffer)
1169 (insert strokes-xpm-header) 1169 (insert strokes-xpm-header)
1170 (loop repeat 33 do 1170 (loop repeat 33 do
1171 (insert ?\") 1171 (insert ?\")
1172 (insert-char ?\ 33) 1172 (insert-char ?\s 33)
1173 (insert "\",") 1173 (insert "\",")
1174 (newline) 1174 (newline)
1175 finally 1175 finally
1176 (forward-line -1) 1176 (forward-line -1)
1177 (end-of-line) 1177 (end-of-line)
1193 (setq rainbow-chars (cdr rainbow-chars) 1193 (setq rainbow-chars (cdr rainbow-chars)
1194 lift-flag nil)) 1194 lift-flag nil))
1195 ;; Otherwise, just plot the point... 1195 ;; Otherwise, just plot the point...
1196 (goto-line (+ 17 y)) 1196 (goto-line (+ 17 y))
1197 (forward-char (+ 2 x)) 1197 (forward-char (+ 2 x))
1198 (subst-char-in-region (point) (1+ (point)) ?\ ?\*))) 1198 (subst-char-in-region (point) (1+ (point)) ?\s ?\*)))
1199 ((strokes-lift-p point) 1199 ((strokes-lift-p point)
1200 ;; a lift--tell the loop to X out the next point... 1200 ;; a lift--tell the loop to X out the next point...
1201 (setq lift-flag t)))) 1201 (setq lift-flag t))))
1202 (when (interactive-p) 1202 (when (interactive-p)
1203 (pop-to-buffer " *strokes-xpm*") 1203 (pop-to-buffer " *strokes-xpm*")
1284 ;; for i from 0 to (1- (length strokes-map)) do 1284 ;; for i from 0 to (1- (length strokes-map)) do
1285 ;; (let ((stroke (car def)) 1285 ;; (let ((stroke (car def))
1286 ;; (command-name (symbol-name (cdr def)))) 1286 ;; (command-name (symbol-name (cdr def))))
1287 ;; (strokes-xpm-for-stroke stroke " *strokes-xpm*") 1287 ;; (strokes-xpm-for-stroke stroke " *strokes-xpm*")
1288 ;; (newline 2) 1288 ;; (newline 2)
1289 ;; (insert-char ?\ 45) 1289 ;; (insert-char ?\s 45)
1290 ;; (beginning-of-line) 1290 ;; (beginning-of-line)
1291 ;; (insert command-name) 1291 ;; (insert command-name)
1292 ;; (beginning-of-line) 1292 ;; (beginning-of-line)
1293 ;; (forward-char 45) 1293 ;; (forward-char 45)
1294 ;; (set (intern (format "strokes-list-annotation-%d" i)) 1294 ;; (set (intern (format "strokes-list-annotation-%d" i))
1340 (command-name (if (symbolp (cdr def)) 1340 (command-name (if (symbolp (cdr def))
1341 (symbol-name (cdr def)) 1341 (symbol-name (cdr def))
1342 (prin1-to-string (cdr def))))) 1342 (prin1-to-string (cdr def)))))
1343 (strokes-xpm-for-stroke stroke " *strokes-xpm*") 1343 (strokes-xpm-for-stroke stroke " *strokes-xpm*")
1344 (newline 2) 1344 (newline 2)
1345 (insert-char ?\ 45) 1345 (insert-char ?\s 45)
1346 (beginning-of-line) 1346 (beginning-of-line)
1347 (insert command-name) 1347 (insert command-name)
1348 (beginning-of-line) 1348 (beginning-of-line)
1349 (forward-char 45) 1349 (forward-char 45)
1350 (insert-image 1350 (insert-image
1513 "Non-nil if CHAR represents an `on' bit in the XPM." 1513 "Non-nil if CHAR represents an `on' bit in the XPM."
1514 (eq char ?*)) 1514 (eq char ?*))
1515 1515
1516 (defsubst strokes-xpm-char-bit-p (char) 1516 (defsubst strokes-xpm-char-bit-p (char)
1517 "Non-nil if CHAR represents an `on' or `off' bit in the XPM." 1517 "Non-nil if CHAR represents an `on' or `off' bit in the XPM."
1518 (or (eq char ?\ ) 1518 (or (eq char ?\s)
1519 (eq char ?*))) 1519 (eq char ?*)))
1520 1520
1521 ;;(defsubst strokes-xor (a b) ### Should I make this an inline function? ### 1521 ;;(defsubst strokes-xor (a b) ### Should I make this an inline function? ###
1522 ;; "T iff one and only one of A and B is non-nil; otherwise, returns nil. 1522 ;; "T iff one and only one of A and B is non-nil; otherwise, returns nil.
1523 ;;NOTE: Don't use this as a numeric xor since it treats all non-nil 1523 ;;NOTE: Don't use this as a numeric xor since it treats all non-nil
1714 (let ((current-char-is-on-p nil)) 1714 (let ((current-char-is-on-p nil))
1715 (while (not (eobp)) 1715 (while (not (eobp))
1716 (insert-char 1716 (insert-char
1717 (if current-char-is-on-p 1717 (if current-char-is-on-p
1718 ?* 1718 ?*
1719 ?\ ) 1719 ?\s)
1720 (strokes-xpm-decode-char (char-after))) 1720 (strokes-xpm-decode-char (char-after)))
1721 (delete-char 1) 1721 (delete-char 1)
1722 (setq current-char-is-on-p (not current-char-is-on-p))) 1722 (setq current-char-is-on-p (not current-char-is-on-p)))
1723 (goto-char (point-min)) 1723 (goto-char (point-min))
1724 (loop repeat 33 do 1724 (loop repeat 33 do