Mercurial > emacs
annotate lisp/mouse.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | a8378792a31d |
| children | 2a49d509b30d |
| 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 | 8 ;;; This file is part of GNU Emacs. |
| 66 | 9 |
| 465 | 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 | |
| 705 | 12 ;;; the Free Software Foundation; either version 2, or (at your option) |
| 465 | 13 ;;; any later version. |
| 66 | 14 |
| 465 | 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. | |
| 66 | 19 |
| 465 | 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. | |
| 66 | 23 |
| 24 | |
| 465 | 25 ;;; Utility functions. |
| 26 | |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
27 (defsubst mouse-movement-p (object) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
28 "Return non-nil if OBJECT is a mouse movement event." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
29 (and (consp object) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
30 (eq (car object) 'mouse-movement))) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
31 |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
32 (defsubst event-start (event) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
33 "Return the starting position of EVENT. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
34 If EVENT is a mouse press or a mouse click, this returns the location |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
35 of the event. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
36 If EVENT is a drag, this returns the drag's starting position. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
37 The return value is of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
38 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
39 The `posn-' functions access elements of such lists." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
40 (nth 1 event)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
41 |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
42 (defsubst event-end (event) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
43 "Return the ending location of EVENT. EVENT should be a drag event. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
44 The return value is of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
45 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
46 The `posn-' functions access elements of such lists." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
47 (nth 2 event)) |
| 465 | 48 |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
49 (defsubst posn-window (position) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
50 "Return the window in POSITION. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
51 POSITION should be a list of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
52 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
53 as returned by the `event-start' and `event-end' functions." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
54 (nth 0 position)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
55 |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
56 (defsubst posn-point (position) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
57 "Return the buffer location in POSITION. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
58 POSITION should be a list of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
59 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
60 as returned by the `event-start' and `event-end' functions." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
61 (nth 1 position)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
62 |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
63 (defsubst posn-col-row (position) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
64 "Return the row and column in POSITION. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
65 POSITION should be a list of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
66 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
67 as returned by the `event-start' and `event-end' functions." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
68 (nth 2 position)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
69 |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
70 (defsubst posn-timestamp (position) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
71 "Return the timestamp of POSITION. |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
72 POSITION should be a list of the form |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
73 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
74 nas returned by the `event-start' and `event-end' functions." |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
75 (nth 3 position)) |
| 66 | 76 |
| 465 | 77 ;;; Indent track-mouse like progn. |
| 78 (put 'track-mouse 'lisp-indent-function 0) | |
| 66 | 79 |
| 465 | 80 |
| 81 (defun mouse-delete-window (click) | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
82 "Delete the window you click on. |
| 465 | 83 This must be bound to a mouse click." |
| 1113 | 84 (interactive "e") |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
85 (delete-window (posn-window (event-start click)))) |
| 465 | 86 |
|
1421
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
87 (defun mouse-tear-off-window (click) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
88 "Delete the window clicked on, and create a new frame displaying its buffer." |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
89 (interactive "e") |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
90 (let* ((window (posn-window (event-start click))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
91 (buf (window-buffer window)) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
92 (frame (new-frame))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
93 (select-frame frame) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
94 (switch-to-buffer buf) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
95 (delete-window window))) |
|
a8378792a31d
* mouse.el (mouse-tear-off-window): New function.
Jim Blandy <jimb@redhat.com>
parents:
1420
diff
changeset
|
96 |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
97 (defun mouse-delete-other-windows () |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
98 "Delete all window except the one you click on." |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
99 (interactive "@") |
| 66 | 100 (delete-other-windows)) |
| 101 | |
| 465 | 102 (defun mouse-split-window-vertically (click) |
| 103 "Select Emacs window mouse is on, then split it vertically in half. | |
| 104 The window is split at the line clicked on. | |
| 105 This command must be bound to a mouse click." | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
106 (interactive "@e") |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
107 (let ((start (event-start click))) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
108 (select-window (posn-window start)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
109 (split-window-vertically (1+ (cdr (posn-col-row click)))))) |
| 66 | 110 |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
111 (defun mouse-split-window-horizontally (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
112 "Select Emacs window mouse is on, then split it horizontally in half. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
113 The window is split at the column clicked on. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
114 This command must be bound to a mouse click." |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
115 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
116 (split-window-horizontally (1+ (car (mouse-coords click))))) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
117 |
| 465 | 118 (defun mouse-set-point (click) |
| 119 "Move point to the position clicked on with the mouse. | |
| 120 This must be bound to a mouse click." | |
| 1113 | 121 (interactive "e") |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
122 (let ((posn (event-start click))) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
123 (select-window (posn-window posn)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
124 (if (numberp (posn-point posn)) |
|
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
125 (goto-char (posn-point posn))))) |
| 66 | 126 |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
127 (defun mouse-set-region (click) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
128 "Set the region to the text that the mouse is dragged over. |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
129 This must be bound to a mouse click." |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
130 (interactive "e") |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
131 (let ((posn (event-start click)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
132 (end (event-end click))) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
133 (select-window (posn-window posn)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
134 (if (numberp (posn-point posn)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
135 (goto-char (posn-point posn))) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
136 (sit-for 1) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
137 (push-mark) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
138 (if (numberp (posn-point end)) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
139 (goto-char (posn-point end))))) |
|
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
140 |
| 465 | 141 (defun mouse-set-mark (click) |
| 142 "Set mark at the position clicked on with the mouse. | |
| 143 Display cursor at that position for a second. | |
| 144 This must be bound to a mouse click." | |
| 1113 | 145 (interactive "e") |
| 66 | 146 (let ((point-save (point))) |
| 147 (unwind-protect | |
| 465 | 148 (progn (mouse-set-point click) |
| 66 | 149 (push-mark nil t) |
| 191 | 150 (sit-for 1)) |
| 66 | 151 (goto-char point-save)))) |
| 152 | |
| 465 | 153 (defun mouse-kill (click) |
| 154 "Kill the region between point and the mouse click. | |
| 155 The text is saved in the kill ring, as with \\[kill-region]." | |
| 1113 | 156 (interactive "e") |
| 758 | 157 (let ((click-posn (event-point click))) |
| 1039 | 158 (if (numberp click-posn) |
| 159 (kill-region (min (point) click-posn) | |
| 160 (max (point) click-posn))))) | |
| 66 | 161 |
| 705 | 162 (defun mouse-yank-at-click (click arg) |
| 163 "Insert the last stretch of killed text at the position clicked on. | |
| 164 Prefix arguments are interpreted as with \\[yank]." | |
| 1113 | 165 (interactive "e\nP") |
| 705 | 166 (mouse-set-point click) |
| 167 (yank arg)) | |
| 168 | |
| 169 (defun mouse-kill-ring-save (click) | |
| 465 | 170 "Copy the region between point and the mouse click in the kill ring. |
| 171 This does not delete the region; it acts like \\[kill-ring-save]." | |
| 1113 | 172 (interactive "e") |
| 465 | 173 (mouse-set-mark click) |
| 705 | 174 (call-interactively 'kill-ring-save)) |
| 66 | 175 |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
176 (defun mouse-save-then-kill (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
177 "Copy the region between point and the mouse click in the kill ring. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
178 This does not delete the region; it acts like \\[kill-ring-save]." |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
179 (interactive "e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
180 (mouse-set-mark click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
181 (if (string= (buffer-substring (point) (mark)) (car kill-ring)) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
182 ;; If this text was already saved in kill ring, |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
183 ;; now delete it from the buffer. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
184 (progn |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
185 (let ((buffer-undo-list t)) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
186 (delete-region (point) (mark))) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
187 ;; Make the undo list by hand so it is shared. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
188 (setq buffer-undo-list |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
189 (cons (cons (car kill-ring) (point)) buffer-undo-list))) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
190 ;; Otherwise, save this region. |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
191 (call-interactively 'kill-ring-save))) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
192 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
193 (defun mouse-buffer-menu (event) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
194 "Pop up a menu of buffers for selection with the mouse." |
| 1113 | 195 (interactive "e") |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
196 (let ((menu |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
197 (list "Buffer Menu" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
198 (cons "Select Buffer" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
199 (let ((tail (buffer-list)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
200 head) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
201 (while tail |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
202 (let ((elt (car tail))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
203 (if (not (string-match "^ " |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
204 (buffer-name elt))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
205 (setq head (cons |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
206 (cons |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
207 (format |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
208 "%14s %s" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
209 (buffer-name elt) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
210 (or (buffer-file-name elt) "")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
211 elt) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
212 head)))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
213 (setq tail (cdr tail))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
214 (reverse head)))))) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
215 (switch-to-buffer (or (x-popup-menu event menu) (current-buffer))))) |
| 66 | 216 |
| 217 ;; Commands for the scroll bar. | |
| 218 | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
219 (defun mouse-scroll-down (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
220 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
221 (scroll-down (1+ (cdr (mouse-coords click))))) |
| 66 | 222 |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
223 (defun mouse-scroll-up (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
224 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
225 (scroll-up (1+ (cdr (mouse-coords click))))) |
| 66 | 226 |
| 227 (defun mouse-scroll-down-full () | |
| 228 (interactive "@") | |
| 229 (scroll-down nil)) | |
| 230 | |
| 231 (defun mouse-scroll-up-full () | |
| 232 (interactive "@") | |
| 233 (scroll-up nil)) | |
| 234 | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
235 (defun mouse-scroll-move-cursor (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
236 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
237 (move-to-window-line (1+ (cdr (mouse-coords click))))) |
| 66 | 238 |
| 239 (defun mouse-scroll-absolute (event) | |
| 240 (interactive "@e") | |
| 241 (let* ((pos (car event)) | |
| 242 (position (car pos)) | |
| 243 (length (car (cdr pos)))) | |
| 244 (if (<= length 0) (setq length 1)) | |
| 245 (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) | |
| 246 (newpos (* (/ (* (/ (buffer-size) scale-factor) | |
| 247 position) | |
| 248 length) | |
| 249 scale-factor))) | |
| 250 (goto-char newpos) | |
| 251 (recenter '(4))))) | |
| 252 | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
253 (defun mouse-scroll-left (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
254 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
255 (scroll-left (1+ (car (mouse-coords click))))) |
| 66 | 256 |
|
1363
f34d8e4d1d7b
* mouse.el: Begin adapting this to the new event format.
Jim Blandy <jimb@redhat.com>
parents:
1214
diff
changeset
|
257 (defun mouse-scroll-right (click) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
258 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
259 (scroll-right (1+ (car (mouse-coords click))))) |
| 66 | 260 |
| 261 (defun mouse-scroll-left-full () | |
| 262 (interactive "@") | |
| 263 (scroll-left nil)) | |
| 264 | |
| 265 (defun mouse-scroll-right-full () | |
| 266 (interactive "@") | |
| 267 (scroll-right nil)) | |
| 268 | |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
269 (defun mouse-scroll-move-cursor-horizontally (click) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
270 (interactive "@e") |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
271 (move-to-column (1+ (car (mouse-coords click))))) |
| 66 | 272 |
| 273 (defun mouse-scroll-absolute-horizontally (event) | |
| 274 (interactive "@e") | |
| 275 (let* ((pos (car event)) | |
| 276 (position (car pos)) | |
| 277 (length (car (cdr pos)))) | |
| 278 (set-window-hscroll (selected-window) 33))) | |
| 279 | |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
280 (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
281 (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
282 (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
283 |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
284 (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
|
285 (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
|
286 (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
|
287 |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
288 (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
289 (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
290 (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
291 |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
292 (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
293 (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
294 (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) |
| 66 | 295 |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
296 (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
|
297 (global-set-key [horizontal-scroll-bar mouse-2] |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
298 'mouse-scroll-absolute-horizontally) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
299 (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) |
| 66 | 300 |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
301 (global-set-key [horizontal-slider mouse-1] |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
302 'mouse-scroll-move-cursor-horizontally) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
303 (global-set-key [horizontal-slider mouse-2] |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
304 'mouse-scroll-move-cursor-horizontally) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
305 (global-set-key [horizontal-slider mouse-3] |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
306 'mouse-scroll-move-cursor-horizontally) |
| 66 | 307 |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
308 (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
309 (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
310 (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
311 |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
312 (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
313 (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
314 (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
315 |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
316 (global-set-key [horizontal-scroll-bar S-mouse-2] |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
317 'mouse-split-window-horizontally) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
318 (global-set-key [mode-line S-mouse-2] |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
319 'mouse-split-window-horizontally) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
320 (global-set-key [vertical-scroll-bar S-mouse-2] |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
321 'mouse-split-window) |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
322 |
| 303 | 323 ;;;; |
| 324 ;;;; Here are experimental things being tested. Mouse events | |
| 325 ;;;; are of the form: | |
| 326 ;;;; ((x y) window screen-part key-sequence timestamp) | |
| 66 | 327 ;; |
| 303 | 328 ;;;; |
| 329 ;;;; Dynamically track mouse coordinates | |
| 330 ;;;; | |
| 66 | 331 ;; |
| 303 | 332 ;;(defun track-mouse (event) |
| 333 ;; "Track the coordinates, absolute and relative, of the mouse." | |
| 334 ;; (interactive "@e") | |
| 335 ;; (while mouse-grabbed | |
| 336 ;; (let* ((pos (read-mouse-position (selected-screen))) | |
| 337 ;; (abs-x (car pos)) | |
| 338 ;; (abs-y (cdr pos)) | |
| 339 ;; (relative-coordinate (coordinates-in-window-p | |
| 340 ;; (list (car pos) (cdr pos)) | |
| 341 ;; (selected-window)))) | |
| 342 ;; (if (consp relative-coordinate) | |
| 343 ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y | |
| 344 ;; (car relative-coordinate) | |
| 345 ;; (car (cdr relative-coordinate))) | |
| 346 ;; (message "mouse: [%d %d]" abs-x abs-y))))) | |
| 66 | 347 |
| 348 ;; | |
| 349 ;; Dynamically put a box around the line indicated by point | |
| 350 ;; | |
| 758 | 351 ;; |
| 352 ;;(require 'backquote) | |
| 353 ;; | |
| 354 ;;(defun mouse-select-buffer-line (event) | |
| 355 ;; (interactive "@e") | |
| 356 ;; (let ((relative-coordinate | |
| 357 ;; (coordinates-in-window-p (car event) (selected-window))) | |
| 358 ;; (abs-y (car (cdr (car event))))) | |
| 359 ;; (if (consp relative-coordinate) | |
| 360 ;; (progn | |
| 361 ;; (save-excursion | |
| 362 ;; (move-to-window-line (car (cdr relative-coordinate))) | |
| 363 ;; (x-draw-rectangle | |
| 364 ;; (selected-screen) | |
| 365 ;; abs-y 0 | |
| 366 ;; (save-excursion | |
| 367 ;; (move-to-window-line (car (cdr relative-coordinate))) | |
| 368 ;; (end-of-line) | |
| 369 ;; (push-mark nil t) | |
| 370 ;; (beginning-of-line) | |
| 371 ;; (- (region-end) (region-beginning))) 1)) | |
| 372 ;; (sit-for 1) | |
| 373 ;; (x-erase-rectangle (selected-screen)))))) | |
| 374 ;; | |
| 375 ;;(defvar last-line-drawn nil) | |
| 376 ;;(defvar begin-delim "[^ \t]") | |
| 377 ;;(defvar end-delim "[^ \t]") | |
| 378 ;; | |
| 379 ;;(defun mouse-boxing (event) | |
| 380 ;; (interactive "@e") | |
| 381 ;; (save-excursion | |
| 382 ;; (let ((screen (selected-screen))) | |
| 383 ;; (while (= (x-mouse-events) 0) | |
| 384 ;; (let* ((pos (read-mouse-position screen)) | |
| 385 ;; (abs-x (car pos)) | |
| 386 ;; (abs-y (cdr pos)) | |
| 387 ;; (relative-coordinate | |
| 388 ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y))) | |
| 389 ;; (selected-window))) | |
| 390 ;; (begin-reg nil) | |
| 391 ;; (end-reg nil) | |
| 392 ;; (end-column nil) | |
| 393 ;; (begin-column nil)) | |
| 394 ;; (if (and (consp relative-coordinate) | |
| 395 ;; (or (not last-line-drawn) | |
| 396 ;; (not (= last-line-drawn abs-y)))) | |
| 397 ;; (progn | |
| 398 ;; (move-to-window-line (car (cdr relative-coordinate))) | |
| 399 ;; (if (= (following-char) 10) | |
| 400 ;; () | |
| 401 ;; (progn | |
| 402 ;; (setq begin-reg (1- (re-search-forward end-delim))) | |
| 403 ;; (setq begin-column (1- (current-column))) | |
| 404 ;; (end-of-line) | |
| 405 ;; (setq end-reg (1+ (re-search-backward begin-delim))) | |
| 406 ;; (setq end-column (1+ (current-column))) | |
| 407 ;; (message "%s" (buffer-substring begin-reg end-reg)) | |
| 408 ;; (x-draw-rectangle screen | |
| 409 ;; (setq last-line-drawn abs-y) | |
| 410 ;; begin-column | |
| 411 ;; (- end-column begin-column) 1)))))))))) | |
| 412 ;; | |
| 413 ;;(defun mouse-erase-box () | |
| 414 ;; (interactive) | |
| 415 ;; (if last-line-drawn | |
| 416 ;; (progn | |
| 417 ;; (x-erase-rectangle (selected-screen)) | |
| 418 ;; (setq last-line-drawn nil)))) | |
| 66 | 419 |
| 465 | 420 ;;; (defun test-x-rectangle () |
| 421 ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) | |
| 422 ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) | |
| 423 ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) | |
| 66 | 424 |
| 425 ;; | |
| 426 ;; Here is how to do double clicking in lisp. About to change. | |
| 427 ;; | |
| 428 | |
| 429 (defvar double-start nil) | |
| 430 (defconst double-click-interval 300 | |
| 431 "Max ticks between clicks") | |
| 432 | |
| 433 (defun double-down (event) | |
| 434 (interactive "@e") | |
| 435 (if double-start | |
| 436 (let ((interval (- (nth 4 event) double-start))) | |
| 437 (if (< interval double-click-interval) | |
| 438 (progn | |
| 439 (backward-up-list 1) | |
| 440 ;; (message "Interval %d" interval) | |
| 441 (sleep-for 1))) | |
| 442 (setq double-start nil)) | |
| 443 (setq double-start (nth 4 event)))) | |
| 444 | |
| 445 (defun double-up (event) | |
| 446 (interactive "@e") | |
| 447 (and double-start | |
| 448 (> (- (nth 4 event ) double-start) double-click-interval) | |
| 449 (setq double-start nil))) | |
| 450 | |
| 465 | 451 ;;; (defun x-test-doubleclick () |
| 452 ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) | |
| 453 ;;; (define-key doubleclick-test-map mouse-button-left 'double-down) | |
| 454 ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) | |
| 66 | 455 |
| 456 ;; | |
| 457 ;; This scrolls while button is depressed. Use preferable in scrollbar. | |
| 458 ;; | |
| 459 | |
| 460 (defvar scrolled-lines 0) | |
| 461 (defconst scroll-speed 1) | |
| 462 | |
| 463 (defun incr-scroll-down (event) | |
| 464 (interactive "@e") | |
| 465 (setq scrolled-lines 0) | |
| 466 (incremental-scroll scroll-speed)) | |
| 467 | |
| 468 (defun incr-scroll-up (event) | |
| 469 (interactive "@e") | |
| 470 (setq scrolled-lines 0) | |
| 471 (incremental-scroll (- scroll-speed))) | |
| 472 | |
| 473 (defun incremental-scroll (n) | |
| 474 (while (= (x-mouse-events) 0) | |
| 475 (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) | |
| 476 (scroll-down n) | |
| 477 (sit-for 300 t))) | |
| 478 | |
| 479 (defun incr-scroll-stop (event) | |
| 480 (interactive "@e") | |
| 481 (message "Scrolled %d lines" scrolled-lines) | |
| 482 (setq scrolled-lines 0) | |
| 483 (sleep-for 1)) | |
| 484 | |
| 465 | 485 ;;; (defun x-testing-scroll () |
| 486 ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) | |
| 487 ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) | |
| 488 ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) | |
| 489 ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) | |
| 490 ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) | |
| 66 | 491 |
| 492 ;; | |
| 493 ;; Some playthings suitable for picture mode? They need work. | |
| 494 ;; | |
| 495 | |
| 496 (defun mouse-kill-rectangle (event) | |
| 497 "Kill the rectangle between point and the mouse cursor." | |
| 498 (interactive "@e") | |
| 499 (let ((point-save (point))) | |
| 500 (save-excursion | |
| 501 (mouse-set-point event) | |
| 502 (push-mark nil t) | |
| 503 (if (> point-save (point)) | |
| 504 (kill-rectangle (point) point-save) | |
| 505 (kill-rectangle point-save (point)))))) | |
| 506 | |
| 507 (defun mouse-open-rectangle (event) | |
| 508 "Kill the rectangle between point and the mouse cursor." | |
| 509 (interactive "@e") | |
| 510 (let ((point-save (point))) | |
| 511 (save-excursion | |
| 512 (mouse-set-point event) | |
| 513 (push-mark nil t) | |
| 514 (if (> point-save (point)) | |
| 515 (open-rectangle (point) point-save) | |
| 516 (open-rectangle point-save (point)))))) | |
| 517 | |
| 518 ;; Must be a better way to do this. | |
| 519 | |
| 520 (defun mouse-multiple-insert (n char) | |
| 521 (while (> n 0) | |
| 522 (insert char) | |
| 523 (setq n (1- n)))) | |
| 524 | |
| 525 ;; What this could do is not finalize until button was released. | |
| 526 | |
| 527 (defun mouse-move-text (event) | |
| 528 "Move text from point to cursor position, inserting spaces." | |
| 529 (interactive "@e") | |
| 530 (let* ((relative-coordinate | |
| 531 (coordinates-in-window-p (car event) (selected-window)))) | |
| 532 (if (consp relative-coordinate) | |
| 533 (cond ((> (current-column) (car relative-coordinate)) | |
| 534 (delete-char | |
| 535 (- (car relative-coordinate) (current-column)))) | |
| 536 ((< (current-column) (car relative-coordinate)) | |
| 537 (mouse-multiple-insert | |
| 538 (- (car relative-coordinate) (current-column)) " ")) | |
| 539 ((= (current-column) (car relative-coordinate)) (ding)))))) | |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
540 |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
541 ;; Font selection. |
| 465 | 542 |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
543 (defvar x-fixed-font-alist |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
544 '("Font menu" |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
545 ("Misc" |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
546 ("fixed" "fixed") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
547 ("6x10" "6x10") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
548 ("6x12" "6x12") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
549 ("6x13" "6x13") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
550 ("7x13" "7x13") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
551 ("7x14" "7x14") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
552 ("8x13" "8x13") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
553 ("8x13 bold" "8x13bold") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
554 ("8x16" "8x16") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
555 ("9x15" "9x15") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
556 ("9x15 bold" "9x15bold") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
557 ("10x20" "10x20") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
558 ("11x18" "11x18") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
559 ("12x24" "12x24")) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
560 ;;; 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
|
561 ;;; ("fg-18" "fg-18") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
562 ;;; ("fg-25" "fg-25") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
563 ;;; ("lucidasanstypewriter-12" "lucidasanstypewriter-12") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
564 ;;; ("lucidasanstypewriter-bold-14" "lucidasanstypewriter-bold-14") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
565 ;;; ("lucidasanstypewriter-bold-24" "lucidasanstypewriter-bold-24") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
566 ;;; ("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
|
567 ;;; ("fixed-medium-20" "-misc-fixed-medium-*-*-*-20-*-*-*-*-*-*-*") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
568 ("Courier" |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
569 ("8" "-adobe-courier-medium-r-normal--8-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
570 ("10" "-adobe-courier-medium-r-normal--10-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
571 ("12" "-adobe-courier-medium-r-normal--12-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
572 ("14" "-adobe-courier-medium-r-normal--14-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
573 ("18" "-adobe-courier-medium-r-normal--18-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
574 ("24" "-adobe-courier-medium-r-normal--24-*-*-*-m-*-iso8859-1") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
575 ("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
|
576 ("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
|
577 ("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
|
578 ("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
|
579 ("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
|
580 ("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
|
581 ("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
|
582 ("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
|
583 ("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
|
584 ("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
|
585 ("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
|
586 ("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
|
587 ("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
|
588 ("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
|
589 ("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
|
590 ("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
|
591 ("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
|
592 ("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
|
593 ) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
594 "X fonts suitable for use in Emacs.") |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
595 |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
596 (defun mouse-set-font (font) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
597 "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
|
598 (interactive |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
599 (x-popup-menu last-nonmenu-event x-fixed-font-alist)) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
600 (modify-frame-parameters (selected-frame) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
601 (list (cons 'font font)))) |
| 465 | 602 |
| 603 ;;; Bindings for mouse commands. | |
| 604 | |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
605 ;; 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
|
606 ;; are properly implemented. |
|
d9775f33488d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1056
diff
changeset
|
607 (global-set-key [mouse-1] 'mouse-set-point) |
|
d9775f33488d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1056
diff
changeset
|
608 |
|
1420
4005f73e5712
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Richard M. Stallman <rms@gnu.org>
parents:
1363
diff
changeset
|
609 (global-set-key [drag-mouse-1] 'mouse-set-region) |
| 705 | 610 (global-set-key [mouse-2] 'mouse-yank-at-click) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
611 (global-set-key [mouse-3] 'mouse-save-then-kill) |
| 705 | 612 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
613 (global-set-key [C-mouse-1] 'mouse-buffer-menu) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
614 |
|
1100
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
615 (global-set-key [C-mouse-3] 'mouse-set-font) |
|
5b3b202a84c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1064
diff
changeset
|
616 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
617 ;; Replaced with dragging mouse-1 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
618 ;; (global-set-key [S-mouse-1] 'mouse-set-mark) |
|
1214
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
619 |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
620 (global-set-key [mode-line mouse-1] 'mouse-delete-other-windows) |
|
467833df795b
(mouse-split-window-vertically): Use @.
Richard M. Stallman <rms@gnu.org>
parents:
1113
diff
changeset
|
621 (global-set-key [mode-line mouse-3] 'mouse-delete-window) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
622 |
|
1060
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
623 ;; Define the mouse help menu tree. |
|
af78c65921c8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1058
diff
changeset
|
624 |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
625 (defvar help-menu-map '(keymap "Help")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
626 (global-set-key [C-mouse-2] help-menu-map) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
627 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
628 (defvar help-apropos-map '(keymap "Is there a command that...")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
629 (defvar help-keys-map '(keymap "Key Commands <==> Functions")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
630 (defvar help-manual-map '(keymap "Manual and tutorial")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
631 (defvar help-misc-map '(keymap "Odds and ends")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
632 (defvar help-modes-map '(keymap "Modes")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
633 (defvar help-admin-map '(keymap "Administrivia")) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
634 |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
635 (define-key help-menu-map [apropos] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
636 (cons "@Is there a command that..." help-apropos-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
637 (define-key help-menu-map [keys] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
638 (cons "@Key Commands <==> Functions" help-keys-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
639 (define-key help-menu-map [manuals] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
640 (cons "@Manual and tutorial" help-manual-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
641 (define-key help-menu-map [misc] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
642 (cons "@Odds and ends" help-misc-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
643 (define-key help-menu-map [modes] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
644 (cons "@Modes" help-modes-map)) |
|
1058
19c6978ab218
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1057
diff
changeset
|
645 (define-key help-menu-map [admin] |
|
1064
e699ce19609f
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1060
diff
changeset
|
646 (cons "@Administrivia" help-admin-map)) |
|
1056
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
647 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
648 (define-key help-apropos-map "c" '("Command Apropos" . command-apropos)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
649 (define-key help-apropos-map "a" '("Apropos" . apropos)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
650 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
651 (define-key help-keys-map "b" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
652 '("List all keystroke commands" . describe-bindings)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
653 (define-key help-keys-map "c" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
654 '("Describe key briefly" . describe-key-briefly)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
655 (define-key help-keys-map "k" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
656 '("Describe key verbose" . describe-key)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
657 (define-key help-keys-map "f" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
658 '("Describe Lisp function" . describe-function)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
659 (define-key help-keys-map "w" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
660 '("Where is this command" . where-is)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
661 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
662 (define-key help-manual-map "i" '("Info system" . info)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
663 (define-key help-manual-map "t" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
664 '("Invoke Emacs tutorial" . help-with-tutorial)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
665 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
666 (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
|
667 (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
|
668 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
669 (define-key help-modes-map "m" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
670 '("Describe current major mode" . describe-mode)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
671 (define-key help-modes-map "b" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
672 '("List all keystroke commands" . describe-bindings)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
673 |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
674 (define-key help-admin-map "n" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
675 '("view Emacs news" . view-emacs-news)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
676 (define-key help-admin-map "l" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
677 '("View the GNU Emacs license" . describe-copying)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
678 (define-key help-admin-map "d" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
679 '("Describe distribution" . describe-distribution)) |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
680 (define-key help-admin-map "w" |
|
a7fc54083464
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1039
diff
changeset
|
681 '("Describe (non)warranty" . describe-no-warranty)) |
| 584 | 682 |
| 683 (provide 'mouse) | |
| 684 | |
|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
685 ;;; mouse.el ends here |
