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: Use `persist` or `multisession` to save/restore `fontaine-latest-state` #3

Open alphapapa opened 9 months ago

alphapapa commented 9 months ago

Hi Prot,

Just a quick suggestion: I saw that you use some bespoke code to serialize and load the variable fontaine-latest-state. Since the multisession library is now built-in to Emacs, and since the persist library is available on GNU ELPA for older versions of Emacs, it would seem like a good idea to use one of them to do the saving and restoring.

Doing so would have a few benefits: reducing code in fontaine; using well-tested, known-good code (which is important for, e.g. code that is added to kill-emacs-hook); sharing configuration (e.g. a common directory for storing this user data), etc.

Thanks for your work on fontaine!

protesilaos commented 9 months ago

From: Adam Porter @.***> Date: Thu, 14 Dec 2023 03:35:22 -0800

Hi Prot,

Hello Adam,

Just a quick suggestion: I saw that you use some bespoke code to serialize and load the variable fontaine-latest-state. Since the multisession library is now built-in to Emacs, and since the persist library is available on GNU ELPA for older versions of Emacs, it would seem like a good idea to use one of them to do the saving and restoring.

Do you know if the multisession works with Emacs 27? I remember first seeing the multisession as part of the emoji implementation of Emacs 29.

Doing so would have a few benefits: reducing code in fontaine; using well-tested, known-good code (which is important for, e.g. code that is added to kill-emacs-hook); sharing configuration (e.g. a common directory for storing this user data), etc.

Yes, these are all nice!

Thanks for your work on fontaine!

You are welcome!

All the best, Prot

-- Protesilaos Stavrou https://protesilaos.com

alphapapa commented 9 months ago

Do you know if the multisession works with Emacs 27? I remember first seeing the multisession as part of the emoji implementation of Emacs 29.

No, it was added to Emacs 29 and is not on GNU ELPA; it only works for 29+. So to support earlier versions, the persist library should be used instead (and it works well, in my experience).

protesilaos commented 5 months ago

Hello again Adam,

I realise I did not follow up on this, though I did mean to. Anyway, persist seems like a decent option for the time being. Since you have used it already, do you want to submit a patch/PR?

alphapapa commented 5 months ago

Hi Prot,

No problem. I'm afraid my to-do list for Emacs packages is already more than I have time for, so I'll have to respectfully decline to send a patch. It's just an idea, anyway. :)

protesilaos commented 5 months ago

From: Adam Porter @.***> Date: Sat, 27 Apr 2024 00:36:07 -0700

Hi Prot,

No problem. I'm afraid my to-do list for Emacs packages is already more than I have time for, so I'll have to respectfully decline to send a patch. It's just an idea, anyway. :)

Okay, that's fine! I will look into it as soon as possible.

-- Protesilaos Stavrou https://protesilaos.com