guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs minor-mode highlight code stages (gexp & sexp)


From: Chris Marusich
Subject: Re: Emacs minor-mode highlight code stages (gexp & sexp)
Date: Fri, 10 Nov 2017 18:34:55 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Oleg Pykhalov <address@hidden> writes:

> Hello Guix,
>
> I found Emacs minor-mode for highlighting stages of code and send a
> request for release a tarball¹, so I could package it properly.
>
>
> Also I made a fork to add a support for G-Expressions and I will wait
> until close a request¹ before sending a patch.  You could try it now:
>
> $ git clone https://github.com/wigust/highlight-stages.git -b gexp
> $ cd CLONED_REPOSITORY_DIRECTORY
> $ guix package --install-from-file=guix.scm
>
>
> ¹ https://github.com/zk-phi/highlight-stages/issues/10
>
> Oleg.

Aw man, that's cool!  I didn't know this was a thing.  I love it
already.

I've only used it for about 5 minutes now, but I have one question: is
it possible to highlight gexps using a different color than other
"staged" code?  For example, it's a little strange that in
gnu/system/vm.scm, in procedure expression->derivation-in-linux-vm, the
quoted module list passed to source-module-closure is highlighted the
same color as the following gexp.  As I understand it,
source-module-closure will take the closure of modules from the host
environment and make it available in the store on the build side, so it
seems to me like this list of modules should not be highlighted as
build-side code.  I like that it highlights quoted expressions in
addition to gexps, but it would be even better if there were two color
"families" here: one for gexps (red, pink, salmon, etc. for different
levels of gexps), and one for regular quotes (blue, light blue, lilac,
etc).  That way, it would be easy to tell different stage levels apart,
and it would also be easy to tell different types of code staging apart.
What do you think?  Too much?

I've also noticed that the highlighting breaks down when using
ungexp-splicing inside of quasiquote inside of gexp.  For example, look
at gnu/tests/install.scm.  In run-install, after the first #~(begin, you
will find the following line:

               `(,(which #$(qemu-command system))

This line introduces a new level (shade) of highlighting.  I do see that
#$(qemu-command system) is correctly highlighted as host-side code (gray
for me, like most of the lines outside the gexp).  However, farther
down, on these lines, the highlighting seems to be incorrect:

                 #$@(cond
                     ((string=? "ext4" installation-disk-image-file-system-type)

Here, I believe that the expression following #$@ (the short form of
ungexp-splicing) should also be highlighted gray, since it is host-side
code.  However, it is highlighted the same color as the rest of the
build-side code in the gexp.  I believe this is happening because it
occurred within the quasiquote form, and the highlighting logic doesn't
realize that #$@ took us back out two levels instead of just one.

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]