mouse.texi 6.6 KB

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