From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17537 invoked by alias); 22 Sep 2011 18:22:45 -0000 Received: (qmail 17527 invoked by uid 22791); 22 Sep 2011 18:22:44 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 18:22:29 +0000 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p8MIMSEm004026 for ; Thu, 22 Sep 2011 11:22:28 -0700 Received: from qyl16 (qyl16.prod.google.com [10.241.83.208]) by hpaq14.eem.corp.google.com with ESMTP id p8MIJUIw020199 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 22 Sep 2011 11:22:26 -0700 Received: by qyl16 with SMTP id 16so9055307qyl.1 for ; Thu, 22 Sep 2011 11:22:26 -0700 (PDT) Received: by 10.224.204.8 with SMTP id fk8mr2083126qab.211.1316715746697; Thu, 22 Sep 2011 11:22:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.204.8 with SMTP id fk8mr2083122qab.211.1316715746542; Thu, 22 Sep 2011 11:22:26 -0700 (PDT) Received: by 10.224.80.149 with HTTP; Thu, 22 Sep 2011 11:22:26 -0700 (PDT) In-Reply-To: <83boucsb3n.fsf@gnu.org> References: <20110909183636.444932461B1@ruffy.mtv.corp.google.com> <201109131839.49816.pedro@codesourcery.com> <201109132015.04463.pedro@codesourcery.com> <83boucsb3n.fsf@gnu.org> Date: Thu, 22 Sep 2011 21:48:00 -0000 Message-ID: Subject: Re: [RFA, doc RFA] Add gdb.add_command_alias From: Doug Evans To: Eli Zaretskii Cc: pedro@codesourcery.com, gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-09/txt/msg00416.txt.bz2 On Thu, Sep 22, 2011 at 11:09 AM, Eli Zaretskii wrote: >> -* New commands "info macros", and "info definitions" have been added. >> +* New commands "info macros", and "info definitions", >> + =A0and "alias" have been added.^^^ > > Redundant "and". Blech, I thought I had removed that. Will fix. >> +Python scripting language, and the third is defining new aliases of >> +existing commands. =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^^ > > "for", I think. Ok. >> +@node Aliases >> +@section Creating new spellings of existing commands > > Please add here an index entry: > > =A0@cindex aliases for commands Ok. >> +Define a new alias with the @samp{alias} command. > > =A0You can define a new alias with the @samp{alias} command. Ok. >> +@item alias [-a] -f FROM -t TO >> + >> +@end table >> + >> +@samp{-f FROM} and @samp{-t TO} may be specified in either order. > > If by "refer" above you mean refer to "-f FROM" etc., then what's > wrong with > > =A0@samp{-f @var{from}} That works. >> +The @samp{-f FROM} option specifies the name of an existing command >> +that is being aliased. >> + >> +The @samp{-t TO} option specifies the name of the new alias. > > Btw, I'm not sure FROM and TO are a good idea; it's not like you are > copying something. =A0How about COMMAND and ALIAS instead? Ok, but then I have to wonder about -f and -t. -c and -a? [setting aside -a collides with the current -a for abbreviation] But if you're happy with -f COMMAND -t ALIAS, great. >> +The @samp{-a} option specifies that the new alias is an abbreviation >> +of the @samp{FROM} command, and will not appear in help command lists. > > Suggest a rewording: > > =A0The @samp{-a} option specifies that the new alias is an abbreviation > =A0of the @samp{FROM} command. =A0Abbreviations are not shown in command > =A0lists displayed by the @samp{help} command. Ok. >> +Note that aliases are different than user-defined commands. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ^^^^ > "from" Ok. >> +Here is an example where we make @samp{elms} an abbreviation of >> +@samp{elements} in the @samp{set print elements} command. >> +This is to show that you can make an abbreviation of any part >> +of a command. >> + >> +@smallexample >> +(gdb) alias -f "set print elements" -t "set print elms" >> +(gdb) alias -f "show print elements" -t "show print elms" > > For didactic purposes, shouldn't these examples use -a? Ok. >> +Note that if you are defining an alias of a @samp{set} command, >> +you also need to define the alias of the corresponding @samp{show} >> +command, if desired. > > > "Need" and "if desired" are in contradiction. =A0Which is it? How about if I reword it to: Note that if you are defining an alias of a @samp{set} command, and you want to have an alias for the corresponding @samp{show} command, then you need to define the latter separately. [i.e. it may be confusing, but it's not a contradiction]