skeeto / elfeed

An Emacs web feeds client
The Unlicense
1.49k stars 116 forks source link

Persisting read entries to database #152

Open shakthimaan opened 8 years ago

shakthimaan commented 8 years ago

I am using elpa/elfeed-20151215.938, and use GNU Emacs 24.5.2 (built from source).

Whenever I mark an entry as "read", close Emacs and start it again, I still see the entry in the list. But, when I use "elfeed-db-compact", close Emacs and start it again, the read entries do not show in the list.

Should marking an entry as "read" also write it to the database?

skeeto commented 8 years ago

Elfeed should write those changes out automatically when Emacs exits, so it sounds like your kill-emacs-hook is not being run. This may be due to an abnormal exiting: a crash or not being given the chance to shut down gracefully. Once Elfeed has loaded, does that variable in your session have two Elfeed functions listed?

I'll take a look at that specific version of Emacs. Perhaps there's some problem with the kill hook.

shakthimaan commented 8 years ago

That was a quick reply!

I actually start Emacs in daemon mode and connect to it from an emacsclient. I have bound "C-x w" to start elfeed, and just type "q" to exit elfeed. The client still runs though, until I shutdown the laptop.

skeeto commented 8 years ago

I'm betting the Emacs daemon doesn't shut down cleanly with your laptop. I should add some more save points, perhaps on "q", so that it doesn't rely only on that hook. If you manually kill the Elfeed buffer it will save the database. It's harmless since the only state in the buffer itself is the active filter string.

shakthimaan commented 8 years ago

Yes, killing the Elfeed buffer works. Not a bug. Thanks once again for your quick response. Appreciate it!

Jesse-Millwood commented 8 years ago

This has been happening to me as well. What is odd is that it worked fine on my other laptop running a different version of emacs (which I also start in daemon mode). I have since had to start using a Windows laptop so I do most of my work in a VM and have noticed this same behaviour now. I usually leave the elfeed-search buffer up in the background and refresh it once in a while. Is it better to just manually kill the buffer?

groks commented 8 years ago

Try enabling desktop-save-mode. desktop-auto-save-timeout controls the idle time between desktop saving, which includes flushing the elfeed db.