(do_autoload): Don't report autoload failure
[bpt/emacs.git] / lisp / mouse.el
CommitLineData
6594deb0 1;;; mouse.el --- window system-independent mouse support.
84176303 2
9a408b1d 3;;; Copyright (C) 1993 Free Software Foundation, Inc.
eea8d4ef 4
84176303 5;; Maintainer: FSF
84176303
ER
6;; Keywords: hardware
7
cc0a8174 8;;; This file is part of GNU Emacs.
72ea54a4 9
cc0a8174
JB
10;;; GNU Emacs is free software; you can redistribute it and/or modify
11;;; it under the terms of the GNU General Public License as published by
87ef29fd 12;;; the Free Software Foundation; either version 2, or (at your option)
cc0a8174 13;;; any later version.
72ea54a4 14
cc0a8174
JB
15;;; GNU Emacs is distributed in the hope that it will be useful,
16;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
72ea54a4 19
cc0a8174
JB
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Emacs; see the file COPYING. If not, write to
22;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
72ea54a4 23
edbd2f74
ER
24;;; Commentary:
25
26;; This package provides various useful commands (including help
27;; system access) through the mouse. All this code assumes that mouse
28;; interpretation has been abstracted into Emacs input events.
29;;
30;; The code is rather X-dependent.
31
aae56ea7
ER
32;;; Code:
33
cc0a8174 34;;; Utility functions.
72ea54a4 35
cc0a8174
JB
36;;; Indent track-mouse like progn.
37(put 'track-mouse 'lisp-indent-function 0)
72ea54a4 38
cc0a8174
JB
39\f
40(defun mouse-delete-window (click)
947da0c4 41 "Delete the window you click on.
cc0a8174 42This must be bound to a mouse click."
ec558adc 43 (interactive "e")
b5370f03 44 (delete-window (posn-window (event-start click))))
cc0a8174 45
b0f3a26b
JB
46(defun mouse-tear-off-window (click)
47 "Delete the window clicked on, and create a new frame displaying its buffer."
48 (interactive "e")
49 (let* ((window (posn-window (event-start click)))
50 (buf (window-buffer window))
51 (frame (new-frame)))
52 (select-frame frame)
53 (switch-to-buffer buf)
54 (delete-window window)))
55
b5370f03 56(defun mouse-delete-other-windows ()
947da0c4 57 "Delete all window except the one you click on."
b5370f03 58 (interactive "@")
cc0a8174 59 (delete-other-windows))
72ea54a4 60
cc0a8174
JB
61(defun mouse-split-window-vertically (click)
62 "Select Emacs window mouse is on, then split it vertically in half.
63The window is split at the line clicked on.
64This command must be bound to a mouse click."
947da0c4 65 (interactive "@e")
b5370f03
JB
66 (let ((start (event-start click)))
67 (select-window (posn-window start))
3f26b32a
RS
68 (let ((new-height (if (eq (posn-point start) 'vertical-scroll-bar)
69 (scroll-bar-scale (posn-col-row start)
70 (1- (window-height)))
71 (1+ (cdr (posn-col-row (event-end click))))))
5ba2dc3f
JB
72 (first-line window-min-height)
73 (last-line (- (window-height) window-min-height)))
74 (if (< last-line first-line)
75 (error "window too short to split")
76 (split-window-vertically
77 (min (max new-height first-line) last-line))))))
cc0a8174 78
947da0c4
RS
79(defun mouse-split-window-horizontally (click)
80 "Select Emacs window mouse is on, then split it horizontally in half.
81The window is split at the column clicked on.
82This command must be bound to a mouse click."
83 (interactive "@e")
5ba2dc3f
JB
84 (let ((start (event-start click)))
85 (select-window (posn-window start))
86 (let ((new-width (1+ (car (posn-col-row (event-end click)))))
87 (first-col window-min-width)
88 (last-col (- (window-width) window-min-width)))
89 (if (< last-col first-col)
90 (error "window too narrow to split")
91 (split-window-horizontally
92 (min (max new-width first-col) last-col))))))
947da0c4 93
cc0a8174
JB
94(defun mouse-set-point (click)
95 "Move point to the position clicked on with the mouse.
96This must be bound to a mouse click."
ec558adc 97 (interactive "e")
b5370f03
JB
98 (let ((posn (event-start click)))
99 (select-window (posn-window posn))
100 (if (numberp (posn-point posn))
101 (goto-char (posn-point posn)))))
cc0a8174 102
652ccd35
RS
103(defun mouse-set-region (click)
104 "Set the region to the text that the mouse is dragged over.
fcfc3c63 105This must be bound to a mouse drag event."
652ccd35
RS
106 (interactive "e")
107 (let ((posn (event-start click))
108 (end (event-end click)))
109 (select-window (posn-window posn))
110 (if (numberp (posn-point posn))
111 (goto-char (posn-point posn)))
fcfc3c63
RS
112 ;; If mark is highlighted, no need to bounce the cursor.
113 (or (and transient-mark-mode
114 (eq (framep (selected-frame)) 'x))
115 (sit-for 1))
652ccd35 116 (push-mark)
1cc8a3f4 117 (set-mark (point))
652ccd35
RS
118 (if (numberp (posn-point end))
119 (goto-char (posn-point end)))))
120
600c6e3a
JB
121(defvar mouse-scroll-delay 0.25
122 "*The pause between scroll steps caused by mouse drags, in seconds.
123If you drag the mouse beyond the edge of a window, Emacs scrolls the
124window to bring the text beyond that edge into view, with a delay of
125this many seconds between scroll steps. Scrolling stops when you move
126the mouse back into the window, or release the button.
127This variable's value may be non-integral.
128Setting this to zero causes Emacs to scroll as fast as it can.")
129
130(defun mouse-scroll-subr (jump &optional overlay start)
131 "Scroll the selected window JUMP lines at a time, until new input arrives.
132If OVERLAY is an overlay, let it stretch from START to the far edge of
133the newly visible text.
134Upon exit, point is at the far edge of the newly visible text."
135 (while (progn
136 (goto-char (window-start))
137 (if (not (zerop (vertical-motion jump)))
138 (progn
139 (set-window-start (selected-window) (point))
140 (if (natnump jump)
141 (progn
142 (goto-char (window-end (selected-window)))
143 ;; window-end doesn't reflect the window's new
144 ;; start position until the next redisplay. Hurrah.
145 (vertical-motion (1- jump)))
146 (goto-char (window-start (selected-window))))
147 (if overlay
148 (move-overlay overlay start (point)))
149 (if (not (eobp))
150 (sit-for mouse-scroll-delay))))))
151 (point))
fcfc3c63 152
600c6e3a
JB
153(defvar mouse-drag-overlay (make-overlay 1 1))
154(overlay-put mouse-drag-overlay 'face 'region)
155
156(defun mouse-drag-region (start-event)
bcd5aef1 157 "Set the region to the text that the mouse is dragged over.
600c6e3a 158Highlight the drag area as the user moves the mouse.
bcd5aef1
RS
159This must be bound to a button-down mouse event."
160 (interactive "e")
600c6e3a
JB
161 (let* ((start-posn (event-start start-event))
162 (start-point (posn-point start-posn))
163 (start-window (posn-window start-posn))
b846d039 164 (start-frame (window-frame start-window))
600c6e3a
JB
165 (bounds (window-edges start-window))
166 (top (nth 1 bounds))
167 (bottom (if (window-minibuffer-p start-window)
168 (nth 3 bounds)
169 ;; Don't count the mode line.
170 (1- (nth 3 bounds)))))
171 (select-window start-window)
172 (goto-char start-point)
173 (move-overlay mouse-drag-overlay
174 start-point start-point
175 (window-buffer start-window))
f767385c 176 (deactivate-mark)
600c6e3a 177 (let (event end end-point)
bcd5aef1 178 (track-mouse
600c6e3a 179 (while (progn
b846d039
JB
180 (setq event (read-event))
181 (or (mouse-movement-p event)
182 (eq (car-safe event) 'switch-frame)))
183
184 (if (eq (car-safe event) 'switch-frame)
185 nil
186 (setq end (event-end event)
187 end-point (posn-point end))
188
189 (cond
190
191 ;; Ignore switch-frame events.
192 ((eq (car-safe event) 'switch-frame))
193
194 ;; Are we moving within the original window?
195 ((and (eq (posn-window end) start-window)
196 (integer-or-marker-p end-point))
197 (goto-char end-point)
198 (move-overlay mouse-drag-overlay
199 start-point (point)))
200
201 ;; Are we moving on a different window on the same frame?
202 ((and (windowp (posn-window end))
203 (eq (window-frame (posn-window end)) start-frame))
204 (let ((mouse-row
205 (+ (nth 1 (window-edges (posn-window end)))
206 (cdr (posn-col-row end)))))
207 (cond
208 ((< mouse-row top)
209 (mouse-scroll-subr
210 (- mouse-row top) mouse-drag-overlay start-point))
211 ((and (not (eobp))
212 (>= mouse-row bottom))
213 (mouse-scroll-subr (1+ (- mouse-row bottom))
214 mouse-drag-overlay start-point)))))
215
216 ;; Otherwise, we have no idea where the mouse is.
217 (t)))))
218
600c6e3a
JB
219 (if (and (eq (get (event-basic-type event) 'event-kind) 'mouse-click)
220 (eq (posn-window (event-end event)) start-window)
221 (numberp (posn-point (event-end event))))
222 (goto-char (posn-point (event-end event))))
223 (if (= (point) start-point)
f767385c 224 (deactivate-mark)
600c6e3a
JB
225 (set-mark start-point))
226 (delete-overlay mouse-drag-overlay))))
227
228;;;! (defun mouse-drag-region (click)
229;;;! "Set the region to the text that the mouse is dragged over.
230;;;! This must be bound to a button-down mouse event."
231;;;! (interactive "e")
232;;;! (let ((posn (event-start click))
233;;;! done event (mark-active nil))
234;;;! (select-window (posn-window posn))
235;;;! ;; Set point temporarily, so user sees where it is.
236;;;! (if (numberp (posn-point posn))
237;;;! (goto-char (posn-point posn)))
238;;;! ;; Turn off the old mark when we set up an empty region.
239;;;! (setq deactivate-mark t)))
240;;;!
241;;;! ;;;Nice hack, but too slow, so not normally in use.
242;;;! (defun mouse-drag-region-1 (click)
243;;;! "Set the region to the text that the mouse is dragged over.
244;;;! This must be bound to a button-down mouse event."
245;;;! (interactive "e")
246;;;! (let (newmark)
247;;;! (let ((posn (event-start click))
248;;;! done event omark (mark-active t))
249;;;! (select-window (posn-window posn))
250;;;! (setq omark (and mark-active (mark)))
251;;;! (if (numberp (posn-point posn))
252;;;! (goto-char (posn-point posn)))
253;;;! ;; Set mark temporarily, so highlighting does what we want.
254;;;! (set-marker (mark-marker) (point))
255;;;! (track-mouse
256;;;! (while (not done)
257;;;! (setq event (read-event))
258;;;! (if (eq (car-safe event) 'mouse-movement)
259;;;! (goto-char (posn-point (event-start event)))
260;;;! ;; Exit when we get the drag event; ignore that event.
261;;;! (setq done t))))
262;;;! (if (/= (mark) (point))
263;;;! (setq newmark (mark)))
264;;;! ;; Restore previous mark status.
265;;;! (if omark (set-marker (mark-marker) omark)))
266;;;! ;; Now, if we dragged, set the mark at the proper place.
267;;;! (if newmark
268;;;! (push-mark newmark t t)
269;;;! ;; Turn off the old mark when we set up an empty region.
270;;;! (setq deactivate-mark t))))
e66feb07 271\f
3f26b32a
RS
272;; Subroutine: set the mark where CLICK happened,
273;; but don't do anything else.
274(defun mouse-set-mark-fast (click)
275 (let ((posn (event-start click)))
276 (select-window (posn-window posn))
277 (if (numberp (posn-point posn))
278 (push-mark (posn-point posn) t t))))
279
280;; Momentarily show where the mark is, if highlighting doesn't show it.
281(defun mouse-show-mark ()
282 (or transient-mark-mode
283 (save-excursion
284 (goto-char (mark t))
285 (sit-for 1))))
286
cc0a8174
JB
287(defun mouse-set-mark (click)
288 "Set mark at the position clicked on with the mouse.
289Display cursor at that position for a second.
290This must be bound to a mouse click."
ec558adc 291 (interactive "e")
72ea54a4
RS
292 (let ((point-save (point)))
293 (unwind-protect
cc0a8174 294 (progn (mouse-set-point click)
897897e3
RS
295 (push-mark nil t t)
296 (or transient-mark-mode
297 (sit-for 1)))
72ea54a4
RS
298 (goto-char point-save))))
299
cc0a8174
JB
300(defun mouse-kill (click)
301 "Kill the region between point and the mouse click.
302The text is saved in the kill ring, as with \\[kill-region]."
ec558adc 303 (interactive "e")
40a45a9f 304 (let ((click-posn (posn-point (event-start click))))
bd307392
JB
305 (if (numberp click-posn)
306 (kill-region (min (point) click-posn)
307 (max (point) click-posn)))))
72ea54a4 308
87ef29fd
JB
309(defun mouse-yank-at-click (click arg)
310 "Insert the last stretch of killed text at the position clicked on.
311Prefix arguments are interpreted as with \\[yank]."
ec558adc 312 (interactive "e\nP")
87ef29fd
JB
313 (mouse-set-point click)
314 (yank arg))
315
316(defun mouse-kill-ring-save (click)
cc0a8174
JB
317 "Copy the region between point and the mouse click in the kill ring.
318This does not delete the region; it acts like \\[kill-ring-save]."
ec558adc 319 (interactive "e")
3f26b32a
RS
320 (mouse-set-mark-fast click)
321 (kill-ring-save (point) (mark t))
322 (mouse-show-mark))
72ea54a4 323
dbc4e1c1
JB
324;;; This function used to delete the text between point and the mouse
325;;; whenever it was equal to the front of the kill ring, but some
326;;; people found that confusing.
327
328;;; A list (TEXT START END), describing the text and position of the last
329;;; invocation of mouse-save-then-kill.
330(defvar mouse-save-then-kill-posn nil)
331
947da0c4 332(defun mouse-save-then-kill (click)
40a45a9f
RS
333 "Save text to point in kill ring; the second time, kill the text.
334If the text between point and the mouse is the same as what's
335at the front of the kill ring, this deletes the text.
336Otherwise, it adds the text to the kill ring, like \\[kill-ring-save],
337which prepares for a second click to delete the text."
947da0c4 338 (interactive "e")
3f26b32a
RS
339 (let ((click-posn (posn-point (event-start click)))
340 ;; Don't let a subsequent kill command append to this one:
341 ;; prevent setting this-command to kill-region.
342 (this-command this-command))
343 (if (and (eq last-command 'mouse-save-then-kill)
dbc4e1c1
JB
344 mouse-save-then-kill-posn
345 (eq (car mouse-save-then-kill-posn) (car kill-ring))
346 (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn)))
347 ;; If this is the second time we've called
348 ;; mouse-save-then-kill, delete the text from the buffer.
40a45a9f 349 (progn
a2d24e95
RS
350 ;; Delete just one char, so in case buffer is being modified
351 ;; for the first time, the undo list records that fact.
352 (delete-region (point)
353 (+ (point) (if (> (mark) (point)) 1 -1)))
354 ;; Now delete the rest of the specified region,
355 ;; but don't record it.
40a45a9f
RS
356 (let ((buffer-undo-list t))
357 (delete-region (point) (mark)))
dbc4e1c1 358 (if (not (eq buffer-undo-list t))
a2d24e95
RS
359 (let ((tail buffer-undo-list))
360 ;; Search back in buffer-undo-list for the string
361 ;; that came from the first delete-region.
362 (while (and tail (not (stringp (car (car tail)))))
363 (setq tail (cdr tail)))
364 ;; Replace it with an entry for the entire deleted text.
365 (and tail
366 (setcar tail (cons (car kill-ring) (point))))))))
40a45a9f 367 ;; Otherwise, save this region.
3f26b32a 368 (mouse-set-mark-fast click)
897897e3 369 (kill-ring-save (point) (mark t))
3f26b32a 370 (mouse-show-mark)
dbc4e1c1
JB
371 (setq mouse-save-then-kill-posn
372 (list (car kill-ring) (point) click-posn)))))
e66feb07
RS
373\f
374(global-set-key [M-mouse-1] 'mouse-start-secondary)
375(global-set-key [M-drag-mouse-1] 'mouse-set-secondary)
376(global-set-key [M-down-mouse-1] 'mouse-drag-secondary)
377(global-set-key [M-mouse-3] 'mouse-secondary-save-then-kill)
378(global-set-key [M-mouse-2] 'mouse-kill-secondary)
379
380;; An overlay which records the current secondary selection
381;; or else is deleted when there is no secondary selection.
382;; May be nil.
383(defvar mouse-secondary-overlay nil)
384
385;; A marker which records the specified first end for a secondary selection.
386;; May be nil.
387(defvar mouse-secondary-start nil)
388
389(defun mouse-start-secondary (click)
390 "Set one end of the secondary selection to the position clicked on.
391Use \\[mouse-secondary-save-then-kill] to set the other end
392and complete the secondary selection."
393 (interactive "e")
394 (let ((posn (event-start click)))
230aaa73
RS
395 (save-excursion
396 (set-buffer (window-buffer (posn-window posn)))
397 ;; Cancel any preexisting secondary selection.
398 (if mouse-secondary-overlay
399 (delete-overlay mouse-secondary-overlay))
400 (if (numberp (posn-point posn))
401 (progn
402 (or mouse-secondary-start
403 (setq mouse-secondary-start (make-marker)))
404 (move-marker mouse-secondary-start (posn-point posn)))))))
e66feb07
RS
405
406(defun mouse-set-secondary (click)
407 "Set the secondary selection to the text that the mouse is dragged over.
408This must be bound to a mouse drag event."
409 (interactive "e")
410 (let ((posn (event-start click))
411 beg
412 (end (event-end click)))
230aaa73
RS
413 (save-excursion
414 (set-buffer (window-buffer (posn-window posn)))
415 (if (numberp (posn-point posn))
416 (setq beg (posn-point posn)))
417 (if mouse-secondary-overlay
418 (move-overlay mouse-secondary-overlay beg (posn-point end))
419 (setq mouse-secondary-overlay (make-overlay beg (posn-point end))))
420 (overlay-put mouse-secondary-overlay 'face 'secondary-selection))))
947da0c4 421
e66feb07
RS
422(defun mouse-drag-secondary (click)
423 "Set the secondary selection to the text that the mouse is dragged over.
424This must be bound to a button-down mouse event."
425 (interactive "e")
426 (let ((posn (event-start click)))
230aaa73
RS
427 (save-window-excursion
428 (select-window (posn-window posn))
429 ;; Set point temporarily, so user sees where it is.
430 (save-excursion
431 (if (numberp (posn-point posn))
432 (goto-char (posn-point posn)))
433 (setq unread-command-events
434 (cons (read-event) unread-command-events))))))
e66feb07
RS
435
436(defun mouse-kill-secondary ()
437 "Kill the text in the secondary selection."
438 (interactive "*")
439 (kill-region (overlay-start mouse-secondary-overlay)
440 (overlay-end mouse-secondary-overlay))
441 (delete-overlay mouse-secondary-overlay)
442 (setq mouse-secondary-overlay nil))
443
444(defun mouse-secondary-save-then-kill (click)
445 "Save text to secondary start point in kill ring; if twice, kill it.
446If the text between secondary start point and the mouse is the same as what's
447at the front of the kill ring, this deletes the text.
448Otherwise, it adds the text to the kill ring, like \\[kill-ring-save],
449which prepares for a second click to delete the text."
450 (interactive "e")
451 (let ((click-posn (posn-point (event-start click)))
452 (start (+ 0 mouse-secondary-start))
453 ;; Don't let a subsequent kill command append to this one:
454 ;; prevent setting this-command to kill-region.
455 (this-command this-command))
456 (if (and (eq last-command 'mouse-secondary-save-then-kill)
457 mouse-save-then-kill-posn
458 (eq (car mouse-save-then-kill-posn) (car kill-ring))
459 (equal (cdr mouse-save-then-kill-posn)
460 (list start click-posn)))
461 ;; If this is the second time we've called
462 ;; mouse-save-then-kill, delete the text from the buffer.
463 (progn
464 (let ((buffer-undo-list t))
465 (delete-overlay mouse-secondary-overlay)
466 (delete-region start click-posn))
467 ;; Make the undo list by hand so it is shared.
468 (if (not (eq buffer-undo-list t))
469 (setq buffer-undo-list
367ee8f4 470 (cons (cons (car kill-ring) (marker-position start))
e66feb07
RS
471 buffer-undo-list))))
472 ;; Otherwise, save this region.
230aaa73
RS
473 (save-excursion
474 (set-buffer (window-buffer (posn-window (event-start click))))
475 (kill-ring-save start click-posn)
476 (if mouse-secondary-overlay
477 (move-overlay mouse-secondary-overlay start click-posn)
478 (setq mouse-secondary-overlay (make-overlay start click-posn)))
479 (overlay-put mouse-secondary-overlay 'face 'secondary-selection)
480 (setq mouse-save-then-kill-posn
481 (list (car kill-ring) start click-posn))))))
e66feb07 482\f
8b34e79d 483(defun mouse-buffer-menu (event)
2d82f7b9
RS
484 "Pop up a menu of buffers for selection with the mouse.
485This switches buffers in the window that you clicked on,
486and selects that window."
ec558adc 487 (interactive "e")
8b34e79d
RS
488 (let ((menu
489 (list "Buffer Menu"
490 (cons "Select Buffer"
491 (let ((tail (buffer-list))
af2a85fe 492 (maxbuf 0)
8b34e79d 493 head)
af2a85fe
RS
494 (while tail
495 (or (eq ?\ (aref (buffer-name (car tail)) 0))
496 (setq maxbuf
497 (max maxbuf
498 (length (buffer-name (car tail))))))
499 (setq tail (cdr tail)))
500 (setq tail (buffer-list))
8b34e79d
RS
501 (while tail
502 (let ((elt (car tail)))
503 (if (not (string-match "^ "
504 (buffer-name elt)))
505 (setq head (cons
506 (cons
507 (format
af2a85fe
RS
508 (format "%%%ds %%s%%s %%s"
509 maxbuf)
8b34e79d 510 (buffer-name elt)
af2a85fe
RS
511 (if (buffer-modified-p elt)
512 "*" " ")
513 (save-excursion
514 (set-buffer elt)
515 (if buffer-read-only "%" " "))
8b34e79d
RS
516 (or (buffer-file-name elt) ""))
517 elt)
518 head))))
519 (setq tail (cdr tail)))
520 (reverse head))))))
2d82f7b9
RS
521 (let ((buf (x-popup-menu event menu))
522 (window (posn-window (event-start event))))
523 (if buf
524 (progn
c0bb9f3b 525 (or (framep window) (select-window window))
2d82f7b9 526 (switch-to-buffer buf))))))
72ea54a4 527\f
5ba2dc3f 528;;; These need to be rewritten for the new scroll bar implementation.
dbc4e1c1
JB
529
530;;;!! ;; Commands for the scroll bar.
531;;;!!
532;;;!! (defun mouse-scroll-down (click)
533;;;!! (interactive "@e")
534;;;!! (scroll-down (1+ (cdr (mouse-coords click)))))
535;;;!!
536;;;!! (defun mouse-scroll-up (click)
537;;;!! (interactive "@e")
538;;;!! (scroll-up (1+ (cdr (mouse-coords click)))))
539;;;!!
540;;;!! (defun mouse-scroll-down-full ()
541;;;!! (interactive "@")
542;;;!! (scroll-down nil))
543;;;!!
544;;;!! (defun mouse-scroll-up-full ()
545;;;!! (interactive "@")
546;;;!! (scroll-up nil))
547;;;!!
548;;;!! (defun mouse-scroll-move-cursor (click)
549;;;!! (interactive "@e")
550;;;!! (move-to-window-line (1+ (cdr (mouse-coords click)))))
551;;;!!
552;;;!! (defun mouse-scroll-absolute (event)
553;;;!! (interactive "@e")
554;;;!! (let* ((pos (car event))
555;;;!! (position (car pos))
556;;;!! (length (car (cdr pos))))
557;;;!! (if (<= length 0) (setq length 1))
558;;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size)))))
559;;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor)
560;;;!! position)
561;;;!! length)
562;;;!! scale-factor)))
563;;;!! (goto-char newpos)
564;;;!! (recenter '(4)))))
565;;;!!
566;;;!! (defun mouse-scroll-left (click)
567;;;!! (interactive "@e")
568;;;!! (scroll-left (1+ (car (mouse-coords click)))))
569;;;!!
570;;;!! (defun mouse-scroll-right (click)
571;;;!! (interactive "@e")
572;;;!! (scroll-right (1+ (car (mouse-coords click)))))
573;;;!!
574;;;!! (defun mouse-scroll-left-full ()
575;;;!! (interactive "@")
576;;;!! (scroll-left nil))
577;;;!!
578;;;!! (defun mouse-scroll-right-full ()
579;;;!! (interactive "@")
580;;;!! (scroll-right nil))
581;;;!!
582;;;!! (defun mouse-scroll-move-cursor-horizontally (click)
583;;;!! (interactive "@e")
584;;;!! (move-to-column (1+ (car (mouse-coords click)))))
585;;;!!
586;;;!! (defun mouse-scroll-absolute-horizontally (event)
587;;;!! (interactive "@e")
588;;;!! (let* ((pos (car event))
589;;;!! (position (car pos))
590;;;!! (length (car (cdr pos))))
591;;;!! (set-window-hscroll (selected-window) 33)))
592;;;!!
593;;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up)
594;;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute)
595;;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down)
596;;;!!
597;;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor)
598;;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor)
599;;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor)
600;;;!!
601;;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full)
602;;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full)
603;;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full)
604;;;!!
605;;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full)
606;;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full)
607;;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full)
608;;;!!
609;;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left)
610;;;!! (global-set-key [horizontal-scroll-bar mouse-2]
611;;;!! 'mouse-scroll-absolute-horizontally)
612;;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right)
613;;;!!
614;;;!! (global-set-key [horizontal-slider mouse-1]
615;;;!! 'mouse-scroll-move-cursor-horizontally)
616;;;!! (global-set-key [horizontal-slider mouse-2]
617;;;!! 'mouse-scroll-move-cursor-horizontally)
618;;;!! (global-set-key [horizontal-slider mouse-3]
619;;;!! 'mouse-scroll-move-cursor-horizontally)
620;;;!!
621;;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full)
622;;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full)
623;;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full)
624;;;!!
625;;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full)
626;;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full)
627;;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full)
628;;;!!
629;;;!! (global-set-key [horizontal-scroll-bar S-mouse-2]
630;;;!! 'mouse-split-window-horizontally)
631;;;!! (global-set-key [mode-line S-mouse-2]
632;;;!! 'mouse-split-window-horizontally)
633;;;!! (global-set-key [vertical-scroll-bar S-mouse-2]
634;;;!! 'mouse-split-window)
6b2154de 635\f
dbc4e1c1
JB
636;;;!! ;;;;
637;;;!! ;;;; Here are experimental things being tested. Mouse events
638;;;!! ;;;; are of the form:
639;;;!! ;;;; ((x y) window screen-part key-sequence timestamp)
640;;;!! ;;
641;;;!! ;;;;
642;;;!! ;;;; Dynamically track mouse coordinates
643;;;!! ;;;;
644;;;!! ;;
645;;;!! ;;(defun track-mouse (event)
646;;;!! ;; "Track the coordinates, absolute and relative, of the mouse."
647;;;!! ;; (interactive "@e")
648;;;!! ;; (while mouse-grabbed
649;;;!! ;; (let* ((pos (read-mouse-position (selected-screen)))
650;;;!! ;; (abs-x (car pos))
651;;;!! ;; (abs-y (cdr pos))
652;;;!! ;; (relative-coordinate (coordinates-in-window-p
653;;;!! ;; (list (car pos) (cdr pos))
654;;;!! ;; (selected-window))))
655;;;!! ;; (if (consp relative-coordinate)
656;;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y
657;;;!! ;; (car relative-coordinate)
658;;;!! ;; (car (cdr relative-coordinate)))
659;;;!! ;; (message "mouse: [%d %d]" abs-x abs-y)))))
660;;;!!
661;;;!! ;;
662;;;!! ;; Dynamically put a box around the line indicated by point
663;;;!! ;;
664;;;!! ;;
665;;;!! ;;(require 'backquote)
666;;;!! ;;
667;;;!! ;;(defun mouse-select-buffer-line (event)
668;;;!! ;; (interactive "@e")
669;;;!! ;; (let ((relative-coordinate
670;;;!! ;; (coordinates-in-window-p (car event) (selected-window)))
671;;;!! ;; (abs-y (car (cdr (car event)))))
672;;;!! ;; (if (consp relative-coordinate)
673;;;!! ;; (progn
674;;;!! ;; (save-excursion
675;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
676;;;!! ;; (x-draw-rectangle
677;;;!! ;; (selected-screen)
678;;;!! ;; abs-y 0
679;;;!! ;; (save-excursion
680;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
681;;;!! ;; (end-of-line)
682;;;!! ;; (push-mark nil t)
683;;;!! ;; (beginning-of-line)
684;;;!! ;; (- (region-end) (region-beginning))) 1))
685;;;!! ;; (sit-for 1)
686;;;!! ;; (x-erase-rectangle (selected-screen))))))
687;;;!! ;;
688;;;!! ;;(defvar last-line-drawn nil)
689;;;!! ;;(defvar begin-delim "[^ \t]")
690;;;!! ;;(defvar end-delim "[^ \t]")
691;;;!! ;;
692;;;!! ;;(defun mouse-boxing (event)
693;;;!! ;; (interactive "@e")
694;;;!! ;; (save-excursion
695;;;!! ;; (let ((screen (selected-screen)))
696;;;!! ;; (while (= (x-mouse-events) 0)
697;;;!! ;; (let* ((pos (read-mouse-position screen))
698;;;!! ;; (abs-x (car pos))
699;;;!! ;; (abs-y (cdr pos))
700;;;!! ;; (relative-coordinate
701;;;!! ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y)))
702;;;!! ;; (selected-window)))
703;;;!! ;; (begin-reg nil)
704;;;!! ;; (end-reg nil)
705;;;!! ;; (end-column nil)
706;;;!! ;; (begin-column nil))
707;;;!! ;; (if (and (consp relative-coordinate)
708;;;!! ;; (or (not last-line-drawn)
709;;;!! ;; (not (= last-line-drawn abs-y))))
710;;;!! ;; (progn
711;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
712;;;!! ;; (if (= (following-char) 10)
713;;;!! ;; ()
714;;;!! ;; (progn
715;;;!! ;; (setq begin-reg (1- (re-search-forward end-delim)))
716;;;!! ;; (setq begin-column (1- (current-column)))
717;;;!! ;; (end-of-line)
718;;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim)))
719;;;!! ;; (setq end-column (1+ (current-column)))
720;;;!! ;; (message "%s" (buffer-substring begin-reg end-reg))
721;;;!! ;; (x-draw-rectangle screen
722;;;!! ;; (setq last-line-drawn abs-y)
723;;;!! ;; begin-column
724;;;!! ;; (- end-column begin-column) 1))))))))))
725;;;!! ;;
726;;;!! ;;(defun mouse-erase-box ()
727;;;!! ;; (interactive)
728;;;!! ;; (if last-line-drawn
729;;;!! ;; (progn
730;;;!! ;; (x-erase-rectangle (selected-screen))
731;;;!! ;; (setq last-line-drawn nil))))
732;;;!!
733;;;!! ;;; (defun test-x-rectangle ()
734;;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap)))
735;;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing)
736;;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box))
737;;;!!
738;;;!! ;;
739;;;!! ;; Here is how to do double clicking in lisp. About to change.
740;;;!! ;;
741;;;!!
742;;;!! (defvar double-start nil)
743;;;!! (defconst double-click-interval 300
744;;;!! "Max ticks between clicks")
745;;;!!
746;;;!! (defun double-down (event)
747;;;!! (interactive "@e")
748;;;!! (if double-start
749;;;!! (let ((interval (- (nth 4 event) double-start)))
750;;;!! (if (< interval double-click-interval)
751;;;!! (progn
752;;;!! (backward-up-list 1)
753;;;!! ;; (message "Interval %d" interval)
754;;;!! (sleep-for 1)))
755;;;!! (setq double-start nil))
756;;;!! (setq double-start (nth 4 event))))
757;;;!!
758;;;!! (defun double-up (event)
759;;;!! (interactive "@e")
760;;;!! (and double-start
761;;;!! (> (- (nth 4 event ) double-start) double-click-interval)
762;;;!! (setq double-start nil)))
763;;;!!
764;;;!! ;;; (defun x-test-doubleclick ()
765;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap)))
766;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down)
767;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up))
768;;;!!
769;;;!! ;;
5ba2dc3f 770;;;!! ;; This scrolls while button is depressed. Use preferable in scroll bar.
dbc4e1c1
JB
771;;;!! ;;
772;;;!!
773;;;!! (defvar scrolled-lines 0)
774;;;!! (defconst scroll-speed 1)
775;;;!!
776;;;!! (defun incr-scroll-down (event)
777;;;!! (interactive "@e")
778;;;!! (setq scrolled-lines 0)
779;;;!! (incremental-scroll scroll-speed))
780;;;!!
781;;;!! (defun incr-scroll-up (event)
782;;;!! (interactive "@e")
783;;;!! (setq scrolled-lines 0)
784;;;!! (incremental-scroll (- scroll-speed)))
785;;;!!
786;;;!! (defun incremental-scroll (n)
787;;;!! (while (= (x-mouse-events) 0)
788;;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines)))
789;;;!! (scroll-down n)
790;;;!! (sit-for 300 t)))
791;;;!!
792;;;!! (defun incr-scroll-stop (event)
793;;;!! (interactive "@e")
794;;;!! (message "Scrolled %d lines" scrolled-lines)
795;;;!! (setq scrolled-lines 0)
796;;;!! (sleep-for 1))
797;;;!!
798;;;!! ;;; (defun x-testing-scroll ()
799;;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix)))
800;;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down)
801;;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up)
802;;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop)
803;;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop)))
804;;;!!
805;;;!! ;;
806;;;!! ;; Some playthings suitable for picture mode? They need work.
807;;;!! ;;
808;;;!!
809;;;!! (defun mouse-kill-rectangle (event)
810;;;!! "Kill the rectangle between point and the mouse cursor."
811;;;!! (interactive "@e")
812;;;!! (let ((point-save (point)))
813;;;!! (save-excursion
814;;;!! (mouse-set-point event)
815;;;!! (push-mark nil t)
816;;;!! (if (> point-save (point))
817;;;!! (kill-rectangle (point) point-save)
818;;;!! (kill-rectangle point-save (point))))))
819;;;!!
820;;;!! (defun mouse-open-rectangle (event)
821;;;!! "Kill the rectangle between point and the mouse cursor."
822;;;!! (interactive "@e")
823;;;!! (let ((point-save (point)))
824;;;!! (save-excursion
825;;;!! (mouse-set-point event)
826;;;!! (push-mark nil t)
827;;;!! (if (> point-save (point))
828;;;!! (open-rectangle (point) point-save)
829;;;!! (open-rectangle point-save (point))))))
830;;;!!
831;;;!! ;; Must be a better way to do this.
832;;;!!
833;;;!! (defun mouse-multiple-insert (n char)
834;;;!! (while (> n 0)
835;;;!! (insert char)
836;;;!! (setq n (1- n))))
837;;;!!
838;;;!! ;; What this could do is not finalize until button was released.
839;;;!!
840;;;!! (defun mouse-move-text (event)
841;;;!! "Move text from point to cursor position, inserting spaces."
842;;;!! (interactive "@e")
843;;;!! (let* ((relative-coordinate
844;;;!! (coordinates-in-window-p (car event) (selected-window))))
845;;;!! (if (consp relative-coordinate)
846;;;!! (cond ((> (current-column) (car relative-coordinate))
847;;;!! (delete-char
848;;;!! (- (car relative-coordinate) (current-column))))
849;;;!! ((< (current-column) (car relative-coordinate))
850;;;!! (mouse-multiple-insert
851;;;!! (- (car relative-coordinate) (current-column)) " "))
852;;;!! ((= (current-column) (car relative-coordinate)) (ding))))))
07a78410 853\f
f936ae06
RS
854;; Choose a completion with the mouse.
855
856(defun mouse-choose-completion (event)
49e61c42 857 "Click on an alternative in the `*Completions*' buffer to choose it."
f936ae06
RS
858 (interactive "e")
859 (let (choice)
860 (save-excursion
861 (set-buffer (window-buffer (posn-window (event-start event))))
862 (save-excursion
863 (goto-char (posn-point (event-start event)))
864 (skip-chars-backward "^ \t\n")
865 (let ((beg (point)))
866 (skip-chars-forward "^ \t\n")
867 (setq choice (buffer-substring beg (point))))))
868 (save-excursion
869 (set-buffer (window-buffer (minibuffer-window)))
870 (goto-char (max (point-min) (- (point-max) (length choice))))
871 (while (and (not (eobp))
872 (let ((tail (buffer-substring (point) (point-max))))
873 (not (string= tail (substring choice 0 (length tail))))))
874 (forward-char 1))
875 (insert choice)
49e61c42
RS
876 (delete-region (point) (point-max))
877 (minibuffer-complete-and-exit))))
f936ae06 878\f
07a78410
RS
879;; Font selection.
880
0eb9fef3
RS
881(defun font-menu-add-default ()
882 (let* ((default (cdr (assq 'font (frame-parameters (selected-frame)))))
883 (font-alist x-fixed-font-alist)
884 (elt (assoc "Misc" font-alist)))
885 (if (assoc "Default" elt)
886 (delete (assoc "Default" elt) elt))
887 (setcdr elt
888 (cons (cons "Default"
889 (cdr (assq 'font (frame-parameters (selected-frame)))))
890 (cdr elt)))))
891
07a78410
RS
892(defvar x-fixed-font-alist
893 '("Font menu"
894 ("Misc"
fa21fdec
RS
895 ("6x10" "-misc-fixed-medium-r-semicondensed--10-110-75-75-c-60-*-1")
896 ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1")
897 ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1")
898 ("lucida 13"
899 "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-*-1")
900 ("7x13" "-misc-fixed-medium-r-normal--13-120-75-75-c-70-*-1")
901 ("7x14" "-misc-fixed-medium-r-normal--14-130-75-75-c-70-*-1")
902 ("9x15" "-misc-fixed-medium-r-normal--15-140-*-*-c-*-*-1")
903 ("")
904 ("clean 8x8" "-schumacher-clean-medium-r-normal--*-80-*-*-c-*-*-1")
905 ("clean 8x14" "-schumacher-clean-medium-r-normal--*-140-*-*-c-*-*-1")
906 ("clean 8x10" "-schumacher-clean-medium-r-normal--*-100-*-*-c-*-*-1")
907 ("clean 8x16" "-schumacher-clean-medium-r-normal--*-160-*-*-c-*-*-1")
908 ("")
909 ("sony 8x16" "-sony-fixed-medium-r-normal--16-120-100-100-c-80-*-1")
910 ("")
07a78410 911 ("fixed" "fixed")
07a78410
RS
912 ("10x20" "10x20")
913 ("11x18" "11x18")
914 ("12x24" "12x24"))
915;;; We don't seem to have these; who knows what they are.
916;;; ("fg-18" "fg-18")
917;;; ("fg-25" "fg-25")
918;;; ("lucidasanstypewriter-12" "lucidasanstypewriter-12")
919;;; ("lucidasanstypewriter-bold-14" "lucidasanstypewriter-bold-14")
920;;; ("lucidasanstypewriter-bold-24" "lucidasanstypewriter-bold-24")
921;;; ("lucidatypewriter-bold-r-24" "-b&h-lucidatypewriter-bold-r-normal-sans-24-240-75-75-m-140-iso8859-1")
922;;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*")
923 ("Courier"
82c048a9
RS
924 ("8" "-adobe-courier-medium-r-normal--*-80-*-*-m-*-iso8859-1")
925 ("10" "-adobe-courier-medium-r-normal--*-100-*-*-m-*-iso8859-1")
926 ("12" "-adobe-courier-medium-r-normal--*-120-*-*-m-*-iso8859-1")
927 ("14" "-adobe-courier-medium-r-normal--*-140-*-*-m-*-iso8859-1")
928 ("18" "-adobe-courier-medium-r-normal--*-180-*-*-m-*-iso8859-1")
929 ("24" "-adobe-courier-medium-r-normal--*-240-*-*-m-*-iso8859-1")
930 ("8 bold" "-adobe-courier-bold-r-normal--*-80-*-*-m-*-iso8859-1")
931 ("10 bold" "-adobe-courier-bold-r-normal--*-100-*-*-m-*-iso8859-1")
932 ("12 bold" "-adobe-courier-bold-r-normal--*-120-*-*-m-*-iso8859-1")
933 ("14 bold" "-adobe-courier-bold-r-normal--*-140-*-*-m-*-iso8859-1")
934 ("18 bold" "-adobe-courier-bold-r-normal--*-180-*-*-m-*-iso8859-1")
935 ("24 bold" "-adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1")
936 ("8 slant" "-adobe-courier-medium-o-normal--*-80-*-*-m-*-iso8859-1")
937 ("10 slant" "-adobe-courier-medium-o-normal--*-100-*-*-m-*-iso8859-1")
938 ("12 slant" "-adobe-courier-medium-o-normal--*-120-*-*-m-*-iso8859-1")
939 ("14 slant" "-adobe-courier-medium-o-normal--*-140-*-*-m-*-iso8859-1")
940 ("18 slant" "-adobe-courier-medium-o-normal--*-180-*-*-m-*-iso8859-1")
941 ("24 slant" "-adobe-courier-medium-o-normal--*-240-*-*-m-*-iso8859-1")
942 ("8 bold slant" "-adobe-courier-bold-o-normal--*-80-*-*-m-*-iso8859-1")
943 ("10 bold slant" "-adobe-courier-bold-o-normal--*-100-*-*-m-*-iso8859-1")
944 ("12 bold slant" "-adobe-courier-bold-o-normal--*-120-*-*-m-*-iso8859-1")
945 ("14 bold slant" "-adobe-courier-bold-o-normal--*-140-*-*-m-*-iso8859-1")
946 ("18 bold slant" "-adobe-courier-bold-o-normal--*-180-*-*-m-*-iso8859-1")
947 ("24 bold slant" "-adobe-courier-bold-o-normal--*-240-*-*-m-*-iso8859-1"))
07a78410
RS
948 )
949 "X fonts suitable for use in Emacs.")
950
dbc4e1c1 951(defun mouse-set-font (&optional font)
07a78410
RS
952 "Select an emacs font from a list of known good fonts"
953 (interactive
954 (x-popup-menu last-nonmenu-event x-fixed-font-alist))
dbc4e1c1 955 (if font
26d86f19
RS
956 (progn (modify-frame-parameters (selected-frame)
957 (list (cons 'font font)))
958 ;; Update some standard faces too.
959 (set-face-font 'bold nil (selected-frame))
960 (make-face-bold 'bold (selected-frame) t)
961 (set-face-font 'italic nil (selected-frame))
962 (make-face-italic 'italic (selected-frame) t)
963 (set-face-font 'bold-italic nil (selected-frame))
964 (make-face-bold-italic 'bold-italic (selected-frame) t))))
cc0a8174
JB
965\f
966;;; Bindings for mouse commands.
967
fcfc3c63 968(define-key global-map [down-mouse-1] 'mouse-drag-region)
dbc4e1c1 969(global-set-key [mouse-1] 'mouse-set-point)
dbc4e1c1 970(global-set-key [drag-mouse-1] 'mouse-set-region)
fcfc3c63 971
dbc4e1c1
JB
972(global-set-key [mouse-2] 'mouse-yank-at-click)
973(global-set-key [mouse-3] 'mouse-save-then-kill)
8b34e79d 974
dbc4e1c1
JB
975;; By binding these to down-going events, we let the user use the up-going
976;; event to make the selection, saving a click.
977(global-set-key [C-down-mouse-1] 'mouse-buffer-menu)
978(global-set-key [C-down-mouse-3] 'mouse-set-font)
07a78410 979
8b34e79d
RS
980;; Replaced with dragging mouse-1
981;; (global-set-key [S-mouse-1] 'mouse-set-mark)
947da0c4 982
dbc4e1c1
JB
983(global-set-key [mode-line mouse-1] 'mouse-delete-other-windows)
984(global-set-key [mode-line mouse-3] 'mouse-delete-window)
985(global-set-key [mode-line S-mouse-2] 'mouse-split-window-horizontally)
8b34e79d 986\f
6b2154de
RS
987;; Define the mouse help menu tree.
988
8b34e79d 989(defvar help-menu-map '(keymap "Help"))
dbc4e1c1
JB
990(global-set-key [C-down-mouse-2] help-menu-map)
991
992(defvar help-apropos-map (make-sparse-keymap "Is there a command that..."))
993(defvar help-keys-map (make-sparse-keymap "Key Commands <==> Functions"))
994(defvar help-manual-map (make-sparse-keymap "Manual and tutorial"))
995(defvar help-misc-map (make-sparse-keymap "Odds and ends"))
996(defvar help-modes-map (make-sparse-keymap "Modes"))
997(defvar help-admin-map (make-sparse-keymap "Administrivia"))
8b34e79d 998
e7691e9c 999(define-key help-menu-map [apropos]
6ec3899e 1000 (cons "@Is there a command that..." help-apropos-map))
e7691e9c 1001(define-key help-menu-map [keys]
6ec3899e 1002 (cons "@Key Commands <==> Functions" help-keys-map))
e7691e9c 1003(define-key help-menu-map [manuals]
6ec3899e 1004 (cons "@Manual and tutorial" help-manual-map))
e7691e9c 1005(define-key help-menu-map [misc]
6ec3899e 1006 (cons "@Odds and ends" help-misc-map))
e7691e9c 1007(define-key help-menu-map [modes]
6ec3899e 1008 (cons "@Modes" help-modes-map))
e7691e9c 1009(define-key help-menu-map [admin]
6ec3899e 1010 (cons "@Administrivia" help-admin-map))
8b34e79d
RS
1011
1012(define-key help-apropos-map "c" '("Command Apropos" . command-apropos))
1013(define-key help-apropos-map "a" '("Apropos" . apropos))
1014
1015(define-key help-keys-map "b"
1016 '("List all keystroke commands" . describe-bindings))
1017(define-key help-keys-map "c"
1018 '("Describe key briefly" . describe-key-briefly))
1019(define-key help-keys-map "k"
1020 '("Describe key verbose" . describe-key))
1021(define-key help-keys-map "f"
1022 '("Describe Lisp function" . describe-function))
1023(define-key help-keys-map "w"
1024 '("Where is this command" . where-is))
1025
1026(define-key help-manual-map "i" '("Info system" . info))
1027(define-key help-manual-map "t"
1028 '("Invoke Emacs tutorial" . help-with-tutorial))
1029
1030(define-key help-misc-map "l" '("Last 100 Keystrokes" . view-lossage))
1031(define-key help-misc-map "s" '("Describe syntax table" . describe-syntax))
1032
1033(define-key help-modes-map "m"
1034 '("Describe current major mode" . describe-mode))
1035(define-key help-modes-map "b"
1036 '("List all keystroke commands" . describe-bindings))
1037
1038(define-key help-admin-map "n"
1039 '("view Emacs news" . view-emacs-news))
1040(define-key help-admin-map "l"
1041 '("View the GNU Emacs license" . describe-copying))
1042(define-key help-admin-map "d"
1043 '("Describe distribution" . describe-distribution))
1044(define-key help-admin-map "w"
1045 '("Describe (non)warranty" . describe-no-warranty))
49116ac0
JB
1046
1047(provide 'mouse)
1048
6594deb0 1049;;; mouse.el ends here