bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#27552: 25.2.50; Indentation problem in rnc-mode


From: Lars Ingebrigtsen
Subject: bug#27552: 25.2.50; Indentation problem in rnc-mode
Date: Tue, 17 May 2022 21:25:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Ivan Andrus <darthandrus@gmail.com> writes:

> The RNC snippet below (from
> http://cs.brown.edu/courses/cs196-9/slidestore/relaxng.html) shows an
> indentation problem when using multiple opening namespace/datatypes
> clauses.
>
> -Ivan
>
> default namespace rng = "http://relaxng.org/ns/structure/1.0";
>                             namespace local = ""
>                                                   datatypes xsd = 
> "http://www.w3.org/2001/XMLSchema-datatypes";
>
> start = pattern
>
> pattern =
>     element element { (nameQName | nameClass), (common & pattern+) }
>     | element attribute { (nameQName | nameClass), (common & pattern?) }
>     | element group|interleave|choice|optional


(defun rnc-smie-rules (kind token)
  (pcase (cons kind token)
    (`(:list-intro . "element") t)
    (`(:elem . empty-line-token) " ; ")
    (`(:before . ,(or "include" "default" "namespace" "datatypes")) 0)
[...]
    (`(:after . ,(or "=" "|=" "&=")) smie-indent-basic)

I guess this "=" rule is for stuff like the "pattern =" etc.  But it
leads to things like this being indented more for each line:

default namesace rng = "http://relaxng.org/ns/structure/1.0";
namespace local = ""
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes";

I betcha this is easy to express in smie, but I have no idea how, so
I've added Stefan to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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