* Emacs minor-mode highlight code stages (gexp & sexp) @ 2017-11-09 9:33 Oleg Pykhalov 2017-11-10 22:51 ` Ludovic Courtès 2017-11-11 2:34 ` Chris Marusich 0 siblings, 2 replies; 10+ messages in thread From: Oleg Pykhalov @ 2017-11-09 9:33 UTC (permalink / raw) To: guix-devel 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. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-09 9:33 Emacs minor-mode highlight code stages (gexp & sexp) Oleg Pykhalov @ 2017-11-10 22:51 ` Ludovic Courtès 2017-11-13 21:33 ` Oleg Pykhalov 2017-11-11 2:34 ` Chris Marusich 1 sibling, 1 reply; 10+ messages in thread From: Ludovic Courtès @ 2017-11-10 22:51 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 231 bytes --] Hi Oleg, Oleg Pykhalov <go.wigust@gmail.com> skribis: > I found Emacs minor-mode for highlighting stages of code and send a > request for release a tarball¹, so I could package it properly. Woow, this is really cool! [-- Attachment #2: sample --] [-- Type: image/png, Size: 113619 bytes --] [-- Attachment #3: Type: text/plain, Size: 378 bytes --] > 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 Works for me! I’ve augmented the regexp to match the long forms: [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #4: Type: text/x-patch, Size: 786 bytes --] diff --git a/highlight-stages.el b/highlight-stages.el index dfaf220..e11260e 100644 --- a/highlight-stages.el +++ b/highlight-stages.el @@ -244,7 +244,7 @@ non-nil, (match-string 0) must be the expression matched." (progn (ignore-errors (forward-sexp 1)) (point))))))) (defun highlight-stages-lisp-escape-matcher (&optional limit) - (when (highlight-stages--search-forward-regexp ",@?\\|([\s\t\n]*\\\\,@?+[\s\t\n]+\\|#\\$" limit) + (when (highlight-stages--search-forward-regexp ",@?\\|([\s\t\n]*\\\\,@?+[\s\t\n]+\\|\\(unquote\\)\\|\\(unquote-splicing\\)\\|\\(ungexp-native\\)\\|\\(ungexp-splicing\\)\\|\\(ungexp-native-splicing\\)\\|\\(ungexp\\)\\|#\\$" limit) (set-match-data (list (point) (progn (ignore-errors (forward-sexp 1)) (point)))) [-- Attachment #5: Type: text/plain, Size: 26 bytes --] Thank you! Ludo’. ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-10 22:51 ` Ludovic Courtès @ 2017-11-13 21:33 ` Oleg Pykhalov 0 siblings, 0 replies; 10+ messages in thread From: Oleg Pykhalov @ 2017-11-13 21:33 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 529 bytes --] Hello Ludovic, ludo@gnu.org (Ludovic Courtès) writes: >> 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 > > Works for me! I’ve augmented the regexp to match the long forms: Thanks! I've pushed to fork as 5a58b94ee3183dd47e3a54e9f35404f9fbeee28d Oleg. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-09 9:33 Emacs minor-mode highlight code stages (gexp & sexp) Oleg Pykhalov 2017-11-10 22:51 ` Ludovic Courtès @ 2017-11-11 2:34 ` Chris Marusich 2017-11-11 13:54 ` Ludovic Courtès 1 sibling, 1 reply; 10+ messages in thread From: Chris Marusich @ 2017-11-11 2:34 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 2868 bytes --] Oleg Pykhalov <go.wigust@gmail.com> 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 #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-11 2:34 ` Chris Marusich @ 2017-11-11 13:54 ` Ludovic Courtès 2017-11-11 16:58 ` Chris Marusich 0 siblings, 1 reply; 10+ messages in thread From: Ludovic Courtès @ 2017-11-11 13:54 UTC (permalink / raw) To: Chris Marusich; +Cc: guix-devel Chris Marusich <cmmarusich@gmail.com> skribis: > 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? Then we’re going to ask too much, like how should it highlight something like: `(foo ,#~(bar '#$baz)) ? :-) The next thing will be to make Geiser aware of staged code… Ludo’. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-11 13:54 ` Ludovic Courtès @ 2017-11-11 16:58 ` Chris Marusich 2017-11-22 6:21 ` Oleg Pykhalov 2017-11-22 6:46 ` Oleg Pykhalov 0 siblings, 2 replies; 10+ messages in thread From: Chris Marusich @ 2017-11-11 16:58 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 530 bytes --] ludo@gnu.org (Ludovic Courtès) writes: > Chris Marusich <cmmarusich@gmail.com> skribis: > >> 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? > > Then we’re going to ask too much, like how should it highlight something > like: > > `(foo ,#~(bar '#$baz)) > > ? > > :-) OK, that's fair. > The next thing will be to make Geiser aware of staged code… That would be really nice. -- Chris [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-11 16:58 ` Chris Marusich @ 2017-11-22 6:21 ` Oleg Pykhalov 2017-11-24 13:23 ` Ludovic Courtès 2017-11-22 6:46 ` Oleg Pykhalov 1 sibling, 1 reply; 10+ messages in thread From: Oleg Pykhalov @ 2017-11-22 6:21 UTC (permalink / raw) To: Chris Marusich; +Cc: guix-devel [-- Attachment #1.1: Type: text/plain, Size: 133 bytes --] Hello, Still no reply on https://github.com/zk-phi/highlight-stages/issues/10 I prepared a patch and could merge it if you agree. [-- Attachment #1.2: [PATCH] gnu: Add emacs-highlight-stages. --] [-- Type: text/x-patch, Size: 4435 bytes --] From aad1089320315f58147d84e7ff35b3f1f89032a9 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov <go.wigust@gmail.com> Date: Wed, 22 Nov 2017 09:10:24 +0300 Subject: [PATCH] gnu: Add emacs-highlight-stages. * gnu/packages/emacs.scm (emacs-highlight-stages): New variable. --- gnu/local.mk | 1 + gnu/packages/emacs.scm | 25 +++++++++++++++++++++ .../patches/emacs-highlight-stages-add-gexp.patch | 26 ++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 gnu/packages/patches/emacs-highlight-stages-add-gexp.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0993c4587..46095ca95 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -608,6 +608,7 @@ dist_patch_DATA = \ %D%/packages/patches/einstein-build.patch \ %D%/packages/patches/emacs-exec-path.patch \ %D%/packages/patches/emacs-fix-scheme-indent-function.patch \ + %D%/packages/patches/emacs-highlight-stages-add-gexp.patch \ %D%/packages/patches/emacs-scheme-complete-scheme-r5rs-info.patch \ %D%/packages/patches/emacs-source-date-epoch.patch \ %D%/packages/patches/erlang-man-path.patch \ diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index e7e93f154..71a47978e 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -4851,6 +4851,31 @@ jQuery and Bootstrap resources included via osscdn.") "This Emacs package highlights the s-exp at the current position.") (license license:gpl3+))) +(define-public emacs-highlight-stages + (let ((commit "29cbc5b78261916da042ddb107420083da49b271") + (revision "1")) + (package + (name "emacs-highlight-stages") + (version (string-append "1.1.0" "-" revision "." (string-take commit 7))) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/zk-phi/highlight-stages.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "0r6nbcrr0dqpgm8dir8ahzjy7rw4nrac48byamzrq96r7ajlxlv0")) + (patches + (search-patches "emacs-highlight-stages-add-gexp.patch")))) + (build-system emacs-build-system) + (home-page "https://github.com/wigust/highlight-stages") + (synopsis "Minor mode that highlights (quasi-quoted) expressions") + (description "@code{highlight-stages} provides an Emacs minor mode that +highlights quasi-quoted expressions.") + (license license:gpl3+)))) + (define-public emacspeak (package (name "emacspeak") diff --git a/gnu/packages/patches/emacs-highlight-stages-add-gexp.patch b/gnu/packages/patches/emacs-highlight-stages-add-gexp.patch new file mode 100644 index 000000000..931355b4f --- /dev/null +++ b/gnu/packages/patches/emacs-highlight-stages-add-gexp.patch @@ -0,0 +1,26 @@ +Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com> +Copyright © 2017 Ludovic Courtès <ludo@gnu.org> + +This patch adds highlighting for (guix) G-Expressions. + +diff --git a/highlight-stages.el b/highlight-stages.el +index 3094c3c..e11260e 100644 +--- a/highlight-stages.el ++++ b/highlight-stages.el +@@ -237,14 +237,14 @@ non-nil, (match-string 0) must be the expression matched." + + (defun highlight-stages-lisp-quote-matcher (&optional limit) + (when (highlight-stages--search-forward-regexp +- "\\(?:`\\|\\(#?'\\)\\)\\|([\s\t\n]*\\(?:backquote\\|\\(quote\\)\\)[\s\t\n]+" limit) ++ "\\(?:`\\|\\(#?'\\)\\)\\|([\s\t\n]*\\(?:backquote\\|\\(quote\\)\\)[\s\t\n]+\\|\\(?:#~\\)\\|([\s\t\n]*\\(?:gexp\\)[\s\t\n]+" limit) + (prog1 (if (or (match-beginning 1) (match-beginning 2)) 'real t) + (set-match-data + (list (point) + (progn (ignore-errors (forward-sexp 1)) (point))))))) + + (defun highlight-stages-lisp-escape-matcher (&optional limit) +- (when (highlight-stages--search-forward-regexp ",@?\\|([\s\t\n]*\\\\,@?+[\s\t\n]+" limit) ++ (when (highlight-stages--search-forward-regexp ",@?\\|([\s\t\n]*\\\\,@?+[\s\t\n]+\\|\\(unquote\\)\\|\\(unquote-splicing\\)\\|\\(ungexp-native\\)\\|\\(ungexp-splicing\\)\\|\\(ungexp-native-splicing\\)\\|\\(ungexp\\)\\|#\\$" limit) + (set-match-data + (list (point) + (progn (ignore-errors (forward-sexp 1)) (point)))) -- 2.15.0 [-- Attachment #1.3: Type: text/plain, Size: 15 bytes --] Thanks, Oleg. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-22 6:21 ` Oleg Pykhalov @ 2017-11-24 13:23 ` Ludovic Courtès 2017-11-24 21:59 ` Oleg Pykhalov 0 siblings, 1 reply; 10+ messages in thread From: Ludovic Courtès @ 2017-11-24 13:23 UTC (permalink / raw) To: Oleg Pykhalov; +Cc: guix-devel Hi! Oleg Pykhalov <go.wigust@gmail.com> skribis: > Still no reply on https://github.com/zk-phi/highlight-stages/issues/10 OK. > I prepared a patch and could merge it if you agree. > > From aad1089320315f58147d84e7ff35b3f1f89032a9 Mon Sep 17 00:00:00 2001 > From: Oleg Pykhalov <go.wigust@gmail.com> > Date: Wed, 22 Nov 2017 09:10:24 +0300 > Subject: [PATCH] gnu: Add emacs-highlight-stages. > > * gnu/packages/emacs.scm (emacs-highlight-stages): New variable. Sure, LGTM, thanks! Ludo’. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-24 13:23 ` Ludovic Courtès @ 2017-11-24 21:59 ` Oleg Pykhalov 0 siblings, 0 replies; 10+ messages in thread From: Oleg Pykhalov @ 2017-11-24 21:59 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guix-devel ludo@gnu.org (Ludovic Courtès) writes: >> I prepared a patch and could merge it if you agree. >> >> From aad1089320315f58147d84e7ff35b3f1f89032a9 Mon Sep 17 00:00:00 2001 >> From: Oleg Pykhalov <go.wigust@gmail.com> >> Date: Wed, 22 Nov 2017 09:10:24 +0300 >> Subject: [PATCH] gnu: Add emacs-highlight-stages. >> >> * gnu/packages/emacs.scm (emacs-highlight-stages): New variable. > > Sure, LGTM, thanks! > > Ludo’. Pushed as 7a45268935f2319ae8349cafd858495dfc891a50 Oleg. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Emacs minor-mode highlight code stages (gexp & sexp) 2017-11-11 16:58 ` Chris Marusich 2017-11-22 6:21 ` Oleg Pykhalov @ 2017-11-22 6:46 ` Oleg Pykhalov 1 sibling, 0 replies; 10+ messages in thread From: Oleg Pykhalov @ 2017-11-22 6:46 UTC (permalink / raw) To: Chris Marusich; +Cc: guix-devel Probably need to append to commit message: * gnu/packages/patches/emacs-highlight-stages-add-gexp.patch: New file. * gnu/local.mk (dist_patch_DATA): Add this. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-11-24 22:00 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-09 9:33 Emacs minor-mode highlight code stages (gexp & sexp) Oleg Pykhalov 2017-11-10 22:51 ` Ludovic Courtès 2017-11-13 21:33 ` Oleg Pykhalov 2017-11-11 2:34 ` Chris Marusich 2017-11-11 13:54 ` Ludovic Courtès 2017-11-11 16:58 ` Chris Marusich 2017-11-22 6:21 ` Oleg Pykhalov 2017-11-24 13:23 ` Ludovic Courtès 2017-11-24 21:59 ` Oleg Pykhalov 2017-11-22 6:46 ` Oleg Pykhalov
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.