diff options
author | Amin Bandali <amin@gnu.org> | 2018-08-23 12:42:39 -0400 |
---|---|---|
committer | Amin Bandali <amin@gnu.org> | 2018-08-23 13:14:46 -0400 |
commit | 0e2ffd584aafdd4cf256bcdf2473f01c3aaaed55 (patch) | |
tree | e2ecdeae90744bd9ca82c246d86fcc2ffccab6b9 /lib/key-seq | |
parent | 1e34032451f9e4fb1d8c962dc77dde829ed5d543 (diff) | |
download | configs-0e2ffd584aafdd4cf256bcdf2473f01c3aaaed55.tar.gz configs-0e2ffd584aafdd4cf256bcdf2473f01c3aaaed55.tar.xz configs-0e2ffd584aafdd4cf256bcdf2473f01c3aaaed55.zip |
[emacs] work around org source block indentation issue with evil
happens due to (setq org-src-tab-acts-natively t)
another less-elegant workaround is to unbind TAB:
(define-key evil-motion-state-map (kbd "TAB") nil)
---
excerpt of conversation with wasamasa on #evil-mode about the issue:
│12:15:00 aminb | wasamasa: mannaged to pinpoint the cause:
│12:15:05 aminb | i had (setq org-src-tab-acts-natively t) in my config
│12:15:22 wasamasa | what does that do?
│12:15:23 aminb | which, for some reason, messes with indentation, and it only happens when evil is enabled
│12:15:26 aminb | give it a shot
│12:15:43 aminb | Documentation:
│12:15:43 aminb | If non-nil, the effect of TAB in a code block is as if it were
│12:15:43 aminb | issued in the language major mode buffer.
│12:15:57 wasamasa | sounds magic
│12:16:11 aminb | i can't notice any difference, at least not with emacs-lisp blocks
│12:16:23 aminb | except that it fucks with evil somehow
│12:19:12 wasamasa | ah, now I get fun behavior
│12:19:19 wasamasa | unless I unbind C-i :P
│12:20:56 aminb | wasamasa: :p so if you unbind C-i, indentation works fine even with that var set?
│12:21:28 wasamasa | I suspect that's why it works normally in my customized session, as opposed to the minimal one (where the block is indented with two spaces for each line)
│12:21:57 aminb | hmm
│12:22:11 wasamasa | ok, it's a bit more complicated
│12:22:35 wasamasa | org looks up the command for the pressed key (evil-jump-forward), executes that in the buffer, then does reformatting
│12:22:56 wasamasa | evil-jump-forward does no indentation, but the reformatting adds indentation unless you customized that
│12:23:10 wasamasa | which I did
│12:23:16 aminb | ha
│12:23:20 aminb | is there anyway to 'fix' this?
│12:23:22 wasamasa | I also unbound TAB and bound C-i separately from that
│12:23:24 wasamasa | well, not really
│12:23:49 aminb | hm okay
│12:23:49 wasamasa | org tries to do the smart thing, but didn't anticipate there's evil where keybindings resolve to something different depending on the state
│12:24:14 aminb | right
│12:26:02 wasamasa | try (define-key evil-motion-state-map (kbd "TAB") nil)
│12:26:29 wasamasa | but as noted, that will kill C-i
│12:27:47 aminb | wasamasa: yup, that seems to do it
│12:27:50 wasamasa | looking at the source of org-babel-do-in-edit-buffer you could do some hack so that the edit buffer comes up in insert state
│12:28:04 wasamasa | then TAB would be looked up correctly
│12:29:10 aminb | i see
│12:42:41 wasamasa | well indeed, try (add-hook 'org-src-mode-hook 'evil-insert-state)
(excerpt included with permission)
Diffstat (limited to 'lib/key-seq')
0 files changed, 0 insertions, 0 deletions