Commit graph

42 commits

Author SHA1 Message Date
Sanne Wouda
73f344f41b Revert 1349d12 and properly fix #213
As suggested by @ridiculousfish, when removing autoloaded functions, add them
to a tombstones set.  These functions will never be autoloaded again in the
current shell, not even when the timestamp changes.

Tested as per comment 1 of #1033.  `~/.config/fish/functions/ls.fish` contains
the function definition.  `function -e ls` removes the redefined `ls` (and
reverts back to the built-in command).  `touch .../ls.fish` does not cause the
function to be reloaded.
2015-04-06 00:10:55 -07:00
Kevin Ballard
cfc06203e7 Add new functions flag -V/--inherit-variable
--inherit-variable takes a variable name and snapshots its current
value. When the function is executed, it will have a local variable with
this value already defined. Printing the function source will include
synthesized `set -l` lines for the values.

This is primarily useful for functions that are created on the fly, such
as in `psub`.
2014-10-02 18:41:39 -07:00
ridiculousfish
3cfdc6d126 Fix line number reporting in new parser 2014-03-20 21:32:02 -07:00
ridiculousfish
630b0515ad Merge branch 'master' into ast
Conflicts:
	parse_util.cpp
2013-10-16 01:48:21 -07:00
Konrad Borowski
1349d129c5 Fix #213. You can now remove autoloaded functions.
Oddly enough, the code is here, but is internal function.
2013-10-12 21:55:23 +02:00
ridiculousfish
cbd8a27a6d Beef up completion tests 2013-10-12 12:04:31 -07:00
ridiculousfish
9992b8eb0e Apply new indentation, brace, and whitespace style 2012-11-18 16:30:30 -08:00
Łukasz Niemier
47df1ae40a Remove trailing whitespaces and change tabs to spaces 2012-11-18 11:23:22 +01:00
ridiculousfish
b08fb86637 Renamed env_vars to env_vars_snapshot_t
Cleanup of non-wcstring version of path_get_path
2012-07-20 20:39:31 -07:00
ridiculousfish
f1d22b6300 Got function.h and function.cpp off of shared_ptr (hooray) 2012-05-18 14:00:36 -07:00
ridiculousfish
da6295c428 More work towards getting function.h off of shared_ptr 2012-05-17 19:46:08 -07:00
ridiculousfish
86645b32e1 Work towards getting function.h off of shared_ptr 2012-05-17 19:38:08 -07:00
ridiculousfish
3ead99b088 Put fish on a diet. Tracked down the biggest memory hogs and fixed them. Total allocations down by a factor of 3 or so, live allocations a few KB. 2012-03-03 15:22:03 -08:00
Siteshwar Vashisht
74a7303c23 Modified functions in function.h/.cpp to use wcstring instead wchar_t*, other files also modified to use wcstring. 2012-02-19 22:55:15 +05:30
ridiculousfish
e5bba2294d Removed some more halloc 2012-02-09 02:01:49 -08:00
ridiculousfish
f891ea5713 Fixed named_arguments to be wcstring_list_t instead of al_list 2012-02-08 23:53:23 -08:00
ridiculousfish
b6bc4381fb Get event_t off of halloc (!) 2012-02-08 19:02:25 -08:00
ridiculousfish
3dc56de0ae Excised some more halloc and array_list_t 2012-02-08 02:34:31 -08:00
ridiculousfish
4eea68b5a4 LRU work to load functions off of the main thread.
We'll have to reevaluate this after we fix function autocomplete
2012-01-28 14:56:13 -08:00
ridiculousfish
2f1cac604d Implemented LRU cache for autoloading. 2012-01-25 18:40:08 -08:00
ridiculousfish
378fd60756 Migrate function.cpp to scoped_lock and shared_ptr 2012-01-23 20:32:36 -08:00
ridiculousfish
fa796d668f Get some basic function signatures right for new instanced parser 2012-01-16 12:10:08 -08:00
ridiculousfish
e4ee4ec3d1 Some const correctness 2012-01-16 11:16:12 -08:00
ridiculousfish
8ba79d6ab9 Migrate function.cpp to STL types. 2012-01-13 23:54:49 -08:00
ridiculousfish
8d2f107d61 Some changes to migrate towards C++ and a multithreaded model 2011-12-26 19:18:46 -08:00
Grissiom
1b9dd0c75f Merge remote branch 'origin/otherchirps-dev' 2010-09-19 14:12:30 +08:00
Grissiom
c6372a1b3f remove trailing spaces
This is done by `sed -i -e 's/[ \t]*$//' *.[c,h]`, which should not
introduce any functionality change.
2010-09-18 09:51:16 +08:00
Christopher Nilsson
7914c92824 replaced the functions '--rename' option with '--copy'.
Copying the function implementation was the main point. Actually removing the original isn't necessary, as that
functionality already exists (functions -e).
2010-09-09 23:48:18 +10:00
Christopher Nilsson
208be0f4d4 Adding '--rename' option to 'functions' builtin.
Aim is to allow an existing function to be renamed, allowing some basic function chaining.

Example:

> function foo
     echo Hello
  end
> foo
Hello
> functions --rename foo bar
> foo
fish: Unknown command 'foo'
> bar
Hello
> functions --rename fish_prompt old_prompt
> function fish_prompt
      printf "{Boo!}%s" (old_prompt)
  end
{Boo!}>

Note in the last case, the new fish_prompt is calling its old definition.
2010-09-08 03:31:05 +10:00
liljencrantz
905b792de7 Improve code comment
darcs-hash:20080116010601-75c98-fc7e940543424479bf1016cec26af619f177f5fd.gz
2008-01-16 11:06:01 +10:00
liljencrantz
87db9517e9 Add lots of new code comments.
darcs-hash:20080113164747-75c98-9d0cefd27be7aef7ba60772616d9da7e6bb52912.gz
2008-01-14 02:47:47 +10:00
axel
ee94424b0f Add the possibility for functions which do not shadow the arguments of the calling function
darcs-hash:20070422221033-ac50b-d9544c87d0ddab10f7f503b5a1707292f266efe4.gz
2007-04-23 08:10:33 +10:00
axel
4d6751c274 Allow named arguments to function instead of only $argv. Philip Ganchev once suggested this, and it was suggested again by Egil Möller.
darcs-hash:20070416200611-ac50b-5eb42c94a65a4e72cae12cd9c04424bdc3b2b4f8.gz
2007-04-17 06:06:11 +10:00
axel
6573d2b451 Use halloc to simplyfy allocations in function.c
darcs-hash:20061115141649-ac50b-aff0e3369bb19d6d88130781b13e598c9445b138.gz
2006-11-16 00:16:49 +10:00
axel
dfa73c7cc1 Remove the --key-binding switch for fish
darcs-hash:20061025202836-ac50b-682015e2f5830a85ff520e89b0a951ca9d2913dc.gz
2006-10-26 06:28:36 +10:00
axel
fdaa79416a Make sure dynamically loaded functions are completable, even if they have not yet been loaded
darcs-hash:20060208173718-ac50b-40c93b82f3b8a717d220642e22c4b4005d8871d0.gz
2006-02-09 03:37:18 +10:00
axel
312c7ab7b2 Add function stack trace to error output
darcs-hash:20060126144810-ac50b-3426191f596674504ce49dd61fcfa3c2c0c0f2bb.gz
2006-01-27 00:48:10 +10:00
axel
51c345311a Make the not builtin work with shellscript functions
darcs-hash:20051129195030-ac50b-7ada30d327f2dcc8ad23f56b0a36c975cb90c481.gz
2005-11-30 05:50:30 +10:00
axel
b9b841f603 Initial update for new event subsystem
darcs-hash:20051005223708-ac50b-8a8d7e003e1c24747f3f154cb66b6c1a1015c35b.gz
2005-10-06 08:37:08 +10:00
James Vega
e27664b13b Add header guards to the header files.
darcs-hash:20051004151139-35ec8-7af69b9d7647d145dc621f7eaea726e729cff554.gz
2005-10-05 01:11:39 +10:00
axel
e3ce01d685 Key binding functions
darcs-hash:20050920234200-ac50b-3895a97cb024368258cd1562bdcc9fda2c84f521.gz
2005-09-21 09:42:00 +10:00
axel
149594f974 Initial revision
darcs-hash:20050920132639-ac50b-fa3b476891e1f5f67207cf4cc7bf623834cc5edc.gz
2005-09-20 23:26:39 +10:00