Subject: bug#354: "Added (how many lines, bytes?!) to file.txt"

From: Paul Eggert <[email-masked]>
Date: Thu, 26 Feb 2015 23:21:06 -0800

Following up to:

http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg01364.html

Jeff Clough wrote:
 > 1. git checkout master
 > 2. git pull
 > 3. git checkout -b wishlist-354 (is this overkill for a small change?)

No, it's what I do.

 > 4. Changed write-region in "fileio.c"
 > 5. Tested my change (is building in place advised?)

It's what I do.  Some people prefer building in another directory.

 > 6. Created "wishlist354log.txt" with my commit message
 > 7. git commit -a -F /path/to/wishlist354log.txt

For now, you need a ChangeLog entry in src/ChangeLog too; it's essentially a 
copy of the commit message.  On my list of things to do is simplifying this.

 > 8. git format-patch -1 (is using this advised?)

Yes, it's good.

 > Changed write-region to show characters added in message

This should be a proper ChangeLog message, e.g., by adding a 2nd line "* 
fileio.c (write_region): description".

 > +    message ((NUMBERP (append)
 > +	      ? "Updated %d characters of %s"
 > +	      : ! NILP (append)
 > +	      ? "Added %d characters to %s"
 > +	      : "Wrote %d characters to %s"),
 > +	     (int) (XINT (end) - XINT (start)),
 > +	     SDATA (ENCODE_SYSTEM (visit_file)));

This won't work on platforms where EMACS_INT is wider than int.  Use the pI 
macro instead, and don't cast to 'int'.

Also, you need to change the documentation of this stuff in 
doc/emacs/files.texi, and add a news item in etc/NEWS.  Plus, you need to change 
epa-file-write-region, jka-compr-write-region, etc. to be compatible.  And 
there's probably more stuff.  I suggest running this shell command:

grep -nH -re 'Wrote ' $(git ls-files)

and checking every matching line.