Subject: 26.1; nxml-mode indentation

From: David Carlisle <[email-masked]>
Date: Mon, 1 Oct 2018 10:44:37 +0100

loading the following xml into emacs -q

<x>
   <abc xx="x/x/x/x/x/x/x/
	   y/y/y/y/y/y/
	   ">
	   <zzz/>
   </abc>
   <nl>&#10;</nl>
</x>

and using indent-region on the whole file produces the layout shown
with <zzz/> indented to the level of the wrapped attribute.

Also unless nxml-char-ref-display-glyph-flag is set to nil, the #10
displays a newline so the display appears as

   <nl>&#10;
</nl>

so spoiling the visual indentation.
(In the actual use case in XSLT, the newlines are only entered as &#10;
rather than a literal newline to improve the indentation layout of the
stylesheet so having the newline displayed defeats this completely.)

Previous versions of nxml-mode (I had not updated emacs for a year, so I
am unsure of when exactly it changed) would indent the file as

<x>
   <abc xx="x/x/x/x/x/x/x/
	   y/y/y/y/y/y/
	   ">
     <zzz/>
   </abc>
   <nl>&#10;</nl>
</x>

With the indentation of <zzz/> correctly indicating the element nesting
and not being affected by the attribute wrapping in <abc..

Also it does not show a visual newline for #10, even when other numeric
references to printable characters do display the character, which was 
the desired behaviour.

In GNU Emacs 26.1 (build 1, x86_64-unknown-cygwin, GTK+ Version 3.22.28)
  of 2018-05-28 built on DESKTOP
Repository revision: d802fa4a0642157d7aff9a9d599785df7604e4d1
Windowing system distributor 'The Cygwin/X Project', version 11.0.12001000
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Using vacuous schema
Mark set
Indenting region...done
You can run the command ‘indent-region’ with C-M-\
Indenting region...done
Saving file /c/tmp/zz.xml...
Wrote /c/tmp/zz.xml
Making completion list... [2 times]

Configured using:
  'configure
  --srcdir=/home/kbrown/src/cygemacs/emacs-26.1-1.x86_64/src/emacs-26.1
  --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
  --docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C
  'CFLAGS=-ggdb -O2 -pipe -Wall -Werror=format-security
  -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong
  --param=ssp-buffer-size=4
 
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-26.1-1.x86_64/build=/usr/src/debug/emacs-26.1-1
 
-fdebug-prefix-map=/home/kbrown/src/cygemacs/emacs-26.1-1.x86_64/src/emacs-26.1=/usr/src/debug/emacs-26.1-1'
  CPPFLAGS= LDFLAGS='

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY ACL
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 THREADS LCMS2

Important settings:
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8-unix

Major mode: nXML

Minor modes in effect:
   tooltip-mode: t
   global-eldoc-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils rng-xsd xsd-regexp rng-cmpct
rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt
rng-util rng-pttrn nxml-ns easymenu nxml-mode nxml-outln nxml-rap
sgml-mode seq byte-opt gv bytecomp byte-compile cconv dom cl-loaddefs
cl-lib nxml-util nxml-enc xmltok elec-pair time-date mule-util tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind gfilenotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 113057 8213)
  (symbols 48 33275 2)
  (miscs 40 98 126)
  (strings 32 46130 1331)
  (string-bytes 1 1078054)
  (vectors 16 17170)
  (vector-slots 8 535364 10330)
  (floats 8 62 253)
  (intervals 56 351 0)
  (buffers 992 15))

Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.