tecosaur / emacs-config

My configuration for Doom Emacs. Mirror of https://git.tecosaur.net/tec/emacs-config.
MIT License
1.04k stars 118 forks source link

:tangle no produces a weird tangling behavior #32

Closed Ziip-dev closed 2 years ago

Ziip-dev commented 2 years ago

Hello, and thanks a lot for making your amazing config this readable and friendly :) I am learning a lot but I am still struggling on the "Systemd daemon" part with no success.

Although I understood how you leveraged the org-mode literate programming powers, I noticed a weird behavior with a source block:

#+begin_src shell :tangle (if (string= "enabled\n" (shell-command-to-string "systemctl --user is-enabled emacs.service")) "no" "setup.sh")
systemctl --user enable emacs.service
#+end_src

Basically, this one tangles systemctl --user enable emacs.service to setup.sh only if the service is not already enabled, and that works well to create setup.sh the first time.

But then, when I save my config.org after an edit and look at config.el, this very code block was tangled to:

;; [[file:config.org::*prompt to run setup script][prompt to run setup script:2]]
  - ;; Setup script is empty
;; prompt to run setup script:2 ends here

and the "-" causes a (void-variable -) error at the next reboot. Note: I have not incorporated your "Asynchronous config tangling" part.

Strangely, when I run doom sync, the tangling of this block becomes:

;; [[file:config.org::*prompt to run setup script][prompt to run setup script:2]]
nil
;; prompt to run setup script:2 ends here

Do you have any idea why and how it could be avoided? If so, could you please demystify this for me? :)

tecosaur commented 2 years ago

Frankly, I'm not sure what's going on there. I haven't ever seen this with my own setup.