From: "Paul W. Rankin" <hello@paulwrankin.com>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: Can we add a delete-match function to subr(-x).el?
Date: Sat, 25 Jan 2020 14:55:09 +1000 [thread overview]
Message-ID: <m2y2twp236.fsf@paulwrankin.com> (raw)
Hello Emacizens,
I frequently forget that Emacs doesn't include a delete-match function
to be called after (re-)search-forward or the like.
Can we add something like the following to subr(-x).el?
(defun delete-match (&optional subexp)
"Delete text matched by last search.
Optional argument SUBEXP specifies the subexpression to delete,
or delete the entire match."
(when (consp (match-data))
(unless group (setq subexp 0))
(delete-region (match-beginning subexp) (match-end subexp))))
next reply other threads:[~2020-01-25 4:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-25 4:55 Paul W. Rankin [this message]
2020-01-25 5:23 ` Can we add a delete-match function to subr(-x).el? Stefan Kangas
2020-01-25 5:32 ` Paul W. Rankin
2020-01-25 15:04 ` Stefan Monnier
2020-01-25 17:18 ` Paul W. Rankin
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=m2y2twp236.fsf@paulwrankin.com \
--to=hello@paulwrankin.com \
--cc=emacs-devel@gnu.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).