208 |
;;; user variables... |
;;; user variables... |
209 |
|
|
210 |
(defgroup strokes nil |
(defgroup strokes nil |
211 |
"Control Emacs through mouse strokes" |
"Control Emacs through mouse strokes." |
212 |
:link '(emacs-commentary-link "strokes") |
:link '(emacs-commentary-link "strokes") |
213 |
:link '(url-link "http://www.mit.edu/people/cadet/strokes-help.html") |
:link '(url-link "http://www.mit.edu/people/cadet/strokes-help.html") |
214 |
:group 'mouse) |
:group 'mouse) |
753 |
(progn |
(progn |
754 |
(goto-char point) |
(goto-char point) |
755 |
(subst-char-in-region point (1+ point) |
(subst-char-in-region point (1+ point) |
756 |
?\ strokes-character)) |
?\s strokes-character)) |
757 |
;; otherwise, we can start drawing the next time... |
;; otherwise, we can start drawing the next time... |
758 |
(setq safe-to-draw-p t)) |
(setq safe-to-draw-p t)) |
759 |
(push (cdr (mouse-pixel-position)) |
(push (cdr (mouse-pixel-position)) |
763 |
;; clean up strokes buffer and then bury it. |
;; clean up strokes buffer and then bury it. |
764 |
(when (equal (buffer-name) strokes-buffer-name) |
(when (equal (buffer-name) strokes-buffer-name) |
765 |
(subst-char-in-region (point-min) (point-max) |
(subst-char-in-region (point-min) (point-max) |
766 |
strokes-character ?\ ) |
strokes-character ?\s) |
767 |
(goto-char (point-min)) |
(goto-char (point-min)) |
768 |
(bury-buffer)))) |
(bury-buffer)))) |
769 |
;; Otherwise, don't use strokes buffer and read stroke silently |
;; Otherwise, don't use strokes buffer and read stroke silently |
813 |
(when point |
(when point |
814 |
(goto-char point) |
(goto-char point) |
815 |
(subst-char-in-region point (1+ point) |
(subst-char-in-region point (1+ point) |
816 |
?\ strokes-character)) |
?\s strokes-character)) |
817 |
(push (cdr (mouse-pixel-position)) |
(push (cdr (mouse-pixel-position)) |
818 |
pix-locs))) |
pix-locs))) |
819 |
(setq event (read-event))) |
(setq event (read-event))) |
831 |
;; protected |
;; protected |
832 |
(when (equal (buffer-name) strokes-buffer-name) |
(when (equal (buffer-name) strokes-buffer-name) |
833 |
(subst-char-in-region (point-min) (point-max) |
(subst-char-in-region (point-min) (point-max) |
834 |
strokes-character ?\ ) |
strokes-character ?\s) |
835 |
(goto-char (point-min)) |
(goto-char (point-min)) |
836 |
(bury-buffer))))))) |
(bury-buffer))))))) |
837 |
|
|
1035 |
"Erase the contents of the current buffer and fill it with whitespace." |
"Erase the contents of the current buffer and fill it with whitespace." |
1036 |
(erase-buffer) |
(erase-buffer) |
1037 |
(loop repeat (frame-height) do |
(loop repeat (frame-height) do |
1038 |
(insert-char ?\ (1- (frame-width))) |
(insert-char ?\s (1- (frame-width))) |
1039 |
(newline)) |
(newline)) |
1040 |
(goto-char (point-min))) |
(goto-char (point-min))) |
1041 |
|
|
1169 |
(insert strokes-xpm-header) |
(insert strokes-xpm-header) |
1170 |
(loop repeat 33 do |
(loop repeat 33 do |
1171 |
(insert ?\") |
(insert ?\") |
1172 |
(insert-char ?\ 33) |
(insert-char ?\s 33) |
1173 |
(insert "\",") |
(insert "\",") |
1174 |
(newline) |
(newline) |
1175 |
finally |
finally |
1195 |
;; Otherwise, just plot the point... |
;; Otherwise, just plot the point... |
1196 |
(goto-line (+ 17 y)) |
(goto-line (+ 17 y)) |
1197 |
(forward-char (+ 2 x)) |
(forward-char (+ 2 x)) |
1198 |
(subst-char-in-region (point) (1+ (point)) ?\ ?\*))) |
(subst-char-in-region (point) (1+ (point)) ?\s ?\*))) |
1199 |
((strokes-lift-p point) |
((strokes-lift-p point) |
1200 |
;; a lift--tell the loop to X out the next point... |
;; a lift--tell the loop to X out the next point... |
1201 |
(setq lift-flag t)))) |
(setq lift-flag t)))) |
1286 |
;; (command-name (symbol-name (cdr def)))) |
;; (command-name (symbol-name (cdr def)))) |
1287 |
;; (strokes-xpm-for-stroke stroke " *strokes-xpm*") |
;; (strokes-xpm-for-stroke stroke " *strokes-xpm*") |
1288 |
;; (newline 2) |
;; (newline 2) |
1289 |
;; (insert-char ?\ 45) |
;; (insert-char ?\s 45) |
1290 |
;; (beginning-of-line) |
;; (beginning-of-line) |
1291 |
;; (insert command-name) |
;; (insert command-name) |
1292 |
;; (beginning-of-line) |
;; (beginning-of-line) |
1342 |
(prin1-to-string (cdr def))))) |
(prin1-to-string (cdr def))))) |
1343 |
(strokes-xpm-for-stroke stroke " *strokes-xpm*") |
(strokes-xpm-for-stroke stroke " *strokes-xpm*") |
1344 |
(newline 2) |
(newline 2) |
1345 |
(insert-char ?\ 45) |
(insert-char ?\s 45) |
1346 |
(beginning-of-line) |
(beginning-of-line) |
1347 |
(insert command-name) |
(insert command-name) |
1348 |
(beginning-of-line) |
(beginning-of-line) |
1515 |
|
|
1516 |
(defsubst strokes-xpm-char-bit-p (char) |
(defsubst strokes-xpm-char-bit-p (char) |
1517 |
"Non-nil if CHAR represents an `on' or `off' bit in the XPM." |
"Non-nil if CHAR represents an `on' or `off' bit in the XPM." |
1518 |
(or (eq char ?\ ) |
(or (eq char ?\s) |
1519 |
(eq char ?*))) |
(eq char ?*))) |
1520 |
|
|
1521 |
;;(defsubst strokes-xor (a b) ### Should I make this an inline function? ### |
;;(defsubst strokes-xor (a b) ### Should I make this an inline function? ### |
1716 |
(insert-char |
(insert-char |
1717 |
(if current-char-is-on-p |
(if current-char-is-on-p |
1718 |
?* |
?* |
1719 |
?\ ) |
?\s) |
1720 |
(strokes-xpm-decode-char (char-after))) |
(strokes-xpm-decode-char (char-after))) |
1721 |
(delete-char 1) |
(delete-char 1) |
1722 |
(setq current-char-is-on-p (not current-char-is-on-p))) |
(setq current-char-is-on-p (not current-char-is-on-p))) |