Emacs column editing CUA mode - is it possible to select rectangular region with mouse?

Is it possible to select a column (rectangular) region with the mouse in emacs?

A simple yes or no will be helpful to me at this point.

Here are more details:

Column editing is possible in emacs. And it is very easy with cua-mode enabled.

Here are my references for this:

  • Here's a video that shows how to do it:

  • And see section "CUA rectangle support" here:

But I also wonder if I can do it with the mouse. I want to select the columns entirely with the mouse (like Scite or Geany can do). Is that possible in emacs?

Edit: New info. The CUA-mode documentation says,

there is mouse support for rectangle highlighting by dragging the mouse while holding down the shift key. The idea is that this behaves exactly like normal mouse dragging except that the region is treated as a rectangle.

When I try to hold down shift and use the mouse, as soon as I click (before I can even drag), I get a dialog popup. Rather than paste an image of the dialog, I'll type out what the dialog says:

  • Change default buffer face
  • Change buffer font...
  • Increase buffer text size
  • Decrease buffer text size
  • Result to default

I'm new to emacs so I don't recognize this dialog, and I don't know why my shift-click action brings it up instead of doing what (I think) the cua-mode docs say should happen when I shift-click/drag. I'm using Kubuntu 12.04 and emacs v24.

4

1 Answer

try this:

(require 'cua-rect)
(defun hkb-mouse-mark-cua-rectangle (event) (interactive "e") (if (not cua--rectangle) (cua-mouse-set-rectangle-mark event)
(cua-mouse-resize-rectangle event)))
(require 'cua-base)
(global-unset-key (kbd "<S-down-mouse-1>"))
(global-set-key (kbd "<S-mouse-1>") 'hkb-mouse-mark-cua-rectangle)
(define-key cua--rectangle-keymap (kbd "<S-mouse-1>") 'hkb-mouse-mark-cua-rectangle)
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like