From: Stefan Kangas <stefan@marxist.se>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 34214@debbugs.gnu.org, "Miguel V. S. Frasson" <mvsfrasson@gmail.com>
Subject: bug#34214: 25.3; minibuffer function help in lisp modes changes match-data
Date: Thu, 13 Aug 2020 04:37:05 -0700 [thread overview]
Message-ID: <CADwFkm=BGa7CHhRQ=fm+y-yOrebR21eMmPny6ryynN6RT=t6Gw@mail.gmail.com> (raw)
In-Reply-To: <CAArVCkT1NRa1j6wiZaztP=fcCm31spoXPDR7n9QHaZvTK6rZYQ@mail.gmail.com> (Philipp Stephani's message of "Sun, 27 Jan 2019 14:58:31 +0100")
tags 34214 + notabug
thanks
Philipp Stephani <p.stephani2@gmail.com> writes:
>> Programming an Emacs lisp program that uses match-data, debugging pieces
>> by hand, I realized that managing matchs was a nightmare. At first I
>> thought that navigation commands like C-a or C-M-f were messing
>> match-data (as one could think they use searching). It could be. But
>> for sure, that very handy help line that shows function arguments are
>> messing match data, making difficult to program Emacs lisp.
[...]
>> What I expect:
>>
>> No unnecessary side-effects like change match-data should happen while
>> simply navigating through code. Lisp modes should protect searches on
>> background with save-match-data, because it makes a nightmare to
>> evaluate code by hand.
>>
>
> Any function is allowed to change the match data, see
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Match-Data.html:
> "Notice that all functions are allowed to overwrite the match data
> unless they're explicitly documented not to do so.".
> In general you almost always want to immediately bind the match
> results to variables, like so:
>
> (when (string-match "f" "foo")
> (let ((match (match-string 0 "foo")))
> ...
> match))
>
> Evaluating the entire 'when' form will then work as intended.
Agreed, I don't think there's a bug here. This is just how this works,
and is documented to work.
Any other opinions?
Best regards,
Stefan Kangas
next prev parent reply other threads:[~2020-08-13 11:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-26 23:42 bug#34214: 25.3; minibuffer function help in lisp modes changes match-data Miguel V. S. Frasson
2019-01-27 13:58 ` Philipp Stephani
2020-08-13 11:37 ` Stefan Kangas [this message]
[not found] ` <CAARdmY3isBNbnM=sbvATaMfT7WwA5eS3aaAcB5FNOzUwJ4v36A@mail.gmail.com>
2020-08-13 14:30 ` Stefan Kangas
2020-08-13 17:14 ` Miguel V. S. Frasson
2020-09-18 9:51 ` Stefan Kangas
2021-09-22 22:10 ` Lars Ingebrigtsen
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='CADwFkm=BGa7CHhRQ=fm+y-yOrebR21eMmPny6ryynN6RT=t6Gw@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=34214@debbugs.gnu.org \
--cc=mvsfrasson@gmail.com \
--cc=p.stephani2@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 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).