4

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 pressed instead of Org, EVIL uses for it's keybinding (evil-jump-forward as shown in bottom right of image). Then why is that?

Garid
  • 545
  • 1
  • 13
  • with the help of [this question's answer](https://emacs.stackexchange.com/questions/69282/evil-mode-unmap-tab-key-from-evil-jump-forward). 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 Sep 05 '22 at 17:53

1 Answers1

7

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)
aplaice
  • 2,126
  • 17
  • 23