Subject: insert timestamps and serial numbers along with \f\n in error-file

From: Dan Jacobson <[email-masked]>
Date: Tue, 23 Apr 2024 18:11:37 +0800

shell-command-on-region is an interactive native-compiled Lisp
function in ‘simple.el’.

In it there is this code:

    (when (and error-file (file-exists-p error-file))
      (if (< 0 (file-attribute-size (file-attributes error-file)))
	  (with-current-buffer (get-buffer-create error-buffer)
            (goto-char (point-max))
            ;; Insert a separator if there's already text here.
	    (unless (bobp)
	      (insert "\f\n"))

Problem is the user cannot tell which stuff, the stuff above the \f\n,
or the stuff below the \f\n is newer!

You might think that after a few years the user will figure it out and
remember it. But the user also worries "maybe where the message gets
inserted also depends which part of the error buffer I was looking at
last moments before." even if not the case.

All this could be cleared up, if along with inserting the \f\n, a
timestamp were inserted. Or at least a serial number: \f\nError group 1:
\f\nError group 2: etc. Best of all would be to use both a timestamp and
a serial number.

In fact (insert "\f\n") makes a heavy assumption that the user usually
doesn't have any \f's of their own in that file. But it is a bad thing
to have it hardwired in the first place, requiring the user to change
the entire function in order to choose a different separator. So maybe
have it a variable, set to \f\n by default, or better something like
("\f\n" . some-counter . some-time-stamp . "\n").

emacs-version "29.3"