[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kill-region in 24.4 shouldn't require BEG and END
From: |
Stefan Monnier |
Subject: |
Re: kill-region in 24.4 shouldn't require BEG and END |
Date: |
Sat, 15 Nov 2014 10:22:24 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> If the REGION argument is non-nil, then BEG and END shouldn't be
> required, since they're unused (except in one place where they aren't
> needed). So the test
> ⌜unless (and beg end)⌝
> in kill-region should be
> ⌜unless (or region (and beg end))⌝
> and the docstring should point out that if REGION is non-nil, then BEG
> and END are unused and might as well be nil.
I think a simpler change would be to add, right after the `interactive'
line, a simple:
(if region (setq beg (mark) end (point)))
Which would make it obvious that the beg/end arguments are not used when
region is non-nil, without having to scan the rest of the code. And it
would keep the rest of the code simpler (less sprinkling of tests of
`region').
And we could even use another API where we only have BEG and END and say
that if BEG is the symbol `region', then use *the* region.
Stefan