emacs-devel
[Top][All Lists]
Advanced

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

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


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

On Sat, Jan 25 2020, Stefan Kangas wrote:
>
> You have a typo in the code btw, should say:
>     (unless subexp (setq subexp 0))

Whoops, thanks! I'd been using this in my init for a while with "group"
and too quickly made the change for Emaconsistency.

    (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 subexp (setq subexp 0))
        (delete-region (match-beginning subexp) (match-end subexp))))




reply via email to

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