Docbook Editor Configuration: Difference between revisions

From NixOS Wiki
imported>Makefu
rename
 
imported>Fadenb
No edit summary
Line 3: Line 3:
The following creates an Emacs with a custom module, which configures nXML for the NixOS / Nixpkgs docbook codebase:
The following creates an Emacs with a custom module, which configures nXML for the NixOS / Nixpkgs docbook codebase:


 
  let
<code>
    pkgs = import <nixpkgs> {};
let
    inherit (pkgs) emacsPackagesNg docbook5 writeText;
  pkgs = import <nixpkgs> {};
  inherit (pkgs) emacsPackagesNg docbook5 writeText;
    schemas = writeText "schemas.xml" ''
 
      <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
  schemas = writeText "schemas.xml" ''
        <documentElement localName="section" typeId="DocBook"/>
    <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
        <documentElement localName="chapter" typeId="DocBook"/>
      <documentElement localName="section" typeId="DocBook"/>
        <documentElement localName="article" typeId="DocBook"/>
      <documentElement localName="chapter" typeId="DocBook"/>
        <documentElement localName="book" typeId="DocBook"/>
      <documentElement localName="article" typeId="DocBook"/>
        <typeId id="DocBook" uri="${docbook5}/xml/rng/docbook/docbookxi.rnc" />
      <documentElement localName="book" typeId="DocBook"/>
      </locatingRules>
      <typeId id="DocBook" uri="${docbook5}/xml/rng/docbook/docbookxi.rnc" />
    '';
    </locatingRules>
  '';
  in emacsPackagesNg.emacsWithPackages (epkgs: [
 
    (emacsPackagesNg.trivialBuild {
in emacsPackagesNg.emacsWithPackages (epkgs: [
      pname = "nix-docbook-mode";
  (emacsPackagesNg.trivialBuild {
      version = "1970-01-01";
    pname = "nix-docbook-mode";
      src = writeText "default.el" ''
    version = "1970-01-01";
        (eval-after-load 'rng-loc
    src = writeText "default.el" ''
          '(add-to-list 'rng-schema-locating-files "${schemas}"))
      (eval-after-load 'rng-loc
      '';
        '(add-to-list 'rng-schema-locating-files "${schemas}"))
    })
    '';
  ])
  })
])
</code>

Revision as of 18:26, 21 August 2017

For Emacs

The following creates an Emacs with a custom module, which configures nXML for the NixOS / Nixpkgs docbook codebase:

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

    schemas = writeText "schemas.xml" 
      <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
        <documentElement localName="section" typeId="DocBook"/>
        <documentElement localName="chapter" typeId="DocBook"/>
        <documentElement localName="article" typeId="DocBook"/>
        <documentElement localName="book" typeId="DocBook"/>
        <typeId id="DocBook" uri="${docbook5}/xml/rng/docbook/docbookxi.rnc" />
      </locatingRules>
    ;

  in emacsPackagesNg.emacsWithPackages (epkgs: [
    (emacsPackagesNg.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}"))
      ;
    })
  ])