From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Saving match data
Date: Fri, 16 Jun 2017 22:16:59 +0000 [thread overview]
Message-ID: <CAArVCkS-OdKVsG4MWH5bpzcJ+60ogmeAvHnLAHgdzV-u0LmbXg@mail.gmail.com> (raw)
In-Reply-To: <jwvmv97d89i.fsf-monnier+emacs@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 553 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Fr., 16. Juni 2017 um
21:53 Uhr:
>
> >> Indeed, there's also an expectation that "primitives" don't touch the
> >> match-data. It would be good to document it, tho it will take some work
> >> to clarify what is meant by "primitive".
> > At least all functions that are side-effect-free or pure (in the sense of
> > byte-opt) are trivially in this category, so we could amend the help
> texts
> > of these functions automatically.
>
> Indeed.
>
>
That's at least easy enough to do (patch attached).
[-- Attachment #1.2: Type: text/html, Size: 920 bytes --]
[-- Attachment #2: 0001-Say-that-side-effect-free-functions-don-t-change-the-m.txt --]
[-- Type: text/plain, Size: 1103 bytes --]
From 8f76c7b9e26967dad1f12636f0e7c6540c5f9ac4 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sat, 17 Jun 2017 00:13:51 +0200
Subject: [PATCH] Say that side effect-free functions don't change the matchd
data
* lisp/help-fns.el (describe-function-1): Add note if a function is
known not to change the match data.
---
lisp/help-fns.el | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 2c635ffa50..54fd834839 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -699,6 +699,9 @@ describe-function-1
(run-hook-with-args 'help-fns-describe-function-functions function)
(insert "\n"
(or doc "Not documented."))
+ (when (or (function-get function 'pure)
+ (function-get function 'side-effect-free))
+ (insert "\nThis function does not change the match data."))
;; Avoid asking the user annoying questions if she decides
;; to save the help buffer, when her locale's codeset
;; isn't UTF-8.
--
2.13.1
next prev parent reply other threads:[~2017-06-16 22:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 14:01 Saving match data Philipp Stephani
2016-09-28 15:03 ` Eli Zaretskii
2016-09-28 16:11 ` Stefan Monnier
2016-09-28 16:49 ` Michael Heerdegen
2016-09-28 18:25 ` Stefan Monnier
2016-09-28 18:37 ` Michael Heerdegen
2016-09-28 20:00 ` Eli Zaretskii
2016-09-28 20:15 ` Michael Heerdegen
2016-09-28 20:22 ` Eli Zaretskii
2016-09-28 20:42 ` Michael Heerdegen
2016-09-28 20:58 ` Lars Ingebrigtsen
2016-09-29 2:36 ` Eli Zaretskii
2016-10-08 4:02 ` Michael Heerdegen
2016-10-08 6:25 ` Eli Zaretskii
2016-10-08 15:06 ` Stefan Monnier
2017-06-16 19:24 ` Philipp Stephani
2017-06-16 19:53 ` Stefan Monnier
2017-06-16 22:16 ` Philipp Stephani [this message]
2017-06-17 13:53 ` Stefan Monnier
2017-06-17 14:02 ` Philipp Stephani
2017-10-08 15:56 ` Philipp Stephani
2017-10-08 16:01 ` Philipp Stephani
2016-09-28 17:00 ` Marcin Borkowski
2016-09-29 9:29 ` Uwe Brauer
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=CAArVCkS-OdKVsG4MWH5bpzcJ+60ogmeAvHnLAHgdzV-u0LmbXg@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.