annotate lisp/hm--html-menus/hm--html-mode.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 8fc7fe29b841
children 441bb1e64a06
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
1 ;;; hm--html-mode --- Major mode for editing HTML documents for the WWW
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
2 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
3 ;;; Keywords: hypermedia languages help docs wp
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
4 ;;;
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
5 ;;; $Id: hm--html-mode.el,v 1.3 1997/02/22 22:07:11 steve Exp $
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
6 ;;;
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
7 ;;; Copyright (C) 1996, 1997 Heiko Muenkel
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
8 ;;; email: muenkel@tnt.uni-hannover.de
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
9 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
10 ;;; This program is free software; you can redistribute it and/or modify
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
11 ;;; it under the terms of the GNU General Public License as published by
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
12 ;;; the Free Software Foundation; either version 2, or (at your option)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
13 ;;; any later version.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
14 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
15 ;;; This program is distributed in the hope that it will be useful,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
18 ;;; GNU General Public License for more details.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
19 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
20 ;;; You should have received a copy of the GNU General Public License
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
21 ;;; along with this program; if not, write to the Free Software
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
22 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
23 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
24 ;;; Commentary:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
25 ;;; Description:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
26 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
27 ;;; This file defines the hm--html-mode, a mode for editing html
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
28 ;;; files. It is the main file of the package hm--html-menus.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
29 ;;; Previous releases had used the file html-mode.el from Marc
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
30 ;;; Andreessen. In that times the mode was called html-mode. I've
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
31 ;;; changed the name of the mode to distinquish it from other
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
32 ;;; html modes. But feel free to set a
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
33 ;;; (defalias 'hm--html-mode 'html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
34 ;;; to get back the old name of the mode.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
35 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
36 ;;; In the earlier releases of the package the main file was
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
37 ;;; hm--html-menu.el. This has been changed to hm--html-mode.el.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
38 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
39 ;;; Installation:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
40 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
41 ;;; Put this file and all the other files of the package
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
42 ;;; in one of your load path directories and the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
43 ;;; following lines in your .emacs:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
44 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
45 ;;; (autoload 'hm--html-mode "hm--html-mode" "HTML major mode." t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
46 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
47 ;;; (or (assoc "\\.html$" auto-mode-alist)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
48 ;;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
49 ;;; auto-mode-alist)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
50 ;;; If there is already another html-mode (like psgml in the XEmacs
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
51 ;;; 19.14, then you must put the following instead of the last form
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
52 ;;; in your .emacs:
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
53 ;;; (setq auto-mode-alist (cons '("\\.html$" . hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
54 ;;; auto-mode-alist))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
55 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
56 ;;; Look at the file hm--html-configuration for further installation
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
57 ;;; points.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
58 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
59 ;;;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
60
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
61
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
62 (require 'font-lock)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
63 (require 'adapt)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
64 (require 'hm--date)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
65 (require 'hm--html)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
66 (eval-when-compile
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
67 (require 'hm--html-configuration))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
68 (hm--html-load-config-files)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
69 (require 'hm--html-indentation)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
70 (require 'hm--html-menu)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
71 (require 'hm--html-drag-and-drop)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
72 (require 'hm--html-keys)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
73
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
75 ;;; The package version
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
76 (defconst hm--html-menus-package-maintainer "muenkel@tnt.uni-hannover.de")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
77
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
78 (defconst hm--html-menus-package-name "hm--html-menus")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
79
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 22
diff changeset
80 (defconst hm--html-menus-package-version "5.2")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
81
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
82
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
83 ;;; Generate the help buffer faces
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
84 (hm--html-generate-help-buffer-faces)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
85
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
86 ;;; syntax table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
87
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
88 (defvar hm--html-mode-syntax-table nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
89 "Syntax table used while in html mode.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
90
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
91 (if hm--html-mode-syntax-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92 ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
93 (setq hm--html-mode-syntax-table (make-syntax-table))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
94 ; (modify-syntax-entry ?\" ". " hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
95 ; (modify-syntax-entry ?\\ ". " hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
96 ; (modify-syntax-entry ?' "w " hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
97 (modify-syntax-entry ?\\ "." hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
98 (modify-syntax-entry ?' "w" hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
99 (modify-syntax-entry ?< "(>" hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
100 (modify-syntax-entry ?> ")<" hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
101 (modify-syntax-entry ?\" "\"" hm--html-mode-syntax-table)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
102 (modify-syntax-entry ?= "." hm--html-mode-syntax-table))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
103
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
104
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
105 ;;; abbreviation table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
106
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
107 (defvar hm--html-mode-abbrev-table nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
108 "Abbrev table used while in html mode.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
109
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
110 (define-abbrev-table 'hm--html-mode-abbrev-table ())
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
111
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
112 ;;; the hm--html-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
113
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
114 (defvar hm--html-mode-name-string "HTML"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
115 "The hm--html-mode name string.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
116
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
117 ;;;###autoload
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
118 (defun hm--html-mode ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
119 "Major mode for editing HTML hypertext documents.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
120 Special commands:\\{hm--html-mode-map}
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
121 Turning on hm--html-mode calls the value of the variable hm--html-mode-hook,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
122 if that value is non-nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
123 (interactive)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
124 (kill-all-local-variables)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
125 (use-local-map hm--html-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
126 (setq mode-name hm--html-mode-name-string)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
127 (setq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
128 (setq local-abbrev-table hm--html-mode-abbrev-table)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
129 (set-syntax-table hm--html-mode-syntax-table)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
130 (make-local-variable 'comment-start)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
131 (make-local-variable 'comment-end)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
132 (setq comment-start "<!--" comment-end "-->")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
133 (make-local-variable 'sentence-end)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
134 (setq sentence-end "[<>.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
135 (setq indent-line-function 'hm--html-indent-line)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 (setq idd-actions hm--html-idd-actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137 (hm--install-html-menu hm--html-mode-pulldown-menu-name)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
138 (make-variable-buffer-local 'write-file-hooks)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
139 (add-hook 'write-file-hooks 'hm--html-maybe-new-date-and-changed-comment)
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
140 (put major-mode 'font-lock-defaults '((hm--html-font-lock-keywords
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
141 hm--html-font-lock-keywords-1
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
142 hm--html-font-lock-keywords-2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
143 t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
144 t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
145 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
146 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents: 2
diff changeset
147 ))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
148 (run-hooks 'hm--html-mode-hook))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
149
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
150 ;;;; Minor Modes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
151
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
152 ;;; hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
153
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
154 (defvar hm--html-region-mode nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
155 "T, if the region is active in the `hm--html-mode'.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
156
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
157 (make-variable-buffer-local 'hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
158
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
159 (add-minor-mode 'hm--html-region-mode " Region" hm--html-region-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
160
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
161 (if (adapt-xemacsp)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
162
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
163 (defun hm--html-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
164 "Toggle 'hm--html-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
165 With ARG, turn hm--html-region-mode on iff ARG is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
166
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
167 If the `major-mode' isn't the `hm--html-mode' then the minor
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
168 mode is switched off, regardless of the ARG and the state
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
169 of `hm--html-region-mode'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
170 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
171 (setq zmacs-regions-stays t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
172 (setq hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
173 (and (eq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
174 (if (null arg) (not hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
175 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
176 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
177
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
178 (defun hm--html-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
179 "Toggle 'hm--html-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
180 With ARG, turn hm--html-region-mode on iff ARG is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
181
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
182 If the `major-mode' isn't the `hm--html-mode' then the minor
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
183 mode is switched off, regardless of the ARG and the state
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
184 of `hm--html-region-mode'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
185 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
186 (setq hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
187 (and (eq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
188 (if (null arg) (not hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
189 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
190 (if hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
191 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
192 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
193 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
194 (if hm--html-expert
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
195 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
196 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
197 hm--html-menu-noregion-expert-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
198 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
199 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
200 hm--html-menu-noregion-novice-map)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
201 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
202
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
203 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
204
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
205
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
206 ;;; hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
207
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
208 (defvar hm--html-minor-mode nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
209 "Non-nil, if the `hm--html-minor-mode' is active.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
210
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
211 (make-variable-buffer-local 'hm--html-minor-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
212
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
213 (add-minor-mode 'hm--html-minor-mode " HM-HTML" hm--html-minor-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
214
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
215 ;;;###autoload
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
216 (defun hm--html-minor-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
217 "Toggle hm--html-minor-mode.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
218 With arg, turn hm--html-minor-mode on iff arg is positive."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
219 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
220 (setq hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
221 (if (null arg) (not hm--html-minor-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
222 (> (prefix-numeric-value arg) 0)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
223 (if hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
224 (hm--install-html-menu hm--html-minor-mode-pulldown-menu-name)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
225 (if (and current-menubar (assoc hm--html-minor-mode-pulldown-menu-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
226 current-menubar))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
227 (delete-menu-item (list hm--html-minor-mode-pulldown-menu-name))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
228 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
229
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
230
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
231 ;;; hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
232
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
233 (defvar hm--html-minor-region-mode nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
234 "Non-nil, if the `hm--html-minor-region-mode' is active.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
235
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
236 (make-variable-buffer-local 'hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
237
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
238 (add-minor-mode 'hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
239 " Region"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
240 hm--html-minor-region-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
241
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
242
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
243 (if (adapt-xemacsp)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
244
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
245 (defun hm--html-minor-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
246 "Toggle `hm--html-minor-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
247 With arg, turn `hm--html-minor-region-mode' on iff arg is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
248
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
249 But however, if the `hm--html-minor-mode' isn't active, then it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
250 turns `hm--html-minor-region-mode' off."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
251 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
252 (setq zmacs-regions-stays t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
253 (setq hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
254 (and hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
255 (if (null arg) (not hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
256 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
257 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
258
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
259 (defun hm--html-minor-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
260 "Toggle `hm--html-minor-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
261 With arg, turn `hm--html-minor-region-mode' on iff arg is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
262
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
263 But however, if the `hm--html-minor-mode' isn't active, then it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
264 turns `hm--html-minor-region-mode' off."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
265 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
266 (setq hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
267 (and hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
268 (if (null arg) (not hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
269 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
270 (if hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
271 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
272 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
273 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
274 (if hm--html-expert
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
275 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
276 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
277 hm--html-menu-noregion-expert-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
278 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
279 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
280 hm--html-menu-noregion-novice-map)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
281 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
282 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
283
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
284
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
285
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
286 ;;; Hook function for toggling the region minor modes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
287 (defun hm--html-switch-region-modes-on ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
288 "Switches the region minor modes of the hm--html-menus package on.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
289 This function should be only be used for the `zmacs-activate-region-hook'
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
290 or for the `activate-mark-hook'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
291 (hm--html-region-mode 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
292 (hm--html-minor-region-mode 1))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
293
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
294 (defun hm--html-switch-region-modes-off ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
295 "Switches the region minor modes of the hm--html-menus package on.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
296 This function should be only be used for the `zmacs-deactivate-region-hook'
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
297 or for the `deactivate-mark-hook'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
298 (hm--html-region-mode -1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
299 (hm--html-minor-region-mode -1))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
300
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
301
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
302 ;;; Run the load hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
303 (run-hooks 'hm--html-load-hook)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
304
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
305
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
306 ;;; Announce the feature hm--html-configuration
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
307 (provide 'hm--html-mode)