[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] emacs: devel: Highlight 'modify-phases' keywords.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] emacs: devel: Highlight 'modify-phases' keywords. |
Date: |
Sun, 27 Sep 2015 22:29:13 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Kost <address@hidden> skribis:
>> ;; For Guix g-expressions.
>> (font-lock-add-keywords 'scheme-mode
>> '(("#~" . font-lock-keyword-face)
>> ("#\\$" . font-lock-keyword-face)
>> ("#\\+" . font-lock-keyword-face)))
>
> Great, what about the attached patch for adding these ones?
Looks good.
>> Similarly .dir-locals.el has ‘modify-syntax-entry’ stuff for gexps that
>> could maybe go to guix-devel.el?
>
> Yes, they could. So as you mention it, there is another thing I would
> like to add — complex indentation rules. Specifically, inherited
> packages are automatically indented like this:
>
> (package (inherit foo)
> (name "foo")
> ...)
>
> or this:
>
> (package
> (inherit foo)
> (name "foo")
> ...)
>
> while we want it to be:
>
> (package (inherit foo)
> (name "foo")
> ...)
>
> The following code may be used to handle this indentation:
>
> (defun guix-devel-package-indent (state indent-point normal-indent)
> (let ((count (if (and (ignore-errors (down-list) t)
> (looking-at "inherit\\>"))
> 1
> 0)))
> (lisp-indent-specform count state indent-point normal-indent)))
>
> (put 'package 'scheme-indent-function 'guix-devel-package-indent)
Nice! I like it, I think it would be a nice addition.
At the same time I wonder if defining sophisticated indentation rules is
a good idea in general. (Though this one was already defined anyway.)
> But it wouldn't work reliably because of ".dir-locals.el", as
> 'scheme-indent-function' property will be overridden every time a scheme
> file from git repo is visited. So my proposition is: what about moving
> all indentation rules from ".dir-locals.el" to "emacs/guix-devel.el"?
> So 'guix-devel-mode' will be responsible for all indenting, highlighting
> and other guix-specific things. WDYT?
Good question. .dir-locals.el includes a bunch of internal rules that
do not make sense outside.
For those who do make sense outside, such as rules for ‘package’, I
think having them in .dir-locals.el has the advantage that Emacs users
cannot escape them inadvertently. With guix-devel.el, there’s a greater
chance of people not loading it.
Unless .dir-locals.el has something like:
(eval . (load "emacs/guix-devel.el")) ;…
?
Thoughts?
> From 13ebd00178d1f6139da4c1f76a2e358935ce16f0 Mon Sep 17 00:00:00 2001
> From: Alex Kost <address@hidden>
> Date: Sat, 26 Sep 2015 22:42:07 +0300
> Subject: [PATCH] emacs: devel: Highlight gexp symbols.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès <address@hidden>.
>
> * emacs/guix-devel.el (guix-devel-gexp-symbol): New face.
> (guix-devel-font-lock-keywords): Adjust to handle gexp symbols.
OK.
Thanks,
Ludo’.