Package: nxml-mode
Version: 20041004-4
Severity: normal

When nXML Mode encounters an invalid character reference (e.g. "�")
during font locking, it fails with this error:

  Internal nXML mode error in nxml-fontify (Wrong type argument: 
number-or-marker-p, nil), degrading

The problem is that `xmltok-char-number' returns nil when an invalid
character reference is found, but `nxml-char-ref-display-extra' always
expects an integer.

The following patch contains a simple fix. Note that the invalid
character reference still gets properly flagged with a tooltip that
explains the problem.

--- nxml-mode-20041004.orig/nxml-mode.el
+++ nxml-mode-20041004/nxml-mode.el
@@ -1115,9 +1115,9 @@
                              (- end 2)
                              'nxml-processing-instruction-content-face))
              ((eq action 'char-ref)
-              (nxml-char-ref-display-extra start
-                                           end
-                                           (xmltok-char-number start end)))
+              (let ((c (xmltok-char-number start end)))
+                (when c
+                  (nxml-char-ref-display-extra start end c))))
              (t (error "Invalid nxml-fontify-rule action %s" action)))))))
 
 (defun nxml-fontify-attributes ()

-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.10-5-amd64-k8
Locale: LANG=C, LC_CTYPE=sv_SE (charmap=ISO-8859-1)

Versions of packages nxml-mode depends on:
ii  emacs21            21.3+1-8ubuntu7local1 The GNU Emacs editor
ii  emacsen-common     1.4.15                Common facilities for all emacsen.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to