annotate lisp/hm--html-menus/hm--html-mode.el @ 2:ac2d302a0011 r19-15b2

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