From 94d2fc1815a919734353c942f224db1de4b4fcb8 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 7 Mar 2011 09:04:49 +0100 Subject: Django, org * Added nxhtml, mostly for django support. * Changed some org settings. --- emacs.d/nxhtml/util/nxml-mode-os-additions.el | 99 +++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 emacs.d/nxhtml/util/nxml-mode-os-additions.el (limited to 'emacs.d/nxhtml/util/nxml-mode-os-additions.el') diff --git a/emacs.d/nxhtml/util/nxml-mode-os-additions.el b/emacs.d/nxhtml/util/nxml-mode-os-additions.el new file mode 100644 index 0000000..0765acf --- /dev/null +++ b/emacs.d/nxhtml/util/nxml-mode-os-additions.el @@ -0,0 +1,99 @@ +;;; nxml-mode-os-additions.el --- additional functions for nxml-mode + +;; Copyright (C) 2004 by Oliver Steele + +;; Author: Oliver Steele +;; Version: 1.0 (2004-08-08) +;; Homepage: http://osteele.com/sources/nxml-mode-os-additions.el +;; Keywords: XML + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the GNU General Public License as +;; published by the Free Software Foundation; either version 2 of +;; the License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be +;; useful, but WITHOUT ANY WARRANTY; without even the implied +;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +;; PURPOSE. See the GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public +;; License along with this program; if not, write to the Free +;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +;; MA 02111-1307 USA + +;;; Description: + +;; nxml-mode-os-additions defines additional functions for using +;; James Clark's nxml-mode: +;; - reload the current buffer's schema +;; - edit the current buffer's schema + +;;; Installation: +;; +;; To use nxml-mode-os-additions.el, put it in your load-path and add +;; the following to your .emacs: +;; +;; (load-library "nxml-mode-os-additions") + +;; Configuration: +;; +;; To make it easier to use, assign the commands to some keys. +;; Once nxml-mode has been loaded, you can define keys on nxml-mode-map. +;; The function rng-mode-os-additions-set-key-bindings illustrates +;; this. +;; +;; Alternatively, you can place the following in your .emacs: +;; (add-hook 'nxml-mode-hook 'rng-mode-os-additions-set-key-bindings) + +;;; ChangeLog: +;; +;; 2004-08-08 (version 1.0): +;; * Initial public release + +;; Added require rng-valid (Lennart Borgman) + +;;; Code: + +(require 'nxml-mode) +(eval-and-compile (require 'rng-valid)) + +(defun rng-mode-os-additions-set-key-bindings () + (define-key nxml-mode-map "\C-c\C-s\C-r" 'rng-reload-schema-file) + ; move the rng-set-schema-file-and-validate to another key binding + ;(define-key nxml-mode-map "\C-c\C-s\C-s" 'rng-set-schema-file-and-validate) + (define-key nxml-mode-map "\C-c\C-sf" 'rng-find-schema-file) + ) + +(defun rng-reload-schema-file () + "Reloads the current schema file." + (interactive) + (let ((schema-filename rng-current-schema-file-name)) + (when schema-filename + (setq rng-current-schema (rng-load-schema schema-filename)) + (run-hooks 'rng-schema-change-hook) + (message "Reloaded schema %s" schema-filename)) + (unless schema-filename + (rng-set-schema-and-validate)))) + +;; Helper function for rng-find-schema-file* +(defun rng-apply-find-schema-file (fn) + (let ((schema-filename rng-current-schema-file-name)) + (unless schema-filename + (error "This file is not associated with a schema file.")) + (funcall fn schema-filename))) + +(defun rng-find-schema-file () + "Edit the current schema file." + (interactive) + (rng-apply-find-schema-file 'find-file)) + +(defun rng-find-schema-file-other-frame () + "Edit the current schema in another frame." + (interactive) + (rng-apply-find-schema-file 'find-file-other-frame)) + +(defun rng-find-schema-file-other-window () + "Edit the current schema in another window." + (interactive) + (rng-apply-find-schema-file 'find-file-other-window)) -- cgit v1.2.3-54-g00ecf