~nolda/psgml-utils

A set of extensions for Emacs’ PSGML mode.
~nolda/psgml-utils

New ticket tracker added

4 years ago
~nolda/psgml-utils

New hg repository added

4 years ago

#PSGML-Utils

PSGML-Utils is a set of extensions for Emacs' PSGML mode. They consist of the following files:

  • psgml-superedit.el: additional editing functions for use with PSGML
  • psgml-run.el: functions for running validation and transformation scenarios in PSGML
  • psgml-xml.el: an XML mode derived from PSGML's SGML mode

PSGML-Utils were developed against PSGML v. 1.4.0 as provided by the Debian package psgml.

Installation and proposed settings in .emacs:

(add-hook 'sgml-mode-hook
          (lambda ()
            (require 'psgml-superedit)
            (require 'psgml-run)
            (define-key sgml-mode-map (kbd "C-c C-e") 'sgml-insert-element-dwim)
            (define-key sgml-mode-map (kbd "C-c RET") 'sgml-split-element-dwim)
            (define-key sgml-mode-map (kbd "C-c DEL") 'sgml-untag-element)
            (define-key sgml-mode-map (kbd "C-c -") 'sgml-delete-attribute)
            (define-key sgml-mode-map (kbd "C-c ?") 'sgml-insert-pi)
            (define-key sgml-mode-map (kbd "M-;") 'sgml-comment-dwim)
            (define-key sgml-mode-map (kbd "C-M-f") 'sgml-forward-dwim)
            (define-key sgml-mode-map (kbd "<C-M-right>") 'sgml-forward-dwim)
            (define-key sgml-mode-map (kbd "C-M-b") 'sgml-backward-dwim)
            (define-key sgml-mode-map (kbd "<C-M-left>") 'sgml-backward-dwim)
            (define-key sgml-mode-map (kbd "C-M-d") 'sgml-down-dwim)
            (define-key sgml-mode-map (kbd "<C-M-down>") 'sgml-down-dwim)
            (define-key sgml-mode-map (kbd "<C-M-next>") 'sgml-forward-up-dwim)
            (define-key sgml-mode-map (kbd "C-M-u") 'sgml-backward-up-dwim)
            (define-key sgml-mode-map (kbd "<C-M-up>") 'sgml-backward-up-dwim)
            (define-key sgml-mode-map (kbd "<C-M-prior>") 'sgml-backward-up-dwim)
            (define-key sgml-mode-map (kbd "C-M-SPC") 'sgml-mark-dwim)
            (define-key sgml-mode-map (kbd "C-M-k") 'sgml-kill-dwim)
            (define-key sgml-mode-map (kbd "<C-M-delete>") 'sgml-kill-dwim)
            (define-key sgml-mode-map (kbd "<C-M-backspace>") 'sgml-kill-backward-dwim)
            (define-key sgml-mode-map (kbd "<tab>") 'sgml-indent-line-or-region)
            (define-key sgml-mode-map (kbd "<backtab>") 'sgml-unindent-line-or-region)
            (define-key sgml-mode-map (kbd "C-c v") 'sgml-run-validation)
            (define-key sgml-mode-map (kbd "C-c t") 'sgml-run-transformation)
            (define-key sgml-mode-map (kbd "C-c C-v") 'sgml-run-validation-scenario)
            (define-key sgml-mode-map (kbd "C-c C-t") 'sgml-run-transformation-scenario)))

(setq sgml-show-context-function 'sgml-show-context-xpath)

(setq sgml-validation-scenario-alist
      '(("DTD" . "xmllint --noout --valid")
        ("DTD/XInclude" . "xmllint --noout --xinclude --postvalid")))

(setq sgml-transformation-scenario-alist
      '(("XSLT" . "xsltproc --output %s stylesheet.xsl")
        ("XSLT/XInclude" . "xsltproc --xinclude --output %s stylesheet.xsl")))

(autoload 'sgml-xml-mode "psgml-xml" "Major mode for editing XML files" t)
(add-to-list 'auto-mode-alist '("\\.xml\\'" . sgml-xml-mode))

PSGML-Utils are released 'as is' with no warranty under the GNU General Public License, version 2.0.

Andreas Nolda (andreas@nolda.org)