3

I want to be able to jump to definition with control left click when editing c++ code. I tried

(define-key c++-mode-map [C-mouse-1] 'rtags-find-symbol-at-point)

This does not seem to work because emacs (24.5.1) already define a global behavior for C-mouse-1 (buffer navigation in graphical mode). The contextual window opens, but rtags-find-symbol-at-point is not called. Any way to make this work ?

2

Try:

(define-key c++-mode-map [C-down-mouse-1] 'rtags-find-symbol-at-point)
| improve this answer | |
  • 1
    If you do f1 k then hold control and click it tells you that you pressed C-down-mouse-1, so this is probably what you should bind. – dshepherd May 25 '16 at 11:20
  • @dshepherd what is f1 k? – sid-kap Dec 20 '16 at 17:29
  • @sid-kap I meant press the F1 key, then press the k key. – dshepherd Dec 20 '16 at 18:41
2

For me the C-down-mouse-1 solution worked, but still used the point from before the click. Thus I use now:

(define-key c-mode-base-map [C-down-mouse-1] 'mouse-drag-region)
(define-key c-mode-base-map [C-mouse-1] 'rtags-find-symbol-at-point)

so now, first the point gets set, then we find the correct symbol.

| improve this answer | |

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.