all messages for Emacs-related lists mirrored at yhetil.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.