annotate lisp/mouse.el @ 1100:5b3b202a84c8

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 12 Sep 1992 01:37:46 +0000
parents e699ce19609f
children 0ffcf74fb8ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1 ;;; mouse.el --- window system-independent mouse support.
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 758
diff changeset
2
840
113281b361ec *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 791
diff changeset
3 ;;; Copyright (C) 1988, 1992 Free Software Foundation, Inc.
113281b361ec *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 791
diff changeset
4
791
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 758
diff changeset
5 ;; Maintainer: FSF
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 758
diff changeset
6 ;; Keywords: hardware
203c23c9f22c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 758
diff changeset
7
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
8 ;;; This file is part of GNU Emacs.
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
11 ;;; it under the terms of the GNU General Public License as published by
705
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
12 ;;; the Free Software Foundation; either version 2, or (at your option)
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
13 ;;; any later version.
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
15 ;;; GNU Emacs is distributed in the hope that it will be useful,
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
18 ;;; GNU General Public License for more details.
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
20 ;;; You should have received a copy of the GNU General Public License
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
25 ;;; Utility functions.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
26
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
27 (defun mouse-movement-p (event)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
28 (and (consp event)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
29 (eq (car event) 'mouse-movement)))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
30
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
31 (defun event-window (event) (nth 1 event))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
32 (defun event-point (event) (nth 2 event))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
33 (defun mouse-coords (event) (nth 3 event))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
34 (defun mouse-timestamp (event) (nth 4 event))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
36 ;;; Indent track-mouse like progn.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
37 (put 'track-mouse 'lisp-indent-function 0)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
39
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
40 (defun mouse-delete-window (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
41 "Delete the window clicked on.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
42 This must be bound to a mouse click."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
43 (interactive "K")
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
44 (delete-window (event-window click)))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
45
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
46 (defun mouse-delete-other-windows (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
47 "Select Emacs window clicked on, then kill all other Emacs windows.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
48 This must be bound to a mouse click."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
49 (interactive "K")
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
50 (select-window (event-window click))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 (delete-other-windows))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
53 (defun mouse-split-window-vertically (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
54 "Select Emacs window mouse is on, then split it vertically in half.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
55 The window is split at the line clicked on.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
56 This command must be bound to a mouse click."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
57 (interactive "K")
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
58 (select-window (event-window click))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
59 (split-window-vertically (1+ (cdr (mouse-coords click)))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
61 (defun mouse-set-point (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
62 "Move point to the position clicked on with the mouse.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
63 This must be bound to a mouse click."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
64 (interactive "K")
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
65 (select-window (event-window click))
1039
8ab465f7a7ff *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 840
diff changeset
66 (if (numberp (event-point click))
8ab465f7a7ff *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 840
diff changeset
67 (goto-char (event-point click))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
69 (defun mouse-set-mark (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
70 "Set mark at the position clicked on with the mouse.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
71 Display cursor at that position for a second.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
72 This must be bound to a mouse click."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
73 (interactive "K")
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 (let ((point-save (point)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 (unwind-protect
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
76 (progn (mouse-set-point click)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (push-mark nil t)
191
b6358b876c71 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 93
diff changeset
78 (sit-for 1))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (goto-char point-save))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
81 (defun mouse-kill (click)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
82 "Kill the region between point and the mouse click.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
83 The text is saved in the kill ring, as with \\[kill-region]."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
84 (interactive "K")
758
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
85 (let ((click-posn (event-point click)))
1039
8ab465f7a7ff *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 840
diff changeset
86 (if (numberp click-posn)
8ab465f7a7ff *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 840
diff changeset
87 (kill-region (min (point) click-posn)
8ab465f7a7ff *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 840
diff changeset
88 (max (point) click-posn)))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89
705
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
90 (defun mouse-yank-at-click (click arg)
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
91 "Insert the last stretch of killed text at the position clicked on.
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
92 Prefix arguments are interpreted as with \\[yank]."
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
93 (interactive "K\nP")
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
94 (mouse-set-point click)
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
95 (yank arg))
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
96
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
97 (defun mouse-kill-ring-save (click)
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
98 "Copy the region between point and the mouse click in the kill ring.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
99 This does not delete the region; it acts like \\[kill-ring-save]."
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
100 (interactive "K")
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
101 (mouse-set-mark click)
705
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
102 (call-interactively 'kill-ring-save))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
104 (defun mouse-buffer-menu (event)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
105 "Pop up a menu of buffers for selection with the mouse."
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
106 (interactive "K")
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
107 (let ((menu
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
108 (list "Buffer Menu"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
109 (cons "Select Buffer"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
110 (let ((tail (buffer-list))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
111 head)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
112 (while tail
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
113 (let ((elt (car tail)))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
114 (if (not (string-match "^ "
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
115 (buffer-name elt)))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
116 (setq head (cons
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
117 (cons
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
118 (format
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
119 "%14s %s"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
120 (buffer-name elt)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
121 (or (buffer-file-name elt) ""))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
122 elt)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
123 head))))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
124 (setq tail (cdr tail)))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
125 (reverse head))))))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
126 (switch-to-buffer (or (x-popup-menu event menu) (current-buffer)))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; Commands for the scroll bar.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (defun mouse-scroll-down (nlines)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (scroll-down nlines))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 (defun mouse-scroll-up (nlines)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (scroll-up nlines))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (defun mouse-scroll-down-full ()
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (interactive "@")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (scroll-down nil))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (defun mouse-scroll-up-full ()
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (interactive "@")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (scroll-up nil))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (defun mouse-scroll-move-cursor (nlines)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (move-to-window-line nlines))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (defun mouse-scroll-absolute (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (let* ((pos (car event))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (position (car pos))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (length (car (cdr pos))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (if (<= length 0) (setq length 1))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size)))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (newpos (* (/ (* (/ (buffer-size) scale-factor)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 position)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 length)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 scale-factor)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (goto-char newpos)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (recenter '(4)))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (defun mouse-scroll-left (ncolumns)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (scroll-left ncolumns))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defun mouse-scroll-right (ncolumns)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (scroll-right ncolumns))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (defun mouse-scroll-left-full ()
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (interactive "@")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (scroll-left nil))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (defun mouse-scroll-right-full ()
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (interactive "@")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (scroll-right nil))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (defun mouse-scroll-move-cursor-horizontally (ncolumns)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (interactive "@p")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (move-to-column ncolumns))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (defun mouse-scroll-absolute-horizontally (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (let* ((pos (car event))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (position (car pos))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (length (car (cdr pos))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (set-window-hscroll (selected-window) 33)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
191 (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
192 (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
193 (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
194
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
195 (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
196 (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
197 (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
198
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
199 (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
200 (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
201 (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
202
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
203 (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
204 (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
205 (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
207 (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
208 (global-set-key [horizontal-scroll-bar mouse-2]
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
209 'mouse-scroll-absolute-horizontally)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
210 (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
212 (global-set-key [horizontal-slider mouse-1]
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
213 'mouse-scroll-move-cursor-horizontally)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
214 (global-set-key [horizontal-slider mouse-2]
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
215 'mouse-scroll-move-cursor-horizontally)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
216 (global-set-key [horizontal-slider mouse-3]
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
217 'mouse-scroll-move-cursor-horizontally)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
219 (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
220 (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
221 (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
222
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
223 (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
224 (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
225 (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full)
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
226
303
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
227 ;;;;
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
228 ;;;; Here are experimental things being tested. Mouse events
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
229 ;;;; are of the form:
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
230 ;;;; ((x y) window screen-part key-sequence timestamp)
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 ;;
303
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
232 ;;;;
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
233 ;;;; Dynamically track mouse coordinates
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
234 ;;;;
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 ;;
303
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
236 ;;(defun track-mouse (event)
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
237 ;; "Track the coordinates, absolute and relative, of the mouse."
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
238 ;; (interactive "@e")
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
239 ;; (while mouse-grabbed
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
240 ;; (let* ((pos (read-mouse-position (selected-screen)))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
241 ;; (abs-x (car pos))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
242 ;; (abs-y (cdr pos))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
243 ;; (relative-coordinate (coordinates-in-window-p
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
244 ;; (list (car pos) (cdr pos))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
245 ;; (selected-window))))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
246 ;; (if (consp relative-coordinate)
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
247 ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
248 ;; (car relative-coordinate)
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
249 ;; (car (cdr relative-coordinate)))
f7330c156716 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 231
diff changeset
250 ;; (message "mouse: [%d %d]" abs-x abs-y)))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 ;; Dynamically put a box around the line indicated by point
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;;
758
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
255 ;;
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
256 ;;(require 'backquote)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
257 ;;
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
258 ;;(defun mouse-select-buffer-line (event)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
259 ;; (interactive "@e")
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
260 ;; (let ((relative-coordinate
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
261 ;; (coordinates-in-window-p (car event) (selected-window)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
262 ;; (abs-y (car (cdr (car event)))))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
263 ;; (if (consp relative-coordinate)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
264 ;; (progn
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
265 ;; (save-excursion
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
266 ;; (move-to-window-line (car (cdr relative-coordinate)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
267 ;; (x-draw-rectangle
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
268 ;; (selected-screen)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
269 ;; abs-y 0
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
270 ;; (save-excursion
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
271 ;; (move-to-window-line (car (cdr relative-coordinate)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
272 ;; (end-of-line)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
273 ;; (push-mark nil t)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
274 ;; (beginning-of-line)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
275 ;; (- (region-end) (region-beginning))) 1))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
276 ;; (sit-for 1)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
277 ;; (x-erase-rectangle (selected-screen))))))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
278 ;;
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
279 ;;(defvar last-line-drawn nil)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
280 ;;(defvar begin-delim "[^ \t]")
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
281 ;;(defvar end-delim "[^ \t]")
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
282 ;;
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
283 ;;(defun mouse-boxing (event)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
284 ;; (interactive "@e")
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
285 ;; (save-excursion
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
286 ;; (let ((screen (selected-screen)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
287 ;; (while (= (x-mouse-events) 0)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
288 ;; (let* ((pos (read-mouse-position screen))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
289 ;; (abs-x (car pos))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
290 ;; (abs-y (cdr pos))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
291 ;; (relative-coordinate
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
292 ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
293 ;; (selected-window)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
294 ;; (begin-reg nil)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
295 ;; (end-reg nil)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
296 ;; (end-column nil)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
297 ;; (begin-column nil))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
298 ;; (if (and (consp relative-coordinate)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
299 ;; (or (not last-line-drawn)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
300 ;; (not (= last-line-drawn abs-y))))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
301 ;; (progn
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
302 ;; (move-to-window-line (car (cdr relative-coordinate)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
303 ;; (if (= (following-char) 10)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
304 ;; ()
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
305 ;; (progn
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
306 ;; (setq begin-reg (1- (re-search-forward end-delim)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
307 ;; (setq begin-column (1- (current-column)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
308 ;; (end-of-line)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
309 ;; (setq end-reg (1+ (re-search-backward begin-delim)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
310 ;; (setq end-column (1+ (current-column)))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
311 ;; (message "%s" (buffer-substring begin-reg end-reg))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
312 ;; (x-draw-rectangle screen
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
313 ;; (setq last-line-drawn abs-y)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
314 ;; begin-column
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
315 ;; (- end-column begin-column) 1))))))))))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
316 ;;
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
317 ;;(defun mouse-erase-box ()
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
318 ;; (interactive)
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
319 ;; (if last-line-drawn
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
320 ;; (progn
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
321 ;; (x-erase-rectangle (selected-screen))
f8688580137c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 705
diff changeset
322 ;; (setq last-line-drawn nil))))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
324 ;;; (defun test-x-rectangle ()
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
325 ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap)))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
326 ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
327 ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 ;; Here is how to do double clicking in lisp. About to change.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 (defvar double-start nil)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (defconst double-click-interval 300
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 "Max ticks between clicks")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (defun double-down (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (if double-start
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (let ((interval (- (nth 4 event) double-start)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 (if (< interval double-click-interval)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (progn
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (backward-up-list 1)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 ;; (message "Interval %d" interval)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (sleep-for 1)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (setq double-start nil))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (setq double-start (nth 4 event))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (defun double-up (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (and double-start
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 (> (- (nth 4 event ) double-start) double-click-interval)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 (setq double-start nil)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
355 ;;; (defun x-test-doubleclick ()
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
356 ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap)))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
357 ;;; (define-key doubleclick-test-map mouse-button-left 'double-down)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
358 ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 ;; This scrolls while button is depressed. Use preferable in scrollbar.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (defvar scrolled-lines 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 (defconst scroll-speed 1)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 (defun incr-scroll-down (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (setq scrolled-lines 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (incremental-scroll scroll-speed))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (defun incr-scroll-up (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (setq scrolled-lines 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (incremental-scroll (- scroll-speed)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 (defun incremental-scroll (n)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 (while (= (x-mouse-events) 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (setq scrolled-lines (1+ (* scroll-speed scrolled-lines)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (scroll-down n)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 (sit-for 300 t)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (defun incr-scroll-stop (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (message "Scrolled %d lines" scrolled-lines)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (setq scrolled-lines 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (sleep-for 1))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
389 ;;; (defun x-testing-scroll ()
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
390 ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix)))
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
391 ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
392 ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
393 ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop)
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
394 ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop)))
66
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 ;; Some playthings suitable for picture mode? They need work.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 ;;
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (defun mouse-kill-rectangle (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 "Kill the rectangle between point and the mouse cursor."
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (let ((point-save (point)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (save-excursion
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (mouse-set-point event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (push-mark nil t)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (if (> point-save (point))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 (kill-rectangle (point) point-save)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (kill-rectangle point-save (point))))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (defun mouse-open-rectangle (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 "Kill the rectangle between point and the mouse cursor."
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (let ((point-save (point)))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (save-excursion
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (mouse-set-point event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (push-mark nil t)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (if (> point-save (point))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (open-rectangle (point) point-save)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (open-rectangle point-save (point))))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 ;; Must be a better way to do this.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (defun mouse-multiple-insert (n char)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (while (> n 0)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (insert char)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 (setq n (1- n))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 ;; What this could do is not finalize until button was released.
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (defun mouse-move-text (event)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 "Move text from point to cursor position, inserting spaces."
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (interactive "@e")
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 (let* ((relative-coordinate
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (coordinates-in-window-p (car event) (selected-window))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (if (consp relative-coordinate)
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 (cond ((> (current-column) (car relative-coordinate))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 (delete-char
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (- (car relative-coordinate) (current-column))))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 ((< (current-column) (car relative-coordinate))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (mouse-multiple-insert
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (- (car relative-coordinate) (current-column)) " "))
5793fbcb9ac1 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 ((= (current-column) (car relative-coordinate)) (ding))))))
1100
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
444
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
445 ;; Font selection.
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
446
1100
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
447 (defvar x-fixed-font-alist
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
448 '("Font menu"
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
449 ("Misc"
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
450 ("fixed" "fixed")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
451 ("6x10" "6x10")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
452 ("6x12" "6x12")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
453 ("6x13" "6x13")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
454 ("7x13" "7x13")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
455 ("7x14" "7x14")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
456 ("8x13" "8x13")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
457 ("8x13 bold" "8x13bold")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
458 ("8x16" "8x16")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
459 ("9x15" "9x15")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
460 ("9x15 bold" "9x15bold")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
461 ("10x20" "10x20")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
462 ("11x18" "11x18")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
463 ("12x24" "12x24"))
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
464 ;;; We don't seem to have these; who knows what they are.
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
465 ;;; ("fg-18" "fg-18")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
466 ;;; ("fg-25" "fg-25")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
467 ;;; ("lucidasanstypewriter-12" "lucidasanstypewriter-12")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
468 ;;; ("lucidasanstypewriter-bold-14" "lucidasanstypewriter-bold-14")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
469 ;;; ("lucidasanstypewriter-bold-24" "lucidasanstypewriter-bold-24")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
470 ;;; ("lucidatypewriter-bold-r-24" "-b&h-lucidatypewriter-bold-r-normal-sans-24-240-75-75-m-140-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
471 ;;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
472 ("Courier"
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
473 ("8" "-adobe-courier-medium-r-normal--8-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
474 ("10" "-adobe-courier-medium-r-normal--10-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
475 ("12" "-adobe-courier-medium-r-normal--12-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
476 ("14" "-adobe-courier-medium-r-normal--14-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
477 ("18" "-adobe-courier-medium-r-normal--18-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
478 ("24" "-adobe-courier-medium-r-normal--24-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
479 ("8 bold" "-adobe-courier-bold-r-normal--8-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
480 ("10 bold" "-adobe-courier-bold-r-normal--10-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
481 ("12 bold" "-adobe-courier-bold-r-normal--12-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
482 ("14 bold" "-adobe-courier-bold-r-normal--14-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
483 ("18 bold" "-adobe-courier-bold-r-normal--18-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
484 ("24 bold" "-adobe-courier-bold-r-normal--24-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
485 ("8 slant" "-adobe-courier-medium-o-normal--8-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
486 ("10 slant" "-adobe-courier-medium-o-normal--10-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
487 ("12 slant" "-adobe-courier-medium-o-normal--12-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
488 ("14 slant" "-adobe-courier-medium-o-normal--14-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
489 ("18 slant" "-adobe-courier-medium-o-normal--18-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
490 ("24 slant" "-adobe-courier-medium-o-normal--24-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
491 ("8 bold slant" "-adobe-courier-bold-o-normal--8-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
492 ("10 bold slant" "-adobe-courier-bold-o-normal--10-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
493 ("12 bold slant" "-adobe-courier-bold-o-normal--12-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
494 ("14 bold slant" "-adobe-courier-bold-o-normal--14-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
495 ("18 bold slant" "-adobe-courier-bold-o-normal--18-*-*-*-m-*-iso8859-1")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
496 ("24 bold slant" "-adobe-courier-bold-o-normal--24-*-*-*-m-*-iso8859-1"))
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
497 )
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
498 "X fonts suitable for use in Emacs.")
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
499
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
500 (defun mouse-set-font (font)
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
501 "Select an emacs font from a list of known good fonts"
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
502 (interactive
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
503 (x-popup-menu last-nonmenu-event x-fixed-font-alist))
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
504 (modify-frame-parameters (selected-frame)
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
505 (list (cons 'font font))))
465
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
506
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
507 ;;; Bindings for mouse commands.
36359663b6d8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 303
diff changeset
508
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
509 ;; This won't be needed once the drag and down events
1057
d9775f33488d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1056
diff changeset
510 ;; are properly implemented.
d9775f33488d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1056
diff changeset
511 (global-set-key [mouse-1] 'mouse-set-point)
d9775f33488d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1056
diff changeset
512
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
513 (global-set-key [down-mouse-1] 'mouse-set-point)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
514 (global-set-key [drag-mouse-1] 'mouse-set-mark)
705
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
515 (global-set-key [mouse-2] 'mouse-yank-at-click)
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
516 (global-set-key [mouse-3] 'mouse-kill-ring-save)
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
517 (global-set-key [S-mouse-3] 'mouse-kill)
705
c7d478752305 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 659
diff changeset
518
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
519 (global-set-key [C-mouse-1] 'mouse-buffer-menu)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
520
1100
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
521 (global-set-key [C-mouse-3] 'mouse-set-font)
5b3b202a84c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1064
diff changeset
522
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
523 ;; Replaced with dragging mouse-1
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
524 ;; (global-set-key [S-mouse-1] 'mouse-set-mark)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
525
1060
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
526 ;; Define the mouse help menu tree.
af78c65921c8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1058
diff changeset
527
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
528 (defvar help-menu-map '(keymap "Help"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
529 (global-set-key [C-mouse-2] help-menu-map)
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
530
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
531 (defvar help-apropos-map '(keymap "Is there a command that..."))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
532 (defvar help-keys-map '(keymap "Key Commands <==> Functions"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
533 (defvar help-manual-map '(keymap "Manual and tutorial"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
534 (defvar help-misc-map '(keymap "Odds and ends"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
535 (defvar help-modes-map '(keymap "Modes"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
536 (defvar help-admin-map '(keymap "Administrivia"))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
537
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
538 (define-key help-menu-map [apropos]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
539 (cons "@Is there a command that..." help-apropos-map))
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
540 (define-key help-menu-map [keys]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
541 (cons "@Key Commands <==> Functions" help-keys-map))
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
542 (define-key help-menu-map [manuals]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
543 (cons "@Manual and tutorial" help-manual-map))
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
544 (define-key help-menu-map [misc]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
545 (cons "@Odds and ends" help-misc-map))
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
546 (define-key help-menu-map [modes]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
547 (cons "@Modes" help-modes-map))
1058
19c6978ab218 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1057
diff changeset
548 (define-key help-menu-map [admin]
1064
e699ce19609f *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1060
diff changeset
549 (cons "@Administrivia" help-admin-map))
1056
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
550
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
551 (define-key help-apropos-map "c" '("Command Apropos" . command-apropos))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
552 (define-key help-apropos-map "a" '("Apropos" . apropos))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
553
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
554 (define-key help-keys-map "b"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
555 '("List all keystroke commands" . describe-bindings))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
556 (define-key help-keys-map "c"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
557 '("Describe key briefly" . describe-key-briefly))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
558 (define-key help-keys-map "k"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
559 '("Describe key verbose" . describe-key))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
560 (define-key help-keys-map "f"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
561 '("Describe Lisp function" . describe-function))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
562 (define-key help-keys-map "w"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
563 '("Where is this command" . where-is))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
564
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
565 (define-key help-manual-map "i" '("Info system" . info))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
566 (define-key help-manual-map "t"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
567 '("Invoke Emacs tutorial" . help-with-tutorial))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
568
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
569 (define-key help-misc-map "l" '("Last 100 Keystrokes" . view-lossage))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
570 (define-key help-misc-map "s" '("Describe syntax table" . describe-syntax))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
571
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
572 (define-key help-modes-map "m"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
573 '("Describe current major mode" . describe-mode))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
574 (define-key help-modes-map "b"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
575 '("List all keystroke commands" . describe-bindings))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
576
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
577 (define-key help-admin-map "n"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
578 '("view Emacs news" . view-emacs-news))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
579 (define-key help-admin-map "l"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
580 '("View the GNU Emacs license" . describe-copying))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
581 (define-key help-admin-map "d"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
582 '("Describe distribution" . describe-distribution))
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
583 (define-key help-admin-map "w"
a7fc54083464 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 1039
diff changeset
584 '("Describe (non)warranty" . describe-no-warranty))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 465
diff changeset
585
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 465
diff changeset
586 (provide 'mouse)
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 465
diff changeset
587
659
505130d1ddf8 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
588 ;;; mouse.el ends here