|
From: | Emanuel Berg |
Subject: | Re: Select/highlight and *copy* matches of some regex |
Date: | Tue, 28 Jun 2022 00:44:22 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Now: (defun re-make-list-forward (re &optional beg end) (interactive (list (read-regexp "re: ") (when (use-region-p) (region-beginning)) (when (use-region-p) (region-end)) )) (or beg (setq beg (point))) (or end (setq end (point-max))) (save-excursion (let ((matches)) (goto-char beg) (while (re-search-forward re end t) (push (match-string-no-properties 0) matches) ) matches) )) (defalias 're-make-list #'re-make-list-forward) (defun re-make-list-backward (re &optional beg end) (interactive (list (read-regexp "re: ") (when (use-region-p) (region-beginning)) (when (use-region-p) (region-end)) )) (or beg (setq beg (point))) (or end (setq end (point-max))) (save-excursion (let ((matches)) (goto-char end) (while (re-search-backward re beg t) (push (match-string-no-properties 0) matches) ) matches) )) -- underground experts united https://dataswamp.org/~incal
[Prev in Thread] | Current Thread | [Next in Thread] |