Fanael / persistent-scratch

Preserve the scratch buffer across Emacs sessions
132 stars 14 forks source link

Keep current major mode if major mode not saved #22

Closed rayw000 closed 4 years ago

rayw000 commented 4 years ago

Hi Fanael,

Would it be better if we keep the current major-mode of *scratch* if we cannot found a valid saved major-mode in persistent-scratch-save-file?

I run into an issue that everytime I call persistent-scratch-restore manually, it will always apply a major-mode, from the saved one or fundamental-mode instead. This makes my *scratch* buffer reset minor mode list. That means, minor modes I enabled for *scratch* buffer only are turned off.

Would it be better if persistent-scratch does nothing when I choose to not save the major-mode of *scratch* buffer?

Admire your work, thanks!.

Fanael commented 4 years ago

That's a good idea, but your change won't work, because funcall is not within when, so it's actually always executed.

I pushed a change that calls ignore instead of fundamental-mode if there's no saved major mode, which will result in the desired effect.

rayw000 commented 4 years ago

Oh sorry. I might make a typo when I migrated the changes from elpa directory to my fork. That's awkward.