1

For my current config, I'm tangling an org-mode buffer into my init.el, and I have a few sections where I'd like to insert rich text between segments of Emacs lisp code, like the following:

...

#+BEGIN_SRC elisp
(use-package exwm
  :config
  (exwm-enable)
#+END_SRC

I find that four workspaces is enough to start out with, and I like being able
to use my X windows across workspaces.

#+BEGIN_SRC elisp
  :init
  (setq exwm-workspace-number 4
        exwm-workspace-show-all-buffers t
        exwm-layout-show-all-buffers t)
#+END_SRC

...

The issue is, if I C-c ' to edit the second SRC block, it reindents to the beginning of the line. Smartparens is also unhappy about any unmatched closing parentheses I have in subsequent blocks.

Is there anything in org-mode that would support something like this? Perhaps some marker I can tag each block with as a hint that they should all be pulled into the same Org Src buffer when I C-c ' on one of them?

  • 1
    I would not split a single expression between multiple src blocks: it's like having y = x + in one block and x*4 in another: they cannot be evaluated independently and it is very confusing. Why not add comments to the src block? They will appear in init.el but so what? You can never have enough documentation. – NickD Apr 6 at 0:24
  • Note also that you can use <<noweb>> syntax. One (use-package block with multiple <<subsections>>, and you can define the subsections elsewhere. Would that help? – mankoff Apr 21 at 20:25
  • Thank you for the suggestion, @mankoff. This is the closest to what I was looking for, but it's unfortunately still a bit too much overhead for my tastes. It seems what I'm trying to do doesn't make much sense in Org, so I've deferred to a plain init.el with comments. – Jakob May 14 at 23:45
  • What about multiple use-package statements as I suggest in the answer below? What about that doesn't work for you? – mankoff May 15 at 14:30
0

You can use (use-package exwm ... ) multiple times. That might help.

| improve this answer | |
  • 1
    Maybe but doesn't that defeat the purpose of use-package? I thought it was to keep the configuration of the package all in one place (but I don't use it, so this may be a wee bit off...) – NickD Apr 6 at 0:27
  • I think use-package is more general than that. There are other purposes, like tighter syntax. And there may be logical reasons to not keep things in one place, and this supports that elegantly. – mankoff Apr 7 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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