Bug 1080086 - psgml package breaks emacs js-mode
psgml package breaks emacs js-mode
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other
Current
Other Other
: P5 - None : Normal (vote)
: Current
Assigned To: Karl Eichwalder
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-02-08 14:34 UTC by Adam Spiers
Modified: 2022-05-11 14:40 UTC (History)
4 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Spiers 2018-02-08 14:34:29 UTC
If the psgml package is installed (which can be pulled in as a requirement of the xslide package) then in emacs, js-mode can fail to load.

Steps to reproduce:

1. emacs -q

2. C-h v load-path shows that "/usr/share/emacs/site-lisp/psgml" is in load-path (I'm guessing this is set up by /usr/share/emacs/site-lisp/suse-start-psgml.el which is loaded by /usr/share/emacs/site-lisp/site-start.el)

3. Load an existing Javascript file or create a new Javascript buffer, e.g. C-x f foo.js

4. Observe a "File mode specification error: (void-variable sgml-name-re)" error and the fact that the newly opened buffer is not in js-mode

This was first reported upstream and confirmed as an openSUSE-only bug:

https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-09/msg00884.html

but I couldn't find any corresponding downstream bug, so here it is.

A workaround is simply to deinstall the psgml package (and xslide if necessary) but obviously this is not ideal.
Comment 1 Dr. Werner Fink 2018-02-11 10:02:21 UTC
Wrong maintainer it is
Comment 2 Karl Eichwalder 2018-02-12 16:41:23 UTC
(In reply to Adam Spiers from comment #0)
> If the psgml package is installed (which can be pulled in as a requirement
> of the xslide package) then in emacs, js-mode can fail to load.

On my Leap 42.3 installation, I cannot reproduce it with your recipe.  I does not seem to matter whether I load the .js file first or the .sgml file.

> A workaround is simply to deinstall the psgml package (and xslide if
> necessary) but obviously this is not ideal.

I no longer use psgml (even if it offers some features not available with nxml).  Thus I'm considering filing a drop request.  It would be great if we could find a new maintainer for psgml, though.
Comment 3 Adam Spiers 2018-02-13 14:26:28 UTC
Hey, thanks for looking at this :)

(In reply to Karl Eichwalder from comment #2)
> (In reply to Adam Spiers from comment #0)
> > If the psgml package is installed (which can be pulled in as a requirement
> > of the xslide package) then in emacs, js-mode can fail to load.
> 
> On my Leap 42.3 installation, I cannot reproduce it with your recipe.  I
> does not seem to matter whether I load the .js file first or the .sgml file.

That's weird.  Do you definitely have "/usr/share/emacs/site-lisp/psgml" in your load-path in step 2?

If you can't reproduce it means you do have sgml-name-re defined, which suggests that somehow your setup is automatically loading sgml-mode.el - any idea how that would happen if you're launching emacs with the -q option?  What does C-h v sgml-name-re show?

> > A workaround is simply to deinstall the psgml package (and xslide if
> > necessary) but obviously this is not ideal.
> 
> I no longer use psgml (even if it offers some features not available with
> nxml).  Thus I'm considering filing a drop request.  It would be great if we
> could find a new maintainer for psgml, though.

Yeah ... do you happen to know the differences between psgml and sgml-mode?  Does psgml offer significant functionality which sgml-mode doesn't?  If so then I guess it's worth keeping and *maybe* I could be persuaded to take over maintainership, as long as it's a very light workload (I'm already doing a bad job of maintaining all kinds of other stuff...).  I seem to remember psgml a few times over the years for its built-in DTD-based validation, but not very often.
Comment 4 Karl Eichwalder 2018-02-14 09:06:56 UTC
(In reply to Adam Spiers from comment #3)

> Do you definitely have "/usr/share/emacs/site-lisp/psgml" in
> your load-path in step 2?

Yes.  I now additionally installed xslide and everything is still working.  I think it will get triggered if your .js files contains sgml or html fragments.

You probably must check how Debian works around this problem.  psgml also consumes the sgml "namespace" which is inherently dangerous.  js-mode relies on internals of sgml-mode and that could also cause trouble.

An easy fix for the psgml package would be moving the site-start file to the doc directory and letting the user figure out how to start psgml instead of sgml-mode if wanted.  Of course, we should enhance the README file accordingly.

> I seem to
> remember psgml a few times over the years for its built-in DTD-based
> validation, but not very often.

Yes, and that's essential for an SGML editor. sgml-mode is just a toy ;)  psgml also knows about special SGML features such as https://en.wikipedia.org/wiki/Standard_Generalized_Markup_Language#Markup_minimization (this is at least partially supported).

Lennart Staflin <lenst@lysator.liu.se> is one of the SGML heroes--he unfortunately stopped hacking on psgml.
Comment 5 Adam Spiers 2018-02-14 15:57:07 UTC
(In reply to Karl Eichwalder from comment #4)
> (In reply to Adam Spiers from comment #3)
> 
> > Do you definitely have "/usr/share/emacs/site-lisp/psgml" in
> > your load-path in step 2?
> 
> Yes.  I now additionally installed xslide and everything is still working.

So what does C-h v sgml-name-re show?
 
> I think it will get triggered if your .js files contains sgml or html
> fragments.

No, it's even triggered by opening a blank .js file as mentioned in the original report.

> You probably must check how Debian works around this problem.  psgml also
> consumes the sgml "namespace" which is inherently dangerous.

Yes, I agree - that seems to be the main problem here. 

> js-mode relies on internals of sgml-mode and that could also cause trouble.

Oh, that's not great :-/

> An easy fix for the psgml package would be moving the site-start file to the
> doc directory and letting the user figure out how to start psgml instead of
> sgml-mode if wanted.  Of course, we should enhance the README file
> accordingly.

Sounds like a good plan.

> > I seem to
> > remember psgml a few times over the years for its built-in DTD-based
> > validation, but not very often.
> 
> Yes, and that's essential for an SGML editor. sgml-mode is just a toy ;) 
> psgml also knows about special SGML features such as
> https://en.wikipedia.org/wiki/
> Standard_Generalized_Markup_Language#Markup_minimization (this is at least
> partially supported).

OK, good to know it's still worth the effort!

> Lennart Staflin <lenst@lysator.liu.se> is one of the SGML heroes--he
> unfortunately stopped hacking on psgml.

:-(
Comment 6 Karl Eichwalder 2018-02-15 14:10:01 UTC
(In reply to Adam Spiers from comment #5)

> So what does C-h v sgml-name-re show?

Nothing.  It's undefined.  probably because sgml-mode does not get loaded (psgml provides it).

> > An easy fix for the psgml package would be moving the site-start file to the
> > doc directory and letting the user figure out how to start psgml instead of
> > sgml-mode if wanted.  Of course, we should enhance the README file
> > accordingly.
> 
> Sounds like a good plan.

Then I'll do this.
Comment 7 Karl Eichwalder 2018-02-19 13:12:01 UTC
https://build.opensuse.org/request/show/578040
Comment 8 Karl Eichwalder 2018-02-19 13:15:57 UTC
Stefan, consider to add to the leap 15 release notes:


Loading psgml
=============

Because of conflicts with shipped Emacs modules, SUSE no longer load psgml automatically.  For more information, see README coming with the psgml package.
Comment 9 Adam Spiers 2018-02-19 14:36:37 UTC
Thanks a lot Karl!
Comment 10 Stefan Knorr 2018-03-13 13:59:45 UTC
Add release note: https://github.com/openSUSE/release-notes-openSUSE/commit/2374eea8dd973ca4b89068d2b6255ff3f912b386

setting -> fixed.
Comment 11 Adam Spiers 2019-09-29 17:13:17 UTC
Unfortunately either there was a regression with this, or it wasn't fully fixed in the first place.  I'm not sure which, but on my Tumbleweed system I see:

    $ grep psgml /usr/share/emacs/site-lisp/suse-start-xslide.el
    (require 'psgml)

and this is sufficient to break not only js-mode as described above, but also the built-in css-mode.el* in /usr/share/emacs/26.2/lisp/textmodes, since it does:

    (require 'sgml-mode)

and later:

    (defvar css--html-tags (mapcar #'car html-tag-alist)

If psgml gets loaded by suse-start-xslide.el in preference to the built-in sgml-mode, then html-tag-alist never gets defined, which causes css-mode to blow up.

So I suggest we consider applying a similar approach to /usr/share/emacs/site-lisp/suse-start-xslide.el as was applied to suse-start-psgml in https://build.opensuse.org/request/show/578040.
Comment 12 Karl Eichwalder 2019-11-05 13:46:20 UTC
Thanks for the report:

created request id 745500
Comment 13 OBSbugzilla Bot 2022-05-11 14:40:16 UTC
This is an autogenerated message for OBS integration:
This bug (1080086) was mentioned in
https://build.opensuse.org/request/show/976384 15.4 / release-notes-openSUSE