Subject: bug#12507: [debbugs-tracker] Processed: severity 12507 wishlist

From: Karl Fogel <[email-masked]>
Date: Tue, 29 Sep 2020 00:25:02 -0500

On 23 Sep 2020, Drew Adams wrote:
>At this point I don't have anything special to say
>about your general proposal regarding backups.  My
>comments regard the bookmarks code.
>
>1. I don't see why this proposal is in bug #12507.
>   It seems like a general proposal, which should
>   probably go to emacs-devel.

When the first motivation for a change that has potentially general use is for fixing a specific bug, I normally initiate the discussion of that change in the ticket for the bug, since there isn't anything else directly motivating the change (even if we suspect it has more general use beyond just being part of the bugfix).  

The more general change may be worth mentioning on emacs-devel once the bug-specific thread has consensed, of course; it's just that I wouldn't start out on emacs-devel, because the discussion may go elsewhere and the change might not happen after all.

>2. I don't see why the bookmark code shouldn't visit
>   the file.  That hasn't been explained.  You cite
>   a commit for save-place, not for bookmark.el.
>   And even for that commit there's no explanation
>   of _why_ the particular file shouldn't be visited.
>
>I switched to using `write-file' for bookmark files
>long ago, and I haven't seen any problem.  When using
>a bookmark file, you're anyway visiting it, in some
>sense.  I see no inconvenience in having the bookmark
>file be added to a list of visited files.  You might
>not be reading or editing it directly (as text), but
>you're definitely reading it or editing it indirectly.
>
>Until we hear a reason for why `write-region' should
>be used for bookmark files, using it seems like a
>solution (for save-place?) looking for a problem.
>
>What's wrong with the obvious, simple solution to the
>real, recognized problem of no backups for bookmark
>files: use `write-file'?  That's the first question
>to ask and answer, no?

I can't think of any reason now.  I have a vague memory that there *was* a specific reason, but if there was, I failed to document adequately at the time and have been unable to recover it now.

Eli helpfully linked to Richard's message (https://lists.gnu.org/archive/html/emacs-devel/2005-05/msg01376.html), in which Richard points out that if bookmark visits the file anyway when reading, then there's nothing to be gained (from the perspective of saveplace.el interference) from avoiding visiting it when writing.

And `bookmark-load' *does* visit the file when reading, so I'm leaning toward just taking your suggestion and reverting to `write-file' -- but this time leaving better historical breadcrumbs (in comments and/or log messages) in case my vaguely-remembered bug turns out to be real and reappears.

I will do this as soon as I have time to focus on it and make sure I don't make a silly blunder; that may be several days.

Best regards,
-Karl