zsh-workers
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: zsh-workers@zsh.org
Subject: Re: multi-alias syntax
Date: Thu, 25 Jun 2015 01:08:15 +0200	[thread overview]
Message-ID: <87fv5gk8m8.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: <150624113448.ZM18893@torch.brasslantern.com>

Bart Schaefer <schaefer@brasslantern.com> 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


  reply	other threads:[~2015-06-24 23:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 17:16 Emanuel Berg
2015-06-24 18:34 ` Bart Schaefer
2015-06-24 23:08   ` Emanuel Berg [this message]
2015-06-25  1:42     ` Bart Schaefer
2015-06-25  1:55       ` Emanuel Berg

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=87fv5gk8m8.fsf@nl106-137-147.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=zsh-workers@zsh.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 public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).