[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DWIM region
From: |
Emanuel Berg |
Subject: |
Re: DWIM region |
Date: |
Sat, 06 Jan 2018 03:20:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Stefan Monnier wrote:
>> code and take several days to fix. Is it
>> really that big an error?
>
> Your karma will suffer if you don't fix
> them promptly!
Oh, no!
I'm actually very concerned about my karma...
OK, if I do it, perhaps there will be new
questions that will be interesting to discuss.
Here is one! As you see in the original
version, the methods of finding out differ!
In the second version, while the code looks
much better, this opportunity is lost...
(defun count-chars ()
(interactive)
(let ((chars (if (use-region-p)
(length (buffer-substring-no-properties (region-beginning)
(region-end)))
(buffer-size)) ))
(message "%d" chars) ))
(defun count-chars-karma (&optional start end)
(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max)) ))
(let ((chars (length (buffer-substring-no-properties start end))))
(message "%d" chars) ))
--
underground experts united
http://user.it.uu.se/~embe8573
- Re: DWIM region (was: Re: count regexp hits), (continued)
- 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
- Re: DWIM region, Emanuel Berg, 2018/01/04
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/05
- Re: DWIM region, Stefan Monnier, 2018/01/05
- Message not available
- Re: DWIM region,
Emanuel Berg <=
- Re: DWIM region, Stefan Monnier, 2018/01/06
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Emanuel Berg, 2018/01/06
- Re: DWIM region, Stefan Monnier, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/08
- Re: DWIM region, Stefan Monnier, 2018/01/08
- Message not available
- Re: DWIM region, Emanuel Berg, 2018/01/08