From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23249 invoked by alias); 24 Jun 2015 23:10:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35594 Received: (qmail 12005 invoked from network); 24 Jun 2015 23:09:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.0 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: zsh-workers@zsh.org To: zsh-workers@zsh.org From: Emanuel Berg Subject: Re: multi-alias syntax Date: Thu, 25 Jun 2015 01:08:15 +0200 Message-ID: <87fv5gk8m8.fsf@nl106-137-147.student.uu.se> References: <87si9hf2n9.fsf@nl106-137-147.student.uu.se> <150624113448.ZM18893@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-246.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:t1rtbu1fvw0SVXGq7w/cYorPBnI= Bart Schaefer writes: > This should work > > alias {a,b,c}=d > > unless you have the ignore_braces option set. That works, thank you. I also learned I can do debian-version debian-ver version ver () { lsb_release -a } # 1 or, as I first thought and as you helped: # 2 debian-version () { lsb_release -a } alias {debian-ver,version,ver}=debian-version Anyone cares to line up the pros and cons of the two approaches? - in terms of programming, and use. I can already tell they are not identical as in (1) debian-ver etc. are functions, not aliases. I happen to use a function I wrote called 't' (for "type") [1] in which the function approach is better (due to the functionality of t, of course) as $ t ver ver: aliased to debian-version (doesn't say a lot) vs. $ t ver ver () { lsb_release -a } Some programmers feel all things should have one name each and you should just memorize it. I sort of disagree. I want long and descriptive name in the source so I can understand it years later. But for interactive use I want short names in many versions. Every time I make a mistake ("zsh: command not found") I stop to think "OK, it isn't there. But does it make sense still?" - if it does, I add an alias. This method will make that easier and perhaps I'll drop the alias method completely and have multiple function names instead, so it will be interesting to hear if there is any fine print to either methods. Another thing I can tell you about the multiple function names method is that it breaks Emacs' zsh mode as you see in this dump [2]. [1] http://user.it.uu.se/~embe8573/conf/.zsh/ide (line 45) [2] http://user.it.uu.se/~embe8573/dumps/zsh-font-lock.png -- underground experts united http://user.it.uu.se/~embe8573