1

I've bound the mouse-3 to a custom function, with a statement

(define-key org-mode-map [mouse-3] 'foobar)

But when I revert some .org file, the keybinding of the mouse-3 goes back to the default and it displays the context menu.

I have this problem every time I start up emacs too. The init file loads, but the mouse-3 won't run the custom function I assigned for the org-mode in org-mode buffers. And when I eval-buffer the init file, it gets fixed until I revert those buffers.

-1

What is the value of variable revert-buffer-function? If it doesn't do what you want, set the variable (in that mode) to your own function that does.

  • C-h v says its value is revert-buffer--default. Is it something I can change without messing up important stuff? – stacko Jan 19 '16 at 20:01
  • Yes. Don't change revert-buffer-default. Just bind revert-buffer-function (locally - in that mode only) to a function that does what you want (e.g., first calls revert-buffer-default and then binds the keys you want). – Drew Jan 19 '16 at 20:21
  • @Drew But why would revert-buffer override the bindings? – Kaushal Modi Jan 20 '16 at 1:45
  • @KaushalModi: I don't know that it does. But apparently the bindings are being reset. revert-buffer-default runs hooks before-revert-hook and after-revert-hook, and it can invoke revert-buffer-insert-file-contents-function. It's trivial to try what I suggested and see whether it takes care of the problem. – Drew Jan 20 '16 at 2:19
  • No idea why someone would downvote this. Oh well. – Drew Apr 13 '16 at 22:53

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.