unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Can we add a delete-match function to subr(-x).el?
@ 2020-01-25  4:55 Paul W. Rankin
  2020-01-25  5:23 ` Stefan Kangas
  2020-01-25 15:04 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Paul W. Rankin @ 2020-01-25  4:55 UTC (permalink / raw)
  To: Emacs Devel

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))))



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-25 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-25  4:55 Can we add a delete-match function to subr(-x).el? Paul W. Rankin
2020-01-25  5:23 ` 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

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).