maxle0312 · 2022-02-25 06:41
Hello. In a normal org source block for LaTex, I can view the source with `org-edit-src-code`. So the org headers are `#+begin_src latex` and `#+end_src`
This will open a new window where my autocomplete package, in this case `yassnippet`, can autocomplete base on key words. For example, while inside the editting source code mode, I can type "eq" and TAB and automatically a LaTex snippet for equation is inserted.
For my case, sometimes I need to use an export block, so `#+begin_export latex` and `#+end_export`. How can I autocomplete in this case? Obviously, `org-edit-src-code` does not work because it is not an "src" block but an "export" block.
Any input is appreciated.
elimik31 · 2022-02-25 14:42
I just use `org-edit-special`, which for me is bound to `C-c '` and works for source blocks as well as export blocks, at least in org v9.5.
A hacky way which works everywhere to edit parts of buffers/files in a different major mode would be to mark the region, call `narrow-to-region`, change the major mode, after editing call `widen` and change the major mode back.
elimik31 · 2022-02-25 14:47
Another tipp regarding yasnippet, you can instruct `org-mode` to inherit all snippets from `latex`. In the directory `snippets/org-mode` just create a file `.yas-parents` with the line `latex-mode`. It will work everywhere in org-mode, not just in latex export blocks, which you might or might not want. Personally I like this because org-mode accepts latex macros and environments even without them being in latex export blocks.
paretoOptimalDev · 2022-02-26 03:24
[lsp-org](https://emacs-lsp.github.io/lsp-mode/manual-language-docs/lsp-org/) supports this with a virtual buffer.
If you need it without lsp you could probably look at their implementation.