aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/strokes.el406
1 files changed, 205 insertions, 201 deletions
diff --git a/lisp/strokes.el b/lisp/strokes.el
index b9dc400f3ff..bca84e5bb3b 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1,10 +1,9 @@
1;;; strokes.el -- Control Emacs through mouse strokes -- 1;;; strokes.el --- control Emacs through mouse strokes
2 2
3;; Copyright (C) 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1997 Free Software Foundation, Inc.
4 4
5;; Author: David Bakhash <cadet@mit.edu> 5;; Author: David Bakhash <cadet@mit.edu>
6;; Maintainer: David Bakhash <cadet@mit.edu> 6;; Maintainer: David Bakhash <cadet@mit.edu>
7;; Created: 12 April 1997
8;; Keywords: lisp, mouse, extensions 7;; Keywords: lisp, mouse, extensions
9 8
10;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -195,10 +194,9 @@
195 194
196(autoload 'reporter-submit-bug-report "reporter") 195(autoload 'reporter-submit-bug-report "reporter")
197(autoload 'mail-position-on-field "sendmail") 196(autoload 'mail-position-on-field "sendmail")
198(eval-when-compile 197(eval-and-compile
199 (mapcar 'require '(pp reporter advice))) 198 (mapcar 'require '(pp reporter advice custom cl))
200 199 (mapcar 'load '("cl-macs" "cl-seq" "levents")))
201(require 'levents)
202 200
203;;; Constants... 201;;; Constants...
204 202
@@ -213,6 +211,14 @@ This will be useful for when Emacs understands Chinese.")
213 211
214;;; user variables... 212;;; user variables...
215 213
214;; suggested Custom hack, so strokes is compatible with emacs19...
215
216(eval-and-compile
217 (if (fboundp 'defgroup) nil
218 (defmacro defgroup (&rest forms) nil)
219 (defmacro defcustom (name init doc &rest forms)
220 (list 'defvar name init doc))))
221
216(defgroup strokes nil 222(defgroup strokes nil
217 "Control Emacs through mouse strokes" 223 "Control Emacs through mouse strokes"
218 :group 'mouse) 224 :group 'mouse)
@@ -224,7 +230,7 @@ This will be useful for when Emacs understands Chinese.")
224 230
225(defcustom strokes-character ?@ 231(defcustom strokes-character ?@
226 "*Character used when drawing strokes in the strokes buffer. 232 "*Character used when drawing strokes in the strokes buffer.
227\(The default is lower-case `o', which works okay\)." 233\(The default is lower-case `@', which works okay\)."
228 :type 'character 234 :type 'character
229 :group 'strokes) 235 :group 'strokes)
230 236
@@ -316,12 +322,12 @@ corresponding interactive function")
316 322
317(defsubst strokes-click-p (stroke) 323(defsubst strokes-click-p (stroke)
318 "Non-nil if STROKE is really click." 324 "Non-nil if STROKE is really click."
319 (< (length stroke) 3)) 325 (< (length stroke) 2))
320 326
321;;; old, but worked pretty good (just in case)... 327;;; old, but worked pretty good (just in case)...
322;;(defmacro strokes-define-stroke (stroke-map stroke def) 328;;(defmacro strokes-define-stroke (stroke-map stroke def)
323;; "Add STROKE to STROKE-MAP alist with given command DEF" 329;; "Add STROKE to STROKE-MAP alist with given command DEF"
324;; (list 'if (list '< (list 'length stroke) 3) 330;; (list 'if (list '< (list 'length stroke) 2)
325;; (list 'error 331;; (list 'error
326;; "That's a click, not a stroke. See `strokes-click-command'") 332;; "That's a click, not a stroke. See `strokes-click-command'")
327;; (list 'setq stroke-map (list 'cons (list 'cons stroke def) 333;; (list 'setq stroke-map (list 'cons (list 'cons stroke def)
@@ -407,7 +413,7 @@ and which is an interactive funcion of one event argument:
407 ;; then strokes is no good and we'll have to use the original 413 ;; then strokes is no good and we'll have to use the original
408 ad-do-it 414 ad-do-it
409 ;; otherwise, we can make strokes work too... 415 ;; otherwise, we can make strokes work too...
410 (let ((strokes-click-command 416 (let ((strokes-click-command
411 ',(intern (format "ad-Orig-%s" command)))) 417 ',(intern (format "ad-Orig-%s" command))))
412 (strokes-do-stroke (ad-get-arg 0)))))))) 418 (strokes-do-stroke (ad-get-arg 0))))))))
413 419
@@ -494,7 +500,7 @@ or for window WINDOW if that is specified."
494 (if (windowp end-w) 500 (if (windowp end-w)
495 (nth 1 (window-edges end-w)) 501 (nth 1 (window-edges end-w))
496 (/ (cdr (posn-x-y (event-end event))) 502 (/ (cdr (posn-x-y (event-end event)))
497 ((frame-char-height end-w))))) 503 (frame-char-height end-w))))
498 (if (>= end-w-top w-top) 504 (if (>= end-w-top w-top)
499 (strokes-event-closest-point-1 start-window) 505 (strokes-event-closest-point-1 start-window)
500 (window-start start-window))))) 506 (window-start start-window)))))
@@ -507,7 +513,7 @@ or for window WINDOW if that is specified."
507 "Undo the last stroke definition." 513 "Undo the last stroke definition."
508 (interactive) 514 (interactive)
509 (let ((command (cdar strokes-global-map))) 515 (let ((command (cdar strokes-global-map)))
510 (if (y-or-n-p-maybe-dialog-box 516 (if (y-or-n-p
511 (format "really delete last stroke definition, defined to `%s'? " 517 (format "really delete last stroke definition, defined to `%s'? "
512 command)) 518 command))
513 (progn 519 (progn
@@ -829,109 +835,110 @@ Optional PROMPT in minibuffer displays before and during stroke reading.
829This function will display the stroke interactively as it is being 835This function will display the stroke interactively as it is being
830entered in the strokes buffer if the variable 836entered in the strokes buffer if the variable
831`strokes-use-strokes-buffer' is non-nil. 837`strokes-use-strokes-buffer' is non-nil.
832Optional EVENT is currently not used, but hopefully will be soon." 838Optional EVENT is acceptable as the starting event of the stroke"
833 (save-excursion 839 (save-excursion
834 (track-mouse 840 (let ((pix-locs nil)
835 (let ((pix-locs nil) 841 (grid-locs nil)
836 (grid-locs nil) 842 (safe-to-draw-p nil))
837 (event nil)) 843 (if strokes-use-strokes-buffer
838 (if strokes-use-strokes-buffer 844 ;; switch to the strokes buffer and
839 ;; switch to the strokes buffer and 845 ;; display the stroke as it's being read
840 ;; display the stroke as it's being read 846 (save-window-excursion
841 (save-window-excursion 847 (set-window-configuration strokes-window-configuration)
842 (set-window-configuration strokes-window-configuration) 848 (when prompt
843 (if prompt 849 (message prompt)
844 (progn 850 (setq event (read-event))
845 (message prompt) 851 (or (button-press-event-p event)
846 (setq event (read-event)) 852 (error "You must draw with the mouse")))
847 (while (not (button-press-event-p event)) 853 (unwind-protect
848 (setq event (read-event))))) 854 (track-mouse
849 (unwind-protect 855 (or event (setq event (read-event)
850 (progn 856 safe-to-draw-p t))
851 (setq event (read-event))
852 (while (not (button-release-event-p event))
853 (if (strokes-mouse-event-p event)
854 (let ((point (strokes-event-closest-point event)))
855 (when point
856 (goto-char point)
857 (subst-char-in-region point (1+ point) ?\ strokes-character))
858 (push (cons (event-x-pixel event)
859 (event-y-pixel event))
860 pix-locs)))
861 (setq event (read-event))))
862 ;; protected
863 ;; clean up strokes buffer and then bury it.
864 (when (equal (buffer-name) strokes-buffer-name)
865 (subst-char-in-region (point-min) (point-max) strokes-character ?\ )
866 (goto-char (point-min))
867 (bury-buffer))))
868 ;; Otherwise, don't use strokes buffer and read stroke silently
869 (if prompt
870 (progn
871 (message prompt)
872 (setq event (read-event))
873 (while (not (button-press-event-p event))
874 (setq event (read-event)))))
875 (setq event (read-event))
876 (while (not (button-release-event-p event))
877 (if (strokes-mouse-event-p event)
878 (push (cons (event-x-pixel event)
879 (event-y-pixel event))
880 pix-locs))
881 (setq event (read-event))))
882 (setq grid-locs (strokes-renormalize-to-grid (nreverse pix-locs)))
883 (strokes-fill-stroke (strokes-eliminate-consecutive-redundancies grid-locs))))))
884
885;;;###autoload
886(defun strokes-read-complex-stroke (&optional prompt event)
887 "Read a complex stroke (interactively) and return the stroke.
888Optional PROMPT in minibuffer displays before and during stroke reading.
889Note that a complex stroke allows the user to pen-up and pen-down. This
890is implemented by allowing the user to paint with button1 or button2 and
891then complete the stroke with button3.
892Optional EVENT is currently not used, but hopefully will be soon."
893 (save-excursion
894 (save-window-excursion
895 (track-mouse
896 (set-window-configuration strokes-window-configuration)
897 (let ((pix-locs nil)
898 (grid-locs nil)
899 (event (or event (read-event))))
900 (if prompt
901 (while (not (button-press-event-p event))
902 (message prompt)
903 (setq event (read-event))))
904 (unwind-protect
905 (progn
906 (setq event (read-event))
907 (while (not (and (button-press-event-p event)
908 (eq (event-button event) 3)))
909 (while (not (button-release-event-p event)) 857 (while (not (button-release-event-p event))
910 (if (strokes-mouse-event-p event) 858 (if (strokes-mouse-event-p event)
911 (let ((point (strokes-event-closest-point event))) 859 (let ((point (strokes-event-closest-point event)))
912 (when point 860 (if (and point safe-to-draw-p)
913 (goto-char point) 861 ;; we can draw that point
914 (subst-char-in-region point (1+ point) ?\ strokes-character)) 862 (progn
863 (goto-char point)
864 (subst-char-in-region point (1+ point) ?\ strokes-character))
865 ;; otherwise, we can start drawing the next time...
866 (setq safe-to-draw-p t))
915 (push (cons (event-x-pixel event) 867 (push (cons (event-x-pixel event)
916 (event-y-pixel event)) 868 (event-y-pixel event))
917 pix-locs))) 869 pix-locs)))
918 (setq event (read-event))) 870 (setq event (read-event)))))
919 (push strokes-lift pix-locs)
920 (while (not (button-press-event-p event))
921 (setq event (read-event))))
922 ;; ### KLUDGE! ### sit and wait
923 ;; for some useless event to
924 ;; happen to fix the minibuffer bug.
925 (while (not (button-release-event-p (read-event))))
926 (setq pix-locs (nreverse (cdr pix-locs))
927 grid-locs (strokes-renormalize-to-grid pix-locs))
928 (strokes-fill-stroke
929 (strokes-eliminate-consecutive-redundancies grid-locs)))
930 ;; protected 871 ;; protected
872 ;; clean up strokes buffer and then bury it.
931 (when (equal (buffer-name) strokes-buffer-name) 873 (when (equal (buffer-name) strokes-buffer-name)
932 (subst-char-in-region (point-min) (point-max) strokes-character ?\ ) 874 (subst-char-in-region (point-min) (point-max) strokes-character ?\ )
933 (goto-char (point-min)) 875 (goto-char (point-min))
934 (bury-buffer)))))))) 876 (bury-buffer))))
877 ;; Otherwise, don't use strokes buffer and read stroke silently
878 (when prompt
879 (message prompt)
880 (setq event (read-event))
881 (or (button-press-event-p event)
882 (error "You must draw with the mouse")))
883 (track-mouse
884 (or event (setq event (read-event)))
885 (while (not (button-release-event-p event))
886 (if (strokes-mouse-event-p event)
887 (push (cons (event-x-pixel event)
888 (event-y-pixel event))
889 pix-locs))
890 (setq event (read-event))))
891 (setq grid-locs (strokes-renormalize-to-grid (nreverse pix-locs)))
892 (strokes-fill-stroke (strokes-eliminate-consecutive-redundancies grid-locs)))))
893
894;;;###autoload
895(defun strokes-read-complex-stroke (&optional prompt event)
896 "Read a complex stroke (interactively) and return the stroke.
897Optional PROMPT in minibuffer displays before and during stroke reading.
898Note that a complex stroke allows the user to pen-up and pen-down. This
899is implemented by allowing the user to paint with button1 or button2 and
900then complete the stroke with button3.
901Optional EVENT is acceptable as the starting event of the stroke"
902 (save-excursion
903 (save-window-excursion
904 (set-window-configuration strokes-window-configuration)
905 (let ((pix-locs nil)
906 (grid-locs nil))
907 (if prompt
908 (while (not (button-press-event-p event))
909 (message prompt)
910 (setq event (read-event))))
911 (unwind-protect
912 (track-mouse
913 (or event (setq event (read-event)))
914 (while (not (and (button-press-event-p event)
915 (eq (event-button event) 3)))
916 (while (not (button-release-event-p event))
917 (if (strokes-mouse-event-p event)
918 (let ((point (strokes-event-closest-point event)))
919 (when point
920 (goto-char point)
921 (subst-char-in-region point (1+ point) ?\ strokes-character))
922 (push (cons (event-x-pixel event)
923 (event-y-pixel event))
924 pix-locs)))
925 (setq event (read-event)))
926 (push strokes-lift pix-locs)
927 (while (not (button-press-event-p event))
928 (setq event (read-event))))
929 ;; ### KLUDGE! ### sit and wait
930 ;; for some useless event to
931 ;; happen to fix the minibuffer bug.
932 (while (not (button-release-event-p (read-event))))
933 (setq pix-locs (nreverse (cdr pix-locs))
934 grid-locs (strokes-renormalize-to-grid pix-locs))
935 (strokes-fill-stroke
936 (strokes-eliminate-consecutive-redundancies grid-locs)))
937 ;; protected
938 (when (equal (buffer-name) strokes-buffer-name)
939 (subst-char-in-region (point-min) (point-max) strokes-character ?\ )
940 (goto-char (point-min))
941 (bury-buffer)))))))
935 942
936(defun strokes-execute-stroke (stroke) 943(defun strokes-execute-stroke (stroke)
937 "Given STROKE, execute the command which corresponds to it. 944 "Given STROKE, execute the command which corresponds to it.
@@ -949,7 +956,7 @@ If no stroke matches, nothing is done and return value is nil."
949 (command-execute command)) 956 (command-execute command))
950 ((null strokes-global-map) 957 ((null strokes-global-map)
951 (if (file-exists-p strokes-file) 958 (if (file-exists-p strokes-file)
952 (and (y-or-n-p-maybe-dialog-box 959 (and (y-or-n-p
953 (format "No strokes loaded. Load `%s'? " 960 (format "No strokes loaded. Load `%s'? "
954 strokes-file)) 961 strokes-file))
955 (strokes-load-user-strokes)) 962 (strokes-load-user-strokes))
@@ -998,122 +1005,121 @@ This must be bound to a mouse event."
998;;;###autoload 1005;;;###autoload
999(defalias 'describe-stroke 'strokes-describe-stroke) 1006(defalias 'describe-stroke 'strokes-describe-stroke)
1000 1007
1001;;; ### FORGET IT! I COULN'T GET THE EMACS READER TO PARSE THIS FUNCTION ###
1002;;;###autoload 1008;;;###autoload
1003;;(defun strokes-help () 1009(defun strokes-help ()
1004;; "Get instructional help on using the the `strokes' package." 1010 "Get instructional help on using the the `strokes' package."
1005;; (interactive) 1011 (interactive)
1006;; (with-output-to-temp-buffer "*Help with Strokes*" 1012 (with-output-to-temp-buffer "*Help with Strokes*"
1007;; (let ((helpdoc 1013 (let ((helpdoc
1008;; "This is help for the strokes package. 1014 "This is help for the strokes package.
1009 1015
1010;;If you find something wrong with strokes, or feel that it can be 1016If you find something wrong with strokes, or feel that it can be
1011;;improved in some way, then please feel free to email me: 1017improved in some way, then please feel free to email me:
1012 1018
1013;;David Bakhash <cadet@mit.edu> 1019David Bakhash <cadet@mit.edu>
1014 1020
1015;;or just do 1021or just do
1016 1022
1017;;M-x strokes-report-bug 1023M-x strokes-report-bug
1018 1024
1019;;------------------------------------------------------------ 1025------------------------------------------------------------
1020 1026
1021;;** Strokes... 1027** Strokes...
1022 1028
1023;;The strokes package allows you to define strokes, made with 1029The strokes package allows you to define strokes, made with
1024;;the mouse or other pointer device, that Emacs can interpret as 1030the mouse or other pointer device, that Emacs can interpret as
1025;;corresponding to commands, and then executes the commands. It does 1031corresponding to commands, and then executes the commands. It does
1026;;character recognition, so you don't have to worry about getting it 1032character recognition, so you don't have to worry about getting it
1027;;right every time. 1033right every time.
1028 1034
1029;;Strokes are easy to program and fun to use. To start strokes going, 1035Strokes are easy to program and fun to use. To start strokes going,
1030;;you'll want to put the following line in your .emacs file as mentioned 1036you'll want to put the following line in your .emacs file as mentioned
1031;;in the commentary to strokes.el. 1037in the commentary to strokes.el.
1032 1038
1033;;This will load strokes when and only when you start Emacs on a window 1039This will load strokes when and only when you start Emacs on a window
1034;;system, with a mouse or other pointer device defined. 1040system, with a mouse or other pointer device defined.
1035 1041
1036;;To toggle strokes-mode, you just do 1042To toggle strokes-mode, you just do
1037 1043
1038;;> M-x strokes-mode 1044> M-x strokes-mode
1039 1045
1040;;** Strokes for controling the behavior of Emacs... 1046** Strokes for controling the behavior of Emacs...
1041 1047
1042;;When you're ready to start defining strokes, just use the command 1048When you're ready to start defining strokes, just use the command
1043 1049
1044;;> M-x global-set-stroke 1050> M-x global-set-stroke
1045 1051
1046;;You will see a ` *strokes*' buffer which is waiting for you to enter in 1052You will see a ` *strokes*' buffer which is waiting for you to enter in
1047;;your stroke. When you enter in the stroke, you draw with button1 or 1053your stroke. When you enter in the stroke, you draw with button1 or
1048;;button2, and then end with button3. Next, you enter in the command 1054button2, and then end with button3. Next, you enter in the command
1049;;which will be executed when that stroke is invoked. Simple as that. 1055which will be executed when that stroke is invoked. Simple as that.
1050;;For now, try to define a stroke to copy a region. This is a popular 1056For now, try to define a stroke to copy a region. This is a popular
1051;;edit command, so type 1057edit command, so type
1052 1058
1053;;> M-x global-set-stroke 1059> M-x global-set-stroke
1054 1060
1055;;Then, in the ` *strokes*' buffer, draw the letter `C' (for `copy'\) 1061Then, in the ` *strokes*' buffer, draw the letter `C' (for `copy'\)
1056;;and then, when it asks you to enter the command to map that to, type 1062and then, when it asks you to enter the command to map that to, type
1057 1063
1058;;> copy-region-as-kill 1064> copy-region-as-kill
1059 1065
1060;;That's about as hard as it gets. 1066That's about as hard as it gets.
1061;;Remember: paint with button1 or button2 and then end with button3. 1067Remember: paint with button1 or button2 and then end with button3.
1062 1068
1063;;If ever you want to know what a certain strokes maps to, then do 1069If ever you want to know what a certain strokes maps to, then do
1064 1070
1065;;> M-x describe-stroke 1071> M-x describe-stroke
1066 1072
1067;;and you can enter in any arbitrary stroke. Remember: The strokes 1073and you can enter in any arbitrary stroke. Remember: The strokes
1068;;package lets you program in simple and complex, or multi-lift, strokes. 1074package lets you program in simple and complex, or multi-lift, strokes.
1069;;The only difference is how you *invoke* the two. You will most likely 1075The only difference is how you *invoke* the two. You will most likely
1070;;use simple strokes, as complex strokes were developed for 1076use simple strokes, as complex strokes were developed for
1071;;Chinese/Japanese/Korean. So the middle mouse button, button2, will 1077Chinese/Japanese/Korean. So the middle mouse button, button2, will
1072;;invoke the command `strokes-do-stroke' in buffers where button2 doesn't 1078invoke the command `strokes-do-stroke' in buffers where button2 doesn't
1073;;already have a meaning other than its original, which is `mouse-yank'. 1079already have a meaning other than its original, which is `mouse-yank'.
1074;;But don't worry: `mouse-yank' will still work with strokes. See the 1080But don't worry: `mouse-yank' will still work with strokes. See the
1075;;variable `strokes-click-command'. 1081variable `strokes-click-command'.
1076 1082
1077;;If ever you define a stroke which you don't like, then you can unset 1083If ever you define a stroke which you don't like, then you can unset
1078;;it with the command 1084it with the command
1079 1085
1080;;> M-x strokes-unset-last-stroke 1086> M-x strokes-unset-last-stroke
1081 1087
1082;;Your strokes are stored as you enter them. They get saved in a file 1088Your strokes are stored as you enter them. They get saved in a file
1083;;called ~/.strokes, along with other strokes configuration variables. 1089called ~/.strokes, along with other strokes configuration variables.
1084;;You can change this location by setting the variable `strokes-file'. 1090You can change this location by setting the variable `strokes-file'.
1085;;You will be prompted to save them when you exit Emacs, or you can save 1091You will be prompted to save them when you exit Emacs, or you can save
1086;;them with 1092them with
1087 1093
1088;;> M-x save-strokes 1094> M-x save-strokes
1089 1095
1090;;Your strokes get loaded automatically when you enable `strokes-mode'. 1096Your strokes get loaded automatically when you enable `strokes-mode'.
1091;;You can also load in your user-defined strokes with 1097You can also load in your user-defined strokes with
1092 1098
1093;;> M-x load-user-strokes 1099> M-x load-user-strokes
1094 1100
1095;;** A few more important things... 1101** A few more important things...
1096 1102
1097;;o The command `strokes-do-stroke' is also invoked with M-button2, so that you 1103o The command `strokes-do-stroke' is also invoked with M-button2, so that you
1098;; can still enter a stroke in modes which use button2 for other things, 1104 can still enter a stroke in modes which use button2 for other things,
1099;; such as cross-referencing. 1105 such as cross-referencing.
1100 1106
1101;;o Strokes are a bit computer-dependent in that they depend somewhat on 1107o Strokes are a bit computer-dependent in that they depend somewhat on
1102;; the speed of the computer you're working on. This means that you 1108 the speed of the computer you're working on. This means that you
1103;; may have to tweak some variables. You can read about them in the 1109 may have to tweak some variables. You can read about them in the
1104;; commentary of `strokes.el'. Better to just use apropos and read their 1110 commentary of `strokes.el'. Better to just use apropos and read their
1105;; docstrings. All variables/functions start with `strokes'. The one 1111 docstrings. All variables/functions start with `strokes'. The one
1106;; variable which many people wanted to see was 1112 variable which many people wanted to see was
1107;; `strokes-use-strokes-buffer' which allows the user to use strokes 1113 `strokes-use-strokes-buffer' which allows the user to use strokes
1108;; silently--without displaying the strokes. All variables can be set 1114 silently--without displaying the strokes. All variables can be set
1109;; by customizing the group named `strokes' via the customization package: 1115 by customizing the group named `strokes' via the customization package:
1110 1116
1111;; > M-x customize")) 1117 > M-x customize"))
1112;; (save-excursion 1118 (save-excursion
1113;; (princ helpdoc) 1119 (princ helpdoc)
1114;; (set-buffer standard-output) 1120 (set-buffer standard-output)
1115;; (help-mode)) 1121 (help-mode))
1116;; (print-help-return-message))))) 1122 (print-help-return-message))))
1117 1123
1118(defun strokes-report-bug () 1124(defun strokes-report-bug ()
1119 "Submit a bug report for strokes." 1125 "Submit a bug report for strokes."
@@ -1164,7 +1170,7 @@ This must be bound to a mouse event."
1164 ;; if window is dedicated or a minibuffer 1170 ;; if window is dedicated or a minibuffer
1165 nil) 1171 nil)
1166 ((or (interactive-p) 1172 ((or (interactive-p)
1167 (not (buffer-live-p (get-buffer strokes-buffer-name))) 1173 (not (bufferp (get-buffer strokes-buffer-name)))
1168 (null strokes-window-configuration)) 1174 (null strokes-window-configuration))
1169 ;; create `strokes-window-configuration' from scratch... 1175 ;; create `strokes-window-configuration' from scratch...
1170 (save-excursion 1176 (save-excursion
@@ -1218,7 +1224,7 @@ This must be bound to a mouse event."
1218 (strokes-load-user-strokes) 1224 (strokes-load-user-strokes)
1219 (if (and (not (equal current strokes-global-map)) 1225 (if (and (not (equal current strokes-global-map))
1220 (or (interactive-p) 1226 (or (interactive-p)
1221 (yes-or-no-p-maybe-dialog-box "save your strokes? "))) 1227 (yes-or-no-p "save your strokes? ")))
1222 (progn 1228 (progn
1223 (require 'pp) ; pretty-print variables 1229 (require 'pp) ; pretty-print variables
1224 (message "Saving strokes in %s..." strokes-file) 1230 (message "Saving strokes in %s..." strokes-file)
@@ -1285,14 +1291,14 @@ strokes with
1285 (and (file-exists-p strokes-file) 1291 (and (file-exists-p strokes-file)
1286 (null strokes-global-map) 1292 (null strokes-global-map)
1287 (strokes-load-user-strokes)) 1293 (strokes-load-user-strokes))
1288 (add-hook 'kill-emacs-hook 1294 (add-hook 'kill-emacs-query-functions
1289 'strokes-prompt-user-save-strokes) 1295 'strokes-prompt-user-save-strokes)
1290 (add-hook 'select-frame-hook 1296 (add-hook 'select-frame-hook
1291 'strokes-update-window-configuration) 1297 'strokes-update-window-configuration)
1292 (strokes-update-window-configuration) 1298 (strokes-update-window-configuration)
1293 (define-key global-map [(button2)] 'strokes-do-stroke) 1299 (define-key global-map [(down-mouse-2)] 'strokes-do-stroke)
1294 (define-key global-map [(meta button2)] 'strokes-do-stroke) 1300 (define-key global-map [(meta down-mouse-2)] 'strokes-do-stroke)
1295 ;; (define-key global-map [(control button2)] 'strokes-do-complex-stroke) 1301 ;; (define-key global-map [(control down-mouse-2)] 'strokes-do-complex-stroke)
1296 (ad-activate-regexp "^strokes-") ; advise button2 commands 1302 (ad-activate-regexp "^strokes-") ; advise button2 commands
1297 (setq strokes-mode t)) 1303 (setq strokes-mode t))
1298 (t ; turn off strokes 1304 (t ; turn off strokes
@@ -1300,9 +1306,9 @@ strokes with
1300 (kill-buffer (get-buffer strokes-buffer-name))) 1306 (kill-buffer (get-buffer strokes-buffer-name)))
1301 (remove-hook 'select-frame-hook 1307 (remove-hook 'select-frame-hook
1302 'strokes-update-window-configuration) 1308 'strokes-update-window-configuration)
1303 (if (string-match "^strokes-" (symbol-name (key-binding [(button2)]))) 1309 (if (string-match "^strokes-" (symbol-name (key-binding [(down-mouse-2)])))
1304 (define-key global-map [(button2)] strokes-click-command)) 1310 (define-key global-map [(down-mouse-2)] strokes-click-command))
1305 (if (string-match "^strokes-" (symbol-name (key-binding [(meta button2)]))) 1311 (if (string-match "^strokes-" (symbol-name (key-binding [(meta down-mouse-2)])))
1306 (global-unset-key [(meta button2)])) 1312 (global-unset-key [(meta button2)]))
1307 ;; (if (string-match "^strokes-" (symbol-name (key-binding [(shift button2)]))) 1313 ;; (if (string-match "^strokes-" (symbol-name (key-binding [(shift button2)])))
1308 ;; (global-unset-key [(shift button2)])) 1314 ;; (global-unset-key [(shift button2)]))
@@ -1311,12 +1317,10 @@ strokes with
1311 (force-mode-line-update)) 1317 (force-mode-line-update))
1312 1318
1313(or (assq 'strokes-mode minor-mode-alist) 1319(or (assq 'strokes-mode minor-mode-alist)
1314(setq minor-mode-alist (cons (list 'strokes-mode strokes-modeline-string) 1320 (setq minor-mode-alist (cons (list 'strokes-mode strokes-modeline-string)
1315 minor-mode-alist))) 1321 minor-mode-alist)))
1316 1322
1317(provide 'strokes) 1323(provide 'strokes)
1318(run-hooks 'strokes-load-hook) 1324(run-hooks 'strokes-load-hook)
1319 1325
1320;;; strokes.el ends here 1326;;; strokes.el ends here
1321
1322