From: Lars Ingebrigtsen <larsi@gnus.org>
To: "積丹尼 Dan Jacobson" <jidanni@jidanni.org>
Cc: 26335@debbugs.gnu.org
Subject: bug#26335: time-stamp-pattern examples unclear
Date: Fri, 26 Jul 2019 12:40:49 +0200 [thread overview]
Message-ID: <87d0hxnkni.fsf@mouse.gnus.org> (raw)
In-Reply-To: <877f33zroy.fsf@jidanni.org> ("積丹尼 Dan Jacobson"'s message of "Sun, 02 Apr 2017 06:30:37 +0800")
積丹尼 Dan Jacobson <jidanni@jidanni.org> 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
prev parent reply other threads:[~2019-07-26 10:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-01 22:30 bug#26335: time-stamp-pattern examples unclear 積丹尼 Dan Jacobson
2019-07-26 10:40 ` Lars Ingebrigtsen [this message]
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=87d0hxnkni.fsf@mouse.gnus.org \
--to=larsi@gnus.org \
--cc=26335@debbugs.gnu.org \
--cc=jidanni@jidanni.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).