zsh-users
 help / color / mirror / code / Atom feed
* `whence -v X` shows file for functions, but not alias; workaround?
@ 2017-01-12 17:24 Timothee Cour
  2017-01-13  4:21 ` Eric Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Timothee Cour @ 2017-01-12 17:24 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

* 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?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: `whence -v X` shows file for functions, but not alias; workaround?
  2017-01-12 17:24 `whence -v X` shows file for functions, but not alias; workaround? Timothee Cour
@ 2017-01-13  4:21 ` Eric Cook
  2017-01-13  7:04   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Cook @ 2017-01-13  4:21 UTC (permalink / raw)
  To: zsh-users

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')


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: `whence -v X` shows file for functions, but not alias; workaround?
  2017-01-13  4:21 ` Eric Cook
@ 2017-01-13  7:04   ` Bart Schaefer
  2017-01-13 18:18     ` Ray Andrews
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2017-01-13  7:04 UTC (permalink / raw)
  To: zsh-users

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 ...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: `whence -v X` shows file for functions, but not alias; workaround?
  2017-01-13  7:04   ` Bart Schaefer
@ 2017-01-13 18:18     ` Ray Andrews
  0 siblings, 0 replies; 4+ messages in thread
From: Ray Andrews @ 2017-01-13 18:18 UTC (permalink / raw)
  To: zsh-users

On 12/01/17 11:04 PM, Bart Schaefer wrote:
>
> And in 20+ years I don't think anyone else has asked about it, so ...
>
At one point I thought I wanted that too but after realizing that it 
really was impossible

via internal methods I ended up just setting all my aliases within one 
file named 'aliases'

and that was the end of the issue.  Some times I can bend the shell to 
my will but other

times I have to bend my will to the shell and often the latter ends up 
being the better.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-13 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 17:24 `whence -v X` shows file for functions, but not alias; workaround? Timothee Cour
2017-01-13  4:21 ` Eric Cook
2017-01-13  7:04   ` Bart Schaefer
2017-01-13 18:18     ` Ray Andrews

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).