]> git.rkrishnan.org Git - .emacs.d.git/blob - emacs/nxhtml/nxhtml/nxhtml-autoload.el
submodulized .emacs.d setup
[.emacs.d.git] / emacs / nxhtml / nxhtml / nxhtml-autoload.el
1 ;; nxhtml-autoload.el -- Autoloading of nxthml-mode
2 ;;
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: Sat Feb 11 00:06:14 2006
5 ;; Version: 0.51
6 ;; Last-Updated: 2008-02-13T01:21:14+0100 Wed
7 ;; Keywords:
8 ;; Compatibility:
9 ;;
10 ;; Features that might be required by this library:
11 ;;
12 ;;   None
13 ;;
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15 ;;
16 ;;; Commentary:
17 ;;
18 ;;
19 ;;
20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 ;;
22 ;;; Change log:
23 ;;
24 ;;
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;;
27 ;; This program is free software; you can redistribute it and/or modify
28 ;; it under the terms of the GNU General Public License as published by
29 ;; the Free Software Foundation; either version 2, or (at your option)
30 ;; any later version.
31 ;;
32 ;; This program is distributed in the hope that it will be useful,
33 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
34 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
35 ;; GNU General Public License for more details.
36 ;;
37 ;; You should have received a copy of the GNU General Public License
38 ;; along with this program; see the file COPYING.  If not, write to the
39 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
40 ;; Boston, MA 02111-1307, USA.
41 ;;
42 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
43 ;;
44 ;;; Code:
45
46 (eval-when-compile (require 'cl))
47 (eval-when (load)
48   (message "nxhtml-autoload starting ... (hm, should maybe be renamed ...)"))
49
50 (eval-when-compile (require 'majmodpri nil t))
51 (eval-when-compile (require 'moz nil t))
52
53 ;;; Convenient moving by tags:
54 (eval-after-load 'nxml-mode
55   '(progn
56      (define-key nxml-mode-map [C-M-left]  'nxml-backward-element)
57      (define-key nxml-mode-map [C-M-right] 'nxml-forward-element)
58      (define-key nxml-mode-map [C-M-up]    'nxml-backward-up-element)
59      (define-key nxml-mode-map [C-M-down]  'nxml-down-element)))
60
61 ;; MozLab support, for more info see moz.el
62 ;;(autoload 'inferior-moz-mode "moz" "MozRepl Inferior Mode" t)
63 ;;(autoload 'moz-minor-mode "moz" "MozRepl Minor Mode" t)
64 (defun javascript-moz-setup () (moz-minor-mode 1))
65 (add-hook 'javascript-mode-hook 'javascript-moz-setup)
66 ;;(add-hook 'js2-fl-mode-hook     'javascript-moz-setup)
67
68
69 (defun nxhtml-setup-file-assoc ()
70   "Setup file associations for nXhtml.
71 Add nXhtml entries similar to those that are already there for
72 html-mode and xml-mode.
73
74 Add multi major mode entries.
75
76 Finally run `majmodpri-sort-lists' to get everything in the right
77 order."
78   ;; Add nXhtml entries similar to those that are already there for
79   ;; html-mode and xml-mode.
80   (dolist (mode-list '(auto-mode-alist magic-fallback-mode-alist magic-mode-alist))
81     (dolist (rec (symbol-value mode-list))
82       (when (eq (cdr rec) 'html-mode)
83         (add-to-list mode-list (cons (car rec) 'nxhtml-mode)))
84       (when (eq (cdr rec) 'html-mode)
85         (add-to-list mode-list (cons (car rec) 'nxhtml-mumamo-mode)))
86       ;; (when (eq (cdr rec) 'html-mode)
87       ;;   (add-to-list mode-list (cons (car rec) 'html-mumamo-mode)))
88       (when (eq (cdr rec) 'xml-mode)
89         (add-to-list mode-list (cons (car rec) 'nxml-mode)))
90       ))
91
92   ;; Add multi major mode entries.
93   (add-to-list 'magic-mode-alist
94                '("\\(?:.\\|\n\\)\\{,500\\}xmlns:py=\"http://genshi.edgewall.org/\""
95                  . genshi-nxhtml-mumamo-mode))
96   (add-to-list 'auto-mode-alist '("\\.htm\\'"      . nxhtml-mumamo-mode))
97   (add-to-list 'auto-mode-alist '("\\.html\\'"     . nxhtml-mumamo-mode))
98   (add-to-list 'auto-mode-alist '("\\.xhtm\\'"     . nxhtml-mumamo-mode))
99   (add-to-list 'auto-mode-alist '("\\.xhtml\\'"    . nxhtml-mumamo-mode))
100   (add-to-list 'auto-mode-alist '("\\.html\\'"     . nxhtml-mumamo-mode))
101   (add-to-list 'auto-mode-alist '("\\.htmlf\\'"    . nxhtml-mumamo-mode))
102   (add-to-list 'auto-mode-alist '("\\.xhtml\\'"    . nxhtml-mumamo-mode))
103   (add-to-list 'auto-mode-alist '("\\.xhtmlf\\'"   . nxhtml-mumamo-mode))
104   (add-to-list 'auto-mode-alist '("\\.php\\'"      . nxhtml-mumamo-mode))
105   (add-to-list 'auto-mode-alist '("\\.phtml\\'"    . nxhtml-mumamo-mode))
106   (add-to-list 'auto-mode-alist '("\\.jsp\\'"      . jsp-nxhtml-mumamo-mode))
107   (add-to-list 'auto-mode-alist '("\\.gsp\\'"      . gsp-nxhtml-mumamo-mode))
108   (add-to-list 'auto-mode-alist '("\\.asp\\'"      . asp-nxhtml-mumamo-mode))
109   (add-to-list 'auto-mode-alist '("\\.djhtml\\'"   . django-nxhtml-mumamo-mode))
110   (add-to-list 'auto-mode-alist '("\\.rhtml\\'"    . eruby-nxhtml-mumamo-mode))
111   (add-to-list 'auto-mode-alist '("\\.erb\\'"      . eruby-javascript-mumamo-mode))
112   (add-to-list 'auto-mode-alist '("\\.phps\\'"     . smarty-nxhtml-mumamo-mode))
113   (add-to-list 'auto-mode-alist '("\\.epl\\'"      . embperl-nxhtml-mumamo-mode))
114   (add-to-list 'auto-mode-alist '("\\.ghtml\\'"     . genshi-nxhtml-mumamo-mode))
115   (add-to-list 'auto-mode-alist '("\\.mhtml\\'"     . mason-nxhtml-mumamo-mode))
116
117   ;; Add html-mumamo style entry if there is an nxhtml-mumamo style entry.
118   (save-match-data
119     (dolist (mode-list '(auto-mode-alist magic-fallback-mode-alist magic-mode-alist))
120       (dolist (rec (symbol-value mode-list))
121         (let* ((mode (cdr rec))
122                (name (when (symbolp mode) (symbol-name mode)))
123                nxmode)
124           (when (and name
125                      (string-match "nxhtml-mumamo" name))
126             (setq name (replace-regexp-in-string "nxhtml-mumamo" "html-mumamo" name t t))
127             (setq nxmode (intern-soft name))
128             (when nxmode
129               (add-to-list mode-list (cons (car rec) nxmode))))))))
130
131   (add-to-list 'auto-mode-alist '("\\.lzx\\'"       . laszlo-nxml-mumamo-mode))
132   (add-to-list 'auto-mode-alist '("\\.js\\'"       . javascript-mode))
133   (add-to-list 'auto-mode-alist '("\\.css\\'"      . css-mode))
134   (add-to-list 'auto-mode-alist '("\\.rnc\\'"      . rnc-mode))
135
136   (majmodpri-sort-lists)
137   ;;(message "nxhtml-autoload finished")
138   )
139
140 ;;(defvar nxhtml-src-dir (file-name-directory (if load-file-name load-file-name buffer-file-name)))
141
142 ;;(eval-when (load) (nxhtml-setup-file-assoc))
143 (nxhtml-setup-file-assoc)
144
145 (provide 'nxhtml-autoload)
146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
147 ;;; nxhtml-autoload.el ends here