Sourcegraph uses a component called syntect_server to syntax-highlight
source files.
Since we already have custom syntaxes, overrides and configuration we
might as well use them with Sourcegraph!
This implements the syntect_server "protocol" (it's just a single
endpoint) so that we can swap out the syntect_server component with
cheddar.
Note: There's a few clippy lints here, but they're being solved in a
followup commit because I wanted to take care of all of them at
once (not just the ones introduced in this change).
Change-Id: Ib518a2fa1b9fee299fe599482403599583cac479
Reviewed-on: https://cl.tvl.fyi/c/depot/+/509
Reviewed-by: lukegb <lukegb@tvl.fyi>
This function opens the depot in magit. By default the depot path is
assumed to be `/depot`, but that is made available as a customise
option that users can override.
Change-Id: Iefc127cad515dbae330d7af3aa69a0c53aa02015
Reviewed-on: https://cl.tvl.fyi/c/depot/+/504
Reviewed-by: glittershark <grfn@gws.fyi>
Introduces two new shortcuts in the magit popup for pushing:
* R: Push for review
* S: Push to submit
The existing "P" command remains, but has been renamed to
"rubberstamp" and documented with a warning.
To make this work across people's different setups, customisation
options for TVL-specific code are being added.
Change-Id: I48e75db55b5f793342fc898093629e437f58dcb2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/503
Reviewed-by: glittershark <grfn@gws.fyi>
Add a simple tvl.el, with only one magit transient command to push and
submit in one go to Gerrit
Change-Id: If02065797a8db39669b85acf87a1c4b43d1482ee
Reviewed-on: https://cl.tvl.fyi/c/depot/+/494
Reviewed-by: tazjin <mail@tazj.in>
This paves the way for using other things than stdin/stdout as
sources/sinks, which is required for example for implementing a
syntect_server replacement based on cheddar.
Change-Id: I5779db8dbf7b7ced109c26b940f721d237d60785
Reviewed-on: https://cl.tvl.fyi/c/depot/+/491
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: lukegb <lukegb@tvl.fyi>
The complexity of the arg parsing is increasing somewhat because we're
adding more features to cheddar, so to set us up for that this
switches the arg parsing to the somewhat more flexible clap.
Change-Id: I187bc0c1b6c6bd596fa0f6bb494b04e335262ba9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/445
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: tazjin <mail@tazj.in>
We can always revert this if we want it back.
Change-Id: I1332b6dd541199584b7b5b94a8651172d79e53a9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/442
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: lukegb <lukegb@tvl.fyi>
This was actually executing ssh, which was kinda silly - we really just
want to check the return code of the `which` invocation
Change-Id: I8a4b277a2be3b0c6a43d2da830cb82a32f9ee51e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/428
Reviewed-by: tazjin <mail@tazj.in>
Add a script to run gerrit commands on the depot host, which reads the
gerrit username from the TVL_USERNAME env var or $(whoami) by default.
At some point this may want to solve the configuration problem in a more
general fashion, but for now this seems relatively obvious.
Change-Id: Ied91c1d26daf4770aef74b2e755d1760c486bb7b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/396
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
Assuming you're in `/depot/fun/clbot`, you can do this:
tazjin@frog /d/f/clbot (master)> depot-build
Building //fun/clbot
/nix/store/i1zc6g58wa4819kyhaqi12zsh3hr31ph-clbot
It is automatically added to the $PATH using direnv, too.
Change-Id: Ia3341704e6317c2b8de40a3fa1be3b680d21a42d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/388
Reviewed-by: eta <eta@theta.eu.org>
Adds a mechanism for per-filename overrides of the chosen language
syntax and configures it for Gerrit's submit rule file.
This also switches the syntax set used to the one from
//third_party/bat_syntaxes, which contains custom additions such as
Prolog support.
Change-Id: I2023dbad5b326305ef2ef0ecf34ef66a3f7575ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/349
Reviewed-by: riking <rikingcoding@gmail.com>
Reviewed-by: lukegb <lukegb@tvl.fyi>
This enables half of the shortcuts for switching keyboard languages
when EXWM launches.
The cyrillic ones are commented out because Emacs doesn't start
otherwise, I've no idea why and don't care at the moment.
These records have so many fields that it's difficult to track what's
what in a long list. For convenience they're now specified in plist
format (see the example).
There isn't really a point to this because the SOA record is the one I
care the *least* about practically as Cloud DNS sets it for me, but
whatever.
vauxhall (my laptop) now has an additional screen connected at home,
but sometimes I use that screen for my desktop computer (nugget).
This refactors the randr configuration for EXWM to support somewhat
more dynamic, multi-monitor layouts and adds key bindings to toggle
between some of the different configurations I want.
Modifies notmuch-show-open-or-close-subthread to take a parameter
instead of using prefix to toggle the argument, and binds that
function to C-, and C-. in notmuch-show-mode-map to enable convenient
collapsing/uncollapsing of subthreads from point.
Configures org-journal to store journal files on camden and encrypt
them to my GPG key.
Journal entries are weekly, with weeks starting Saturday (yes, there's
a reason for this).
This uses the built-in chart.el library to create a quick graph of the
number of unread emails in each notmuch tag. Some generic tags are
excluded from the overview.
Cheddar now needs to be passed the --about-filter flag to toggle the
behaviour for rendering Markdown into HTML.
By default Markdown will be highlighted like normal source code (i.e.
cgit source-filtering is the default behaviour).
This advice is potentially defined before the autoloads for telega
have run, which means that the macro-expansion fails and
`telega-ins-fmt` is looked up as a function.
With this setup the initialisation works as expected.
The lambda that acts as the sentinel for building SBCL with packages
needs to be able to capture variables if lexical binding is enabled,
which is made possible by the lexical-let form.
Adds a function that can launch Sly with a pre-configured SBCL for a
Lisp derivation in the depot.
This makes it convenient to spin up development environments for Lisp
libraries and programs by simply calling `M-x nix/sly-from-depot RET
tools.something`.
This relies on `nix-depot-path` being configured currently as I have
not yet reliably added the depot to my NIX_PATH on all machines.
Sets up Lisp modes in Sly REPL and points at the local hyperspec
checkout.
In fact the Hyperspec bit should probably be managed by Nix, but one
step at a time.
Implements support for tagging paragraphs that begin with a callout
word (TODO, WARNING, QUESTION, TIP) with an additional `cheddar-*`
class that makes it possible to render these callouts specially.
This is currently not the nicest implementation, but it works.
Since I am going down the path of adding additional Markdown
extensions it makes sense to avoid letting `format_markdown` turn into
a giant beast of a function.
Therefore this commit extracts the logic for rendering code blocks via
syntect and changes the innards of `format_markdown` to instead
provide arbitrary AST value replacements.
Instead of splitting below and moving the target buffer into the new
split, split and move the buffer into the active window.
The other way around does (for some reason I don't fully understand)
not work because `split-window-below` may return invalid windows.
Configures edwina using `s-w` as the key prefix (in line with my other
EXWM-related commands).
An additional function is added that switches to a buffer (borrowing
the implementation from `ivy-switch-buffer`) but splitting it into a
new window instead.
Implements fully static (i.e. no JavaScript!) highlighting of code
blocks when rendering Markdown.
This works by walking through the Comrak AST and replacing any code
blocks with pre-rendered HTML blocks.
Syntaxes are chosen based on the "block info", which is the string
users put after the block's opening fence. This can either be
a (case-insensitive) name of a syntax, or alternatively a file
extension associated with the desired syntax.
The theme is set to one that imitates GitHub.
Renders any ".md" file by pushing it through the Comrak rendering
pipeline.
This does not yet implement syntax highlighting of fenced blocks, but
we're getting there.
Generalises the two bits of the program that will be required either
way (extension parsing and syntax loading).
A dependency on Comrak is introduced as I think GitHub-flavoured
Markdown (with all its fancy extensions) is desirable!
This uses Nix to inject the path to the syntax highlighting assets
that ship with the bat source code into the cheddar build at compile
time, where the Rust compiler then inserts it into the binary via
macros.
bat has a lot of custom syntax highlighting definitions that they
collected from all over the place (including for languages like Nix!)
and this makes them accessible to cheddar.
Also if you're reading this, can you just take a moment to appreciate
how incredible it is that Nix just lets us do something like this?!
The first step with this tool will be to use it as a source-filter for
cgit. The second step is to use it as the Markdown renderer by
depending on one of the Markdown libraries, with integration for
rendering code snippets directly.
This moves the various projects from "type-based" folders (such as
"services" or "tools") into more appropriate semantic folders (such as
"nix", "ops" or "web").
Deprecated projects (nixcon-demo & gotest) which only existed for
testing/demonstration purposes have been removed.
(Note: *all* builds are broken with this commit)
Packages the telega-server binary and adds the required mode into
Emacs.
Unread message count is displayed in the modeline, which is neat.
Probably need to figure out some key bindings for this.
Adds an Emacs library with so far a grand total of one helper function
that can prefetch and insert a git repository at point.
This is very useful for the various Go repo imports I am doing at the
moment.
This makes it possible to quickly adjust the size of text in all
frames using one keyboard shortcut. Each of these functions
understands a prefix argument to mean "please only operate on the
current buffer", hence the following bindings and effects:
Global:
* `C-=`: Increase the global font size (chosen because `+` lies on the
`=` key)
* `C--`: Decrease the global font size
* `C-x C-0`: Restore the global default font size
Local:
* `C-u C-=`: Increase the local font size
* `C-u C--`: Decrease the local font size
* `C-u C-x C-0`: Restore the local default font size
This function makes it possible to build an Emacs instance that,
instead of launching an Emacs built by Nix, configures an Emacs
already present on the system to use the packages built by Nix.
This **requires** that the versions of the two Emacsen (i.e. the one
used by Nix to build and the one used to run the packages) are kept in
sync, otherwise byte-code incompatibilities may lead to undefined
behaviour.
Exposes an `overrideEmacs` which can take a package function that
receives the current package list and can make arbitrary modifications
to it.
This makes it possible for me to maintain a private overlay for e.g.
work purposes with packages that should not be visible in my public
repos.
This was set to my old home directory name from a different machine
and I had low-key been wondering why it didn't work, but not enough to
go do something about it.
This incredible package provides a fully functional, libvterm based
terminal emulator inside of Emacs.
Killer feature: It's possible to switch the buffer into a full Emacs
text mode (read-only) for selections and such.
Adds a "do what I mean" multiple-cursor selection with the logic that
I find most useful:
* If there is no active region, mark the next line (or lines, based on
prefix argument)
* If there is an active region that spans multiple lines, call
`mc/edit-lines`
* If there is an active region on a single line, trigger a custom
selection hydra with functionality equivalent to
`mc/mark-more-like-this-extended` but a slightly improved user
experience
Hopefully this will make it easier to get into the habit of actually
using multiple-cursors without calling the mc commands via M-x
This enables usage of __dispatch.sh from anywhere, even outside of the
depot.
Specifically this means I can add `~/depot/bin` to my $PATH and all
the registered tools work from anywhere.