From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.bugs Subject: bug#12507: [debbugs-tracker] Processed: severity 12507 wishlist Date: Wed, 23 Sep 2020 01:41:52 -0500 Message-ID: <87v9g52dvz.fsf@red-bean.com> References: <87bogubqjy.fsf@gnu.org> <873925ebpd.fsf@gnu.org> <87363ff7qp.fsf@gnus.org> <11ee80e5-6d98-4a1f-93c8-babb6da003f3@default> <87r1qxrgs1.fsf@gnus.org> Reply-To: Karl Fogel Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29028"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , Chong Yidong , 12507@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 23 08:42:19 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKyTr-0007Qx-75 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 08:42:19 +0200 Original-Received: from localhost ([::1]:37698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKyTq-0005Fs-7E for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Sep 2020 02:42:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKyTa-0005Fk-KN for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 02:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKyTa-0008Vo-9o for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 02:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kKyTa-0003ff-7s for bug-gnu-emacs@gnu.org; Wed, 23 Sep 2020 02:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Karl Fogel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Sep 2020 06:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 12507-submit@debbugs.gnu.org id=B12507.160084331814097 (code B ref 12507); Wed, 23 Sep 2020 06:42:02 +0000 Original-Received: (at 12507) by debbugs.gnu.org; 23 Sep 2020 06:41:58 +0000 Original-Received: from localhost ([127.0.0.1]:34318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKyTV-0003fJ-SV for submit@debbugs.gnu.org; Wed, 23 Sep 2020 02:41:58 -0400 Original-Received: from newsp.red-bean.com ([45.79.25.59]:42914 helo=sanpietro.red-bean.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKyTS-0003f6-It for 12507@debbugs.gnu.org; Wed, 23 Sep 2020 02:41:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=red-bean.com; s=202005newsp; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:Reply-To:References:Subject:Cc:To:From:Sender: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Qyy4m3AlSGyUQkfYrvczhTy4toord879QGBqtuSxJnc=; t=1600843314; x=1602052914; b=NfNHGp4uBdulSwb6mnC+h2TxNeQnn1zYtqr+DF8ojwtQ1NJoWbPkox/uXh4KcXMIlOVCti5ntv zb6+nJtQXCZh7PXrK+bLqKmJq3ladJodlhOf7IsfV+R/vhg5dK0zPKjiwaj8zajieNHYH0qEdR9ub An+c3CkdpbYtyq2zdYVES+icDVj/3qcTkUvk/FV3Lkb46hZWUwu8pLys+/uR/AODLECXYA9GQ5hfW V8KfsGq+KHzmsqT2nL+qPo5Mwj2Mda4YR5Ur0/XN8T274o+eTUuxRRhTe0z22/WiKtcCIpDDqRLrx Nqp0pJBFXh0Q/n3PWWSE9i/A8NZ8VHVykbm4w==; Original-Received: from 99-112-125-163.lightspeed.cicril.sbcglobal.net ([99.112.125.163]:38958 helo=floss) by sanpietro.red-bean.com with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKyTR-0004Yf-Dt; Wed, 23 Sep 2020 06:41:53 +0000 In-Reply-To: (Drew Adams's message of "Sat, 19 Sep 2020 10:29:58 -0700 (PDT)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188759 Archived-At: I've just been deep-diving into this again. I'd like feedback on this general plan for a solution: 1) In files.el: define a new function `back-up-file' [a] that takes a file name as argument and does most of what `backup-buffer' currently does -- basically, everything from the second `when' on down to the end of the function. 2) Change `backup-buffer' to use the new function `back-up-file'. In other words, we abstract out most of the Emacs file backup functionality to this new function `back-up-file' so we can call it in (3) below, passing a file name argument. 3) In bookmark.el, in `bookmark-write-file', call `back-up-file' right before the `write-region' call. (Note that the ambient value of `version-control' will already be correct at this point.) Before I make the patch, I wanted to propose the general idea here and see if it seems okay to others. This way we would still use `write-region' and avoid visiting the file. Even though we don't know exactly why Richard made the original motivating change (commit cfde584f6d, see [b] below), there was some problem with `write-file' -- so we shouldn't just go back to that, because a regression would be likely. Thoughts on this plan? Best regards, -Karl [a] Yes, I know I've inserted a hyphen into "back-up" in that function name. That's because in English "back up" is a compound verb, whereas "backup" as one word is a noun. The existing function name "backup-buffer" is thus grammatically suspect, but I'm not proposing to fix that here; I'm just trying to avoid repeating the confusion. If folks would prefer "backup-file" for consistency, I could do that, or maybe just find another name. The details of the function names are not the point here -- I'm just looking for feedback on the general plan. [b] Commit cfde584f6d: =============================================== commit cfde584f6d25db8c0ba229ebb85fba60e99eb1af Author: Richard M. Stallman AuthorDate: Sun May 29 08:36:26 2005 +0000 Commit: Richard M. Stallman CommitDate: Sun May 29 08:36:26 2005 +0000 (save-place-alist-to-file): Write the file using write-region. M lisp/saveplace.el =============================================== --- lisp/saveplace.el +++ lisp/saveplace.el @@ -222,7 +222,8 @@ save-place-alist-to-file (t t)))) (condition-case nil - (write-file file) + ;; Don't use write-file; we don't want this buffer to visit it. + (write-region (point-min) (point-max) file) (file-error (message "Can't write %s" file))) (kill-buffer (current-buffer)) (message "Saving places to %s...done" file))))) ===============================================