annotate lisp/hm--html-menus/hm--html-mode.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 131b0175ea99
children 4be1180a9e89
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 ;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
5 ;;; $Id: hm--html-mode.el,v 1.2 1997/02/15 22:21:04 steve Exp $
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
6 ;;;
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
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
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
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)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
66 (hm--html-load-config-files)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
67 (require 'hm--html-indentation)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
68 (require 'hm--html-menu)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
69 (require 'hm--html-drag-and-drop)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
70 ;(hm--html-load-config-files) ; Load the system and user configuration files
46
6a22abad6937 Import from CVS: tag r19-15
cvs
parents: 42
diff changeset
71 (require 'hm--html-keys)
6a22abad6937 Import from CVS: tag r19-15
cvs
parents: 42
diff changeset
72
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
73
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
74 ;;; The package version
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
75 (defconst hm--html-menus-package-maintainer "muenkel@tnt.uni-hannover.de")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
76
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
77 (defconst hm--html-menus-package-name "hm--html-menus")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
78
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
79 (defconst hm--html-menus-package-version "5.1")
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
80
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
81
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
82 ;;; Generate the help buffer faces
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
83 (hm--html-generate-help-buffer-faces)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
84
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
85 ;;; syntax table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
86
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
87 (defvar hm--html-mode-syntax-table nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
88 "Syntax table used while in html mode.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
89
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
90 (if hm--html-mode-syntax-table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
91 ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
92 (setq hm--html-mode-syntax-table (make-syntax-table))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
93 ; (modify-syntax-entry ?\" ". " hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
94 ; (modify-syntax-entry ?\\ ". " hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95 ; (modify-syntax-entry ?' "w " hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
96 (modify-syntax-entry ?\\ "." hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
97 (modify-syntax-entry ?' "w" hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
98 (modify-syntax-entry ?< "(>" hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
99 (modify-syntax-entry ?> ")<" hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
100 (modify-syntax-entry ?\" "\"" hm--html-mode-syntax-table)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
101 (modify-syntax-entry ?= "." hm--html-mode-syntax-table))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
102
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
103
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
104 ;;; abbreviation table
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
105
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
106 (defvar hm--html-mode-abbrev-table nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
107 "Abbrev table used while in html mode.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
108
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
109 (define-abbrev-table 'hm--html-mode-abbrev-table ())
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
110
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
111 ;;; the hm--html-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
112
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
113 (defvar hm--html-mode-name-string "HTML"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
114 "The hm--html-mode name string.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
115
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
116 ;;;###autoload
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
117 (defun hm--html-mode ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
118 "Major mode for editing HTML hypertext documents.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
119 Special commands:\\{hm--html-mode-map}
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
120 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
121 if that value is non-nil."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
122 (interactive)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
123 (kill-all-local-variables)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
124 (use-local-map hm--html-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
125 (setq mode-name hm--html-mode-name-string)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
126 (setq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
127 (setq local-abbrev-table hm--html-mode-abbrev-table)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
128 (set-syntax-table hm--html-mode-syntax-table)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
129 (make-local-variable 'comment-start)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
130 (make-local-variable 'comment-end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
131 (setq comment-start "<!--" comment-end "-->")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
132 (make-local-variable 'sentence-end)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
133 (setq sentence-end "[<>.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
134 (setq indent-line-function 'hm--html-indent-line)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
135 (setq idd-actions hm--html-idd-actions)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
136 (hm--install-html-menu hm--html-mode-pulldown-menu-name)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
137 (make-variable-buffer-local 'write-file-hooks)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
138 (add-hook 'write-file-hooks 'hm--html-maybe-new-date-and-changed-comment)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
139 ; (make-local-variable 'font-lock-keywords)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
140 ; (setq font-lock-keywords-case-fold-search t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
141 ; (setq font-lock-keywords hm--html-font-lock-keywords)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
142 (put major-mode 'font-lock-defaults '((hm--html-font-lock-keywords
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
143 hm--html-font-lock-keywords-1
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
144 hm--html-font-lock-keywords-2)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
145 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
146 t
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
147 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
148 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
149 ))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
150 (run-hooks 'hm--html-mode-hook))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
151
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
152 ;;;; Minor Modes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
153
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
154 ;;; hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
155
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
156 (defvar hm--html-region-mode nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
157 "T, if the region is active in the `hm--html-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 (make-variable-buffer-local 'hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
160
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
161 (add-minor-mode 'hm--html-region-mode " Region" hm--html-region-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
162
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
163 (if (adapt-xemacsp)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
164
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
165 (defun hm--html-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
166 "Toggle 'hm--html-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
167 With ARG, turn hm--html-region-mode on iff ARG is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
168
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
169 If the `major-mode' isn't the `hm--html-mode' then the minor
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
170 mode is switched off, regardless of the ARG and the state
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
171 of `hm--html-region-mode'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
172 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
173 (setq zmacs-regions-stays t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
174 (setq hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
175 (and (eq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
176 (if (null arg) (not hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
177 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
178 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
179
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
180 (defun hm--html-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
181 "Toggle 'hm--html-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
182 With ARG, turn hm--html-region-mode on iff ARG is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
183
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
184 If the `major-mode' isn't the `hm--html-mode' then the minor
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
185 mode is switched off, regardless of the ARG and the state
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
186 of `hm--html-region-mode'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
187 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
188 (setq hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
189 (and (eq major-mode 'hm--html-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
190 (if (null arg) (not hm--html-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
191 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
192 (if hm--html-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
193 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
194 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
195 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
196 (if hm--html-expert
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
197 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
198 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
199 hm--html-menu-noregion-expert-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
200 (define-key hm--html-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
201 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
202 hm--html-menu-noregion-novice-map)))
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
207 ;(or (assq 'hm--html-region-mode minor-mode-alist)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
208 ; (setq minor-mode-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
209 ; (purecopy
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
210 ; (append minor-mode-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
211 ; '((hm--html-region-mode " Region"))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
212
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
213
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
214
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
215 ;(defun hm--html-region-mode (on)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
216 ; "Turns the minor mode hm--html-region-mode on or off.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
217 ;The function turns the hm--html-region-mode on, if ON is t and off otherwise."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
218 ; (if (eq major-mode 'hm--html-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
219 ; ;;(string= mode-name "HTML")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
220 ; (if on
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
221 ; ;; html-region-mode on
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
222 ; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
223 ; (setq hm--html-region-mode t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
224 ; (use-local-map hm--html-region-mode-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
225 ; ;; html-region-mode off
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
226 ; (setq hm--html-region-mode nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
227 ; (use-local-map hm--html-mode-map))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
228
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
229
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
230
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
231
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
232 ;;; hm--html-minor-mode
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
233
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
234 (defvar hm--html-minor-mode nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
235 "Non-nil, if the `hm--html-minor-mode' is active.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 46
diff changeset
236
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
237 (make-variable-buffer-local 'hm--html-minor-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
238
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
239 (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
240
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
241 ;;;###autoload
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
242 (defun hm--html-minor-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
243 "Toggle hm--html-minor-mode.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
244 With arg, turn hm--html-minor-mode on iff arg is positive."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
245 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
246 (setq hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
247 (if (null arg) (not hm--html-minor-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
248 (> (prefix-numeric-value arg) 0)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
249 (if hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
250 (hm--install-html-menu hm--html-minor-mode-pulldown-menu-name)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
251 (if (and current-menubar (assoc hm--html-minor-mode-pulldown-menu-name
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
252 current-menubar))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
253 (delete-menu-item (list hm--html-minor-mode-pulldown-menu-name))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
254 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
255
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
256
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
257 ;;; hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
258
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
259 (defvar hm--html-minor-region-mode nil
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
260 "Non-nil, if the `hm--html-minor-region-mode' is active.")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
261
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
262 (make-variable-buffer-local 'hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
263
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
264 (add-minor-mode 'hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
265 " Region"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
266 hm--html-minor-region-mode-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
267
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
268
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
269 (if (adapt-xemacsp)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
270
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
271 (defun hm--html-minor-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
272 "Toggle `hm--html-minor-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
273 With arg, turn `hm--html-minor-region-mode' on iff arg is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
274
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
275 But however, if the `hm--html-minor-mode' isn't active, then it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
276 turns `hm--html-minor-region-mode' off."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
277 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
278 (setq zmacs-regions-stays t)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
279 (setq hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
280 (and hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
281 (if (null arg) (not hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
282 (> (prefix-numeric-value arg) 0))))
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 (defun hm--html-minor-region-mode (&optional arg)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
286 "Toggle `hm--html-minor-region-mode'.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
287 With arg, turn `hm--html-minor-region-mode' on iff arg is positive.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
288
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
289 But however, if the `hm--html-minor-mode' isn't active, then it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
290 turns `hm--html-minor-region-mode' off."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
291 (interactive "P")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
292 (setq hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
293 (and hm--html-minor-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
294 (if (null arg) (not hm--html-minor-region-mode)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
295 (> (prefix-numeric-value arg) 0))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
296 (if hm--html-minor-region-mode
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
297 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
298 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
299 nil)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
300 (if hm--html-expert
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
301 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
302 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
303 hm--html-menu-noregion-expert-map)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
304 (define-key hm--html-minor-mode-map
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
305 hm--html-emacs19-popup-noregion-menu-button
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
306 hm--html-menu-noregion-novice-map)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
307 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
308 )
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
309
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
310
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
311
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
312 ;;; Hook function for toggling the region minor modes
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
313 (defun hm--html-switch-region-modes-on ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
314 "Switches the region minor modes of the hm--html-menus package on.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
315 This function should be only be used for the `zmacs-activate-region-hook'
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
316 or for the `activate-mark-hook'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
317 (hm--html-region-mode 1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
318 (hm--html-minor-region-mode 1))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
319
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
320 (defun hm--html-switch-region-modes-off ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
321 "Switches the region minor modes of the hm--html-menus package on.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
322 This function should be only be used for the `zmacs-deactivate-region-hook'
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
323 or for the `deactivate-mark-hook'."
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
324 (hm--html-region-mode -1)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
325 (hm--html-minor-region-mode -1))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
326
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
327
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
328 ;;; Run the load hook
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
329 (run-hooks 'hm--html-load-hook)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
330
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
331
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
332 ;;; Announce the feature hm--html-configuration
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents:
diff changeset
333 (provide 'hm--html-mode)