Subject: Re: bug#26335: time-stamp-pattern examples unclear

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 26 Jul 2019 12:40:49 +0200

積丹尼 Dan Jacobson <[email-masked]> writes:

> time-stamp-pattern is a variable defined in ‘time-stamp.el’.
> ...
> This string has four parts, each of which is optional.
> ...
> Examples:
> "-10/"
> "-9/^Last modified: %%$"
> "@set Time-stamp: %:b %:d, %:y$"
> "newcommand{\\\\timestamp}{%%}"
>
> Please say
> Examples:
>
> This only has the first part:
> "-10/"
>
> This has the first part, followed by the second and maybe? the third part:
> "-9/^Last modified: %%$"
>
> This has the second part followed by the ??th part:
> "@set Time-stamp: %:b %:d, %:y$"
>
> This has the ??nd part followed by the ??th part:
> "newcommand{\\\\timestamp}{%%}"

Well, all that stuff is pretty much incomprehensible, so I went through
the examples using the code like this:

(progn
  (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(%[-.,:@+_ #^()0-9]*[A-Za-z%][^%]*\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'"
		"newcommand{\\\\\\\\timestamp}{%%}")
  (match-data))
=> (0 29 nil nil nil nil 0 26 26 28 nil nil 28 29)

and matched up to this code fragment:

	  (and (match-beginning 2)
	       (setq line-limit
		     (string-to-number (match-string 2 time-stamp-pattern))))
	  (and (match-beginning 3)
	       (setq ts-start (match-string 3 time-stamp-pattern)))
	  (and (match-beginning 4)
	       (not (string-equal (match-string 4 time-stamp-pattern) "%%"))
	       (setq ts-format (match-string 4 time-stamp-pattern)))
	  (and (match-beginning 6)
	       (setq ts-end (match-string 6 time-stamp-pattern)))))

and added the explanations about what's set.  It was probably not worth
it, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no