Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / info / sxemacs / mouse.texi
1 @node Mouse Selection, Additional Mouse Operations, Mark, Top
2 @comment  node-name,  next,  previous,  up
3 @section Selecting Text with the Mouse
4 @cindex mouse selection
5
6 @cindex pointer shapes
7   If you are using SXEmacs under X, you can use the mouse pointer
8 to select text. (The normal mouse pointer is an I-beam, the same
9 pointer that @code{xterm} uses.)
10
11 @vindex modeline-pointer-glyph
12 @vindex nontext-pointer-glyph
13 @vindex text-pointer-glyph
14 The glyph variable @code{text-pointer-glyph} controls the shape of
15 the mouse pointer when over text.  You can also control the shape
16 of the mouse pointer when over nontext using @code{nontext-pointer-glyph},
17 and the shape of the mouse pointer when over the modeline using
18 @code{modeline-pointer-glyph}. (Remember, you should use
19 @code{set-glyph-image}, not @code{setq}, to set one of these
20 variables.)
21
22 @cindex pointer face
23 If you want to get fancy, you can set the foreground and background
24 colors of the mouse pointer by setting the @code{pointer} face.
25
26 There are two ways to select a region of text with the mouse:
27
28   To select a word in text, double-click with the left mouse button
29 while the mouse cursor is over the word.  The word is highlighted when
30 selected. On monochrome monitors, a stippled background indicates that a
31 region of text has been highlighted. On color monitors, a color
32 background indicates highlighted text. You can triple-click to select
33 whole lines.
34
35 To select an arbitrary region of text:
36
37 @enumerate
38 @item
39 Move the mouse cursor over the character at the beginning of the region of
40 text you want to select.
41 @item
42 Press and hold the left mouse button.
43 @item
44 While holding the left mouse button down, drag the cursor to the
45 character at the end of the region of text you want to select.
46 @item
47 Release the left mouse button.
48 @end enumerate
49 The selected region of text is highlighted.
50
51   Once a region of text is selected, it becomes the primary X selection
52 (@pxref{Using X Selections}) as well as the Emacs selected region. You
53 can paste it into other X applications and use the options from the
54 @b{Edit} pull-down menu on it.  Since it is also the Emacs region, you
55 can use Emacs region commands on it.
56
57 @node Additional Mouse Operations, Killing, Mouse Selection, Top
58 @section Additional Mouse Operations
59 @cindex mouse operations
60
61 SXEmacs also provides the following mouse functions.  Most of these are
62 not bound to mouse gestures by default, but they are provided for your
63 customization pleasure.  For example, if you wanted @kbd{shift-left}
64 (that is, holding down the @key{Shift} key and clicking the left mouse
65 button) to delete the character at which you are pointing, then you
66 could do this:
67
68 @example
69 (global-set-key '(shift button1) 'mouse-del-char)
70 @end example
71
72 @findex mouse-del-char
73 @findex mouse-delete-window
74 @findex mouse-keep-one-window
75 @findex mouse-kill-line
76 @findex mouse-line-length
77 @findex mouse-scroll
78 @findex mouse-select
79 @findex mouse-select-and-split
80 @findex mouse-set-mark
81 @findex mouse-set-point
82 @findex mouse-track
83 @findex mouse-track-adjust
84 @findex mouse-track-and-copy-to-cutbuffer
85 @findex mouse-track-delete-and-insert
86
87 @table @kbd
88 @item mouse-del-char
89 Delete the character pointed to by the mouse.
90 @item mouse-delete-window
91 Delete the Emacs window that the mouse is on.
92 @item mouse-keep-one-window
93 Select the Emacs window that the mouse is on, then delete all other
94 windows on this frame.
95 @item mouse-kill-line
96 Kill the line pointed to by the mouse.
97 @item mouse-line-length
98 Print the length of the line indicated by the pointer.
99 @item mouse-scroll
100 Scroll point to the mouse position.
101 @item mouse-select
102 Select the Emacs window the mouse is on.
103 @item mouse-select-and-split
104 Select the Emacs window mouse is on, then split it vertically in half.
105 @item mouse-set-mark
106 Select the Emacs window the mouse is on and set the mark at the mouse
107 position.  Display the cursor at that position for a second.
108 @item mouse-set-point
109 Select the Emacs window that the mouse is on and move point to the
110 mouse position.
111 @item mouse-track
112 Make a selection with the mouse.   This is the default binding of
113 the left mouse button (@key{button1}).
114 @item mouse-track-adjust
115 Extend the existing selection.  This is the default binding of
116 @key{Shift-button1}.
117 @item mouse-track-and-copy-to-cutbuffer
118 Make a selection like @code{mouse-track}, but also copy it to the cut buffer.
119 @item mouse-track-delete-and-insert
120 Make a selection with the mouse and insert it at point.  This is the
121 default binding of @key{control-shift-button1}.
122 @item mouse-track-insert
123 Make a selection with the mouse and insert it at point.
124 This is the default binding of @key{control-button1}.
125 @item mouse-window-to-region
126 Narrow a window to the region between the cursor and the mouse pointer.
127 @end table
128
129 The @kbd{M-x mouse-track} command should be bound to a mouse button.  If
130 you click-and-drag, the selection is set to the region between the
131 point of the initial click and the point at which you release the
132 button.  These positions do not need to be ordered.
133
134 If you click-and-release without moving the mouse, the point is moved,
135 and the selection is disowned (there will be no selection owner.)  The
136 mark will be set to the previous position of point.
137
138 If you double-click, the selection will extend by symbols instead of by
139 characters.  If you triple-click, the selection will extend by lines.
140
141 If you drag the mouse off the top or bottom of the window, you can
142 select pieces of text that are larger than the visible part of the
143 buffer; the buffer will scroll as necessary.
144
145 The selected text becomes the current X selection, and is also copied to
146 the top of the kill ring.  Point will be left at the position at
147 which you released the button and the mark will be left at the initial
148 click position.  Bind a mouse click to
149 @kbd{mouse-track-and-copy-to-cutbuffer} to copy selections to the cut buffer.
150 (See also the @code{mouse-track-adjust} command, on @kbd{Shift-button1}.)
151
152 The @kbd{M-x mouse-track-adjust} command should be bound to a mouse
153 button.  The selection will be enlarged or shrunk so that the point of
154 the mouse click is one of its endpoints.  This is only meaningful
155 after the @code{mouse-track} command (@key{button1}) has been executed.
156
157 The @kbd{M-x mouse-track-delete-and-insert} command is exactly the same
158 as the @code{mouse-track} command on @key{button1}, except that point is
159 not moved; the selected text is immediately inserted after being
160 selected; and the text of the selection is deleted.
161
162 The @kbd{M-x mouse-track-insert} command is exactly the same as the
163 @code{mouse-track} command on @key{button1}, except that point is not moved;
164 the selected text is immediately inserted after being selected; and the
165 selection is immediately disowned afterwards.