emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keep|flush-lines, how-many to be used backward.


From: Juri Linkov
Subject: Re: keep|flush-lines, how-many to be used backward.
Date: Sun, 30 Sep 2007 01:48:44 +0300
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

> What I fail to agree with, is that a prefix argument can be a
> three-state boolean: present, negative or positive.  I think it's just
> a hack, and should not be used like that.  A user that sees that C-u and
> C-- has different behavior will try to figure out what C-9 will do, but
> it'd be nonsense.  Don't you agree?

I think until the meaning of the positive numeric argument is implemented,
it should do nothing special, i.e. do not change the default behavior.

>> Using C-u now to change the direction will prevent these commands from
>> extending to do more useful things in future.
>
> If I continue in your way, I think you are suggesting that we don't use
> the prefix value 2 in M-x search because it can be used for future
> features.  It's a little bit extreme, but wanting to differentiate = 0, < 0
> and > 0 will eventually lead to this.

If you mean the prefix value 2 of a search command, it makes sense to use
it as a number N to find the N-th occurrence of the search string starting
from the current position.

> To sum up, I think the prefix argument has only two use cases:
> - As a boolean (present/absent),
> - As a number.
>
> Wanting to mix those two is, to me, a hack.

The last case can be subdivided into a positive, negative number and zero.
M-0 often is a special case (like e.g. in `M-0 w' in dired to copy the
absolute file name).  For keep-lines, flush-lines M-0 could be interpreted
as operating on the whole buffer.  I miss this functionality very much.
I always want for these commands to operate on the whole buffer no matter
where point is located before calling these commands, but I need every
time to put point to the beginning of the buffer.  With a special argument
to operate on the whole buffer these commands will be easier to use.

>> Please also note that usually the command should have parameters it reads
>> in its function arguments.  So it's better to change
>
>> (defun keep-lines (regexp &optional rstart rend interactive direction)
>
> Well, this is another matter.  I want to do the following with those
> three functions:
> - Remove the `interactive' flag (it's silly),
> - Remove the `optional'.
>
> That way, `direction' is not needed, as the caller should provide rstart
> and rend (like in nearly all the functions that take a region -- as a
> first count, 90%).  The direction is just an interactive help.

It's a good idea to remove the `interactive' flag.  If Richard will agree
to your change, please replace it.

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]