zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Proof of concept mainstream plugin manager
Date: Sat, 23 Jan 2016 09:36:02 -0800	[thread overview]
Message-ID: <160123093602.ZM14454@torch.brasslantern.com> (raw)
In-Reply-To: <CAKc7PVCywh3fVsvFOUP3Bi27-8o1w30_E73rs8c+Zd4sOqtT8w@mail.gmail.com>
In-Reply-To: <CAKc7PVCXvW0PCV_pREMBqvWvVL02qFmnvc+PMcdDArrCuDMjpg@mail.gmail.com>

On Jan 23, 10:03am, Sebastian Gniazdowski wrote:
}
} I occur a problem with traps.

Hm.  The difference between a "real" autolaod and a function that calls
"autoload -X" is a couple levels of function stack depth -- in the "real"
case zsh knows it can optimize out the first call:

torch% functions showfunctrace
torch% autoload !$
autoload showfunctrace
torch% showfunctrace
Src/zsh:30
torch% unfunction showfunctrace
torch% showfunctrace() { autoload -X }
torch% showfunctrace
(eval):1
showfunctrace:0
Src/zsh:33
torch% 

This will affect traps created with the trap command because they
execute in the same scope as the function call that defined them,
rather than "inside" the call that defined them; so some convoluted
trap tricks that rely on the scope may not work.

} This is fixed in 5.1 (occurs in 5.0.8), wonder if
} I can somehow workaround this:

Probably not, it's almost certainly an internal signal handling thing.

There's another problem with the "local FPATH" trick that I thought
of just now:  It changes the load path for all other functions down
the call stack, which is likely to cause some other autoloads to fail.
A better approach is a temporary prepend.

    local FPATH="$ZPLUGIN_HOME/plugins/${ZPLUGIN_CURRENT_USER}--${ZPLUGIN_CURRENT_PLUGIN}:$FPATH"

A less pleasing approach to the whole thing is to use "autoload +X"
instead:

  preload-autoload() {
    FPATH="/tmp:$FPATH" autoload +X $1
  }

This causes the function to be loaded immediately but not run.  So it
"fixes" the trap problem but fills up memory with functions that may
never be used.


  parent reply	other threads:[~2016-01-23 17:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 19:44 Sebastian Gniazdowski
2016-01-23  1:37 ` Bart Schaefer
2016-01-23  9:03   ` Sebastian Gniazdowski
2016-01-23 15:54     ` Sebastian Gniazdowski
2016-01-23 16:00       ` Sebastian Gniazdowski
2016-01-23 16:09         ` Sebastian Gniazdowski
2016-01-23 16:26           ` Sebastian Gniazdowski
2016-01-23 17:36           ` Bart Schaefer [this message]
2016-01-23 19:20             ` Bart Schaefer
2016-01-23 20:00               ` Bart Schaefer
2016-01-24 10:51                 ` Sebastian Gniazdowski
2016-01-24 14:59                   ` Sebastian Gniazdowski
2016-01-24 19:06                     ` Sebastian Gniazdowski
2016-01-24 20:45                     ` Bart Schaefer
2016-06-04 11:36                       ` Sebastian Gniazdowski
2016-06-04 17:02                         ` Bart Schaefer
2016-01-26 22:50                   ` Daniel Shahaf
2016-01-27  7:47                     ` Sebastian Gniazdowski
2016-01-26 22:50                 ` Daniel Shahaf
2016-01-27  4:34                   ` Bart Schaefer
2016-01-27  7:34                     ` Sebastian Gniazdowski
2016-01-28  6:38                       ` Bart Schaefer
2016-01-28  7:13                         ` Sebastian Gniazdowski

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=160123093602.ZM14454@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).