GNU bug report logs - #32897
nxml-mode nxml-char-ref-extra-display for 
 (newline) is unwanted

Previous Next

Package: emacs;

Reported by: David Carlisle <davidc <at> nag.co.uk>

Date: Mon, 1 Oct 2018 15:23:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 26.1

Fixed in version 26.3

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32897 in the body.
You can then email your comments to 32897 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32897; Package emacs. (Mon, 01 Oct 2018 15:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Carlisle <davidc <at> nag.co.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 01 Oct 2018 15:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Carlisle <davidc <at> nag.co.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; nxml-mode indentation
Date: Mon, 1 Oct 2018 10:44:37 +0100
[Message part 1 (text/plain, inline)]

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. 
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32897; Package emacs. (Fri, 19 Apr 2019 17:43:01 GMT) Full text and rfc822 format available.

Message #8 received at 32897 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: David Carlisle <davidc <at> nag.co.uk>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 32897 <at> debbugs.gnu.org
Subject: Re: bug#32897: 26.1; nxml-mode indentation
Date: Fri, 19 Apr 2019 13:42:36 -0400
[Message part 1 (text/plain, inline)]
retitle 32897 nxml-mode nxml-char-ref-extra-display for &#10; (newline) is unwanted
severity 32897 minor
tags 32897 + patch
quit

[For the indentation aspect of this bug, see Bug#32003.]

David Carlisle <davidc <at> nag.co.uk> writes:

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

I assume this was changed by [1: 930f8e8377].  I guess can just special
case newline, it's the only character that has this problem that I can
think of.  This would be for emacs-26 since it's a regression.

[0001-Disable-extra-display-of-10-in-nxml-mode-Bug-32897.patch (text/x-diff, inline)]
From 689e90314f73fef3b2a7bdda183ca78101a5d449 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Fri, 19 Apr 2019 13:28:00 -0400
Subject: [PATCH] Disable extra display of &#10; in nxml-mode (Bug#32897)

* lisp/nxml/nxml-mode.el (nxml-char-ref-display-extra): Don't put
display for the newline, it makes the indentation look wrong.
---
 lisp/nxml/nxml-mode.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index f17f5843b8..14748d5c56 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -2378,7 +2378,9 @@ (defun nxml-toggle-char-ref-extra-display (arg)
 (put 'nxml-char-ref 'evaporate t)
 
 (defun nxml-char-ref-display-extra (start end n)
-  (when nxml-char-ref-extra-display
+  (when (and ;; Displaying literal newline is unhelpful.
+             (not eql n ?\n)
+             nxml-char-ref-extra-display)
     (let ((name (or (get-char-code-property n 'name)
                     (get-char-code-property n 'old-name)))
 	  (glyph-string (and nxml-char-ref-display-glyph-flag
-- 
2.11.0

[Message part 3 (text/plain, inline)]
[1: 930f8e8377]: 2016-01-15 10:29:20 -0500
  Update nXML to use Emacs's Unicode support, and lexical-binding
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=930f8e8377e40ba161bd16ea4d612cb4c570ee1b

Changed bug title to 'nxml-mode nxml-char-ref-extra-display for &#10; (newline) is unwanted' from '26.1; nxml-mode indentation' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Apr 2019 17:43:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Apr 2019 17:43:02 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Apr 2019 17:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32897; Package emacs. (Thu, 09 May 2019 11:46:01 GMT) Full text and rfc822 format available.

Message #17 received at 32897 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: David Carlisle <davidc <at> nag.co.uk>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 32897 <at> debbugs.gnu.org
Subject: Re: bug#32897: 26.1; nxml-mode indentation
Date: Thu, 09 May 2019 07:45:12 -0400
tags 32897 fixed
close 32897 26.3
quit

Noam Postavsky <npostavs <at> gmail.com> writes:

>> 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.
>
> I assume this was changed by [1: 930f8e8377].  I guess can just special
> case newline, it's the only character that has this problem that I can
> think of.  This would be for emacs-26 since it's a regression.

> Subject: [PATCH] Disable extra display of &#10; in nxml-mode (Bug#32897)
>
> * lisp/nxml/nxml-mode.el (nxml-char-ref-display-extra): Don't put
> display for the newline, it makes the indentation look wrong.

> +  (when (and ;; Displaying literal newline is unhelpful.
> +             (not eql n ?\n)
> +             nxml-char-ref-extra-display)

Added missing parens, and pushed to emacs-26.

e4cde42657 2019-05-09T06:42:40-04:00 "Disable extra display of &#10; in nxml-mode (Bug#32897)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e4cde42657f8f91f795e6b7041dc50b896dc468d





Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 09 May 2019 11:46:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.3, send any further explanations to 32897 <at> debbugs.gnu.org and David Carlisle <davidc <at> nag.co.uk> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 09 May 2019 11:46:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 07 Jun 2019 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 325 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.