From 8dc0ec35e1fbbad84ca3ed99ad5ad932832c2291 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 3 Apr 2025 06:37:37 -0400 Subject: [PATCH] compat: remove obsolete hacks --- config.org | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/config.org b/config.org index cc7284c..5704c5e 100644 --- a/config.org +++ b/config.org @@ -2865,37 +2865,6 @@ There are a few useful functions Doom doesn't bind by default, so let's add them "v" (lookup-key org-mode-map (kbd "C-c C-v"))) #+end_src -**** YASnippet - -By default, snippet expansion doesn't work in Org mode; when =TAB= is pressed to move to the next placeholder, headline visibility cycling is triggered instead. This is because in ~org-mode-map~ =TAB= is unconditionally bound to ~org-cycle~, and for some reason this has a higher precedence than YAS's keymaps. - -While this is a complex problem, the solution is actually rather simple: just remove the ~org-mode-map~ binding. The ~org-cycle~ command will still be triggered on =TAB= when in normal mode, as it is bound in ~evil-org-mode-map~, but when in insert mode (as one generally is during snippet expansion) the binding will fall through both maps and be handled by YASnippet. - -#+begin_src emacs-lisp -(map! :after org - :map org-mode-map - "TAB" nil - "" nil - :i "TAB" nil - :i "" nil) -#+end_src - -This also means we don't need ~org-cycle~ to emulate indentation, which is nice. Unfortunately, this breaks something else: ~org-cycle~ not only handles visibility cycling, but also navigating inside tables. If ~org-cycle~ isn't being called when in insert mode, then we can't use =TAB= to move fields. This means that we need a little extra binding configuration: - -#+begin_src emacs-lisp -(let ((item - `(menu-item nil org-table-next-field - :filter ,(lambda (cmd) - (when (org-table-p) - cmd))))) - (map! :after org - :map evil-org-mode-map - :i "TAB" item - :i "" item)) -#+end_src - -This makes it so that we only let tab keypresses fall through if we aren't in a table. (We'll just assume that we aren't going to be expanding any snippets while we're in a table.) - *** Project Links It's sometimes nice to be able to click a link in an Org file that takes me to one of my projects.