From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: nXML mode maintenance and enhancement Date: Wed, 23 May 2018 21:18:55 +0700 Message-ID: References: <87603e4lhz.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1527085042 3426 195.159.176.226 (23 May 2018 14:17:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 23 May 2018 14:17:22 +0000 (UTC) To: nyraghu27132@gmail.com, Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 23 16:17:18 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fLUZp-0000hq-4A for ged-emacs-devel@m.gmane.org; Wed, 23 May 2018 16:17:17 +0200 Original-Received: from localhost ([::1]:33737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLUbu-00025J-Ln for ged-emacs-devel@m.gmane.org; Wed, 23 May 2018 10:19:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLUbl-000251-98 for emacs-devel@gnu.org; Wed, 23 May 2018 10:19:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLUbf-0000RD-0M for emacs-devel@gnu.org; Wed, 23 May 2018 10:19:17 -0400 Original-Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:46187) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fLUbe-0000Qy-Ql for emacs-devel@gnu.org; Wed, 23 May 2018 10:19:10 -0400 Original-Received: by mail-oi0-x22d.google.com with SMTP id y15-v6so19608284oia.13 for ; Wed, 23 May 2018 07:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=d2pJT6YiWNX5ofEXX5j02b1nEb7W6U1LUUs4VA7spHA=; b=UObZd+I6cMncrx38uuctMmuuoPXHvNQORv3YcbgKv3Kr9jPN9uwM9ijbLr6cMHQuev flpb1s47bktd1G4hvU1Jn4hkVL+B4isbGlwCGZwW4nxXOkwj0RW8MxSkiUs4ZS4va5Ca ZMJ3SBaulhFtBRkL+8AQ0eyrIvZg2oLX6SopCJBUVLmDiA9AIA25oI+zdU30F2VhXPJ+ DYj5l8qwU6JdllQC9CGFDphyxH02pbb3jgAM/fJgJ9QrZ1uIDvPLUTR474UfVU9nN2VF 0TGlng1y32HAoy2wccqXGfCyJwaLX2o/sItNLfWiV2W3fqN20L0jAQShtFA2rI9wh/9r M+Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=d2pJT6YiWNX5ofEXX5j02b1nEb7W6U1LUUs4VA7spHA=; b=X4Q5gc5ptdTdoj5XZ8hUVvFGkbCFgzrGSYilqnrmt3/4ixF4wLLC1Af4Sie3R3+Eas lC5GD+ftfK0dAoi3twah1YKYoVlmiYs0XYqNDIId/hijmJHLWY2+DgERXlgb1jigFAX8 xjiIiQPl3cYO3Ozws2/IvrHIvahO71eQbJdqqYNP59CtI1KDwwaQ99EraUgiNGR3jZar OwnDdYKMioOKSEcBHmfcVS+nW/uCSAxAYFp3EZWj13YnceISp1zAR+Vetnk/3PaPz6wB GEvJzl9OlqiMYjTXpzGO3v22N8xz7Uh5z48TwN5yDAvc8UXyRITLxgMS20vTvefySBao KVYw== X-Gm-Message-State: ALKqPwcEpFw5cAUwroTVRDVlX+ZnP+ZUZrxO/gBCxfvI46jU/NNz1MuX W0p1niZNPlMwlq6mlbvvgbI3K56myvUE0qK/1+A= X-Google-Smtp-Source: AB8JxZo4qUiKwigtack68e4zfpZVHg7TnNnYuNfV+sRYMjegUDATp+iskzlKUEhrAN0VzUoaMXx/wXCT5GFL7cqSVDo= X-Received: by 2002:aca:cc0e:: with SMTP id c14-v6mr1455941oig.307.1527085146673; Wed, 23 May 2018 07:19:06 -0700 (PDT) In-Reply-To: <87603e4lhz.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225598 Archived-At: On Wed, May 23, 2018 at 7:15 PM N. Raghavendra wrote: > I would like to help with the maintenance and enhancement of nXML mode. > Here are some things which may be considered: > 1. Make indentation in nXML mode compatible with that in the official > SGML mode, and in the unofficial PSGML mode; the latter indentation > styles are arguably more natural, and followed by projects like the > FreeBSD Documentation Project. I had stumbled across this problem > recently, as in > https://lists.gnu.org/archive/html/help-gnu-emacs/2018-05/msg00009.ht= ml There is not and cannot be One True Way to indent XML, for all users and uses of nXML. XML formats are used for text markup languages such as XHTML and DocBook; configuration files; and various data files. The indentation rules in =E2=80=98nxml-indent-line=E2=80=99 are very much oriented towards data file= s =E2=80=94 as in, =E2=80=9Cadd a level of indentation for every unclosed opening tag; remove a level of indentation for every closing tag opened elsewhere, independent of the actual tag names=E2=80=9D. I am not well acquainted with PSGML, but I suspe= ct that it is is more text-markup-oriented. What I would like is a way to specify indentation rules depending on the XML schema, so that I could use one set of rules for XHTML, another for DocBook, a third one for FictionBook 2, and a default set for all other types of XML documents. I sort-of can do that now. This involves: hooking =E2=80=98rng-schema-chang= e-hook=E2=80=99; in the hook function, looking at =E2=80=98rng-current-schema=E2=80=99 to se= e if its =E2=80=98caddr=E2=80=99 is "html"; and, if so, pointing =E2=80=98indent-line-function=E2=80=99 at m= y own function that pretty much has to reimplement the whole of =E2=80=98nxml-indent-line= =E2=80=99 from scratch, in about 250 lines of Elisp. Maybe the first step would be to identify specific indentation rules people want, and provide building blocks for those. To give an example of things I customize *for the html schema only*: * Do not increase indentation level inside , , any inline elements, and any elements with flow content model (defined by enumerating all their tag names). Test

Lorem ipsum dolor sit amet, consectetur wgah=E2=80=99nagl fhtagn.

* Do increase indentation level inside a few select flow-content elements such as
  • . * Increase indentation level inside mixed content model elements (also defined by enumeration) if and only if they contain block elements (determined as no text following the opening tag on the same line).

    Paragraph 1 of quote

    Paragraph 2 of quote

    but:
    Lorem ipsum dolor sit amet
    * Increase indentation level of a
    immediately following a
    =E2=80= =A6
    , and decrease indentation level of a
    immediately following a
    =E2=80= =A6
    .
    Apple
    A type of fruit.
    A computer company.
    Banana
    Another type of fruit.
    * Never attempt to reindent inside