Go to the first, previous, next, last section, table of contents.

10. The mouse; cutting and pasting

10.1. I keep hitting the middle mouse button by accident and getting stuff pasted into my buffer so how can I turn this off?

Here is an alternative binding, whereby the middle mouse button selects (but does not cut) the expression under the mouse. Clicking middle on a left or right paren will select to the matching one. Note that you can use define-key or global-set-key.

(defun Mouse-Set-Point-and-Select (event)
  "Sets the point at the mouse location, then marks following form"
  (interactive "@e")
  (mouse-set-point event)
  (mark-sexp 1)
  )
(define-key global-map 'button2 'Mouse-Set-Point-and-Select)

(Editor's Note -- there is a problem with texinfo/text/html conversion, so the double at-sign should only be a single, above. I'll fix it one of these days -- AJR)

10.2. How do I set control/meta/etc modifiers on mouse buttons?

Use, for instance, [(meta button1)]. For example, here is a common setting for Common Lisp programmers who use the bundled ilisp package, whereby meta-button1 on a function name will find the file where the function name was defined, and put you at that location in the source file.

[Inside a function that gets called by the lisp-mode-hook and ilisp-mode-hook]

(local-set-key [(meta button1)] 'edit-definitions-lisp)

10.3. I do "^x ^b" to get a list of buffers and the entries get highlighted when I move the mouse over them but clicking the left mouse does not do anything.

Use the middle mouse button.

10.4. How can I get a list of buffers to popup when I hit button 3 on the mouse?

The following code will actually replace the default popup on button3:

(defun cw-build-buffers ()
  "Popup buffer menu."
  (interactive "@")
  (run-hooks 'activate-menubar-hook)
  (popup-menu (car (find-menu-item current-menubar '("Buffers")))))

(define-key global-map [(button3)] 'cw-build-buffers)

(Editor's Note -- there is a problem with texinfo/text/html conversion, so the double at-sign should only be a single, above. I'll fix it one of these days -- AJR)

10.5. Why does cut-and-paste not work between XEmacs and a cmdtool?

We don't know. It's a bug. There does seem to be a work-around, however. Try running xclipboard first. It appears to fix the problem even if you exit it. (This should be mostly fixed in 19.13, but we haven't yet verified that).

10.6. How I can set XEmacs up so that it pastes where the cursor is _not_ where the pointer lies?

Try adding the following to your `.emacs':

(define-key global-map 'button2 'x-insert-selection)

This comes from the `sample.emacs' file in `etc/', which has lots of goodies.

10.7. How do I select a rectangular region?

Just select the region normally, then use the rectangle commands (e.g. kill-rectangle) on it. The region does not highlight as a rectangle, but the commands work just fine.

To actually sweep out rectangular regions with the mouse do the following:

(setq mouse-track-rectangle-p t)

10.8. Why does M-w take so long?

It actually doesn't. It leaves the region visible for a second so that you can see what area is being yanked. If you start working, though, it will immediately complete its operation. In other words, it will only delay for a second if you let it.


Go to the first, previous, next, last section, table of contents.