unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jaakov <j_k_v@ro.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 13949@debbugs.gnu.org
Subject: bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as modified
Date: Tue, 22 Mar 2016 18:40:13 +0100	[thread overview]
Message-ID: <56F1837D.4060300@ro.ru> (raw)
In-Reply-To: <83y49a4hga.fsf@gnu.org>

On 03/22/2016 05:15 PM, Eli Zaretskii wrote:
>> From: Jaakov <j_k_v@ro.ru>
>> Date: Tue, 22 Mar 2016 11:50:08 +0100
>>
>>> fill-paragraph first removes all the newlines from the paragraph, and
>>> then inserts only as many as needed to get a filled paragraph.  So the
>>> buffer gets changed at least twice in the process.
>>
>> This is _how_ it is done, not _what_ is done. Then "what" is described in the documentation
>>
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-Modification.html :
>>
>> "Emacs keeps a flag called the modified flag for each buffer, to record whether you have changed the text of the buffer. This flag is set to t whenever you alter the contents of the buffer, and cleared to nil when you save it."
>>
>> The description of fill-paragraph at
>>
>> http://www.gnu.org/software/emacs/manual/html_node/emacs/Fill-Commands.html
>>
>> mentions no exception to the above and "Emacs always behaved like that" is just saying that the issue is old.
>>
>> Since fill-paragraph does not heed the above piece of "modified"-flag--documentation, it represents a non-compliance with the (informal) specification, i.e., a typical bug.
>>
>> Therefore, I changed the severity from wishlist to normal.
>
> I disagree.  I think Dani is right: the buffer text is changed (at
> least twice), which turns on the modified flag.  This situation is
> equivalent to inserting a character and then deleting it: the buffer
> stays modified, although its text is identical to the original one.
>
Objection for the following reason:
- It's a human who types in and deletes a charter.
- fill-paragraph is not a human, but a routine.

A routine is allowed to do all kinds of strange stuff, e.g., to split a 
long line it into chunks such that each chunk fits into a memory-page, 
process the chunks separately, then recombine the results, inserting, 
deleting, and cutting on need. Or to store all the text lines compressed 
and run clever algorithms on the compressed representation. An ingenious 
(though probably currently nonexistant) LISP interpreter could take your 
implementation of fill-paragraph and automatically convert it into an 
equivalent, lazy routine which modifies each cell of the the buffer zero 
times or once---completely transparent to you as the programmer. 
Probably, the user cannot and should not be aware of any such details.

Was I clear on the distinction of
(1) what is done by a command and
(2) how it is done
?

In my view, changing the buffer twice is an implementation decision (2) 
of fill-paragraph, not a specification/documentation decision (1). In my 
view, the modifies-flag, or, at least, the star in the left lower 
corner, also refers to (1).

If one does nevertheless represent the viewpoint that this 
implementation detail (rewriting the buffer twice) is important and 
should be user-visible, one should probably rewrite the documentation of 
fill-paragraph to reflect this issue.

If one represents the viewpoint that the modifies flag should reflect 
the internal implementation, one should probably implement the 
user-visible buffer-modification in some other way than reading 
modifies-flag. And document it properly.





  reply	other threads:[~2016-03-22 17:40 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 22:09 bug#13949: 24.3.50; `fill-paragraph' should not always put the buffer as modified Dani Moncayo
2013-03-14  3:43 ` Eli Zaretskii
2013-03-14  7:57   ` Dani Moncayo
2013-03-14 10:27     ` Andreas Röhler
2013-03-14 17:50       ` Eli Zaretskii
2013-03-14 13:38     ` Stefan Monnier
2013-03-14 17:53       ` Eli Zaretskii
2013-03-14 18:34         ` Andreas Röhler
2013-03-14 18:49           ` Eli Zaretskii
2013-03-14 19:01             ` Andreas Röhler
2013-03-14 19:19               ` Eli Zaretskii
2013-03-14 19:32                 ` Andreas Röhler
2013-03-15  4:02         ` Stefan Monnier
2013-03-15  7:27           ` Dani Moncayo
2013-03-14 17:46     ` Eli Zaretskii
2013-03-14 18:34       ` Dani Moncayo
2016-03-22 10:50 ` bug#13949: 24.4.1; " Jaakov
2016-03-22 11:39   ` Andreas Röhler
2016-03-22 16:15   ` Eli Zaretskii
2016-03-22 17:40     ` Jaakov [this message]
2016-03-22 17:56       ` Michael Heerdegen
2016-03-22 18:07         ` Drew Adams
2016-03-22 18:23           ` Michael Heerdegen
2016-03-22 18:31       ` Eli Zaretskii
2016-03-22 18:42         ` Jaakov
2016-03-26 23:46           ` John Wiegley
2016-03-27  3:31             ` Óscar Fuentes
2016-03-27  7:44               ` Andreas Röhler
2016-03-27 15:09                 ` Óscar Fuentes
2016-03-28  8:01                   ` Andreas Röhler
2016-03-27  8:42               ` Andreas Schwab
2016-03-27 14:59                 ` Óscar Fuentes
2016-03-27 15:15                   ` Drew Adams
2016-03-27 15:21                     ` Óscar Fuentes
2016-03-27 18:53                     ` Drew Adams
2016-03-27 15:13                 ` Drew Adams
2016-03-27 14:56               ` Eli Zaretskii
2016-03-27 15:28                 ` Óscar Fuentes
2016-03-27 15:42                   ` Dmitry Gutov
2016-03-27 15:52                     ` Óscar Fuentes
2016-03-27 15:57                       ` Lars Magne Ingebrigtsen
2016-03-27 16:21                         ` Óscar Fuentes
2016-03-27 16:33                           ` Lars Magne Ingebrigtsen
2016-03-27 16:46                             ` Óscar Fuentes
2016-03-27 16:58                               ` Lars Magne Ingebrigtsen
2016-03-27 18:22                                 ` Drew Adams
2016-03-27 15:29                 ` Óscar Fuentes
2016-03-27 15:58                   ` Eli Zaretskii
2016-03-27 16:05                     ` Óscar Fuentes
2016-03-27 16:12                       ` Eli Zaretskii
2016-03-27 16:37                         ` Óscar Fuentes
2016-03-27 16:50                           ` Eli Zaretskii
2016-03-27 17:30                             ` Óscar Fuentes
2016-03-27 17:51                               ` Eli Zaretskii
2016-03-27 16:38                         ` Óscar Fuentes
2016-03-27 17:00                           ` Lars Magne Ingebrigtsen
2016-03-27 16:14                       ` Lars Magne Ingebrigtsen
2016-03-27 15:46                 ` Lars Magne Ingebrigtsen
2016-03-27 16:04                   ` Eli Zaretskii
2016-03-27 16:11                     ` Lars Magne Ingebrigtsen
2016-03-27 16:18                       ` Eli Zaretskii
2016-03-27 16:28                         ` Lars Magne Ingebrigtsen
2016-03-28 10:39                           ` Lars Magne Ingebrigtsen
2016-03-28 11:27                             ` Lars Magne Ingebrigtsen
2016-03-28 11:32                               ` Lars Magne Ingebrigtsen
2016-03-28 11:39                                 ` Lars Magne Ingebrigtsen
2016-03-28 13:46                               ` Lars Magne Ingebrigtsen
2016-03-28 15:29                               ` Eli Zaretskii
2016-03-28 15:39                                 ` Lars Magne Ingebrigtsen
2016-03-28 15:15                             ` Eli Zaretskii
2016-03-28 15:39                               ` Lars Magne Ingebrigtsen
2016-03-28 15:52                                 ` Óscar Fuentes
2016-03-28 16:29                                   ` Lars Magne Ingebrigtsen
2016-03-28 17:04                                     ` Eli Zaretskii
2016-03-28 17:07                                       ` Lars Magne Ingebrigtsen
2016-03-28 17:37                                         ` Eli Zaretskii
2016-03-28 17:45                                           ` Lars Magne Ingebrigtsen
2016-03-28 18:17                                             ` Eli Zaretskii
2016-03-28  8:09                 ` Andreas Röhler
2016-03-27 15:28               ` Dmitry Gutov
2016-03-27 15:35                 ` Óscar Fuentes
2016-03-27 15:46                   ` Dmitry Gutov
2016-03-27 15:53                     ` Lars Magne Ingebrigtsen
2016-03-27 20:24                       ` Dmitry Gutov
2016-03-27 21:05                         ` Óscar Fuentes
2016-03-27 21:20                           ` Dmitry Gutov
2016-03-27 22:03                             ` Óscar Fuentes
2016-03-27 15:35                 ` Lars Magne Ingebrigtsen
2016-03-27 15:42                   ` Dmitry Gutov
2016-03-27 15:50                     ` Lars Magne Ingebrigtsen
2016-03-27 20:27                       ` Dmitry Gutov
2016-03-27 21:36                         ` Jaakov
2016-03-27 16:08                   ` Jaakov
2016-03-22 17:52     ` Jaakov
2016-03-22 18:40 ` bug#13949: (no subject) Jaakov
2016-03-22 18:56   ` Eli Zaretskii
2016-03-22 19:07     ` Jaakov
2016-03-22 19:10       ` Eli Zaretskii
2016-03-22 19:53         ` Jaakov
2016-03-22 20:07           ` Eli Zaretskii
2016-03-22 21:58             ` Jaakov
2016-03-22 22:38               ` Glenn Morris
2016-03-23 15:57                 ` Eli Zaretskii
2016-03-23 17:45                   ` Jaakov
2016-03-26 23:33                 ` John Wiegley
2016-03-23 15:57               ` Eli Zaretskii
2016-03-22 23:44 ` bug#13949: `fill-paragraph' should not always put the buffer as modified Petros Travioli
2016-03-28  4:55 ` bug#13949: fill-paragraph is buggy, but using MD5 is even more buggy Petros Travioli
2016-03-28 10:32   ` Andreas Schwab
2016-03-28 13:29     ` bug#13949: Aw: " Petros Travioli
2016-03-28 14:31       ` Andreas Schwab
2016-03-28 17:05       ` Eli Zaretskii
2016-03-28 15:16 ` Petros Travioli
2016-03-28 17:05   ` Lars Magne Ingebrigtsen
2016-03-28 17:06   ` Eli Zaretskii
2016-03-28 19:03     ` Petros Travioli

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=56F1837D.4060300@ro.ru \
    --to=j_k_v@ro.ru \
    --cc=13949@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).