Inverse search from pdf-tools to auctex uses Ctrl-click on the pdf file to go to the corresponding part of latex file. Is it possible to also assign Alt-click to do inverse search? I am using ubuntu 18.04 (in case the OS is relevant).
To do this, you need to know the keymap used by pdf-sync-minor-mode
. Normally this will be something like pdf-sync-minor-mode-map
. You can find out by calling C-h v
, then using tab completion to get the full name. In this case, it is indeed pdf-sync-minor-mode-map
.
Now you can use the function define-key
to bind your new key to the map. This function takes three arguments: the keymap, the key, and the function. The syntax for binding a mouse click is [mouse-1]
, or [M-mouse-1]
for clicking with the Alt key pressed. So:
(eval-after-load 'pdf-sync
'(define-key pdf-sync-minor-mode-map
[M-mouse-1]
'pdf-sync-backward-search-mouse))
I used eval-after-load
to make sure the code isn't run until after pdf-sync
is loaded.
-
I followed the instructions and indeed pdf-sync-minor-mode-map is correct. But when I put the suggested code in my .emacs file, I get the response ``Symbol's function definition is void: pdf-sync-minor-mode-map''. Maybe I need to specify in the .emacs file the specific minor mode for it to work? I dont know how to do this. – Vikram Feb 12 '20 at 15:43
-
Did you copy that error message directly? It doesn't really make sense, unless it actually reads "Symbol's function definition is void: pdf-sync-backward-search-engine". In any case, it suggests the pdf-tools package isn't loaded before you run the code. I'll update the answer – Tyler Feb 12 '20 at 16:48
-