[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
DWIM region (was: Re: count regexp hits)
From: |
Emanuel Berg |
Subject: |
DWIM region (was: Re: count regexp hits) |
Date: |
Thu, 04 Jan 2018 22:32:55 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
BTW this method on acting on the region (if
any) I have found very useful and it has
recurred many times in my code:
(defun count-regexp-hits (regexp)
(interactive "sregexp: ")
(let*((region (if mark-active
`(,(region-beginning) ,(region-end))
`(,(point-min) ,(point-max)) ))
(start (car region))
(end (cadr region)) )
(count-matches regexp start end t) ))
Is it the canonical way of doing it as well?
--
underground experts united
http://user.it.uu.se/~embe8573
- count regexp hits, Emanuel Berg, 2018/01/03
- RE: count regexp hits, Drew Adams, 2018/01/04
- Message not available
- Re: count regexp hits, Emanuel Berg, 2018/01/04
- Re: DWIM region (was: Re: count regexp hits), Kaushal Modi, 2018/01/04
- Message not available
- Re: DWIM region (was: Re: count regexp hits), Emanuel Berg, 2018/01/04
- Re: DWIM region (was: Re: count regexp hits), Kaushal Modi, 2018/01/04
- Message not available
- Re: DWIM region (was: Re: count regexp hits), Emanuel Berg, 2018/01/04
- advice vs hooks in org (was DWIM region), Rusi, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/04
- Re: DWIM region, Stefan Monnier, 2018/01/04
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/04