comparison lisp/hm--html-menus/hm--html-menu.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; hm--html-menu.el: A menu for the html-mode.
2 ;;; v4.60; 17 Feb 1996
3 ;;; Copyright (C) 1993, 1994, 1995, 1996 Heiko Muenkel
4 ;;; email: muenkel@tnt.uni-hannover.de
5 ;;;
6 ;;; This program is free software; you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 2, or (at your option)
9 ;;; any later version.
10 ;;;
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with this program; if not, write to the Free Software
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ;;;
20 ;;;
21 ;;; Description:
22 ;;;
23 ;;; Defines pulldown and popup menus for the html mode.
24 ;;; This file requires the following files:
25 ;;; hm--html.el
26 ;;; hm--date.el
27 ;;; hm--html-configuration.el
28 ;;; adapt.el
29 ;;; html-mode.el
30 ;;; The file html-mode.el is the html mode file from Marc Andreessen.
31 ;;;
32 ;;; You should also have the w3 package from William M. Perry, for
33 ;;; browsing html- files in the xemacs and the program Xmosaic together
34 ;;; with the file html-view.el from Ron Tapia for browsing html- files
35 ;;; in the Xmosaic.
36 ;;;
37 ;;; Installation:
38 ;;;
39 ;;; Put this file in one of your load path directories and the
40 ;;; following lines in your .emacs:
41 ;;;
42 ;;; (autoload 'html-mode "hm--html-menu" "HTML major mode." t)
43 ;;; (or (assoc "\\.html$" auto-mode-alist)
44 ;;; (setq auto-mode-alist (cons '("\\.html$" . html-mode)
45 ;;; auto-mode-alist)))
46 ;;;
47 ;;; Look at the file hm--html-configuration for further installation
48 ;;; points.
49 ;;;
50
51
52 (provide 'hm--html-menu)
53 (require 'html-mode)
54 (require 'hm--html)
55 (require 'adapt)
56
57
58 ;;
59 ;; Menu "HTML"
60 ;;
61
62 (defvar hm--html-pulldown-menu nil "*A List with the HTML-Menu.")
63 (defvar hm--html-menu-region-expert nil "*A List with the HTML-Menu.")
64 (defvar hm--html-menu-region-novice nil "*A List with the HTML-Menu.")
65 (defvar hm--html-menu-noregion-expert nil "*A List with the HTML-Menu.")
66 (defvar hm--html-menu-noregion-novice nil "*A List with the HTML-Menu.")
67
68 (setq hm--html-menu-noregion-expert
69 '("HTML Noregion Expert Menu"
70 ("Anchors"
71 ["Html link..." hm--html-add-html-link t]
72 ["Info link..." hm--html-add-info-link t]
73 ["Gopher link..." hm--html-add-gopher-link t]
74 ["File link..." hm--html-add-file-link t]
75 "----"
76 ["Ftp link..." hm--html-add-ftp-link t]
77 ["News link..." hm--html-add-news-link t]
78 ["Mailbox link..." hm--html-add-mail-link t]
79 ["Mailto link..." hm--html-add-mailto-link t]
80 ["Wais link (direct)..." hm--html-add-direct-wais-link t]
81 ["Wais link (gateway)..." hm--html-add-wais-link t]
82 "----"
83 ["Proggate link..." hm--html-add-proggate-link t]
84 ["Local Proggate link..." hm--html-add-local-proggate-link t]
85 ["General link..." html-add-normal-link t]
86 "----"
87 ["Link target..." hm--html-add-link-target t]
88 )
89 ("Frame"
90 ["Full html frame..." hm--html-add-full-html-frame t]
91 ["Frame template..."
92 (hm--html-insert-template hm--html-frame-template-file)
93 (file-exists-p hm--html-frame-template-file)]
94 "----"
95 ["Html" hm--html-add-html t]
96 ["Head" hm--html-add-head t]
97 ["Body" hm--html-add-body t]
98 "----"
99 ["Title and Header..." hm--html-add-title-and-header t]
100 ["Title..." hm--html-add-title t]
101 ["Header..." hm--html-add-header t]
102 ["Node Link..." hm--html-add-normal-node-link t]
103 ["Address" html-add-address t]
104 ["Signature" hm--html-add-signature t]
105 "----"
106 ["Created comment" hm--html-insert-created-comment t]
107 ["Changed comment" hm--html-insert-changed-comment t]
108 ["New date in title" hm--html-new-date t]
109 )
110 ("Structure"
111 ["Menu or list item" html-add-list-or-menu-item t]
112 ["Menu" html-add-menu t]
113 ["Unordered list" html-add-list t]
114 ["Ordered list" hm--html-add-numberlist t]
115 ["Directory list" hm--html-add-directory-list t]
116 "----"
117 ["Description list" html-add-description-list t]
118 ["Description title" hm--html-add-description-title t]
119 ["Description entry" hm--html-add-only-description-entry t]
120 ["Description title + entry" html-add-description-entry t]
121 "----"
122 ["Table..." hm--html-add-table t]
123 ["Table title..." hm--html-add-table-title t]
124 ["Table header..." hm--html-add-table-header t]
125 ["Table first row..." hm--html-add-first-table-row t]
126 ["Table additional row..." hm--html-add-additional-table-row t]
127 ("Additional Commands"
128 ["Table row frame..." hm--html-add-row-frame t]
129 ["Table header entry..." hm--html-add-header-entry t]
130 ["Table row entry..." hm--html-add-row-entry t]
131 ["Span columns..." hm--html-table-add-colspan-attribute t]
132 ["Span rows..." hm--html-table-add-rowspan-attribute t]
133 )
134 "----"
135 ["Paragraph container" hm--html-add-paragraph t]
136 ["Paragraph start tag" hm--html-add-paragraph-separator t]
137 ["New line" hm--html-add-line-break t]
138 ["Horizontal rule" hm--html-add-horizontal-rule t]
139 )
140 ("Formating Paragraphs"
141 ["Without links" html-add-plaintext t]
142 ["With links" hm--html-add-preformated t]
143 "----"
144 ["Blockquote" html-add-blockquote t]
145 ["Listing" html-add-listing t]
146 ["Abstract" hm--html-add-abstract t]
147 )
148 ("Formatting Words"
149 ["Bold" hm--html-add-bold t]
150 ["Italic" hm--html-add-italic t]
151 ["Underline" hm--html-add-underline t]
152 ["Typewriter" html-add-fixed t]
153 ["Strikethru" hm--html-add-strikethru t]
154 ["Superscript" hm--html-add-superscript t]
155 ["Subscript" hm--html-add-subscript t]
156 ;; ["Render" hm--html-add-render t]
157 "----"
158 ["Emphasized" html-add-emphasized t]
159 ["Strong" html-add-strong t]
160 "----"
161 ("Computing"
162 ["Definition" hm--html-add-definition t]
163 ["Keyboard" html-add-keyboard t]
164 ["Command" hm--html-add-command t]
165 ["Argument" hm--html-add-argument t]
166 ["Option" hm--html-add-option t]
167 ["Variable" html-add-variable t]
168 ["Instance" hm--html-add-instance t]
169 ["Code" hm--html-add-code t]
170 ["Sample" html-add-sample t]
171 )
172 ("Literature"
173 ["Quote" hm--html-add-quote t]
174 ["Acronym" hm--html-add-acronym t]
175 ["Abbrevation" hm--html-add-abbrevation t]
176 ["Citation" html-add-citation t]
177 ["Literature" hm--html-add-literature t]
178 ["Publication" hm--html-add-publication t]
179 ["ISBN" hm--html-add-isbn t]
180 )
181 ("Person"
182 ["Person" hm--html-add-person t]
183 ["Author" hm--html-add-author t]
184 ["Editor" hm--html-add-editor t]
185 ["Credits" hm--html-add-credits t]
186 ["Copyright" hm--html-add-copyright t]
187 )
188 "----"
189 ["Footnote" hm--html-add-footnote t]
190 ["Margin" hm--html-add-margin t]
191 "----"
192 ["HTML Comment" hm--html-add-comment t]
193 )
194 ("Include"
195 ["Top aligned image..." hm--html-add-image-top t]
196 ["Middle aligned image..." hm--html-add-image-middle t]
197 ["Bottom aligned image..." hm--html-add-image-bottom t]
198 ; "----"
199 ; ["File..." hm--html-add-server-side-include-file t]
200 ; ["Command..." hm--html-add-server-side-include-command t]
201 ; ["Command with isindex parameter..."
202 ; hm--html-add-server-side-include-command-with-isindex-parameter
203 ; t]
204 )
205 ("Forms"
206 ["Form..." hm--html-add-form t]
207 "----"
208 ["Text field..." hm--html-form-add-input-text t]
209 ["Password field..." hm--html-form-add-input-password t]
210 ["Isindex field..." hm--html-form-add-input-isindex t]
211 ["Integer field..." hm--html-form-add-input-integer t]
212 ["Float field..." hm--html-form-add-input-float t]
213 ["Date field..." hm--html-form-add-input-date t]
214 ["Url field..." hm--html-form-add-input-url t]
215 ["Scribble field..." hm--html-form-add-input-scribble t]
216 "----"
217 ["Checkbox button..." hm--html-form-add-input-checkbox t]
218 ["Radio button..." hm--html-form-add-input-radio t]
219 ["Reset button..." hm--html-form-add-input-reset t]
220 ["Submit button..." hm--html-form-add-input-submit t]
221 ["Image button..." hm--html-form-add-input-image t]
222 ["Audio button..." hm--html-form-add-input-audio t]
223 "----"
224 ["Option Menu..." hm--html-form-add-select-option-menu t]
225 ["Scrolled List..." hm--html-form-add-select-scrolled-list t]
226 ["Option..." hm--html-form-add-select-option t]
227 "----"
228 ["Textarea..." hm--html-form-add-textarea t]
229 )
230 ))
231
232
233 (setq hm--html-menu-noregion-novice
234 '("HTML No-region Novice Menu"
235 ("Anchors"
236 ["Html link..." hm--html-add-html-link t]
237 ["File link..." hm--html-add-file-link t]
238 )
239 ("Frame"
240 ["Full html frame..." hm--html-add-full-html-frame t]
241 "----"
242 ["Title and Header..." hm--html-add-title-and-header t]
243 ["Signature" hm--html-add-signature t]
244 )
245 ("Structure"
246 ["Menu item" html-add-list-or-menu-item t]
247 ["Menu" html-add-menu t]
248 "----"
249 ["Paragraph Container" hm--html-add-paragraph t]
250 )
251 ("Formating Paragraphs"
252 ["Without links" html-add-plaintext t]
253 ["With links" hm--html-add-preformated t]
254 )
255 ("Formatting Words"
256 ["Bold" hm--html-add-bold t]
257 ["Italic" hm--html-add-italic t]
258 ["Underline" hm--html-add-underline t]
259 ["Typewriter" html-add-fixed t]
260 )))
261
262 (setq hm--html-menu-region-expert
263 '("HTML Region Expert Menu"
264 ("Anchors"
265 ["Html link..." hm--html-add-html-link-to-region t]
266 ["Info link..." hm--html-add-info-link-to-region t]
267 ["Gopher link..." hm--html-add-gopher-link-to-region t]
268 ["File link..." hm--html-add-file-link-to-region t]
269 "----"
270 ["Ftp link..." hm--html-add-ftp-link-to-region t]
271 ["News link..." hm--html-add-news-link-to-region t]
272 ["Mailbox link..." hm--html-add-mail-link-to-region t]
273 ["Mailto link..." hm--html-add-mailto-link-to-region t]
274 ["WAIS link (direct)..." hm--html-add-direct-wais-link-to-region t]
275 ["WAIS link (gateway)..." hm--html-add-wais-link-to-region t]
276 "----"
277 ["Proggate link..." hm--html-add-proggate-link-to-region t]
278 ["Local Proggate link..."
279 hm--html-add-local-proggate-link-to-region
280 t]
281 ["General link..." hm--html-add-normal-link-to-region t]
282 "----"
283 ["Link target..." html-add-reference-to-region t]
284 )
285 ("Frame"
286 ["Full html frame..." hm--html-add-full-html-frame-with-region t]
287 "----"
288 ["Head" hm--html-add-head-to-region t]
289 ["Body" hm--html-add-body-to-region t]
290 "----"
291 ["Title and Header..." hm--html-add-title-and-header-to-region t]
292 ["Title" hm--html-add-title-to-region t]
293 ["Header..." hm--html-add-header-to-region t]
294 ["Address" hm--html-add-address-to-region t]
295 )
296 ("Structure"
297 ["Menu" hm--html-add-menu-to-region t]
298 ["Unordered list" hm--html-add-list-to-region t]
299 ["Ordered list" hm--html-add-numberlist-to-region t]
300 ["Directory list" hm--html-add-directorylist-to-region t]
301 "----"
302 ["Description list" hm--html-add-description-list-to-region t]
303 "----"
304 ["Table..." hm--html-add-table-to-region t]
305 ["Table Title..." hm--html-add-table-title-to-region t]
306 ("Additional Commands"
307 ["Table row frame..." hm--html-add-row-frame-to-region t]
308 )
309 "----"
310 ["Paragraph container" hm--html-add-paragraph-to-region t]
311 )
312 ("Formatting Paragraphs"
313 ["Without links" hm--html-add-plaintext-to-region t]
314 ["With links" hm--html-add-preformated-to-region t]
315 "----"
316 ["Blockquote" hm--html-add-blockquote-to-region t]
317 ["Listing" hm--html-add-listing-to-region t]
318 ["Abstract" hm--html-add-abstract-to-region t]
319 )
320 ("Formatting Words"
321 ["Bold" hm--html-add-bold-to-region t]
322 ["Italic" hm--html-add-italic-to-region t]
323 ["Underline" hm--html-add-underline-to-region t]
324 ["Typewriter" hm--html-add-fixed-to-region t]
325 ["Strikethru" hm--html-add-strikethru-to-region t]
326 ["Superscript" hm--html-add-superscript-to-region t]
327 ["Subscript" hm--html-add-subscript-to-region t]
328 ;; ["Render" hm--html-add-render-to-region t]
329 "----"
330 ["Emphasized" hm--html-add-emphasized-to-region t]
331 ["Strong" hm--html-add-strong-to-region t]
332 "----"
333 ("Computing"
334 ["Definition" hm--html-add-definition-to-region t]
335 ["Keyboard" hm--html-add-keyboard-to-region t]
336 ["Command" hm--html-add-command-to-region t]
337 ["Argument" hm--html-add-argument-to-region t]
338 ["Option" hm--html-add-option-to-region t]
339 ["Variable" hm--html-add-variable-to-region t]
340 ["Instance" hm--html-add-instance-to-region t]
341 ["Code" hm--html-add-code-to-region t]
342 ["Sample" hm--html-add-sample-to-region t]
343 )
344 ("Literature"
345 ["Quote" hm--html-add-quote-to-region t]
346 ["Acronym" hm--html-add-acronym-to-region t]
347 ["Abbrevation" hm--html-add-abbrevation-to-region t]
348 ["Citation" hm--html-add-citation-to-region t]
349 ["Literature" hm--html-add-literature-to-region t]
350 ["Publication" hm--html-add-publication-to-region t]
351 ["ISBN" hm--html-add-isbn-to-region t]
352 )
353 ("Person"
354 ["Person" hm--html-add-person-to-region t]
355 ["Author" hm--html-add-author-to-region t]
356 ["Editor" hm--html-add-editor-to-region t]
357 ["Credits" hm--html-add-credits-to-region t]
358 ["Copyright" hm--html-add-copyright-to-region t]
359 )
360 "----"
361 ["Footnote" hm--html-add-footnote-to-region t]
362 ["Margin" hm--html-add-margin-to-region t]
363 "----"
364 ["HTML Comment" hm--html-add-comment-to-region t]
365 )
366 ("Forms"
367 ["Form..." hm--html-add-form-to-region t])
368 ))
369
370
371 (setq hm--html-menu-region-novice
372 '("HTML Region Novice Menu"
373 ("Anchors"
374 ["Html link..." hm--html-add-html-link-to-region t]
375 ["File link..." hm--html-add-file-link-to-region t]
376 )
377 ("Frame"
378 ["Full html frame..." hm--html-add-full-html-frame-with-region t]
379 "----"
380 ["Title and Header..." hm--html-add-title-and-header-to-region t]
381 )
382 ("Structure"
383 ["Menu" hm--html-add-menu-to-region t]
384 )
385 ("Formatting Paragraphs"
386 ["Without links" hm--html-add-plaintext-to-region t]
387 ["With links" hm--html-add-preformated-to-region t]
388 )
389 ("Formatting Words"
390 ["Bold" hm--html-add-bold-to-region t]
391 ["Italic" hm--html-add-italic-to-region t]
392 ["Underline" hm--html-add-underline-to-region t]
393 ["Typewriter" hm--html-add-fixed-to-region t]
394 )
395 ))
396
397
398
399 (setq hm--html-pulldown-menu
400 '("HTML Config Menu"
401 ("Set popup menu"
402 ["Novice menu" hm--html-use-novice-menu t]
403 ["Expert menu" hm--html-use-expert-menu t]
404 ["Marcs menu" hm--html-use-marcs-menu t]
405 )
406 ; ("Highlighting"
407 ; ["Toggle font lock mode" font-lock-mode (adapt-xemacsp)]
408 ; ["Fontify buffer" font-lock-fontify-buffer (adapt-xemacsp)]
409 ; ["Set font lock color..."
410 ; hm--html-set-font-lock-color
411 ; (or (adapt-xemacsp) (adapt-emacs19p))]
412 ; "----"
413 ; ["Toggle use highlighting"
414 ; hm--html-toggle-use-highlighting
415 ; html-use-highlighting]
416 ; )
417 ; "----"
418 ["Reload config files" hm--html-load-config-files t]
419 ["Templates ..." hm--html-insert-template t]
420 "----"
421 ["Remove numeric names" hm--html-remove-numeric-names t]
422 ["Quotify hrefs" html-quotify-hrefs t]
423 "----"
424 ["Submit bug report..." hm--html-submit-bug-report t]
425 ["WWW Package Docs" hm--html-view-www-package-docu t]
426 "----"
427 ("Preview Document"
428 ["Netscape view buffer" (hm--html-send-buffer-to-netscape
429 (current-buffer)) t]
430 "----"
431 ["Xmosaic start" html-view-start-mosaic t]
432 ["Xmosaic view buffer" html-view-view-buffer t]
433 ["Xmosaic view file" html-view-view-file t]
434 ["Xmosaic goto url" html-view-goto-url t]
435 ["Xmosaic get display" html-view-get-display t]
436 "----"
437 ["W3 start" w3 t]
438 ["W3 view buffer" w3-preview-this-buffer t]
439 ["W3 open remote file..." w3-fetch t]
440 ["W3 open local..." w3-open-local t]
441 ["W3 use hotlist..." w3-use-hotlist t]
442 )
443 ))
444
445
446 (if (adapt-xemacsp)
447 (defun hm--install-html-menu ()
448 (if (and current-menubar (not (assoc "HTML" current-menubar)))
449 (progn
450 (set-buffer-menubar (copy-sequence current-menubar))
451 (add-menu nil "HTML" (cdr hm--html-pulldown-menu)))))
452 (defun hm--install-html-menu ()
453 (if (and current-menubar (not (assoc "HTML" current-menubar)))
454 (progn
455 (set-buffer-menubar current-menubar)))
456 ; (setq lucid-menubar-map nil)
457 ; (make-local-variable 'lucid-menubar-map)
458 ; (set-buffer-menubar (copy-sequence current-menubar))
459 ; (make-local-variable 'lucid-menubar-map)
460 ; (make-local-variable 'current-menubar)))
461 (add-menu nil "HTML" (cdr hm--html-pulldown-menu))
462 ))
463
464 ; (add-menu nil "HTML" (cdr hm--html-pulldown-menu))))
465
466
467 ;(defun hm--popup-html-menu (event)
468 ; "Pops the HTML- menu up."
469 ; (interactive "@e")
470 ; (if hm--html-marc
471 ; (popup-menu html-menu)
472 ; (if hm--html-expert
473 ; (if hm--region-active
474 ; (popup-menu hm--html-menu-region-expert)
475 ; (popup-menu hm--html-menu-noregion-expert))
476 ; (if hm--region-active
477 ; (popup-menu hm--html-menu-region-novice)
478 ; (popup-menu hm--html-menu-noregion-novice)))))
479
480
481 (defun hm--popup-html-menu (event)
482 "Pops the HTML- menu up, if no region is active."
483 (interactive "@e")
484 (if hm--html-marc
485 (popup-menu html-menu)
486 (if hm--html-expert
487 (popup-menu hm--html-menu-noregion-expert)
488 (popup-menu hm--html-menu-noregion-novice))))
489
490
491 (defun hm--popup-html-menu-region (event)
492 "Pops the HTML- menu up, if a region is active."
493 (interactive "@e")
494 (if hm--html-marc
495 (popup-menu html-menu)
496 (if hm--html-expert
497 (popup-menu hm--html-menu-region-expert)
498 (popup-menu hm--html-menu-region-novice))))
499
500
501 (defun hm--html-use-novice-menu ()
502 "Changes the HTML popup menu to the novice menu."
503 (interactive)
504 (setq hm--html-expert nil)
505 (setq hm--html-marc nil)
506 ; (define-key html-mode-map '(button3) 'hm--popup-html-menu)
507 ; (define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
508 )
509
510
511 (defun hm--html-use-expert-menu ()
512 "Changes the HTML popup menu to the expert menu."
513 (interactive)
514 (setq hm--html-expert t)
515 (setq hm--html-marc nil)
516 ; (define-key html-mode-map '(button3) 'hm--popup-html-menu)
517 ; (define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
518 )
519
520
521 (defun hm--html-use-marcs-menu ()
522 "Changes the HTML popup menu to Marc Andreessens menu."
523 (interactive)
524 (setq hm--html-marc t)
525 ; (define-key html-mode-map '(button3) 'hm--popup-html-menu)
526 ; (define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
527 )
528
529
530 ;(define-key html-mode-map '(button3) 'hm--popup-html-menu)
531 ;(define-key html-region-mode-map '(button3) 'hm--popup-html-menu)
532
533 (add-hook 'html-mode-hook 'hm--install-html-menu)
534
535
536 (defvar hm--html-menu-load-hook nil
537 "*Hook variable to execute functions after loading the file hm--html-menu.")
538
539
540 (run-hooks 'hm--html-menu-load-hook)
541