0

Using emacs 25.2.2 on Kubuntu 18.04 with evil and evil-org.

Here is a very basic question that I could not get a clear answer for, despite googling.

I want to define a keyboard binding that works ONLY in org-agenda when it is under evil.

I want to be able to press C-s to execute save-all-org-buffers.

How do I achieve that?

1

You can achieve that with following code:

(evil-define-key 'normal org-agenda-mode-map
  (kbd "C-s") 'save-all-agenda-buffers)

Adjust first argument of evil-define-key to whatever evil <state> you are using for org-agenda buffers.

However I am not sure about save-all-agenda-buffers function - it doesn't exist in my Emacs with org-mode 9.1.3. If it doesn't exist in your Emacs either, I would suggest you to use org-save-all-org-buffers instead.


noctuid/evil-guide is great help resource to look at when you setting up evil in Emacs

  • Thanks! But that does not work. I added that code to my init.el, did evaluate-buffer, went to my agenda and tried C-s It still does incremental search. I did C-h k C-s while in agenda. It shows incremental search as a command. Also, it is org-save-all-org-buffers. I have edited the question. Lastly, that is a great resource, indeed. – deshmukh Jul 19 '18 at 5:53
  • I figured out the error. At least in my case, agenda is displayed in motion state. So, I changed 'normal to 'motion and all is well now. – deshmukh Jul 19 '18 at 6:11

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.