This built-in emacs library actually provides a data structure that
can work as an LRU list through the existing helper function to move
an element to the front of the ring if it already exists.
As a result, the code for workspace history moving becomes a lot less
brittle and complicated than it was before. No more carefully figuring
out when to modify state, just push it in the ring unless it's being
rotated already.
Change-Id: If354e0618fc5a6d7333776468eec077596cfe9df
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9162
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
I haven't used that since ... 2018 or so, time for it to go.
Change-Id: I5e1b729bd553940b98335e3d9c7ca5b134fdf692
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9161
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This does nothing other than dump out the list of XDG apps to stdout
in JSON format. There are no options or anything.
This can be used for selection in app launchers (e.g. dmenu, something
based on completing-read in emacs, rofi, etc.).
I wrote this because I don't want to deal with having to do this in
Elisp. It's also unclear what logic actually hides behind under the
hood here, so why not just use the official library.
Change-Id: I16fed2c92760cadecc02c59a4e537a1fa247aff9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9157
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
vertico and consult are more modern versions of interactive narrowing
helpers, as those implemented by ivy and its related packages.
The primary differences (and what I care about here) is that they are
more focused on integration with the core Emacs primitives, rather
than building an ecosystem around them.
For example:
* vertico enhances `completing-read' and friends, but does not attempt
to provide its own ecosystem of functions to *trigger* completions.
* vertico integrates with the default `completion-style' system,
meaning that I can continue to use things like prescient without
extra packages that integrate it with vertico
* consult does not rely on vertico or any other specific completion
framework (such as counsel/swiper do with ivy), and simply
implements its functions using completing-read
This reduces the overall amount of code in the dependency closure and
leads to a less special setup.
Functionality is basically equivalent, except for two things which
counsel came with that I will need to substitute:
* counsel-notmuch (actually this was a separate package, but I didn't
use it much anyways, so just ignoring it for now)
* counsel-linux-app (opening desktop shortcuts, this I will need to make)
As a side note, consult notes "This package is a part of GNU Emacs",
but it doesn't seem to be the case.
Change-Id: Ia046b763bf3d401b505e0f6393cfe1ccd6f41293
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9155
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
replaceStrings would previously fail to replace the last character
in a string.
Change-Id: I43a7c960945350b2e7a5b731b7fdb617723eb38f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9151
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
When entering an incorrect GPG key password, I don't want my whole
buffer layout ruined. A small error message in the modeline is enough.
Change-Id: I7318d685e74fa4e110a9bff30d0de9f7f18b2be4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9149
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Especially the recursive minibuffers only cause a mess.
Change-Id: I6f7f790acd6a2f8cc4cec26c9cf97d5e53e77106
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9148
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Adds a completing-read function (defaulting to ivy for me, but it
doesn't matter) that offers a reliable alternative to standard
buffer-switching implementations.
In particular, this implementation retains a mapping of
buffer names to their buffer *objects*, so that the correct buffer is
selected even if some renaming took place during the selection.
I tried to account for a bunch of the common behaviours I could think
of:
* invisible buffers are ... invisible
* entering a buffer name manually creates that buffer, if there is no
match
* ... unless that buffer is an invisible buffer, in which case it is
selected and switched to
* the first element is always `(other-buffer (current-buffer))`,
because of the ordering of #'buffer-list
Yet, the entire code of my implementation is less than the *setup*
code of ivy-switch-buffers, so it's possible I missed something. Well,
I'll find out ...
Change-Id: I08be0da0863d06c9a930e5efaf916719655db90e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9147
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
The builtin `seq' has everything I need, and this way bpalmer will be
less annoyed.
Change-Id: Ic8e5ac07d5214f36d77e9b577a3f805cdf89f220
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9146
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
The terminal switcher uses ivy to select buffers from a list of
buffer *names*, however this can cause weird situations if, for
example, two `vterm` sessions are in the same folder and buffer name
uniquification is active.
This commit implements a corrected solution, which constructs an
association list of buffer names to their actual buffer object, and
retrieves the buffer object from that list after the user has made
their selection. This way, changes in buffer names during terminal
selection do not lead to confusing results.
Change-Id: I3ab3d6b715b32606cf771dabc31d9d4507c8b856
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9145
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
The current unstable has a bunch of breakage which people have been
reporting, lets move the public instance to the stable channel until
that is sorted out.
Example breakage: https://github.com/tazjin/nixery/issues/159
Change-Id: Id5eb11ebd235928b85c01c178c32da3badea517f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9126
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
There's been some patch submissions gone wrong recently, and piling up
in Gerrit. Describe a bit more why patch submission via email is less
convenient for both sides.
Change-Id: I9dfb5e912511a8b5b828f443c25d5cf36ec5acea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9089
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
We already have these hashes accessible in the Cargo.nix file created
by cargo2nix, so there's no need to also manually maintain them here.
It removes one potential footgun I ran into while updating wu-manber to
a different rev, without updating it here.
Change-Id: I93932ac8ba55f83746ee38571b7740af2d49bbdf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9090
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
There was a NixHash::new() before, which didn't perform any validation
of the digest length. We had some length validation when parsing nix
hashes or SRI hashes, but some places didn't perform validation and/or
constructed the struct directly.
Replace NixHash::new() with a
`impl TryFrom<(HashAlgo, Vec<u8>)> for NixHash`, which does do this
validation, and update constructing code to use that, rather than
populating structs directly. In some rare cases where we're sure the
digest length is correct we still populate the struct manually.
Fixes b/291.
Change-Id: I7a323c5b18d94de0ec15e391b3e7586df42f4229
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9109
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This question popped up every once in a while. While already explained
quite well at
https://inbox.tvl.su/depot/20230316120039.j4fkp3puzrtbjcpi@tp/T/#t,
it's not easily accessible.
Lift it from there into tvix/docs for better visibility.
Change-Id: I5f2d4aff31ab4adc421e06a7d36c871f45e09100
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9080
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This passes a unit value to the function.
Change-Id: I4df3ad8fb0f35c0f110cee3349971ae28ce2878c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9101
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
We already have the parsed output_hash from above, no need to construct
it again.
Change-Id: Ie6d924ab446137c25c29fbeaf671aa7e5418262d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9110
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Previously, Output deserialization would silence validation errors and
provide `None` for `hash_with_mode` as soon as a validation error would
happen inside of the `NixHashWithMode` deserialization, e.g. invalid
hash length would not provide an validation error but a silent `None`
value.
This is problematic, we workaround a serde limitation here by writing
our own Deserializer.
As you can see, we write some boilerplate code unfortunately, as, for
example:
- `#[serde(fail_if_unparsed_as="Option::is_none")]` is not a thing,
otherwise, we could have been able to just bubble up errors in case of
"not fully parsed" (and not missing) values.
- `From<&serde_json::Value> for serde:🇩🇪:Unexpected` is not a thing,
otherwise, we could just map invalid type errors and reuse the
existing types instead of doing extremely bizarre things with
`serde:🇩🇪:Unexpected::Other`, note: this is a not problem for
expected, we know what we expect, we don't know what we received in
practice.
I decided to write a `NixHashWithMode::from_map` which will eat a map
deserialized via `serde_json`, so our serde magic is not totally "data
model" agnostic.
I wanted to go for data model agnosticity and enable maximal
performance, e.g. building the structure as the map values are streamed
in the Visitor, this is needlessly painful because `Output` and
`NixHashWithMode` are in different files and this really makes sense
only if we write the full implementation in one file, indeed, otherwise,
you end up duplicating the work or having strange coupling.
So, for now, we will allocate a full map of the fields inside the
`Output`, i.e. if any "unknown field" is in that map, we will
deserialize it for no reason.
Doing it properly, as I repeat it in the code and to flokli at C3Camp
2023, requires to patch serde upstream IMHO.
Change-Id: I46fe6ccb8c390c48d6934fd3e3f02a0dfe59557b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9107
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
We don't need rust-analyzer to run cargo doc.
Change-Id: I5e2fd559e4045cadeab24b438c28d6df7f1d5d5f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9092
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
cl/8306 fixed building all docs, but we forgot to update the comment.
Change-Id: I17829612f13e7357bd0efe8223cc28ed0f6cdea2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9091
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This `.into_iter()` call is equivalent to `.iter()` and will not consume
the `BTreeMap`.
Change-Id: Ie26637ebecb0bea5b09c447cc45ed207f8b50913
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9088
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
We only need bstr::ByteSlice to be able to use replace, it doesn't need
to return a BString.
Change-Id: I811948436fb89652e880970c2c05356183f3e439
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9084
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>