~grtcdr/pub

Re: Fix for activation of darkman-mode in Doom Emacs

Details
Message ID
<NjnK52h--3-9@tutanota.com>
DKIM signature
missing
Download raw message
Hi there,

I've just come here to give my point of view and I hope to be able to help.

I hadn't had the ilbdzumpfl issue explained. On my side, Emacs loads with no issue, maybe because I use a different Emacs configuration. I wanted to share it as a reference:

```
;; $DOOMDIR/packages.el
(package! darkman
  :pin "13417d14abb3affc20a903daddd2f1525671b5bf"
  :recipe (:host sourcehut :repo "grtcdr/darkman.el"))
```

```
;; $DOOMDIR/config.el
(use-package! darkman
  :custom
  (darkman-themes '(:light doom-tomorrow-day
                                   :dark doom-tomorrow-night))
  (darkman-switch-themes-silently nil)
  :config
  (when (display-graphic-p)
    (add-hook! 'window-setup-hook (darkman-mode))) ;; after custom.el is loaded
  (when (daemonp)
    (add-hook 'server-after-make-frame-hook #'darkman-mode)
    (advice-add 'darkman-mode :after
                (lambda ()
                  (remove-hook 'server-after-make-frame-hook #'darkman-mode)))))

```

I have checked and tested the possible replacement for `doom-init-theme-h` advice. Even though I have tried it and it works, I initially thought it was not the best solution because it bypasses the `load-theme` code hash validation[^1], which we have discussed in the past on a github issue[^2] about the value of not skipping it.

As always, it is up to Aziz to decide, but I will provide some references:

- `-h` suffix is a naming convention used in doomemacs for function hooks[^3]. You could advice any other internal aspect, but I see it as a fragile configuration. Good for a personal configuration, but bad for the documentation of a package that is not directly related to modifying some aspect of doomemacs.
- `doom-init-theme-h` is configured using a similar logic[^4] to the darkman.el documentation snippet.
- The snippet actually does not mention anything related to dooemacs. I add a hook related to the framework on my config when Emacs does not have a daemon running to load darkman-mode after the `$DOOMDIR/custom.el` file where `custom-safe-themes` is. I found it in a comment on doomemacs load order[^5]. So it seems to me to be right for all kinds of configurations.

I see perhaps an opportunity to improve the documentation to make it more friendly to well-known frameworks like doomemacs by creating a section in the documentation to adapt it for each one. Anyone in the future could send a patch to extend it, something like "community contributions".

Best regards,
Agustín

[^1]: https://github.com/doomemacs/doomemacs/blob/986398504d09e585c7d1a8d73a6394024fe6f164/lisp/doom-ui.el#L562
[^2]: https://github.com/grtcdr/darkman.el/pull/7
[^3]: https://github.com/doomemacs/doomemacs/blob/master/docs/contributing.org#lisp-naming-conventions
[^4]: https://github.com/doomemacs/doomemacs/blob/986398504d09e585c7d1a8d73a6394024fe6f164/lisp/doom-ui.el#L607-L616
[^5]: https://github.com/doomemacs/doomemacs/blob/e96624926d724aff98e862221422cd7124a99c19/lisp/doom.el#L33-L60
Reply to thread Export thread (mbox)