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