Commit graph

19566 commits

Author SHA1 Message Date
Fabian Boehm
6d28845c2b Automatically attempt to install
This is fairly subtle.

When installable, and we either can't find the version file or it is
outdated, we ask the user to confirm installation (just like `--install`).

We do that only if we are really truly interactive (with a tty!) to
avoid `fish -c` running into problems.
This check could be tightened even more, because currently:

```fish
fish -ic 'echo foo'
```

asks, while

```fish
fish -ic 'echo foo' < /dev/null
```

does not.

`fish -c` will still error out if it can't find the config, but it
will just run if it is out of date.
2024-12-13 19:19:26 +01:00
Fabian Boehm
99fa8aaaa7 Really hide install() from clippy 2024-12-11 17:21:34 +01:00
Fabian Boehm
fa298c41e0 Hide install() from clippy
Not checkable because it would require sphinx
2024-12-11 17:18:34 +01:00
Fabian Boehm
327aa964e9 Disable default features for cargo test
Unfortunately it does not appear like #[cfg(test)] works for build.rs?

Investigating a better solution, but this is a good idea anyway (or `make
test` would generate man pages via build.rs!)
2024-12-11 17:05:38 +01:00
Fabian Boehm
6c852655dd Disable man page building in clippy
This would otherwise break any clippy run if you didn't have sphinx installed.
2024-12-11 16:56:14 +01:00
Fabian Boehm
0e0d56d805 format 2024-12-11 16:51:25 +01:00
Fabian Boehm
2d2f18c159 installable builds: Fail when building man pages fails
This is unfortunately necessary, because otherwise it would not rerun
the build script just because you installed sphinx.

Because we use the man pages for --help output, they're pretty
necessary.

To override it, you can set $FISH_BUILD_DOCS=0, like

```fish
FISH_BUILD_DOCS=0 cargo install --path .
```
2024-12-11 16:49:49 +01:00
David Adam
c58313fb2b README: minor formatting update 2024-12-11 08:04:52 +08:00
David Adam
662607fb2a README: minor formatting update 2024-12-11 08:04:15 +08:00
David Adam
6ae887383c README: improve instructions on building from source
Closes #10894.
2024-12-11 08:04:00 +08:00
David Adam
1b33e4b9a6 CHANGELOG: work on 4.0.0 2024-12-11 08:03:26 +08:00
Fabian Boehm
0083192fcb Read git SHA ourselves if it is unavailable
`git describe` *may* fail e.g. for `sudo make install`,
so we just read the SHA ourselves.
2024-12-09 16:57:47 +01:00
Peter Ammon
5c8b6adc2c Fix infinite prompt loop if status message is printed in prompt
fish will print messages for some jobs when they exit abnormally, such as
with SIGABRT. If a job exits abnormally inside the prompt, then (prior to
this commit) fish would print the message and re-trigger the prompt, which
could result in an infinite loop. This has existed for a very long time.

Fix it by reaping jobs after running the prompt, and NOT triggering a
redraw based on that reaping. We still print the message but the prompt is
not executed.

Add a test.

Fixes #9796
2024-12-08 18:12:59 -08:00
Peter Ammon
c97b1a992c
Remove some unused code from the tests 2024-12-08 13:57:10 -08:00
Fabian Boehm
56a1403350 Revert "Enable gettext without the _nl_msg_cat_cntr gnuism"
This built on my test system, might be version differences.

(it's also not enough to make it *work*, but a necessary step)

This reverts commit 6fded249cd.
2024-12-08 22:04:59 +01:00
Fabian Boehm
6fded249cd Enable gettext without the _nl_msg_cat_cntr gnuism
This should allow e.g. musl to be translated.
2024-12-08 21:53:20 +01:00
Johannes Altmanninger
421ce13be6 Fix replacing completions spuriously quoting ~
Commit 29dc30711 (Insert some completions with quotes instead of
backslashes, 2024-04-13) wrongly copmletes

	$ cat ~/space

to

	$ cat '~/path with spaces'

Today completions can be either replacing or appending.  We never quote
(but backslash-escape) appending completions (unless they "append"
to an empty token).  We always quote replacing completions. The
assumption in this part of the code is that replacing completions
can be quoted without changing meaning.

This assumption is wrong for tildes.  For the backslash-escaping code
path, we take care of this edge case via a special DONT_ESCAPE_TILDES
flag. However that flag does not take effect when using quotes for
escaping. Fix that.

Unfortunately, e97a4fab7 (Escape : and = in file completions,
2024-04-19) introduced a (hopefully temporary) code clone in
escape_separators, which made added an extra step to debugging here.
2024-12-08 15:27:08 +01:00
Fabian Boehm
99b5e6e0e7 completions/cargo: Complete packages to uninstall 2024-12-08 09:13:20 +01:00
Fabian Boehm
004953a3b2 Revert "BuiltinData to use const constructor function"
Unfortunately, this does not work with rust 1.70.

This reverts commit 7e516925e9.
2024-12-08 07:52:57 +01:00
Peter Ammon
7e516925e9
BuiltinData to use const constructor function
This makes the list of builtins one line per builtin. No functional change.
2024-12-07 10:37:53 -08:00
Peter Ammon
0b68fbfd85
Clean up some stale comments 2024-12-07 10:37:53 -08:00
Fabian Boehm
fcf8ed0628 Clarify docs on self-installing builds 2024-12-07 13:13:18 +01:00
Fabian Boehm
210d687b2b CHANGELOG installable fish 2024-12-06 22:13:34 +01:00
Fabian Boehm
74e0436c3c Document installable builds 2024-12-06 22:12:26 +01:00
Fabian Boehm
3360dcbebc Make static builds on Github Actions
For x86_64 and cross-compiled for aarch64, manually triggered

It *seems* to work, but I had to explicitly disable gettext for it (which is AFAICT currently non-functional under musl anyway).

Also it will create one .zip containing two .tar.xzs. It is about 8MB, which should be fine, tbh.
2024-12-06 22:12:26 +01:00
Fabian Boehm
1599293796 Build man pages into installable fish
This calls sphinx-build from build.rs to include the man pages in the binary.

We don't abort if sphinx doesn't exist, but we do if it failed.
2024-12-06 22:12:26 +01:00
Fabian Boehm
2343a6b1f1 docs: Read version from the version file
Makes it possible to generate the man pages without fish_indent
available.

(not the html docs because they highlight via fish_indent!)
2024-12-06 22:12:26 +01:00
Fabian Boehm
7c73c5fec0 Make fish installable
When built with the default "installable" feature, the data files (share/) are
included in the fish binary itself.

Run `fish --install` or `fish --install=noconfirm` (for
non-interactive use) to install fish's data files into ~/.local/share/fish/install

To figure out if the data files are out of date, we write the current version
to a file on install, and read it on start.

CMake disables the default features so nothing changes for that, but this allows installing via `cargo install`,
and even making a static binary that you can then just upload and have extract itself.

We set $__fish_help_dir to empty for installable builds, because we do not have
a way to generate html docs (because we need fish_indent for highlighting).
The man pages are found via $__fish_data_dir/man
2024-12-06 22:12:26 +01:00
Fabian Boehm
7827a8e533 Make bin path an Option
It is possible we cannot acquire this
2024-12-06 22:12:26 +01:00
Fabian Boehm
aa30b4db4b Set crate version to 4.0.0-alpha1
The next version is gonna be 4.0.0
2024-12-06 22:12:26 +01:00
Fabian Boehm
378dc9123a git_version_gen: Just print the version
This was needed because we #included it in C++, but now it's easier to
have just the version in there
2024-12-06 22:12:26 +01:00
Fabian Boehm
5abd0e46f5 build.rs: Panic if version could not be found
We don't want "fish --version" to print "unknown" or any other fake version
2024-12-06 22:12:26 +01:00
Fabian Boehm
e24823dd6c Signals: Compute signal set once on startup
Really the only thing we're looking for here is if we're started with
HUP ignored or not.

Saves a syscall per external process.

Continuation of #10869
2024-12-04 20:18:16 +01:00
Ambrose Bonnaire-Sergeant
3012020af3
doc: expand &| reference to full example (#10885)
* doc: expand &| reference to full example

* feedback
2024-12-04 20:13:00 +01:00
Fabian Boehm
7b2cc9dca2 CI: Disable cargo-deny again
I am not a fan of CI tools that make the checks fail for reasons
unrelated to the patch at hand.
2024-12-04 18:42:20 +01:00
Himadri Bhattacharjee
d124c31958 refactor: remove unnecessary copied() for Utf32Str reference 2024-12-02 19:12:39 +01:00
Fabian Boehm
b2e6609367 builtin random: Be less strict about arguments
This now allows:

- Same argument (`random 5 5`)
- Swapped ends (`random 10 2`)
- One possibility (`random 0 5 4`)

This makes it easier to use with numbers generated elsewhere instead
of hard-coded, so you don't need to check as much before running it.

Fixes #10879
2024-12-02 19:06:14 +01:00
Fabian Boehm
1cad9898d6 Refactor some more .unwrap/asserts
No use in asserting and then unwrapping, just .expect()
2024-11-30 23:11:04 +01:00
Fabian Boehm
4859606e0c posix_spawn: Unconditionally default all signals (except HUP)
We don't really care if the process has a custom handler installed, we
can just set it to default.

The one we check is SIGHUP, which may be given to us via `nohup`.

This saves ~30 syscalls *per process* we spawn, so:

```fish
for f in (seq 1000)
    command true
end
```

has ~30000 fewer rt_sigaction calls. These take up about ~30% of the
total time spent in syscalls according to strace.

We could also compute this set once at startup and then reuse it.
2024-11-30 23:00:44 +01:00
Peter Ammon
5d10bc6a02
Fix/suppress some clippies
needless_lifetimes is annoying; supress that. Fix some spacing that clippy was
complaining about.
2024-11-30 12:21:30 -08:00
Fabian Boehm
eee44b7469 ulimit: Fix multiplication overflow 2024-11-30 15:40:48 +01:00
Fabian Boehm
8736d9b1e7 CI: Add cargo-deny 2024-11-29 18:17:11 +01:00
Fabian Boehm
f5e71063d7 Add cargo-deny configuration 2024-11-29 18:17:00 +01:00
Fabian Boehm
2d1ad1c3cc Mostly Revert "cmake: Remove code to resolve rustup toolchains"
Apparently needed on our FreeBSD CI setup.

This reverts commit 281df5daad.
2024-11-28 20:00:34 +01:00
Fabian Boehm
8b464d96af Remove reference to static mut
This is what UnsafeCell is for: Providing interior mutability.

The docs at https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html
give an example just like this - `&mut *ptr.get()`

Without, rustc may complain - https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html
2024-11-28 19:36:50 +01:00
Fabian Boehm
281df5daad cmake: Remove code to resolve rustup toolchains
We turned it off, but for some reason (cmake version?) that stopped working on my system.

So instead we just remove all the code that does it.

To be honest I do not know why this exists anyway.
2024-11-27 22:29:13 +01:00
Johannes Altmanninger
3ed031c149 Update Kakoune completions 2024-11-27 08:44:36 +01:00
Johannes Altmanninger
644171fac6 fix: check whether a function is tombstoned during highlight
exists_no_autoload() wrongly thinks that tombstoned functions can be
autoloaded; fix that.

While at-it replace the use of get_props() with something simpler.

Co-authored-by: Himadri Bhattacharjee

Closes #10873
2024-11-27 08:44:36 +01:00
Fabian Boehm
c625a324ba docs/string-trim: Double down on the set of chars vs string thing 2024-11-25 17:53:14 +01:00
Fabian Boehm
4101bb30bf Remove unused variables
Never set since the introduction in 61686aff34
2024-11-25 16:29:00 +01:00