Commit Graph

10112 Commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
2fe2169065 Make eval a decorator
`eval` has always been implemented as a function, which was always a bit
of a hack that caused some issues such as triggering the creation of a
new scope. This turns `eval` into a decorator.

The scoping issues with eval prevented it from being usable to actually
implement other shell components in fish script, such as the problems
described in #4442, which should now no longer be the case.

Closes #4443.
2019-04-11 10:36:49 -05:00
Mahmoud Al-Qudsi
0bda853dc7 Add detection of eval to the parser
While `eval` is still a function, this paves the way for changing that
in the future, and lets the proc/exec functions detect when an eval is
used to allow/disallow certain behaviors and optimizations.
2019-04-10 21:19:57 -05:00
Fabian Homborg
25dd22242d Adjust __fish_print_help for sphinx
This is beyond cheesy, but it seems to work.

Fixes #5782.
2019-04-10 18:20:25 +02:00
Fabian Homborg
8f1b240289 docs: Slight touchup on brace expansion
Clarify the "literal {}" bit and fix formatting.

[ci skip]
2019-04-10 18:04:07 +02:00
Mahmoud Al-Qudsi
04a96f6c6e Change when PENDING_REMOVAL jobs are removed
Followup to 394623b.

Doing it in the parser meant only top-level jobs would be reaped after
being `disown`ed, as subjobs aren't directly handled by the parser.

This is also much cleaner, as now job removal is centralized in
`process_clean_after_marking()`.

Closes #5803.
2019-04-10 11:00:48 -05:00
Fabian Homborg
83e72c912d docs: Put "Some common words" first
Before all the sections that use these, it seems useful to explain the
common words _first_.

[ci skip]
2019-04-10 17:20:02 +02:00
Fabian Homborg
774d46e180 docs: :ref: more
[ci skip]
2019-04-10 17:19:56 +02:00
Fabian Homborg
151170280a docs: Explain ?s status better
[ci skip]
2019-04-10 17:19:48 +02:00
Fabian Homborg
b0102a0809 docs: Spruce up copy and paste section
[ci skip]
2019-04-10 17:19:48 +02:00
Artur Juraszek
cece4d81c1 completions/pinky: Prompt with users list 2019-04-10 12:46:36 +02:00
Mahmoud Al-Qudsi
394623bf08 Prevent disown from directly removing jobs
This prevents the `disown` builtin from directly removing jobs out of
the jobs list to prevent sanity issues, as `disown` may be called within
the context of a subjob (e.g. in a function or block) in which case the
parent job might not yet be done with the reference to the child job.

Instead, a flag is set and the parser removes the job from the list only
after the entire execution chain has completed.

Closes #5720.
2019-04-09 23:29:58 -05:00
Mahmoud Al-Qudsi
f1b261388a Fix build error on old (buggy?) versions of libstdc++
Closes #5801.
2019-04-09 22:43:32 -05:00
Mahmoud Al-Qudsi
a21c65a5ac Makefile: Correct search for cmake 2019-04-09 22:32:29 -05:00
Mahmoud Al-Qudsi
ab1519acef Fix high CPU usage in subsequent select(2) calls
The timeout was being reset to zero, so `select` was being called in a
very tight loop.

Closes #5761.
2019-04-09 21:10:30 -05:00
Mahmoud Al-Qudsi
49935f13df Add completions for git bisect
[ci skip]
2019-04-09 20:36:42 -05:00
Mahmoud Al-Qudsi
e296e3c505 Makefile: Replace literal cmake usage with $(CMAKE) 2019-04-09 20:06:41 -05:00
Mahmoud Al-Qudsi
20db22f0fe Add basic make shim for CMake
This lets non-developers simply `cd` into the fish source directory and
execute `make` to build the project. The Makefile searches for CMake and
hands over the build to it if it is available, otherwise an error
message is emitted. All dependency checking is left to CMake.

Non-fish-devs shouldn't have to concern themselves with what build
system fish developers have chosen, and building a random C++ project
should not be a chore in familiarizing one's self with all the various
build platforms out there.

CMake is instructed to use `ninja` if it is available, otherwise the
standard Unix Makefiles generator option is used.

(This has already been the behavior on BSDs since CMake was adopted.)
2019-04-09 19:58:48 -05:00
David Adam
d6a4694d9f tests: add test for invalid variable name in for loop
Work on #5800.
2019-04-09 20:10:57 +08:00
David Adam
c6c0c9bfdf use standard warning for invalid variable in for loop
Work on #5800.
2019-04-09 20:10:57 +08:00
Fabian Homborg
add0bd0538 docs: Fix refs to cartesian product
There's an explicit label for "cartesian-product", but the title is
"Cartesian Product*s*". So linking via with `thing <#link>`_ links the
title, so without the "s" it doesn't work.

From what I know, linking via :ref:`thing <label>` is preferred and
works better with other exports and across files?

I think I should take a doc holiday.

[ci skip]
2019-04-09 14:06:54 +02:00
Fabian Homborg
e9f2a2904b Update the year of the doc
Next I'm gonna join the Temple Of The Doc.

[ci skip]
2019-04-09 13:58:59 +02:00
Fabian Homborg
5aed0bbf88 docs: Remove underline for whitespace
This made it look like code was `echo_Hello_World` instead of `echo
Hello World`.

See #5696.

[ci skip]
2019-04-09 13:57:36 +02:00
Fabian Homborg
c2259cbb86 docs: Fix typo
Also removes a warning.

[ci skip]
2019-04-09 13:47:54 +02:00
Aaron Gyes
3b97e2d7ec Stop caching set_color output in rest of prompts
No more __fish_prompt_* variables.
2019-04-09 03:40:09 -07:00
Aaron Gyes
5f7f4c638f informative.fish: stop caching_set_color, use br* directly
No longer uses global vars to cache set_color output, this was
from before set_color was a builtin, it is pointless now.

This is also a prompt from before we had bright named colors,
and it appears it was relying on -o red to get bright red.
so use brred, etc.
2019-04-09 03:13:45 -07:00
Aaron Gyes
b002eb350c Get rid of __fish_repaint_root
it's identical to __fish_repaint - so just register that for both
variable change events.
2019-04-09 00:29:22 -07:00
ridiculousfish
ef88e959ac Merge branch 'pygments'
This adds support for a fish_indent driven pygments syntax highlighter
to the sphinx docs build.
2019-04-08 20:14:12 -07:00
ridiculousfish
1fb05d8fa0 Add fish specific css to docs 2019-04-08 19:13:58 -07:00
ridiculousfish
e85cb25883 Switch to fish_indent based syntax highlighting in sphinx docs 2019-04-08 19:11:22 -07:00
ridiculousfish
93cc99d6d0 Teach CMake to tell Sphinx where fish_indent is 2019-04-08 19:11:10 -07:00
ridiculousfish
5b2c741f6c Add fish_indent_lexer.py
This is a pygments lexer that shells out to fish_indent
2019-04-08 19:09:53 -07:00
ridiculousfish
e44cb235a7 Add pygments CSV output to fish_indent
This will allow pygments to highlight fish code using fish_indent.
2019-04-08 19:09:41 -07:00
ridiculousfish
51e5077d98 Merge branch 'env_dispatch'
This merges a bunch of changes that migrate logic from env.cpp to a new file
env_dispatch.cpp. env_dispatch is concerned with dispatching changes to
variables, while env.cpp is the "core."
2019-04-08 16:22:22 -07:00
ridiculousfish
3e14f96d40 Eliminate string_set_contains 2019-04-08 16:22:04 -07:00
ridiculousfish
1caf20f7c3 Migrate the read limit into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
fa0a6ae096 Move locale and curses init from env to env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
11651dec7a Clean up env_stack_t::pop
Use the new dispatch mechanism to reduce duplication
2019-04-08 16:22:04 -07:00
ridiculousfish
a4fe3c87ae Switch certain environment callbacks from named to anonymous 2019-04-08 16:22:04 -07:00
ridiculousfish
987e41de12 Remove the op from env_dispatch
Environment dispatch passes strings like "ERASE" and "SET" but nobody
ever looks at those. Just get rid of them.
2019-04-08 16:22:04 -07:00
ridiculousfish
dc729653be Migrate pop complexity from vars_stack_t to env_stack_t
When popping a scope from the environment stack, we currently do a lot of
nonsense like looking for changed curses variables. We want to centralize
this in env_stack_t so that it can be migrated to the env_dispatch logic.
Move this logic up one level in preparation for doing that.
2019-04-08 16:22:04 -07:00
ridiculousfish
59fb5b1849 var_stack_t::pop() to return the popped node 2019-04-08 16:22:04 -07:00
ridiculousfish
0c5809a088 Minor cleanup of env_node_t 2019-04-08 16:22:04 -07:00
ridiculousfish
ab67354192 Migrate fish_use_posix_spawn into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
e7de9cc371 Migrate some env initialization into env_dispatch 2019-04-08 16:22:04 -07:00
ridiculousfish
b67174b4a3 Clean up env_dispatch_table 2019-04-08 16:22:04 -07:00
ridiculousfish
b7fceddfc8 Refactor some environment code into env_dispatch.cpp
This new file is supposed to encapsulate all of the logic around
reacting to variable changes, as opposed to the environment core.
This is to help break up the env.cpp monolith.
2019-04-08 16:22:04 -07:00
Aaron Gyes
e5362a4ae5 wutil.cpp: fixup: don't involve the uninitialized parameter 2019-04-08 16:02:00 -07:00
Aaron Gyes
8eb05f8731 parse_execution.cpp: validate 'for' variable name
Fixes #5800
(that's a nice round number)
2019-04-08 11:23:00 -07:00
Aaron Gyes
dd9a26715d fcntl a little less
Setting O_CLOEXEC on closed file descriptors and getting E_BADF
should be faster than actually checking if an fd is open first.
2019-04-08 11:23:00 -07:00
ridiculousfish
bf40f84b06 Remove an unused variable 2019-04-07 15:07:36 -07:00