emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can we add a delete-match function to subr(-x).el?


From: Paul W. Rankin
Subject: Can we add a delete-match function to subr(-x).el?
Date: Sat, 25 Jan 2020 14:55:09 +1000
User-agent: mu4e 1.2.0; emacs 27.0.60

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]