From: Drew Adams <drew.adams@oracle.com>
To: Tino Calancha <tino.calancha@gmail.com>, 27659@debbugs.gnu.org
Subject: bug#27659: 26.0.50; Add string-matched-text: string-match + match-string
Date: Wed, 19 Jul 2017 17:54:28 -0700 (PDT) [thread overview]
Message-ID: <770f8fbd-343d-4bbc-bbf8-9a9cfe87367e@default> (raw)
In-Reply-To: <87fue2rxm1.fsf@calancha-pc>
> (when (string-match "[[:alpha:]]+-\\([0-9]+\\)" str)
> (match-string 1 str))
> is equivalent to:
> (string-matched-text "[[:alpha:]]+-\\([0-9]+\\)" str 1)
My own opinion, FWIW, is that the former is much clearer
and is sufficiently succinct. YAGNI.
[FWIW2:
I would write the former as
(and (string-match ...) (match-string...)), not as
(when (string-match ...) (match-string...)).
I follow the Common Lisp convention of using `when' to
indicate (to a human) that the return value is not
important (the function is used for side effects only).
I don't expect a human reader to look for a `nil' return
value from `when', for instance.]
next prev parent reply other threads:[~2017-07-20 0:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 6:13 bug#27659: 26.0.50; Add string-matched-text: string-match + match-string Tino Calancha
2017-07-20 0:54 ` Drew Adams [this message]
2017-07-20 1:19 ` Tino Calancha
2017-07-20 19:51 ` Philipp Stephani
2017-07-21 12:29 ` Tino Calancha
2017-07-21 13:34 ` Stefan Monnier
2017-07-21 14:08 ` Tino Calancha
2017-07-21 23:28 ` John Mastro
2017-07-22 2:02 ` Michael Heerdegen
2017-07-23 20:41 ` Philipp Stephani
2017-07-24 14:30 ` Stefan Monnier
2017-07-22 1:46 ` Michael Heerdegen
2017-07-23 20:45 ` Philipp Stephani
2017-07-23 21:39 ` Michael Heerdegen
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=770f8fbd-343d-4bbc-bbf8-9a9cfe87367e@default \
--to=drew.adams@oracle.com \
--cc=27659@debbugs.gnu.org \
--cc=tino.calancha@gmail.com \
/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.