1

I'd like my emacs v25.3.1 running on Mac OS X to have a mouse middle button functionality that copies what you mouse middle on to the insertion point in your buffer. This is great when writing code and you want to quickly grab a section of code already in your file by pointing with your mouse. This is the way the old Lisp Machines worked with Zmacs and the ZWEI editor. You click a point and it copies an sexp you point to or you click drag to specify an exact range of characters to copy, or you click at end of line to copy a whole line.

I've had doing this on my own, but it always breaks going to a new version of emacs, so it would be nice if there was built-in code to do this or an add-on that is supported.

I found Mouse Copy but that project appears untouched since 2012.

1

Set option mouse-yank-at-point to non-nil. Then clicking mouse-2 yanks at point instead of at the mouse-pointer (click) position. See also:

  • (emacs) Mouse Commands:

    If you change the variable mouse-yank-at-point to a non-nil value, mouse-2 does not move point; it inserts the text at point, regardless of where you clicked or even which of the frame’s windows you clicked on. This variable affects both mouse-yank-primary and mouse-yank-at-click.

  • (emacs) Secondary Selection: mouse-yank-at-point non-nil means M-mouse-2 yanks at point.

  • Sounds like you have to first fill yank buffer with the text to yank, the Zwei approach does this in one click to copy what you point at and yank it at insertion point. – WilliamKF Jan 30 '18 at 0:32
  • You would need to write a command that combines that with what mouse-yank-at-click does. AFAIK, nothing in vanilla Emacs defines "what you point at", but you could certainly do so. Perhaps someone here will do that for you, if you define "what you point at". (It could so something like what thing-at-point does, but using the mouse-pointer position rather than point.) – Drew Jan 30 '18 at 1:47
  • By point, I meant, what you click on is copied to insertion point. – WilliamKF Jan 30 '18 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.