From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.devel Subject: Re: write-region bug ? Date: Sun, 5 Jan 2020 11:01:56 +0900 Message-ID: References: <87k169okfu.fsf@igel.home> <83zhf5ixe1.fsf@gnu.org> <83woa7ezzb.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="187198"; mail-complaints-to="usenet@blaine.gmane.org" To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 05 03:03:16 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1invG8-0010DV-EI for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2020 03:03:16 +0100 Original-Received: from localhost ([::1]:38422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1invG7-0007b4-9W for ged-emacs-devel@m.gmane.org; Sat, 04 Jan 2020 21:03:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57450) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1invFY-0007An-FM for emacs-devel@gnu.org; Sat, 04 Jan 2020 21:02:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1invFX-0005Dg-1i for emacs-devel@gnu.org; Sat, 04 Jan 2020 21:02:40 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:59961) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1invFW-00058M-Qq for emacs-devel@gnu.org; Sat, 04 Jan 2020 21:02:38 -0500 Original-Received: from [172.20.10.2] (KD182251134161.au-net.ne.jp [182.251.134.161]) (Authenticated sender: jean.christophe.helary@traduction-libre.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 80619240003 for ; Sun, 5 Jan 2020 02:02:31 +0000 (UTC) In-Reply-To: X-Mailer: Apple Mail (2.3608.40.2.2.4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.178.230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:244026 > On Jan 5, 2020, at 7:58, Stefan Monnier = wrote: >=20 >>>>>> =E2=86=92 for some reason, the foo.el buffer is now associated to = bar.txt >>>>> You asked for it. >>>> Indeed, because the VISIT argument of write-region was non-nil, and >>>> that's what it does. It's in the documentation. >>>=20 >>> OTOH, the VISIT argument can't make sense when the text comes from >>> a string rather than from a buffer. >>=20 >> Why does it not make sense? FILENAME is still provided. >=20 > VISIT basically tells that the buffer should be considered as > visiting FILENAME. Here, we have VISIT and FILENAME but we don't have > the buffer (except that by accident). *Yes*, that's where I stopped understanding the documentation. Thank you = for pointing that out. Even though I provide a string (START is an empty string in my case, but = it happens with any string), the function considers that START is nil = and hence instead of the provided string uses the whole buffer by = default just *because* VISIT is non-nil. The documentation says: `If START is a string, then =E2=80=98write-region=E2=80=99 writes or = appends that string, rather than text from the buffer.' So I feel safe here. But then: `If VISIT is =E2=80=98t=E2=80=99, then Emacs establishes an association = between the buffer and the file: the buffer is then visiting that file.' I guess I still have issues with understanding what "the buffer is then = *visiting* that file" means but it does seem to contradict the above = description of START. Obviously, there is an issue here. If it is intended that a non-nil VISIT resets the value of START to nil, = or overrides it that should be documented. If it is not intended, then that's a bug. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune