unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32897: 26.1; nxml-mode indentation
@ 2018-10-01  9:44 David Carlisle
  2019-04-19 17:42 ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: David Carlisle @ 2018-10-01  9:44 UTC (permalink / raw)
  To: 32897

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



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. 

[-- Attachment #2: Type: text/html, Size: 6744 bytes --]

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

* bug#32897: 26.1; nxml-mode indentation
  2018-10-01  9:44 bug#32897: 26.1; nxml-mode indentation David Carlisle
@ 2019-04-19 17:42 ` Noam Postavsky
  2019-05-09 11:45   ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2019-04-19 17:42 UTC (permalink / raw)
  To: David Carlisle; +Cc: Stefan Monnier, 32897

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1101 bytes --]

From 689e90314f73fef3b2a7bdda183ca78101a5d449 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@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


[-- Attachment #3: Type: text/plain, Size: 208 bytes --]


[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

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

* bug#32897: 26.1; nxml-mode indentation
  2019-04-19 17:42 ` Noam Postavsky
@ 2019-05-09 11:45   ` Noam Postavsky
  0 siblings, 0 replies; 3+ messages in thread
From: Noam Postavsky @ 2019-05-09 11:45 UTC (permalink / raw)
  To: David Carlisle; +Cc: Stefan Monnier, 32897

tags 32897 fixed
close 32897 26.3
quit

Noam Postavsky <npostavs@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






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

end of thread, other threads:[~2019-05-09 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01  9:44 bug#32897: 26.1; nxml-mode indentation David Carlisle
2019-04-19 17:42 ` Noam Postavsky
2019-05-09 11:45   ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).