comparison lisp/hm--html-menus/hm--html-mode.el @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 25f70ba0133c
children
comparison
equal deleted inserted replaced
176:6866abce6aaf 177:6075d714658b
1 ;;; hm--html-mode --- Major mode for editing HTML documents for the WWW 1 ;;; hm--html-mode --- Major mode for editing HTML documents for the WWW
2 ;;; 2
3 ;;; Keywords: hypermedia languages help docs wp 3 ;; Copyright (C) 1996, 1997 Heiko Muenkel
4 ;;; 4
5 ;;; $Id: hm--html-mode.el,v 1.6 1997/05/29 23:49:43 steve Exp $ 5 ;; Author: Heiko Muenkel <muenkel@tnt.uni-hannover.de>
6 ;;; 6 ;; Keywords: hypermedia languages help docs wp
7 ;;; Copyright (C) 1996, 1997 Heiko Muenkel 7
8 ;;; email: muenkel@tnt.uni-hannover.de 8 ;; $Id: hm--html-mode.el,v 1.7 1997/07/26 22:09:45 steve Exp $
9 ;;; 9
10 ;;; This program is free software; you can redistribute it and/or modify 10 ;; This file is part of XEmacs.
11 ;;; it under the terms of the GNU General Public License as published by 11
12 ;;; the Free Software Foundation; either version 2, or (at your option) 12 ;; XEmacs is free software; you can redistribute it and/or modify it
13 ;;; any later version. 13 ;; under the terms of the GNU General Public License as published by
14 ;;; 14 ;; the Free Software Foundation; either version 2, or (at your
15 ;;; This program is distributed in the hope that it will be useful, 15 ;; option) any later version.
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ;; This program is distributed in the hope that it will be useful, but
18 ;;; GNU General Public License for more details. 18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;;; You should have received a copy of the GNU General Public License 20 ;; General Public License for more details.
21 ;;; along with this program; if not, write to the Free Software 21
22 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 ;; You should have received a copy of the GNU General Public License
23 ;;; 23 ;; along with XEmacs; See the file COPYING. if not, write to the Free
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 ;; 02111-1307, USA
26
27 ;;; Synched up with: Not part of Emacs.
28
24 ;;; Commentary: 29 ;;; Commentary:
25 ;;; Description: 30
26 ;;; 31 ;; Description:
27 ;;; This file defines the hm--html-mode, a mode for editing html 32
28 ;;; files. It is the main file of the package hm--html-menus. 33 ;; This file defines the hm--html-mode, a mode for editing html
29 ;;; Previous releases had used the file html-mode.el from Marc 34 ;; files. It is the main file of the package hm--html-menus.
30 ;;; Andreessen. In that times the mode was called html-mode. I've 35 ;; Previous releases had used the file html-mode.el from Marc
31 ;;; changed the name of the mode to distinquish it from other 36 ;; Andreessen. In that times the mode was called html-mode. I've
32 ;;; html modes. But feel free to set a 37 ;; changed the name of the mode to distinquish it from other
33 ;;; (defalias 'hm--html-mode 'html-mode) 38 ;; html modes. But feel free to set a
34 ;;; to get back the old name of the mode. 39 ;; (defalias 'hm--html-mode 'html-mode)
35 ;;; 40 ;; to get back the old name of the mode.
36 ;;; In the earlier releases of the package the main file was 41
37 ;;; hm--html-menu.el. This has been changed to hm--html-mode.el. 42 ;; In the earlier releases of the package the main file was
38 ;;; 43 ;; hm--html-menu.el. This has been changed to hm--html-mode.el.
39 ;;; Installation: 44
40 ;;; 45
41 ;;; Put this file and all the other files of the package 46 ;; Installation:
42 ;;; in one of your load path directories and the 47
43 ;;; following lines in your .emacs: 48 ;; Put this file and all the other files of the package
44 ;;; 49 ;; in one of your load path directories and the
45 ;;; (autoload 'hm--html-mode "hm--html-mode" "HTML major mode." t) 50 ;; following lines in your .emacs:
46 ;;; 51
47 ;;; (or (assoc "\\.html$" auto-mode-alist) 52 ;; (autoload 'hm--html-mode "hm--html-mode" "HTML major mode." t)
48 ;;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode) 53
49 ;;; auto-mode-alist))) 54 ;; (or (assoc "\\.html$" auto-mode-alist)
50 ;;; If there is already another html-mode (like psgml in the XEmacs 55 ;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode)
51 ;;; 19.14, then you must put the following instead of the last form 56 ;; auto-mode-alist)))
52 ;;; in your .emacs: 57 ;; If there is already another html-mode (like psgml in the XEmacs
53 ;;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode) 58 ;; 19.14, then you must put the following instead of the last form
54 ;;; auto-mode-alist)) 59 ;; in your .emacs:
55 ;;; 60 ;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode)
56 ;;; But you can also use the hm--html-minor-mode as an addition to 61 ;; auto-mode-alist))
57 ;;; the psgml html modes. For that you've to put the following line in 62
58 ;;; your .emacs: 63 ;; But you can also use the hm--html-minor-mode as an addition to
59 ;;; (add-hook 'html-mode-hook 'hm--html-minor-mode) 64 ;; the psgml html modes. For that you've to put the following line in
60 ;;; 65 ;; your .emacs:
61 ;;; Note: This works only in an XEmacs version greater than 19.14 and 66 ;; (add-hook 'html-mode-hook 'hm--html-minor-mode)
62 ;;; also not in the XEmacs 20.0. 67
63 ;;; 68 ;; Note: This works only in an XEmacs version greater than 19.14 and
64 ;;; Look at the file hm--html-configuration for further installation 69 ;; also not in the XEmacs 20.0.
65 ;;; points. 70
66 ;;; 71 ;; Look at the file hm--html-configuration for further installation
67 ;;; 72 ;; points.
68 73
74 ;;; Code:
69 75
70 (require 'font-lock) 76 (require 'font-lock)
71 (require 'cl) 77 (require 'cl)
72 (require 'adapt) 78 (require 'adapt)
73 (require 'hm--date) 79 (require 'hm--date)
97 ;;; The package version 103 ;;; The package version
98 (defconst hm--html-menus-package-maintainer "muenkel@tnt.uni-hannover.de") 104 (defconst hm--html-menus-package-maintainer "muenkel@tnt.uni-hannover.de")
99 105
100 (defconst hm--html-menus-package-name "hm--html-menus") 106 (defconst hm--html-menus-package-name "hm--html-menus")
101 107
102 (defconst hm--html-menus-package-version "5.7") 108 (defconst hm--html-menus-package-version "5.8")
103 109
104 110
105 ;;; Generate the help buffer faces 111 ;;; Generate the help buffer faces
106 (hm--html-generate-help-buffer-faces) 112 (hm--html-generate-help-buffer-faces)
107 113
158 (setq indent-line-function 'hm--html-indent-line) 164 (setq indent-line-function 'hm--html-indent-line)
159 (setq idd-actions hm--html-idd-actions) 165 (setq idd-actions hm--html-idd-actions)
160 (hm--install-html-menu hm--html-mode-pulldown-menu-name) 166 (hm--install-html-menu hm--html-mode-pulldown-menu-name)
161 (make-variable-buffer-local 'write-file-hooks) 167 (make-variable-buffer-local 'write-file-hooks)
162 (add-hook 'write-file-hooks 'hm--html-maybe-new-date-and-changed-comment) 168 (add-hook 'write-file-hooks 'hm--html-maybe-new-date-and-changed-comment)
163 (put major-mode 'font-lock-defaults '((hm--html-font-lock-keywords 169 (if (adapt-xemacsp)
164 hm--html-font-lock-keywords-1 170 (put major-mode 'font-lock-defaults '((hm--html-font-lock-keywords
165 hm--html-font-lock-keywords-2) 171 hm--html-font-lock-keywords-1
166 t 172 hm--html-font-lock-keywords-2)
167 t 173 t
168 nil 174 t
169 nil 175 nil
170 )) 176 nil))
177 (make-local-variable 'font-lock-defaults)
178 (setq font-lock-defaults '((hm--html-font-lock-keywords
179 hm--html-font-lock-keywords-1
180 hm--html-font-lock-keywords-2)
181 t
182 t
183 nil
184 nil)))
171 (run-hooks 'hm--html-mode-hook)) 185 (run-hooks 'hm--html-mode-hook))
172 186
173 ;;;; Minor Modes 187 ;;;; Minor Modes
174 188
175 ;;; hm--html-region-mode 189 ;;; hm--html-region-mode
238 (interactive "P") 252 (interactive "P")
239 (setq hm--html-minor-mode 253 (setq hm--html-minor-mode
240 (if (null arg) (not hm--html-minor-mode) 254 (if (null arg) (not hm--html-minor-mode)
241 (> (prefix-numeric-value arg) 0))) 255 (> (prefix-numeric-value arg) 0)))
242 (if hm--html-minor-mode 256 (if hm--html-minor-mode
243 (hm--install-html-menu hm--html-minor-mode-pulldown-menu-name) 257 (progn
244 (if (and current-menubar (assoc hm--html-minor-mode-pulldown-menu-name 258 (hm--install-html-menu hm--html-minor-mode-pulldown-menu-name)
245 current-menubar)) 259 (when (adapt-emacs19p)
246 (delete-menu-item (list hm--html-minor-mode-pulldown-menu-name)))) 260 (hm--html-add-major-menu-to-minor-menus)))
261 (when (and current-menubar (assoc hm--html-minor-mode-pulldown-menu-name
262 current-menubar))
263 (delete-menu-item (list hm--html-minor-mode-pulldown-menu-name)))
264 (when (adapt-emacs19p)
265 (hm--html-remove-major-menu-from-minor-menus)))
247 ) 266 )
248 267
249 268
250 ;;; hm--html-minor-region-mode 269 ;;; hm--html-minor-region-mode
251 270
322 (run-hooks 'hm--html-load-hook) 341 (run-hooks 'hm--html-load-hook)
323 342
324 343
325 ;;; Announce the feature hm--html-configuration 344 ;;; Announce the feature hm--html-configuration
326 (provide 'hm--html-mode) 345 (provide 'hm--html-mode)
346
347
348 ;;; hm--html-mode.el ends here