From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-commit] emacs/lisp saveplace.el Date: Sun, 29 May 2005 21:20:38 -0500 Message-ID: <87d5r9e9op.fsf@floss.red-bean.com> References: Reply-To: kfogel@red-bean.com NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117419720 28905 80.91.229.2 (30 May 2005 02:22:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 30 May 2005 02:22:00 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 30 04:21:50 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DcZtn-00010c-Qt for ged-emacs-devel@m.gmane.org; Mon, 30 May 2005 04:21:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DcZyb-0002TZ-0x for ged-emacs-devel@m.gmane.org; Sun, 29 May 2005 22:26:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DcZyO-0002SJ-Gj for emacs-devel@gnu.org; Sun, 29 May 2005 22:25:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DcZyK-0002QW-Qr for emacs-devel@gnu.org; Sun, 29 May 2005 22:25:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DcZyK-0002PP-Cr for emacs-devel@gnu.org; Sun, 29 May 2005 22:25:44 -0400 Original-Received: from [207.115.57.43] (helo=ylpvm12.prodigy.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DcZvt-0003wU-0P for emacs-devel@gnu.org; Sun, 29 May 2005 22:23:13 -0400 Original-Received: from pimout5-ext.prodigy.net (pimout5-int.prodigy.net [207.115.4.21]) by ylpvm12.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id j4U2Kg28009083 for ; Sun, 29 May 2005 22:20:42 -0400 X-ORBL: [69.216.240.239] Original-Received: from floss.red-bean.com (ppp-69-216-240-239.dsl.chcgil.ameritech.net [69.216.240.239]) by pimout5-ext.prodigy.net (8.12.10 milter /8.12.10) with ESMTP id j4U2KcdI026032 for ; Sun, 29 May 2005 22:20:43 -0400 Original-Received: from kfogel by floss.red-bean.com with local (Exim 3.36 #1 (Debian)) id 1DcZtO-000369-00 for ; Sun, 29 May 2005 21:20:38 -0500 Original-To: emacs-devel@gnu.org Emacs: is that a Lisp interpreter in your editor, or are you just happy to see me? In-Reply-To: (Richard M. Stallman's message of "Sun, 29 May 2005 04:36:27 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:37876 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37876 "Richard M. Stallman" writes: > Log message: > (save-place-alist-to-file): Write the file using write-region. > > Index: lisp/saveplace.el > =================================================================== > RCS file: /cvsroot/emacs/emacs/lisp/saveplace.el,v > retrieving revision 1.31 > retrieving revision 1.32 > diff -u -r1.31 -r1.32 > --- lisp/saveplace.el 23 Apr 2005 16:40:24 -0000 1.31 > +++ lisp/saveplace.el 29 May 2005 08:36:26 -0000 1.32 > @@ -222,7 +222,8 @@ > (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))))) What were the bad effects of using 'write-file'? I ask because I'm wondering if the same change should be made to 'bookmark-write-file' in bookmark.el. In fact, maybe there should be a bigger change to bookmark-write-file. Instead of using find-file-noselect, it could just work the way save-place-alist-to-file does: switch to a buffer, clear the buffer, insert the new data, and write it out to the destination. That is: 2005-05-29 Karl Fogel * bookmark.el (bookmark-write-file): Don't visit the destination file, just write the data to it using write-region. This is similar to revision 1.32 of saveplace.el, but with an additional change to avoid visiting the file in the first place. Index: lisp/bookmark.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/bookmark.el,v retrieving revision 1.73 diff -u -r1.73 bookmark.el --- lisp/bookmark.el 26 May 2005 12:28:39 -0000 1.73 +++ lisp/bookmark.el 30 May 2005 02:17:40 -0000 @@ -1340,12 +1340,11 @@ (save-window-excursion (if (>= baud-rate 9600) (message "Saving bookmarks to file %s..." file)) - (set-buffer (let ((enable-local-variables nil)) - (find-file-noselect file))) + (set-buffer (get-buffer-create " *Bookmarks*")) (goto-char (point-min)) + (delete-region (point-min) (point-max)) (let ((print-length nil) (print-level nil)) - (delete-region (point-min) (point-max)) (bookmark-insert-file-format-version-stamp) (pp bookmark-alist (current-buffer)) (let ((version-control @@ -1356,7 +1355,7 @@ (t t)))) (condition-case nil - (write-file file) + (write-region file) (file-error (message "Can't write %s" file))) (kill-buffer (current-buffer)) (if (>= baud-rate 9600) Does this patch look sane? -Karl