Search code examples
emacselisp

emacs `C-S-<mouse-1>` sequence


I am trying to bind the multiple-cursors.el click event, using the following line in my .emacs configuration file:

(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click)

I don't get this specific sequence of keys, here is what I am doing now :

  • C => Ctrl

  • S => Shifts

  • <mouse-1> => mouse click (left? right?)

But when I press CtrlShifts I am prompted with the search in the minibar.

How do I get this shortcut working ?

Note : in case this is relevant, I am using emacs-prelude.

Edit : I made it working with the following lines, but I am still curious about the meaning of the previous sequence.

(global-unset-key (kbd "M-<down-mouse-1>"))
(global-set-key (kbd "M-<mouse-1>") 'mc/add-cursor-on-click)

Solution

  • The "S" you mentioned is spurious.

    The C-S-<mouse-1> sequence is just Ctrl+Shift+Left click.

    The reason you were getting dropped into the minibuffer requesting search input is because by default Ctrl+s is bound to isearch-forward.


    Edit: I may have misread what you were looking for.

    If you actually want to use the sequence Ctrl+Shift+s followed by Left click then you have use the following mapping:

    (global-set-key (kbd "C-S-s <down-mouse-1>") 'mc/add-cursor-on-click)
    

    Thanks to @resueman below for pointing this out.