5

It seems using non-GUI is much much faster when working with very long org-files.

However I can't org-cycle with TAB key. (See image below).

enter image description here

What is happening? My best guess is: when TAB is pressed, EVIL (instead of Org) uses for it's keybinding (evil-jump-forward as shown in bottom right of image). Then why is that?

1
  • with the help of this question's answer. I can turn off evil-jump-forward and can org-cycle. However, I still want evil-jump-forward to work other non-orgmode buffers
    – Garid
    Commented Sep 5, 2022 at 17:53

1 Answer 1

8

I'll try to answer why pressing the Tab key leads to different results when you're using the Emacs GUI vs. Emacs in a terminal.

org-cycle is bound to both <tab> and TAB (at least in my and probably your version of org (see ). evil-jump-forward is bound to just TAB. (Yes, these are subtly different!)

<tab> is how Emacs interprets the Tab key in GUI Emacs. Normally, (but not always), in GUI Emacs, <tab> is "translated" to TAB (see C-h k <tab> in a GUI).

In contrast, TAB is AFAICT completely equivalent to C-i. In a terminal, when you press the Tab key, the terminal just sends the control character C-i and there's no way to distinguish between Ctrl+i and Tab. (You can play around with C-h k C-i and C-h k <tab> in both the terminal and the GUI.)

In this case, since org-cycle is bound to <tab>, when you press Tab in GUI Emacs, it's immediately interpreted as org-cycle, and we never get to TAB.

When you press Tab in Terminal Emacs, it's sent by the terminal as C-i (TAB) to Emacs, and since Evil has priority over Org, it's interpreted as evil-jump-forward. (If you were to disable Evil, then C-i would run org-cycle because it'd no longer be shadowed by evil-jump-forward.)

Disabling mapping of evil-jump-forward

You can use:

(setq evil-want-C-i-jump nil)

before (require 'evil) or (use-package evil).

This will unfortunately disable the mapping everywhere (not just in Org files).

If you want to override the mapping just for Org files (and have it active in all other files), you could create your own keymap that overrides evil and that's only activated for Org files or perhaps try using evil-org (which creates such a keymap and does the override for you. (note: I haven't tried it))

From this answer, you could also try:

(evil-define-key 'normal org-mode-map (kbd "<tab>") #'org-cycle)
1
  • 1
    Just a small comment on 2nd answer/suggestion: when "TAB" is chosen (rather than "<tab>") then this works. In other words. (evil-define-key 'normal org-mode-map (kbd "TAB") #'org-cycle) works.
    – Garid
    Commented Nov 16, 2023 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.