From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Finding the file offsets for functions
Date: Sat, 21 May 2022 13:17:02 -0700 [thread overview]
Message-ID: <CAH+w=7Zniv+gBN_cTZH3Hm3p+Wd4r+em0DkucuzirkVccShDbg@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5n4Tho2-ddGNKbf1mFa7ZdtdHRSMN-dv3NcsudAGNKXQQ@mail.gmail.com>
On Fri, May 20, 2022 at 11:27 PM Zach Riggle <zachriggle@gmail.com> wrote:
>
> Autoloadable functions show up differently.
>
> $ whence -v zztop
> zztop is an autoload shell function
In recent zsh you can use
autoload -r zztop
and then whence -v output and $functions_source will include the path
(but you also can't change that path later by changing $fpath).
> $ cat /Users/zachriggle/.zprezto/modules/zach-riggle/functions/zztop
> #!/usr/bin/env zsh#
> zztop() {
> echo This is zztop
> }
> echo Zztop module loaded
That pretty much obliterates the whole reason for "autoload".
If you don't like "autoload -r" at the time of declaring all the
autoloads, you can use "autoload +X" at the time you want the source
of a particular function.
The flag +X attempts to load each NAME as an autoloaded function,
but does _not_ execute it. ...
... This does _not_ replace any existing definition ...
> I've run into issues where I'd like to create a path/to/autoloadable:$lineno such that I can easily pass it to vim or another editor. This saves a lot of time on my end
Wouldn't
vim "+/function $name\\|$name *()" $functions_source[$name]
be sufficient in nearly all cases?
next prev parent reply other threads:[~2022-05-21 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-21 6:27 Zach Riggle
2022-05-21 20:17 ` Bart Schaefer [this message]
2022-05-23 1:16 ` Bart Schaefer
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='CAH+w=7Zniv+gBN_cTZH3Hm3p+Wd4r+em0DkucuzirkVccShDbg@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=zachriggle@gmail.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).