From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] emacs: devel: Highlight 'modify-phases' keywords. Date: Sun, 27 Sep 2015 22:29:13 +0200 Message-ID: <87si5zwqqu.fsf@gnu.org> References: <871tdm6i0i.fsf@gmail.com> <8737y28fss.fsf@gnu.org> <87d1x57yhg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgIg2-0005F5-3G for guix-devel@gnu.org; Sun, 27 Sep 2015 16:36:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgIfx-0002Ws-Ef for guix-devel@gnu.org; Sun, 27 Sep 2015 16:36:06 -0400 In-Reply-To: <87d1x57yhg.fsf@gmail.com> (Alex Kost's message of "Sat, 26 Sep 2015 22:48:59 +0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Kost Cc: guix-devel@gnu.org Alex Kost 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 =E2=80=98modify-syntax-entry=E2=80=99 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 =E2=80=94 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 =E2=80=98package=E2= =80=99, I think having them in .dir-locals.el has the advantage that Emacs users cannot escape them inadvertently. With guix-devel.el, there=E2=80=99s a gr= eater chance of people not loading it. Unless .dir-locals.el has something like: (eval . (load "emacs/guix-devel.el")) ;=E2=80=A6 ? Thoughts? > From 13ebd00178d1f6139da4c1f76a2e358935ce16f0 Mon Sep 17 00:00:00 2001 > From: Alex Kost > 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=3DUTF-8 > Content-Transfer-Encoding: 8bit > > Suggested by Ludovic Court=C3=A8s . > > * emacs/guix-devel.el (guix-devel-gexp-symbol): New face. > (guix-devel-font-lock-keywords): Adjust to handle gexp symbols. OK. Thanks, Ludo=E2=80=99.