all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrew Hyatt <ahyatt@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 5440@debbugs.gnu.org, user42@zip.com.au
Subject: bug#5440: 23.1; buffer-file-format encoding temp buffers not reentrant
Date: Mon, 25 Jul 2016 00:07:50 -0400	[thread overview]
Message-ID: <m2a8h6l5rd.fsf@Andrews-MacBook-Pro.local> (raw)
In-Reply-To: <83twfft8ny.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 24 Jul 2016 17:25:37 +0300")

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Andrew Hyatt <ahyatt@gmail.com>
>> Cc: user42@zip.com.au,  5440@debbugs.gnu.org
>> Date: Sun, 24 Jul 2016 01:06:05 -0400
>> 
>> >  -- Variable: format-alist
>> >      This list contains one format definition for each defined file
>> >      format.            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> >      ^^^^^^
>> >
>> > "Only one format definition per format."  But I think it won't do any
>> > harm to specifically warn about violating that.
>> >
>> > Thanks.
>> 
>> I think the original bug report had one format definition for each
>> defined file format, but was manipulating a file in one format while in
>> another format function.
>
> That's more than one format in disguise.
>
>> How about I change the documentation to just warn not to manipulate
>> other files in FROM-FN here?
>
> Can you show a proposed patch?
>
> Thanks.

Attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: format-alist docs patch --]
[-- Type: text/x-patch, Size: 1542 bytes --]

From 18eb654c4541a49f415d4826974fd2c216f2c2db Mon Sep 17 00:00:00 2001
From: Andrew Hyatt <ahyatt@gmail.com>
Date: Sun, 24 Jul 2016 23:58:47 -0400
Subject: [PATCH] Warn against unintentional recursion in formatting.

Change documentation for format-alist to warn against formatting when
formatting, which leads to incorrect results..
---
 doc/lispref/files.texi | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index f3650a4..5763380 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3238,7 +3238,9 @@ Format Conversion Round-Trip
 
 One responsibility of @var{from-fn} is to make sure that the beginning
 of the file no longer matches @var{regexp}.  Otherwise it is likely to
-get called again.
+get called again.  Also, @var{from-fn} must not involve other buffers or
+files other than the one being decoded, or else formatting may happen
+during formatting, leading to incorrect results.
 
 @item to-fn
 A shell command or function to encode data in this format---that is, to
@@ -3269,6 +3271,10 @@ Format Conversion Round-Trip
 positions.  All this takes place without modifying the buffer.
 @end itemize
 
+@var{to-fn} must not involve other buffers or files other than the one
+being encoded, or else formatting may happen during formatting,
+leading to incorrect results.
+
 @item modify
 A flag, @code{t} if the encoding function modifies the buffer, and
 @code{nil} if it works by returning a list of annotations.
-- 
2.4.9 (Apple Git-60)


  reply	other threads:[~2016-07-25  4:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 23:03 bug#5440: 23.1; buffer-file-format encoding temp buffers not reentrant Kevin Ryde
2016-07-21  4:33 ` Andrew Hyatt
2016-07-21 14:27   ` Eli Zaretskii
2016-07-24  5:06     ` Andrew Hyatt
2016-07-24 14:25       ` Eli Zaretskii
2016-07-25  4:07         ` Andrew Hyatt [this message]
2016-07-25 16:35           ` Eli Zaretskii
2016-07-26  1:13             ` Andrew Hyatt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2a8h6l5rd.fsf@Andrews-MacBook-Pro.local \
    --to=ahyatt@gmail.com \
    --cc=5440@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=user42@zip.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.