GNU bug report logs -
#24978
25.1; Bad interaction between nxml-auto-insert-xml-declaration-flag and archive-extract
Previous Next
Reported by: Heinz Rommerskirchen <heinz <at> h-rommerskirchen.de>
Date: Mon, 21 Nov 2016 13:42:02 UTC
Severity: normal
Tags: fixed
Found in version 25.1
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
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 24978 in the body.
You can then email your comments to 24978 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24978
; Package
emacs
.
(Mon, 21 Nov 2016 13:42:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Heinz Rommerskirchen <heinz <at> h-rommerskirchen.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 21 Nov 2016 13:42:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
If the variable nxml-auto-insert-xml-declaration-flag is set, an XML
declaration is inserted into non-empty XML files inside a zip archive.
To reproduce this bug create the valid XML file foo.xml containing
=== start foo.xml ===
<?xml version="1.0" encoding="utf-8"?>
<content>y</content>
=== end foo.xml ===
and pack it into a zip-archive:
$ zip -m bar.zip foo.xml
Now start "emacs -Q", evaluate
"(setq nxml-auto-insert-xml-declaration-flag 't)" in the *scratch*
buffer, visit bar.zip with C-x C-f, and press Enter on the entry
"foo.xml". foo.xml will be opened and an additional XML declaration is
inserted into the buffer rendering the file invalid and marking the
buffer as modified.
The following simple patch solved the problem for me.
=== start patch ====
--- nxml-mode-from-25.1.el 2016-11-20 19:45:43.339427354 +0100
+++ nxml-mode.el 2016-11-20 19:48:26.009625534 +0100
@@ -566,7 +566,8 @@
;; hook. The hook also had the drawback of overriding explicit user
;; instruction to save as some encoding other than utf-8.
;;(add-hook 'write-contents-hooks 'nxml-prepare-to-save)
- (when (not (and (buffer-file-name) (file-exists-p (buffer-file-name))))
+ (when (and (not (and (buffer-file-name) (file-exists-p (buffer-file-name))))
+ (not archive-superior-buffer))
(when (and nxml-default-buffer-file-coding-system
(not (local-variable-p 'buffer-file-coding-system)))
(setq buffer-file-coding-system nxml-default-buffer-file-coding-system))
=== end patch ===
--
Dr. Heinrich Rommerskirchen
Prof.-Schmid-Str. 41
82140 Olching
Allemagne
Tel. +49 8142 28787
Email heinz <at> h-rommerskirchen.de
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24978
; Package
emacs
.
(Sat, 27 Jul 2019 12:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 24978 <at> debbugs.gnu.org (full text, mbox):
Heinz Rommerskirchen <heinz <at> h-rommerskirchen.de> writes:
> If the variable nxml-auto-insert-xml-declaration-flag is set, an XML
> declaration is inserted into non-empty XML files inside a zip archive.
>
> To reproduce this bug create the valid XML file foo.xml containing
> === start foo.xml ===
> <?xml version="1.0" encoding="utf-8"?>
> <content>y</content>
> === end foo.xml ===
> and pack it into a zip-archive:
> $ zip -m bar.zip foo.xml
> Now start "emacs -Q", evaluate
> "(setq nxml-auto-insert-xml-declaration-flag 't)" in the *scratch*
> buffer, visit bar.zip with C-x C-f, and press Enter on the entry
> "foo.xml". foo.xml will be opened and an additional XML declaration is
> inserted into the buffer rendering the file invalid and marking the
> buffer as modified.
(I'm going through older Emacs bug reports that have received no
response.)
I was able to reproduce the bug in Emacs 27, too.
> The following simple patch solved the problem for me.
[...]
> - (when (not (and (buffer-file-name) (file-exists-p (buffer-file-name))))
> + (when (and (not (and (buffer-file-name) (file-exists-p (buffer-file-name))))
> + (not archive-superior-buffer))
Thanks for the patch, but I think the problem is a bit more general.
The intention seems to be to insert the declaration whenever you're
starting a new file, so I think a more general solution is to just check
whether the buffer is empty before inserting the declaration. I've now
done this change on the Emacs trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Jul 2019 12:03:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 27.1, send any further explanations to
24978 <at> debbugs.gnu.org and Heinz Rommerskirchen <heinz <at> h-rommerskirchen.de>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 27 Jul 2019 12:03: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
.
(Sun, 25 Aug 2019 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 15 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.