all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 17916@debbugs.gnu.org
Subject: bug#17916: 24.4.50; `write-region' doc for numeric APPEND arg
Date: Thu, 3 Jul 2014 10:23:37 -0700 (PDT)	[thread overview]
Message-ID: <f185b19a-8cf6-419a-8656-24b27239084d@default> (raw)
In-Reply-To: <<83wqbu1jmy.fsf@gnu.org>>

> This assumes not only that the reader knows about 'seek', it also
> assumes that she has general knowledge about writing to files: there
> is no "inserting" stuff in the middle of a file.  When you write, you
> always overwrite whatever is there.  Isn't that common knowledge?

Hard to believe I need to explain this to you, Eli, but I'll try.

"Writing to a file" can have several meanings, depending on the
level of abstraction.  If you situate yourself at the level of what
this function actually does, and so understand that it is a
low-level, physical write operation, then sure, all is clear.

That's the point.  Some users will not think in these terms about
writing text to a file.  They may well think that the existing file
text and the text to be added are inserted into a buffer together,
with the former being inserted at the given offset into the latter,
and then the buffer is written to the file.  That too is "writing
to a file".

Or they may put little thought into _how_ the text is written to
the file, beyond what they read here: _that_ (nothing is said
about how) the region text is "copied into" the file text at the
given position.  And as I pointed out, by itself "copied into"
is ambiguous.  ("Written over" is not so ambiguous.)

Friendly suggestion: You need to be capable of seeing what the
words can suggest, and not just understanding what you already
understand about what the code actually does.  That the actual
behavior fits the words does not mean that the words fit only
that behavior.  The former is necessary but not sufficient for
general comprehension.

To avoid misunderstanding by readers it is enough to do as I
suggested: add a few words to say that this is a physical write
operation, and as such it overwrites existing file content
starting at the given offset.

I also made the separate but related point that what
`write-region' does is NOT the "inverse of `M-x insert-file'."
That statement can only add to the confusion I pointed to.
It is NOT as if `insert-file' inserts text from a file into
the buffer (true) whereas `write-region' inserts text from
the buffer into a file (false).

It is misleading to refer to what `write-region' does using
"insert" or "into", without further explanation.





       reply	other threads:[~2014-07-03 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<d50aa5b4-8835-470d-b190-eb664e864bd3@default>
     [not found] ` <<83wqbu1jmy.fsf@gnu.org>
2014-07-03 17:23   ` Drew Adams [this message]
2014-07-03 16:14 bug#17916: 24.4.50; `write-region' doc for numeric APPEND arg Drew Adams
2014-07-03 16:39 ` Eli Zaretskii
2021-07-14  9:28   ` Lars Ingebrigtsen

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=f185b19a-8cf6-419a-8656-24b27239084d@default \
    --to=drew.adams@oracle.com \
    --cc=17916@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 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.