From: michael@cadilhac.name (Michaël Cadilhac)
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: keep|flush-lines, how-many to be used backward.
Date: Fri, 28 Sep 2007 11:32:07 +0200 [thread overview]
Message-ID: <87lkardtk8.fsf@cadilhac.name> (raw)
In-Reply-To: <871wcmquw6.fsf@jurta.org> (Juri Linkov's message of "Wed, 26 Sep 2007 00:49:09 +0300")
[-- Attachment #1.1: Type: text/plain, Size: 3150 bytes --]
Juri Linkov <juri@jurta.org> writes:
>>> What do you think about using a negative argument to operate before point?
>>> Many Emacs commands change their direction when the argument is negative,
>>> e.g. for `kill-sexp' the negative arg means kill sexps before point, etc.
>>
>> Well, on the one hand, I understand what 18 kill-sexp does. It kills 18
>> sexps, and this is fine if you want to kill that much sexps. On the
>> other hand, what does 18 how-many means?
>>
>> You're asking for a differentiation between a positive and a negative
>> argument, but what is the *purpose* of the value of this argument?
>
> My purpose was to propose to reserve C-u for other possible future uses.
I fully understand that a prefix argument changes the behavior of a
function ; I fully understand that a numeric prefix argument repeats the
action that much time, or by modifying N times its behavior.
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?
> 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.
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.
If we're going to camp on our positions :-) does someone else have an
opinion ?
>>> keep|flush-lines, how-many could do the same, e.g. `M-- M-x keep-lines'.
>>
>> M-- puts a prefix of -1, so M-- M-x keep-lines would be the same as M-u
>> M-x keep-lines.
>
> `M-- M-x keep-lines' is the same as `C-u - M-x keep-lines'
> (see `prefix-numeric-value').
I was saying that, with the first proposal, C-- would have the same
behavior than C-u.
> 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.
--
| Michaël `Micha' Cadilhac | The second-degree, |
| http://michael.cadilhac.name | is kind of |
| JID/MSN: | the semantic back slang. |
`---- michael.cadilhac@gmail.com | - --'
[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-09-28 9:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-24 16:08 keep|flush-lines, how-many to be used backward Michaël Cadilhac
2007-09-24 17:27 ` Drew Adams
2007-09-24 17:42 ` Michaël Cadilhac
2007-09-25 14:10 ` Stefan Monnier
2007-09-25 14:36 ` Michaël Cadilhac
2007-09-26 5:01 ` Stefan Monnier
2007-09-25 10:44 ` Richard Stallman
2007-09-25 20:39 ` Michaël Cadilhac
2007-09-25 20:56 ` Juri Linkov
2007-09-25 21:01 ` Michaël Cadilhac
2007-09-25 21:49 ` Juri Linkov
2007-09-28 9:32 ` Michaël Cadilhac [this message]
2007-09-28 10:52 ` Robert J. Chassell
2007-09-28 10:59 ` Michaël Cadilhac
2007-09-29 16:10 ` Richard Stallman
2007-09-28 15:50 ` Drew Adams
2007-09-28 22:25 ` Robert J. Chassell
2007-09-29 22:48 ` Juri Linkov
2007-09-30 2:18 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lkardtk8.fsf@cadilhac.name \
--to=michael@cadilhac.name \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.