GNU bug report logs - #22906
SGML-mode can't validate unsaved buffers

Previous Next

Package: emacs;

Reported by: Live System User <nyc4bos <at> aol.com>

Date: Fri, 4 Mar 2016 14:40:02 UTC

Severity: wishlist

Tags: fixed

Found in version 24.5

Fixed in version 28.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 22906 in the body.
You can then email your comments to 22906 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#22906; Package emacs. (Fri, 04 Mar 2016 14:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Live System User <nyc4bos <at> aol.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 04 Mar 2016 14:40:02 GMT) Full text and rfc822 format available.

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

From: Live System User <nyc4bos <at> aol.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; eww SGML validate error 
Date: Fri, 04 Mar 2016 09:39:00 -0500
Hi,

While just playing around with eww...

When using eww on https://www.fsf.org and clicking on menus:

  Eww->View page source
  SGML->Validate

I get the error:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("[^-0-9a-zA-Z_./\n]" "\\\\\\&" nil)
  shell-quote-argument(nil)
  (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name)))))
  (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name))))))
  (read-string "Validate command: " (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name (buffer-file-name))) (and name (file-name-nondirectory name)))))))
  (list (read-string "Validate command: " (or sgml-saved-validate-command (concat sgml-validate-command " " (shell-quote-argument (let ((name ...)) (and name (file-name-nondirectory name))))))))
  call-interactively(sgml-validate nil nil)
  command-execute(sgml-validate)




In GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.18.7)
 of 2016-02-03 on buildhw-05.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11799901
Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -m64 -mtune=generic' LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-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

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail epa-file epa derived epg
epg-config auth-source eieio byte-opt bytecomp byte-compile cl-extra
cconv eieio-core sieve sieve-mode sieve-manage password-cache nnir
gnus-sum gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec
gnus-int gnus-range message format-spec rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems
wid-edit cl-loaddefs cl-lib nnoo nnheader gnus-util mm-util help-fns
mail-prsvr mail-utils misearch multi-isearch time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer 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 make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 122422 11314)
 (symbols 48 23829 0)
 (miscs 40 41 143)
 (strings 32 26352 4090)
 (string-bytes 1 846056)
 (vectors 16 16033)
 (vector-slots 8 451957 8256)
 (floats 8 161 304)
 (intervals 56 339 9)
 (buffers 960 12)
 (heap 1024 20539 998))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22906; Package emacs. (Wed, 07 Sep 2016 16:51:02 GMT) Full text and rfc822 format available.

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

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Live System User <nyc4bos <at> aol.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 24.5; eww SGML validate error
Date: Wed, 07 Sep 2016 18:49:51 +0200
I can reproduce this on the current master branch (ec12c670).

The issue seems to be that `sgml-validate' assumes that the buffer is
visiting a file, which is not the case when you view a web page's source
from eww.

Maybe we could offer to save the buffer when it's not visiting a file?

diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 990c09b..b98db7e 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1109,8 +1109,10 @@ sgml-validate
 				  " "
 				  (shell-quote-argument
 				   (let ((name (buffer-file-name)))
-				     (and name
-					  (file-name-nondirectory name)))))))))
+                                     (unless name
+                                       (save-buffer)
+                                       (setq name (buffer-file-name)))
+				     (file-name-nondirectory name))))))))
   (setq sgml-saved-validate-command command)
   (save-some-buffers (not compilation-ask-about-save) nil)
   (compilation-start command))


-- Simen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22906; Package emacs. (Tue, 24 Jan 2017 22:29:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 22906 <at> debbugs.gnu.org, Live System User <nyc4bos <at> aol.com>
Subject: Re: bug#22906: 24.5; eww SGML validate error
Date: Tue, 24 Jan 2017 23:28:07 +0100
Simen Heggestøyl <simenheg <at> gmail.com> writes:

> I can reproduce this on the current master branch (ec12c670).
>
> The issue seems to be that `sgml-validate' assumes that the buffer is
> visiting a file, which is not the case when you view a web page's source
> from eww.
>
> Maybe we could offer to save the buffer when it's not visiting a file?

I think that would be unusual for commands like this (that have to be
written out to work).  Instead it could save the buffer to a temporary
file, validate and then delete it again.

I'm not sure it's worth it, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Changed bug title to 'SGML-mode can't validate unsaved buffers' from '24.5; eww SGML validate error ' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 22:29:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'minor' Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 24 Jan 2017 22:30:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22906; Package emacs. (Tue, 15 Sep 2020 16:14:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: Live System User <nyc4bos <at> aol.com>, 22906 <at> debbugs.gnu.org
Subject: Re: bug#22906: 24.5; eww SGML validate error
Date: Tue, 15 Sep 2020 18:12:55 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

>> I can reproduce this on the current master branch (ec12c670).
>>
>> The issue seems to be that `sgml-validate' assumes that the buffer is
>> visiting a file, which is not the case when you view a web page's source
>> from eww.
>>
>> Maybe we could offer to save the buffer when it's not visiting a file?
>
> I think that would be unusual for commands like this (that have to be
> written out to work).  Instead it could save the buffer to a temporary
> file, validate and then delete it again.

Actually, looking at the code again, I think it's just a simple bug.  It
checks whether buffer-file-name is non-nil, but then it ends up with
(shell-quote-argument nil), which is invalid.

I've now fixed this in Emacs 28.

-- 
(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. (Tue, 15 Sep 2020 16:14:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 22906 <at> debbugs.gnu.org and Live System User <nyc4bos <at> aol.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 15 Sep 2020 16:14:03 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. (Wed, 14 Oct 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 193 days ago.

Previous Next


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