mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Prevent not-yet-loaded functions from loaded when erased (#5951)
* Prevent not-yet-loaded functions from loaded when erased
Today, `functions --erase $function` does nothing if the function
hasn't been autoloaded yet.
E.g. run, in an interactive session
> functions --erase ls
> type ls
and be amazed that it still shows our default `ls --color=auto`
wrapper function.
This seems counter-intuitive - removing a function ought to remove it,
whether it had been executed before or not.
* doc/changelog
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
- `test` (aka `[`) now prints a stacktrace on error, making the offending call easier to find (#5771).
|
- `test` (aka `[`) now prints a stacktrace on error, making the offending call easier to find (#5771).
|
||||||
- The default read limit has been increased to 100MiB (#5267).
|
- The default read limit has been increased to 100MiB (#5267).
|
||||||
- `math` now also understands `x` for multiplication, provided it is followed by whitespace (#5906).
|
- `math` now also understands `x` for multiplication, provided it is followed by whitespace (#5906).
|
||||||
|
- `functions --erase` now also prevents fish from autoloading a function for the first time (#5951).
|
||||||
|
|
||||||
### Interactive improvements
|
### Interactive improvements
|
||||||
- Major improvements in performance and functionality to the 'sorin' sample prompt (#5411).
|
- Major improvements in performance and functionality to the 'sorin' sample prompt (#5411).
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ The following options are available:
|
|||||||
|
|
||||||
- ``-d DESCRIPTION`` or ``--description=DESCRIPTION`` changes the description of this function.
|
- ``-d DESCRIPTION`` or ``--description=DESCRIPTION`` changes the description of this function.
|
||||||
|
|
||||||
- ``-e`` or ``--erase`` causes the specified functions to be erased.
|
- ``-e`` or ``--erase`` causes the specified functions to be erased. This also means that it is prevented from autoloading.
|
||||||
|
|
||||||
- ``-D`` or ``--details`` reports the path name where each function is defined or could be autoloaded, ``stdin`` if the function was defined interactively or on the command line or by reading stdin, and ``n/a`` if the function isn't available. If the ``--verbose`` option is also specified then five lines are written:
|
- ``-D`` or ``--details`` reports the path name where each function is defined or could be autoloaded, ``stdin`` if the function was defined interactively or on the command line or by reading stdin, and ``n/a`` if the function isn't available. If the ``--verbose`` option is also specified then five lines are written:
|
||||||
|
|
||||||
|
|||||||
@@ -245,10 +245,9 @@ bool function_set_t::remove(const wcstring &name) {
|
|||||||
|
|
||||||
void function_remove(const wcstring &name) {
|
void function_remove(const wcstring &name) {
|
||||||
auto funcset = function_set.acquire();
|
auto funcset = function_set.acquire();
|
||||||
if (funcset->remove(name)) {
|
funcset->remove(name);
|
||||||
// Prevent re-autoloading this function.
|
// Prevent (re-)autoloading this function.
|
||||||
funcset->autoload_tombstones.insert(name);
|
funcset->autoload_tombstones.insert(name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool function_get_definition(const wcstring &name, wcstring &out_definition) {
|
bool function_get_definition(const wcstring &name, wcstring &out_definition) {
|
||||||
|
|||||||
Reference in New Issue
Block a user