zsh-workers
 help / color / mirror / code / Atom feed
* Zed obtains fresh text of function
@ 2015-10-03 10:44 Sebastian Gniazdowski
  2015-10-03 19:18 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2015-10-03 10:44 UTC (permalink / raw)
  To: zsh-workers

Hello,
creating simple function tst in */site-functions:

        echo "Hello tst abcd"

doing:
autoload zed
autoload tst
zed -f tst

And then repeating:
zed -f tst<Enter><Ctrl-C>

after each update of the tst file/function – will result in zed
loading the most recent version of the function, i.e. from disk.

Not sure if this is expected, however I face an obvious situation – I
update autoloaded function and run it, and it is the disk version that
is being run, not the one from first load – i.e. Zsh constantly
reloads the function. It's hard to report that as it's bunch of full
size functions (zntools). I report the similar zed behavior as it can
have the same source of problem. Tested on 5.0.2 and on current head
(64061e5).

Best regards,
Sebastian Gniazdowski


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

* Re: Zed obtains fresh text of function
  2015-10-03 10:44 Zed obtains fresh text of function Sebastian Gniazdowski
@ 2015-10-03 19:18 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2015-10-03 19:18 UTC (permalink / raw)
  To: zsh-workers

On Oct 3, 12:44pm, Sebastian Gniazdowski wrote:
} Subject: Zed obtains fresh text of function
}
} Hello,
} creating simple function tst in */site-functions:
} 
}         echo "Hello tst abcd"
} 
} doing:
} autoload zed
} autoload tst
} zed -f tst
} 
} And then repeating:
} zed -f tst<Enter><Ctrl-C>
} 
} after each update of the tst file/function - will result in zed
} loading the most recent version of the function, i.e. from disk.

Yes, if you ctrl+c out of zed then it does not save the function in
the current shell, so it remains undefined/autoloadable.  Then the
next time you run zed, it loads from the $fpath file again.

This is the intended behavior; you need to exit from zed with ^X^W
(or ZZ if in vicmd mode) in order to save your changes (even if you
didn't explicitly make any -- autoloading was an implicit change).

Even if you ^X^W the state is only saved to the current shell (memory),
not written back to the source file.

} Not sure if this is expected, however I face an obvious situation - I
} update autoloaded function and run it, and it is the disk version that
} is being run, not the one from first load

If the ONLY "first load" is with zed, then the function was never
really loaded -- it was only pulled into a vared buffer to await
that final write command.  You aborted the process of parsing it
into a runnable state by hitting ctrl+c.

If this isn't what you mean, then you're going to have to give a
more explicit example.


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

end of thread, other threads:[~2015-10-03 19:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-03 10:44 Zed obtains fresh text of function Sebastian Gniazdowski
2015-10-03 19:18 ` Bart Schaefer

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