zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: `whence -v X` shows file for functions, but not alias; workaround?
Date: Thu, 12 Jan 2017 23:04:30 -0800 (PST)	[thread overview]
Message-ID: <alpine.LRH.2.00.1701122107080.4560@toltec.zanshin.com> (raw)
In-Reply-To: <44e243d5-2423-6d31-4c92-87ff3fe295cd@gmx.com>

On Thu, 12 Jan 2017, Eric Cook wrote:

> On 01/12/2017 12:24 PM, Timothee Cour wrote:
> > * how do i search for where an alias is defined?
> > `whence -v my_function`: works
> > my_function is a shell function from /home/timothee/.zshrc
> >
> > `whence -v my_alias`: doesn't do that:
> > my_alias is an alias for ...
> > Could that be implemented? What's a workaround? (besides grep of course)
> >
> > * why not also include line info?
> >
> zsh -lxic : 2> >(grep -F '> alias')

That only works if PS4 is not redefined somewhere in the init files, but
nice trick.

To answer the original question -- function objects track of all of this
information because of the delayed (auto)loading feature.  It was easy
to retain the information and add it to whence's output.  (Adding line
info would be additional work, that's why not.)

Aliases on the other hand use a simple generic hash table element that
doesn't have space for a source file name, so it would be a larger effort
to rewrite for that -- and it would double or more the amount of space
required to store aliases, whereas the space for functions was already
committed.

And in 20+ years I don't think anyone else has asked about it, so ...


  reply	other threads:[~2017-01-13  7:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 17:24 Timothee Cour
2017-01-13  4:21 ` Eric Cook
2017-01-13  7:04   ` Bart Schaefer [this message]
2017-01-13 18:18     ` Ray Andrews

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=alpine.LRH.2.00.1701122107080.4560@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@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).