unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "\"Michaël\" Cadilhac" <michael@cadilhac.name>,
	"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 08:50:33 -0700	[thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACEEDNCDAA.drew.adams@oracle.com> (raw)
In-Reply-To: <87lkardtk8.fsf@cadilhac.name>

> 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 ?

Yes (since you asked), FWIW, and without reference to the specific
prefix-arg use in this thread -

A raw prefix arg can have different kinds of values (nil, consp, integer
(negative, zero, positive)), and the numeric values of these different raw
values can also be used. Functions should be free to use any of these values
(both raw and numeric) as they like. There should be no limits or
conventions that restrict this.

However, functions that interpret a prefix arg owe it to their users to
clearly explain the behavior of the prefix arg in the doc string. As long as
that is done, I see no problem.

However #2: Other things being equal, there are some common use patterns
that can be followed (can be, not need to be), and that can make life easier
for users:

* positive numeric arg N means repeat N times

* -N means reverse the "direction" of N, whatever "direction" might mean in
a particular context.

* the default behavior (without any explicit prefix arg) should be the
behavior that users will use most

In sum:

1. No strict convention or standard meaning that limits what you do with a
function you define.

2. If there is no reason not to, you might want to follow some common use
patterns, interpreting them as appropriate in your context.

3. Document all prefix-arg behavior clearly in the doc string.

A prefix arg is a useful way to multiply the functionality of a single
function, typically a command that is bound to a key. Programmers should not
feel limited in any way in the use they make of prefix args. Explore,
experiment, do what you want with it; it's just a tool. If you want to make
things easier on users, however, and if there is no reason not to, then you
might want to follow some informal conventions - it's up to you.

Just my opinion, of course.

  parent reply	other threads:[~2007-09-28 15:50 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BNELLINCGFJLDJIKDGACEEDNCDAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@jurta.org \
    --cc=michael@cadilhac.name \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).