bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33005: 27.0.50; Data loss with Gnus registry


From: Eric Abrahamsen
Subject: bug#33005: 27.0.50; Data loss with Gnus registry
Date: Tue, 10 Dec 2019 15:31:58 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Oh, of course! Well in that case an :after method on
>> `eieio-persistent-save' might be just the thing.
>
> I'll use this for now - works so far:
>
> #+begin_src emacs-lisp
> (setf (alist-get (regexp-quote ".gnus.registry.eieio") 
> file-name-handler-alist)
>       (defun my-gnus-registry-save-file-handler (operation &rest args)
>         (pcase-let ((`(,_start ,_end ,filename . ,_rest) args))
>           (when (eq operation 'write-region)
>             (let ((buffer-backed-up nil)
>                   (buffer-file-name filename)
>                   (file-precious-flag t)
>                   (kept-new-versions 300))
>               (backup-buffer))))
>         (let ((inhibit-file-name-handlers
>                (cons 'my-gnus-registry-save-file-handler
>                      inhibit-file-name-handlers))
>               (inhibit-file-name-operation operation))
>           (apply operation args))))
> #+end_src

Huh. Seems like a fair amount of work, but it's certainly low level!
Nice to have it integrated into all of Emacs' regular save-file
mechanisms.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]