From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: RE: master 97cb255: newcomment.el (comment-line): New command on C-x C-; . Date: Tue, 10 Feb 2015 00:13:40 +0000 Message-ID: References: <20150208190338.30436.1351@vcs.savannah.gnu.org> <87lhk8w4jt.fsf@gmx.net> <2d8fcbc0-7f63-43de-9376-da8ed881d3e2@default> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113d5b7c51101a050eb0c2e8 X-Trace: ger.gmane.org 1423527243 7967 80.91.229.3 (10 Feb 2015 00:14:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Feb 2015 00:14:03 +0000 (UTC) Cc: emacs-devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 10 01:14:03 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YKySm-0006oj-Vo for ged-emacs-devel@m.gmane.org; Tue, 10 Feb 2015 01:14:01 +0100 Original-Received: from localhost ([::1]:35869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKySl-00027V-TU for ged-emacs-devel@m.gmane.org; Mon, 09 Feb 2015 19:13:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKySV-00027D-8L for emacs-devel@gnu.org; Mon, 09 Feb 2015 19:13:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKyST-0000Nr-Dx for emacs-devel@gnu.org; Mon, 09 Feb 2015 19:13:43 -0500 Original-Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:46361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKyST-0000Nh-6M for emacs-devel@gnu.org; Mon, 09 Feb 2015 19:13:41 -0500 Original-Received: by mail-ob0-f181.google.com with SMTP id vb8so28693208obc.12 for ; Mon, 09 Feb 2015 16:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=QNIAzUbi/PdqrvXiot9QL0UvLrMuGRWKiRWpll42+6E=; b=aTNx3P38Yj0Zva2RGhVlfcd1I1BTitVv5qNMQ+K9psaPN1MK3MR9WLh+q5m/vcsRLV BHPQcZa9nlCHr+QHM6IGCiRWzHsCXDvfz81K+iH7ZpkEX+UdeRsgNBtuJPwypZvgbhi0 q0w13PoZO9Dt1HRcBAnG12GFthc2Vx8q/baVTUUxKGShhW7GC52wf9f/uHp3FQk+inUk +kgbw9kdPlXVMp/eMNGChlC18+QNAfNs8q+lVRj7iTZUgr2KZW1jNj0elANkZSXotfiQ XTpcwhKxNM637isTt+RM19T94iIrET13bJmfaYRRh1RZu+o5mP3XIk8BJ0GLIpYyoScC 6RRQ== X-Received: by 10.202.218.135 with SMTP id r129mr13030335oig.26.1423527220676; Mon, 09 Feb 2015 16:13:40 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Mon, 9 Feb 2015 16:13:40 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Mon, 9 Feb 2015 16:13:40 -0800 (PST) In-Reply-To: <2d8fcbc0-7f63-43de-9376-da8ed881d3e2@default> X-Google-Sender-Auth: r9NIVmA2iW8RYUTg4JGnbqYsK-M X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182764 Archived-At: --001a113d5b7c51101a050eb0c2e8 Content-Type: text/plain; charset=UTF-8 Yes, I did give it a try and it was a conscious decision, but let me start by saying I didn't put a huge amount of thought into it. There were three factors that made me choose this: 1. Reversing direction while going up can also be done by just hitting some harmless key like C-a (for this particular command, C-a is harmless). That takes the same number of keys as C-- and has the same effect. In some cases (when you're moving one line at a time), `undo' will also do what you want with even less keys. 2. A good portion of users won't expect it to behave like that (even if it's written in the doc). This also applies to the current version, but see below. 3. Unlike the current "persistent negative argument effect", this "reverse direction twice" functionality seems like it would come up very rarely, probably less than the number of times it would catch someone by surprise. Combine 3 with the fact that it has perfectly plausible alternatives for those instances when it does come up, and that's I why I decided this way. As I said, I just thought of this very briefly. Items 2 and 3 are really just hunches. Cheers On 9 Feb 2015 01:13, "Drew Adams" wrote: > > > + (when (and (eq last-command 'comment-line-backward) > > + (natnump n)) > > + (setq n (- n))) > > It's really too bad (IMO) that you didn't take my suggestion. > It sounded like you were going to... ("Good idea. Will do.") > > You did part of it - repeated upward commenting when started > with a negative prefix arg. So far, so good. Thx. > > But this other feature, which you left out, is also useful, IMO: > > When repeated, a negative prefix arg switches direction. > > If you change the above predicate to just (eq last-command > 'comment-line-backward) then you get the direction-switching > that I suggested. > > You then still get inheritance of a negative prefix arg when > you repeat (upward commenting instead of downward). > > The direction-switching feature does not change the behavior > in any way, except if you use a negative prefix arg again, > while you are repeating. > > With your implementation, hitting `C--' while you are > repeating has an effect only if you are going downward. In > that case it does switch direction. But if you hit `C--' > when going up then it is a no-op. And in fact I see no way > to switch to going down again - not `C-1' or `C-u' or ... > > The direction-switching behavior is thus not symmetric. > It's not very useful for it to work only when moving down, > IMO. If someone does not want to switch direction when > repeating moving down, then s?he just won't hit `C-' again. > Since the initial prefix arg is inherited, there is no > reason to hit `C--' again, if it does nothing. In that > context, `C--' is useless anyway. > > Did you try what I suggested in this regard? If so, did > you find something wrong with it? To me it is handy to be > able to always reverse direction (by hitting `C--') - not > only when you are moving downward. > > It is in general handy to have a quick way to reverse > the direction of an operation that is bound to a repeating > key. One can easily repeat quickly and go past a target > position. A quick way to reverse, while staying within > the repeating command (e.g. as opposed to using `undo'), > is an advantage in general - not just for this command. > > Anyway, not a big deal. It won't be the first time I will > have my own local version of something. ;-) I would prefer > not to have to, of course. And I am curious what downside > you saw to this feature, if you even tried it at all. --001a113d5b7c51101a050eb0c2e8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Yes, I did give it a try and it was a conscious decision, bu= t let me start by saying I didn't put a huge amount of thought into it.=

There were three factors that made me choose this:

1. Reversing direction while going up can also be done by ju= st hitting some harmless key like C-a (for this particular command, C-a is = harmless). That takes the same number of keys as C-- and has the same effec= t. In some cases (when you're moving one line at a time), `undo' wi= ll also do what you want with even less keys.

2. A good portion of users won't expect it to behave lik= e that (even if it's written in the doc). This also applies to the curr= ent version, but see below.

3. Unlike the current "persistent negative argument eff= ect", this "reverse direction twice" functionality seems lik= e it would come up very rarely, probably less than the number of times it w= ould catch someone by surprise.

Combine 3 with the fact that it has perfectly plausible alte= rnatives for those instances when it does come up, and that's I why I d= ecided this way.

As I said, I just thought of this very briefly. Items 2 and = 3 are really just hunches.

Cheers

On 9 Feb 2015 01:13, "Drew Adams" <drew.adams@oracle.com> wrote:
>
> > +=C2=A0 =C2=A0 (when (and (eq last-command 'comment-line-back= ward)
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(natnump = n))
> > +=C2=A0 =C2=A0 =C2=A0 (setq n (- n)))
>
> It's really too bad (IMO) that you didn't take my suggestion.<= br> > It sounded like you were going to... ("Good idea. Will do.")=
>
> You did part of it - repeated upward commenting when started
> with a negative prefix arg.=C2=A0 So far, so good.=C2=A0 Thx.
>
> But this other feature, which you left out, is also useful, IMO:
>
> =C2=A0 When repeated, a negative prefix arg switches direction.
>
> If you change the above predicate to just (eq last-command
> 'comment-line-backward) then you get the direction-switching
> that I suggested.
>
> You then still get inheritance of a negative prefix arg when
> you repeat (upward commenting instead of downward).
>
> The direction-switching feature does not change the behavior
> in any way, except if you use a negative prefix arg again,
> while you are repeating.
>
> With your implementation, hitting `C--' while you are
> repeating has an effect only if you are going downward.=C2=A0 In
> that case it does switch direction.=C2=A0 But if you hit `C--'
> when going up then it is a no-op.=C2=A0 And in fact I see no way
> to switch to going down again - not `C-1' or `C-u' or ...
>
> The direction-switching behavior is thus not symmetric.
> It's not very useful for it to work only when moving down,
> IMO.=C2=A0 If someone does not want to switch direction when
> repeating moving down, then s?he just won't hit `C-' again. > Since the initial prefix arg is inherited, there is no
> reason to hit `C--' again, if it does nothing.=C2=A0 In that
> context, `C--' is useless anyway.
>
> Did you try what I suggested in this regard?=C2=A0 If so, did
> you find something wrong with it?=C2=A0 To me it is handy to be
> able to always reverse direction (by hitting `C--') - not
> only when you are moving downward.
>
> It is in general handy to have a quick way to reverse
> the direction of an operation that is bound to a repeating
> key.=C2=A0 One can easily repeat quickly and go past a target
> position.=C2=A0 A quick way to reverse, while staying within
> the repeating command (e.g. as opposed to using `undo'),
> is an advantage in general - not just for this command.
>
> Anyway, not a big deal.=C2=A0 It won't be the first time I will > have my own local version of something. ;-)=C2=A0 I would prefer
> not to have to, of course.=C2=A0 And I am curious what downside
> you saw to this feature, if you even tried it at all.

--001a113d5b7c51101a050eb0c2e8--