protesilaos / fontaine

Set Emacs font configurations using presets
https://protesilaos.com/emacs/fontaine
GNU General Public License v3.0
64 stars 1 forks source link

Suggestion: A minor mode to automatically save, restore, and update presets #2

Closed alphapapa closed 7 months ago

alphapapa commented 9 months ago

Hi Prot,

Quick suggestion I thought of as I read through the manual: There could be a fontaine-mode that would add fontaine-store-latest-preset to kill-emacs-hook, fontaine-restore-latest-preset to, e.g. after-init-hook, and advise enable-theme, etc.

Thanks for your work on Fontaine!

protesilaos commented 9 months ago

From: Adam Porter @.***> Date: Tue, 12 Dec 2023 16:40:44 -0800

Hi Prot,

Hello Adam,

Quick suggestion I thought of as I read through the manual: There could be a fontaine-mode that would add fontaine-store-latest-preset to kill-emacs-hook, fontaine-restore-latest-preset to, e.g. after-init-hook, and advise enable-theme, etc.

Yes, this make sense! I will have to give it a try. Right now I use these but a minor mode is easier:

;; The other side of `fontaine-restore-latest-preset'.
(add-hook 'kill-emacs-hook #'fontaine-store-latest-preset)

;; Persist font configurations while switching themes.  The
;; `enable-theme-functions' is from Emacs 29.
(add-hook 'enable-theme-functions #'fontaine-apply-current-preset)

Thanks for your work on Fontaine!

You are welcome!

-- Protesilaos Stavrou https://protesilaos.com

protesilaos commented 7 months ago

Hello again! I just pushed the change for this. Thank you!

alphapapa commented 7 months ago

Thanks, Prot!