all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* nXML mode maintenance and enhancement
@ 2018-05-23 12:14 N. Raghavendra
  2018-05-23 14:18 ` Yuri Khan
  2018-05-23 16:12 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: N. Raghavendra @ 2018-05-23 12:14 UTC (permalink / raw)
  To: emacs-devel

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.html

2. Addition of features in PSGML mode, e.g,

   a) Information about the schema: analogues of
      `sgml-describe-element-type', `sgml-list-elements', etc.

   b) Support for processing instructions such as, e.g.,

      <?PSGML ELEMENT foo nofill=t>

      which specify that a `foo' element should not be disturbed when
      filling a region; this is useful if one wants to fill a buffer
      containing verbatim elements such as program listings.

   c) Provision of more editing commands analogous to `sgml-tag-region',
      `sgml-auto-insert-required-elements', etc.

3. Support for XInclude.

4. Provision of a facility similar to RefTeX for manipulating
   cross-references in a modular document.

5. Analogues of `LaTeX-fill-region' and friends from AUCTeX.

6. More documentation.

I would like advice on how to proceed.

Thanks,
Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 12:14 nXML mode maintenance and enhancement N. Raghavendra
@ 2018-05-23 14:18 ` Yuri Khan
  2018-05-23 14:48   ` N. Raghavendra
  2018-05-23 16:12 ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Yuri Khan @ 2018-05-23 14:18 UTC (permalink / raw)
  To: nyraghu27132, Emacs developers

On Wed, May 23, 2018 at 7:15 PM N. Raghavendra <nyraghu27132@gmail.com>
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.html

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
‘nxml-indent-line’ are very much oriented towards data files — as in, “add
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”. I am not well acquainted with PSGML, but I suspect 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 ‘rng-schema-change-hook’;
in the hook function, looking at ‘rng-current-schema’ to see if its ‘caddr’
is "html"; and, if so, pointing ‘indent-line-function’ at my own function
that pretty much has to reimplement the whole of ‘nxml-indent-line’ 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 <html>, <body>, any inline
elements, and any elements with flow content model (defined by enumerating
all their tag names).

     <html>
     <head>
       <title>Test</title>
     </head>
     <body>
     <p>Lorem ipsum dolor sit amet,
     consectetur wgah’nagl fhtagn.</p>
     </body>
     </html>

* Do increase indentation level inside a few select flow-content elements
such as <li>.

* 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).

     <blockquote>
       <p>Paragraph 1 of quote</p>
       <p>Paragraph 2 of quote</p>
     </blockquote>

     but:

     <blockquote>Lorem ipsum
     dolor sit amet</blockquote>

* Increase indentation level of a <dd> immediately following a <dt>…</dt>,
and decrease indentation level of a <dt> immediately following a <dd>…</dd>.

     <dl>
     <dt>Apple</dt>
       <dd>A type of fruit.</dd>
       <dd>A computer company.</dd>
     <dt>Banana</dt>
       <dd>Another type of fruit.</dd>
     </dl>

* Never attempt to reindent inside <style>, <script>, <pre>, <code> and
<textarea>.

> 2. Addition of features in PSGML mode, e.g,

>     b) Support for processing instructions such as, e.g.,

>        <?PSGML ELEMENT foo nofill=t>

>        which specify that a `foo' element should not be disturbed when
>        filling a region; this is useful if one wants to fill a buffer
>        containing verbatim elements such as program listings.

Better to have this controlled by a customizable variable, so as not to
litter the document text with Emacs/nXML-specific instructions. Again, this
variable should be keyed by schema, and contain a list of element tag names
inside which filling is undesirable.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 14:18 ` Yuri Khan
@ 2018-05-23 14:48   ` N. Raghavendra
  2018-05-23 15:15     ` Yuri Khan
  0 siblings, 1 reply; 8+ messages in thread
From: N. Raghavendra @ 2018-05-23 14:48 UTC (permalink / raw)
  To: emacs-devel

At 2018-05-23T21:18:55+07:00, Yuri Khan wrote:

> There is not and cannot be One True Way to indent XML, for all users and
> uses of nXML.

Sure, the user can always change it.  Every mode comes with a default
indentation style.  I am only suggesting that the default indentation
rules of nXML conform to those of the SGML and PSGML modes.

> XML formats are used for text markup languages such as XHTML and DocBook;
> configuration files; and various data files. The indentation rules in
> ‘nxml-indent-line’ are very much oriented towards data files — as in, “add
> 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”. I am not well acquainted with PSGML, but I suspect that
> it is is more text-markup-oriented.

Yes, and PSGML provides a many more editing facilities for authors of
documents, than does nXML.

> I sort-of can do that now. This involves: hooking ‘rng-schema-change-hook’;
> in the hook function, looking at ‘rng-current-schema’ to see if its ‘caddr’
> is "html"; and, if so, pointing ‘indent-line-function’ at my own function
> that pretty much has to reimplement the whole of ‘nxml-indent-line’ from
> scratch, in about 250 lines of Elisp.

I wonder if you can share your code here; perhaps I or someone else can
try to adapt it into a general function in nXML.

>>     b) Support for processing instructions such as, e.g.,
>
>>        <?PSGML ELEMENT foo nofill=t>
>
>>        which specify that a `foo' element should not be disturbed when
>>        filling a region; this is useful if one wants to fill a buffer
>>        containing verbatim elements such as program listings.

Sure, one can have both the PI and variable customisation methods.  PIs
for editing have been a common facility in SGML and XML; for instance,
just today I saw that XMLMind has a PI mechanism for associating a RELAX
NG schema with a document.

Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 14:48   ` N. Raghavendra
@ 2018-05-23 15:15     ` Yuri Khan
  2018-05-23 17:15       ` N. Raghavendra
  0 siblings, 1 reply; 8+ messages in thread
From: Yuri Khan @ 2018-05-23 15:15 UTC (permalink / raw)
  To: nyraghu27132, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1568 bytes --]

On Wed, May 23, 2018 at 10:03 PM N. Raghavendra <nyraghu27132@gmail.com>
wrote:

> > There is not and cannot be One True Way to indent XML, for all users and
> > uses of nXML.

> Sure, the user can always change it.  Every mode comes with a default
> indentation style.  I am only suggesting that the default indentation
> rules of nXML conform to those of the SGML and PSGML modes.

And I’m suggesting that text markup languages constitute a small portion of
all XML-based formats, and thus the default rules might be good enough for
the majority of the formats.

> > [Customizing indentation] involves: hooking ‘rng-schema-change-hook’;
> > in the hook function, looking at ‘rng-current-schema’ to see if its
‘caddr’
> > is "html"; and, if so, pointing ‘indent-line-function’ at my own
function
> > that pretty much has to reimplement the whole of ‘nxml-indent-line’ from
> > scratch, in about 250 lines of Elisp.

> I wonder if you can share your code here; perhaps I or someone else can
> try to adapt it into a general function in nXML.

Why not. Warning, personal-use-quality code ahead.

Magic words, for all code in the attached file that is not copied from nxml:

I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.

[-- Attachment #2: yk-xhtml-indent.el --]
[-- Type: text/x-emacs-lisp, Size: 10115 bytes --]

(defvar yk-xhtml-zeroindent-tags
  (list "html"
        "title" "style"
        "body" "article" "section"
        "h1" "h2" "h3" "h4" "h5" "h6"
        "p" "pre" "figcaption" "main"
        "a" "em" "strong" "small" "s" "cite" "q" "dfn" "abbr" "data" "time"
        "code" "var" "samp" "kbd" "sub" "sup" "i" "b" "u" "mark"
        "ruby" "rb" "rt" "rtc" "rp" "bdi" "bdo" "span"
        "table" "caption"
        "script")
  "Tags whose elements’ content should not be indented. This
should include inline elements and may include container
elements for which indentation adds no value.")

(defvar yk-xhtml-conditional-indent-tags
  (list "blockquote" "ol" "ul" "dl"
        "ins" "del"
        "embed" "object" "video" "audio" "map"
        "td" "th"
        "button")
  "Tags whose elements’ content should be indented only if there
is no content on the same line with the opening tag. This should
include elements with mixed content model; they will indent if
used as block elements.")

(defvar yk-xhtml-sibling-indent-tags
  '((("dd" "dt") . 1) (("dt" "dd") . -1))
  "Tags which indent relative to their preceding sibling.

Format: List of triples of the form ((TAG SIBLING-TAG) . OFFSET).")

(defvar yk-xhtml-noindent-tags
  (list "style" "script" "pre" "code" "textarea")
  "Tags whose elements’ content should retain its indentation.")


(defun yk-xhtml--noindent-elements ()
  "Return 'noindent if within a noindent element, nil if not.

Destroys: xmltok state."
  (save-excursion
    (back-to-indentation)
    (catch 'yk-xhtml-indent-result
      (while (< (point-min) (point))
        (nxml-token-before)
        (let ((token-start xmltok-start))
          (cond
           ((eq xmltok-type 'start-tag)
            (if (member (xmltok-start-tag-local-name) yk-xhtml-noindent-tags)
                (throw 'yk-xhtml-indent-result 'noindent)
              (goto-char token-start)))
           ((eq xmltok-type 'end-tag)
            (condition-case nil
                (progn
                  (nxml-scan-element-backward (point))
                  (goto-char xmltok-start))
              (nxml-scan-error (goto-char token-start))))
           (t
            (goto-char token-start)))))
      nil)))


(defun yk-xhtml-compute-indent--for-closing-tag ()
  "Return indentation for a single closing tag on a line.

A closing tag indents to its opening tag if both tags are the
only non-whitespace content on their lines.

If the current line does not consist of a single closing tag,
or if there is no matching opening tag, or if there is other
content before the matching opening tag in the same line,
return nil.

Destroys: xmltok state."
  (save-excursion
    (back-to-indentation)
    (let ((bol (point)))
      (end-of-line)
      (skip-chars-backward " \t")
      (and ;; Current line contains only a closing tag
       (= (nxml-token-before) (point))
       (memq xmltok-type '(end-tag partial-end-tag))
       (= xmltok-start bol)
       ;; No content before the matching opening tag on its line
       (let ((tok-end
              (condition-case nil
                  (nxml-scan-element-backward
                   (point) nil
                   (- (point)
                      nxml-end-tag-indent-scan-distance))
                (nxml-scan-error nil))))
         (and tok-end
              ;; (progn
              ;;   (goto-char tok-end)
              ;;   (looking-at "[ \t]*$"))
              (progn
                (goto-char xmltok-start)
                (looking-back "^[ \t]*"))
              ;; If all conditions met, return opening tag indentation
              (current-column)))))))

(defun yk-xhtml-compute-indent--from-preceding-sibling ()
  "Return indentation relative to the preceding sibling element.

If the first token on the current line is an opening tag and the
previous line ends with a closing tag and the matching opening
tag starts a line, return the indentation of the sibling
element’s opening tag adjusted by the offset specified in
`yk-xhtml-sibling-indent-tags' multiplied by
`nxml-child-indent'. Otherwise, return nil.

Destroys: xmltok state."
  (save-excursion
    (catch 'yk-result
      (back-to-indentation)
      (nxml-token-after)
      (unless (eq xmltok-type 'start-tag) (throw 'yk-result nil))
      (let ((this-tag-name (xmltok-start-tag-local-name)))
        (forward-line -1)
        (end-of-line)
        (skip-chars-backward " \t")
        (nxml-token-before)
        (unless (eq xmltok-type 'end-tag) (throw 'yk-result nil))
        (let* ((preceding-tag-name (xmltok-end-tag-local-name))
               (pair (assoc (list this-tag-name preceding-tag-name)
                            yk-xhtml-sibling-indent-tags)))
          (unless pair (throw 'yk-result nil))
          (condition-case nil
              (nxml-scan-element-backward (point))
            (nxml-scan-error (throw 'yk-result nil)))
          (goto-char xmltok-start)
          (unless (looking-back "^[ \t]*") (throw 'yk-result nil))
          (+ (current-column)
             (* nxml-child-indent
                (cdr pair))))))))


(defun yk-xhtml-compute-indent--from-preceding-element ()
  "Return indentation of the preceding block element.

If the opening tag matching the closing tag before point
starts a line, return the indentation of the opening tag.
Otherwise (if there is no matching opening tag, or if there is
non-blank text preceding it on the line), return nil.

Expects: point immediately following a closing tag.

Destroys: point, xmltok state."
  (and (condition-case nil
           (nxml-scan-element-backward
            (point) nil
            (- (point) nxml-end-tag-indent-scan-distance))
         (nxml-scan-error nil))
       (progn
         (goto-char xmltok-start)
         (skip-chars-backward " \t")
         (bolp))
       (progn
         (goto-char xmltok-start)
         (current-column))))

(defun yk-xhtml--opening-tag ()
  "Analyze the opening tag after point.

Return a list of the form (TAG-NAME CLOSED MORE-TEXT), where:

 * TAG-NAME is a string containing the local name of the tag.
 * CLOSED is t if the element is closed before the end of line,
   nil otherwise.
 * MORE-TEXT is t if there is any non-whitespace following
   the opening tag, nil if only whitespace.

Return nil if point is not immediately preceding an opening tag.

Destroys: xmltok state."

  (let ((token-end (nxml-token-after)))
    (and (= xmltok-start (point))
         (eq xmltok-type 'start-tag)
         (let ((tag-name (xmltok-start-tag-local-name))
               (more-text (save-excursion
                            (goto-char token-end)
                            (not (looking-at "[ \t]*$")))))
           (let ((closing-tag-end
                  (condition-case nil
                      (nxml-scan-element-forward (point))
                    (nxml-scan-error nil)))
                 (eol (save-excursion
                        (end-of-line)
                        (point))))
             (list tag-name
                   (and closing-tag-end
                        (<= closing-tag-end eol))
                   more-text))))))

(defun yk-xhtml-compute-indent--from-previous-line ()
  "Compute the indentation based on the previous non-blank line.

 * If there is no previous line, return 0.
 * If the previous line ends with a closing tag
   and the corresponding opening tag starts a line,
   return the indentation of the opening tag.
 * If the previous line starts with text, return its indentation.
 * If the previous line starts with an opening tag:
   * If it is closed on the same line, or
   * if it is listed in `yk-xhtml-zeroindent-tags', or
   * if it is listed in `yk-xhtml-conditional-indent-tags' and
     there is no other text on the same line, return its indentation.
   * Otherwise, return its indentation plus `nxml-child-indent'.

If the previous line starts with an opening tag which is not
closed on the same line, return the indentation of that line plus
`nxml-child-indent'."
  (save-excursion
    (while (and (zerop (forward-line -1))
                (looking-at "[ \t]*$")))
    ;; now either at the first line or at start of a non-whitespace line
    (if (looking-at "[ \t]*$") ;; first line which is blank
        0
      (end-of-line)
      (let ((eol (point)))
        (skip-chars-backward " \t")
        (nxml-token-before)
        (or (and (eq xmltok-type 'end-tag)
                 (yk-xhtml-compute-indent--from-preceding-element))
            (progn
              (back-to-indentation)
              (pcase (yk-xhtml--opening-tag)
                (`(,tag-name ,closed ,more-text)
                 (if (or closed
                         (member tag-name yk-xhtml-zeroindent-tags)
                         (and (not more-text)
                              (member tag-name yk-xhtml-conditional-indent-tags)))
                     (current-column)
                   (+ (current-column) nxml-child-indent)))
                (_ (current-column)))))))))

(defun yk-xhtml--compute-indent ()
  "Compute indentation for the current line."
  (or (yk-xhtml--noindent-elements)
      (yk-xhtml-compute-indent--for-closing-tag)
      (yk-xhtml-compute-indent--from-preceding-sibling)
      (yk-xhtml-compute-indent--from-previous-line)
      'noindent))


(defun yk-xhtml-indent-line ()
  "Indent the current line suitably for XHTML."
  (let ((indent (yk-xhtml--compute-indent))
        (savep (> (point)
                  (save-excursion
                    (back-to-indentation)
                    (point)))))
    (if (not (numberp indent))
        indent
      (if savep
          (save-excursion
            (indent-line-to indent))
        (indent-line-to indent)))))

(defun yk-xhtml-indent--maybe-enable ()
  "Set the current buffer’s indentation function
to `yk-xhtml-indent-line' if the current schema is “html”."
  (and (stringp (caddr rng-current-schema))
       (string= (caddr rng-current-schema) "html")
    (set-variable 'indent-line-function 'yk-xhtml-indent-line 'local)))

(with-eval-after-load 'nxml-mode
  (add-hook 'nxml-mode-hook 'yk-xhtml-indent--maybe-enable))

(provide 'yk-xhtml-indent)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 12:14 nXML mode maintenance and enhancement N. Raghavendra
  2018-05-23 14:18 ` Yuri Khan
@ 2018-05-23 16:12 ` Stefan Monnier
  2018-05-23 17:34   ` N. Raghavendra
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2018-05-23 16:12 UTC (permalink / raw)
  To: emacs-devel

> 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.html

Yes, in general sharing more code between those modes would be great.
nXML's indentation algorithm is indeed one of its main weaknesses in
my experience.

> 2. Addition of features in PSGML mode, e.g,
> 3. Support for XInclude.
> 4. Provision of a facility similar to RefTeX for manipulating
>    cross-references in a modular document.

Yes, please!

> 5. Analogues of `LaTeX-fill-region' and friends from AUCTeX.

Not sure what this would do which the default fill-region wouldn't do
(once the indentation is improved)?

If I may add a personal wish: make it a bit more permissive with respect
to details of the header (or better help the user fix those headers) so
it's easier to use it for HTML5.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 15:15     ` Yuri Khan
@ 2018-05-23 17:15       ` N. Raghavendra
  0 siblings, 0 replies; 8+ messages in thread
From: N. Raghavendra @ 2018-05-23 17:15 UTC (permalink / raw)
  To: emacs-devel

At 2018-05-23T22:15:05+07:00, Yuri Khan wrote:

> And I’m suggesting that text markup languages constitute a small portion of
> all XML-based formats,

Perhaps, but even SGML was mostly used in industry, and data was a key
form of content in that usage.  So, the SGML mode indentation cannot be
assumed to be specifically friendly to textual content, and unfriendly
to data-centric content.  Secondly, SGML and XML files with data content
are typically generated by a program, and processed by another, so
indentation doesn't matter for them; the whole document could be in one
long line.

In summary, the current indentation scheme of nXML is probably
irrelevant to data-centric usage, but is unfriendly to textual usage.
The (P)SGML type of indentation also is irrelevant to data-centric
usage; it is, however, friendly to textual usage, as it conforms with
the indentation schemes of other Emacs modes for structured markup, as
in AUCTeX:

\begin{theorem}Let us suppose that the noumena have nothing to do with
  necessity, since knowledge of the Categories is a posteriori.  Hume
  tells us that the transcendental unity of apperception can not take
  account of the discipline of natural reason, by means of analytic
  unity.\end{theorem}

\begin{corollary}
  It remains a mystery why the Ideal stands in need of reason.  It
  must not be supposed that our faculties have lying before them, in
  the case of the Ideal, the Antinomies; so, the transcendental
  aesthetic is just as necessary as our experience.
\end{corollary}

The above indentation is exactly the one (P)SGML mode gives in the same
situation.

In any case, I have been told recently that I am not the first person
who has complained about nXML indentation!

> and thus the default rules might be good enough for the majority of
> the formats.

Just as I am suggesting that the (P)SGML indentation rules are also good
enough for most types of usage.  They have the added advantage of being
similar to the default indentation styles of other similar modes.

> Why not.

Thanks for sharing that.  I haven't looked at it closely yet, but it
looks like one can mimic it to define variables whose values are alists
in which the car of every element is a schema, and cdr a list of
elements in that schema which need a certain kind of indentation.  I'll
try to cook up something, and report here.

Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 16:12 ` Stefan Monnier
@ 2018-05-23 17:34   ` N. Raghavendra
  2018-05-23 17:49     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: N. Raghavendra @ 2018-05-23 17:34 UTC (permalink / raw)
  To: emacs-devel

At 2018-05-23T12:12:50-04:00, Stefan Monnier wrote:

>> 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.html
>
> Yes, in general sharing more code between those modes would be great.
> nXML's indentation algorithm is indeed one of its main weaknesses in
> my experience.
>
>> 2. Addition of features in PSGML mode, e.g,
>> 3. Support for XInclude.
>> 4. Provision of a facility similar to RefTeX for manipulating
>>    cross-references in a modular document.
>
> Yes, please!

Okay.  So I hope people will help if I come back here for help as I
attempt to implement some of the above things :-)

>> 5. Analogues of `LaTeX-fill-region' and friends from AUCTeX.
>
> Not sure what this would do which the default fill-region wouldn't do
> (once the indentation is improved)?

I don't know, but I use `LaTeX-fill-buffer' often, and it is a pleasure
to see it chugging along, saying "57% ..." and such things, and
eventually providing a buffer with the contents filled and indented
exactly as I would have done manually.  I don't have much experience
with `fill-region' in other modes; perhaps they work equally well.

> If I may add a personal wish: make it a bit more permissive with
> respect to details of the header (or better help the user fix those
> headers) so it's easier to use it for HTML5.

HTML5 is not an XML application, so I don't think nXML is the right mode
for it.  (It is not an SGML application, so (P)SGML is also
inappropriate for it.)  One possibility is to use the XHTML5 RELAX NG
schema from the Nu Validator,

https://github.com/validator/validator/blob/master/schema/html5/xhtml5.rnc

There is also an `html5.rnc' there, and I don't know what the difference
is.  I almost never write HTML manually, and have not used either of
them.

Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: nXML mode maintenance and enhancement
  2018-05-23 17:34   ` N. Raghavendra
@ 2018-05-23 17:49     ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2018-05-23 17:49 UTC (permalink / raw)
  To: emacs-devel

>>> 5. Analogues of `LaTeX-fill-region' and friends from AUCTeX.
>> Not sure what this would do which the default fill-region wouldn't do
>> (once the indentation is improved)?
> I don't know, but I use `LaTeX-fill-buffer' often,

Sorry, I was thinking of indent-region rather than fill-region.

Ideally, it also should be possible to hook into fill-region to do
whatever you want, but it's a long-standing missing functionality.

>> If I may add a personal wish: make it a bit more permissive with
>> respect to details of the header (or better help the user fix those
>> headers) so it's easier to use it for HTML5.
> HTML5 is not an XML application,

It's close enough for my use, with the GNU ELPA `html5-schema` package
(which should be improved to include SVG etc...).

> One possibility is to use the XHTML5 RELAX NG
> schema from the Nu Validator,

That's what html5-schema does.


        Stefan




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-23 17:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-23 12:14 nXML mode maintenance and enhancement N. Raghavendra
2018-05-23 14:18 ` Yuri Khan
2018-05-23 14:48   ` N. Raghavendra
2018-05-23 15:15     ` Yuri Khan
2018-05-23 17:15       ` N. Raghavendra
2018-05-23 16:12 ` Stefan Monnier
2018-05-23 17:34   ` N. Raghavendra
2018-05-23 17:49     ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.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.