NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.36k stars 13.59k forks source link

locatingRules for DocBook on emacs #68236

Open jtojnar opened 5 years ago

jtojnar commented 5 years ago

The emacs DocBook config from Nix Pills, which was copied to the wiki match the schema based on elements, not the namespace. That is suspicious, given that we use DocBook 5 which is namespace aware. Should not we use something like this instead:

<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
  <namespace ns="http://docbook.org/ns/docbook" uri="${docbook5}/xml/rng/docbook/docbookxi.rnc"/>
</locatingRules>

cc @grahamc

Edit: We even have this https://nixos.org/nixos/manual/index.html#sec-emacs-docbook-xml in the manual, which looks more correct. Though, it relies on profile paths, which is not a good idea: https://github.com/NixOS/nixpkgs/issues/24959

jtojnar commented 5 years ago

Here are the related enacs docs: https://www.gnu.org/software/emacs/manual/html_node/nxml-mode/Locating-a-schema.html#Locating-a-schema

The default schemas (including the old docbook 4) are in ${emacs}/share/emacs/26.3/etc/schema/schemas.xml

jtojnar commented 5 years ago

I verified that the following works.

let
 pkgs = import <nixpkgs> {};
 inherit (pkgs) emacsPackages docbook5 writeText;

 schemas = writeText "schemas.xml" ''
   <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
     <namespace ns="http://docbook.org/ns/docbook" uri="${docbook5}/share/xml/docbook-5.0/rng/docbookxi.rnc"/>
   </locatingRules>
 '';

in emacsPackages.emacsWithPackages (epkgs: [
 (emacsPackages.trivialBuild {
   pname = "nix-docbook-mode";
   version = "1970-01-01";
   src = writeText "default.el" ''
     (eval-after-load 'rng-loc
       '(add-to-list 'rng-schema-locating-files "${schemas}"))
     (global-set-key (kbd "<C-return>") 'nxml-complete)
   '';
 })
])
stale[bot] commented 4 years ago

Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on irc.freenode.net.
jtojnar commented 4 years ago

Needs to be fixed.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info