Mercurial > hg > xemacs-beta
comparison lisp/hm--html-menus/hm--html.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | 8fc7fe29b841 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
1 ;;; hm--html.el: | 1 ;;; $Id: hm--html.el,v 1.1.1.2 1996/12/18 03:46:47 steve Exp $ |
2 ;;; v6.00; 17 Feb 1996 | 2 ;;; |
3 ;;; Copyright (C) 1993, 1994, 1995, 1996 Heiko Muenkel | 3 ;;; Copyright (C) 1993, 1994, 1995, 1996 Heiko Muenkel |
4 ;;; email: muenkel@tnt.uni-hannover.de | 4 ;;; email: muenkel@tnt.uni-hannover.de |
5 ;;; | 5 ;;; |
6 ;;; This program is free software; you can redistribute it and/or modify | 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 | 7 ;;; it under the terms of the GNU General Public License as published by |
25 ;;; Installation: | 25 ;;; Installation: |
26 ;;; | 26 ;;; |
27 ;;; Put this file in one of your load path directories. | 27 ;;; Put this file in one of your load path directories. |
28 ;;; | 28 ;;; |
29 | 29 |
30 | 30 ;(require 'hm--date) |
31 | 31 ;(require 'adapt) |
32 (provide 'hm--html) | |
33 (require 'hm--date) | |
34 (require 'adapt) | |
35 | 32 |
36 | 33 |
37 (defconst hm--html-menus-package-maintainer "muenkel@tnt.uni-hannover.de") | 34 ;;; Indentation |
38 | 35 |
39 (defconst hm--html-menus-package-name "hm--html-menus") | 36 (defun hm--html-indent-region (begin end) |
40 | 37 "Indents the region between BEGIN and END according to the major mode." |
41 (defconst hm--html-menus-package-version "4.16") | 38 (when (< end begin) |
42 | 39 (let ((a end)) |
40 (setq end start) | |
41 (setq start a))) | |
42 (save-excursion | |
43 (goto-char begin) | |
44 (let ((old-point)) | |
45 (while (and (<= (point) end) | |
46 (not (eq (point) old-point))) | |
47 (setq old-point (point)) | |
48 (indent-according-to-mode) | |
49 (forward-line) | |
50 )))) | |
51 | |
43 | 52 |
44 ;;; Functions for adding html commands which consists of a start and a | 53 ;;; Functions for adding html commands which consists of a start and a |
45 ;;; end tag and some text between them. (Basicfunctions) | 54 ;;; end tag and some text between them. (Basicfunctions) |
46 | 55 |
47 (defun hm--html-add-tags (function-insert-start-tag | 56 (defun hm--html-add-tags (function-insert-start-tag |
48 start-tag | 57 start-tag |
49 &optional function-insert-end-tag | 58 &optional |
50 &optional end-tag | 59 function-insert-end-tag |
51 &optional function-insert-middle-tag | 60 end-tag |
52 &optional middle-tag) | 61 function-insert-middle-start-tag |
62 middle-start-tag | |
63 function-insert-middle-end-tag | |
64 middle-end-tag) | |
53 "Adds the start and the end html tag at point. | 65 "Adds the start and the end html tag at point. |
54 The first parameter specifies the funtion which insert the start tag | 66 The first parameter specifies the funtion which insert the start tag |
55 and the third parameter specifies the function which insert the end tag. | 67 and the third parameter specifies the function which insert the end tag. |
56 The second parameter is the string for the start tag and the fourth parameter | 68 The second parameter is the string for the start tag and the fourth parameter |
57 is the string for the end tag. The third and fourth parameters are optional. | 69 is the string for the end tag. The third and fourth parameters are optional. |
58 The fifth parameter is optional. If it exists, it specifies a function which | 70 The fifth parameter is optional. If it exists, it specifies a function which |
59 inserts the sixth parameter (the middle-tag) between the start and the end | 71 inserts the sixth parameter (the middle-start-tag) between the start and the end |
60 tag." | 72 tag." |
61 ; (interactive "aFunction, which adds the HTML start tag: \n\ | 73 ; (interactive "aFunction, which adds the HTML start tag: \n\ |
62 ;aFunction, which adds the HTML end tag: \n\ | 74 ;aFunction, which adds the HTML end tag: \n\ |
63 ;sThe HTML start tag: \n\ | 75 ;sThe HTML start tag: \n\ |
64 ;sThe HTML end tag: ") | 76 ;sThe HTML end tag: ") |
65 (eval (list function-insert-start-tag start-tag)) | 77 (eval (list function-insert-start-tag start-tag)) |
66 (if function-insert-middle-tag | 78 (if function-insert-middle-start-tag |
67 (eval (list function-insert-middle-tag middle-tag))) | 79 (eval (list function-insert-middle-start-tag middle-start-tag))) |
68 (if function-insert-end-tag | 80 (let ((position (point))) |
69 (let ((position (point))) | 81 (if function-insert-middle-end-tag |
70 (eval (list function-insert-end-tag end-tag)) | 82 (eval (list function-insert-middle-end-tag middle-end-tag))) |
71 (goto-char position)))) | 83 (if function-insert-end-tag |
84 (eval (list function-insert-end-tag end-tag))) | |
85 (goto-char position))) | |
72 | 86 |
73 | 87 |
74 (defun hm--html-add-tags-to-region (function-insert-start-tag | 88 (defun hm--html-add-tags-to-region (function-insert-start-tag |
75 start-tag | 89 start-tag |
76 function-insert-end-tag | 90 function-insert-end-tag |
104 (defun hm--html-insert-start-tag (tag) | 118 (defun hm--html-insert-start-tag (tag) |
105 "Inserts the HTML start tag 'tag' without a Newline. | 119 "Inserts the HTML start tag 'tag' without a Newline. |
106 The parameter must be a string (i.e. \"<B>\")" | 120 The parameter must be a string (i.e. \"<B>\")" |
107 (let ((start (point))) | 121 (let ((start (point))) |
108 (insert tag) | 122 (insert tag) |
109 (html-maybe-deemphasize-region start (- (point) 1)))) | 123 (hm--html-indent-region start (point)))) |
124 ; (html-maybe-deemphasize-region start (- (point) 1)))) | |
110 | 125 |
111 | 126 |
112 (defun hm--html-insert-end-tag (tag) | 127 (defun hm--html-insert-end-tag (tag) |
113 "Inserts the HTML end tag 'tag' without a Newline. | 128 "Inserts the HTML end tag 'tag' without a Newline. |
114 The parameter must be a string (i.e. \"</B>\")" | 129 The parameter must be a string (i.e. \"</B>\")" |
115 (let ((start (point))) | 130 (let ((start (point))) |
116 (insert tag) | 131 (insert tag) |
117 (html-maybe-deemphasize-region start (- (point) 1)))) | 132 (hm--html-indent-region start (point)))) |
133 ; (html-maybe-deemphasize-region start (- (point) 1)))) | |
118 | 134 |
119 | 135 |
120 (defun hm--html-insert-start-tag-with-newline (tag) | 136 (defun hm--html-insert-start-tag-with-newline (tag) |
121 "Inserts the HTML start tag 'tag' with a Newline. | 137 "Inserts the HTML start tag 'tag' with a Newline. |
122 The parameter must be a string (i.e. \"<PRE>\")" | 138 The parameter must be a string (i.e. \"<PRE>\")" |
123 (let ((start (point))) | 139 (let ((start (point))) |
124 (insert tag) | 140 (insert tag) |
125 (html-maybe-deemphasize-region start (- (point) 1))) | 141 (hm--html-indent-region start (point)) |
142 ) | |
143 ; (html-maybe-deemphasize-region start (- (point) 1))) | |
126 (insert "\n")) | 144 (insert "\n")) |
127 | 145 |
128 | 146 |
129 (defun hm--html-insert-end-tag-with-newline (tag) | 147 (defun hm--html-insert-end-tag-with-newline (tag) |
130 "Inserts the HTML end tag 'tag' with a Newline. | 148 "Inserts the HTML end tag 'tag' with a Newline. |
131 The parameter must be a string (i.e. \"</PRE>\")" | 149 The parameter must be a string (i.e. \"</PRE>\")" |
132 (insert "\n") | 150 (insert "\n") |
133 (let ((start (point))) | 151 (let ((start (point))) |
134 (insert tag) | 152 (insert tag) |
135 (html-maybe-deemphasize-region start (- (point) 1)))) | 153 (hm--html-indent-region start (point)))) |
154 ; (html-maybe-deemphasize-region start (- (point) 1)))) | |
136 | 155 |
137 | 156 |
138 | 157 |
139 ;;; Functions which add simple tags of the form <tag> | 158 ;;; Functions which add simple tags of the form <tag> |
159 | |
160 (defun hm--html-add-list-or-menu-item-separator () | |
161 "Adds a list or menu item. Assume we're at the end of the last item." | |
162 (interactive) | |
163 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline "<LI> ")) | |
164 | |
165 (defun hm--html-add-list-or-menu-item () | |
166 "Adds the tags for a menu item at the point in the current buffer." | |
167 (interactive) | |
168 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline "<LI> " | |
169 'hm--html-insert-end-tag " </LI>")) | |
170 | |
171 (defun hm--html-add-list-or-menu-item-to-region () | |
172 "Adds the tags for a menu item to the region in the current buffer." | |
173 (interactive) | |
174 (hm--html-add-tags-to-region 'hm--html-insert-start-tag "<LI> " | |
175 'hm--html-insert-end-tag " </LI>")) | |
140 | 176 |
141 (defun hm--html-add-line-break () | 177 (defun hm--html-add-line-break () |
142 "Adds the HTML tag for a line break." | 178 "Adds the HTML tag for a line break." |
143 (interactive) | 179 (interactive) |
144 (hm--html-add-tags 'hm--html-insert-start-tag "<BR>")) | 180 (hm--html-add-tags 'hm--html-insert-start-tag "<BR>")) |
253 | 289 |
254 (defun hm--html-add-image-bottom (href alt) | 290 (defun hm--html-add-image-bottom (href alt) |
255 "Add an image, bottom aligned." | 291 "Add an image, bottom aligned." |
256 (interactive (let ((url (hm--html-read-url "Image URL: "))) | 292 (interactive (let ((url (hm--html-read-url "Image URL: "))) |
257 (list url (hm--html-read-altenate url)))) | 293 (list url (hm--html-read-altenate url)))) |
258 (let ((start (point))) | 294 (hm--html-add-tags |
259 (if alt | 295 'hm--html-insert-start-tag |
260 (insert "<IMG ALIGN=BOTTOM SRC=\"" href "\" ALT=\"" alt "\">") | 296 (concat "<IMG ALIGN=BOTTOM SRC=\"" |
261 (insert "<IMG ALIGN=BOTTOM SRC=\"" href "\">")) | 297 href |
262 (html-maybe-deemphasize-region (1+ start) (1- (point))))) | 298 (when alt |
299 (concat "\" ALT=\"" alt)) | |
300 "\">"))) | |
263 | 301 |
264 | 302 |
265 (defun hm--html-add-image-middle (href alt) | 303 (defun hm--html-add-image-middle (href alt) |
266 "Add an image, middle aligned." | 304 "Add an image, middle aligned." |
267 (interactive (let ((url (hm--html-read-url "Image URL: "))) | 305 (interactive (let ((url (hm--html-read-url "Image URL: "))) |
268 (list url (hm--html-read-altenate url)))) | 306 (list url (hm--html-read-altenate url)))) |
269 (let ((start (point))) | 307 (hm--html-add-tags |
270 (if alt | 308 'hm--html-insert-start-tag |
271 (insert "<IMG ALIGN=MIDDLE SRC=\"" href "\" ALT=\"" alt "\">") | 309 (concat "<IMG ALIGN=MIDDLE SRC=\"" |
272 (insert "<IMG ALIGN=MIDDLE SRC=\"" href "\">")) | 310 href |
273 (html-maybe-deemphasize-region (1+ start) (1- (point))))) | 311 (when alt |
312 (concat "\" ALT=\"" alt)) | |
313 "\">"))) | |
274 | 314 |
275 | 315 |
276 (defun hm--html-add-image-top (href alt) | 316 (defun hm--html-add-image-top (href alt) |
277 "Add an image, top aligned." | 317 "Add an image, top aligned." |
278 (interactive (let ((url (hm--html-read-url "Image URL: "))) | 318 (interactive (let ((url (hm--html-read-url "Image URL: "))) |
279 (list url (hm--html-read-altenate url)))) | 319 (list url (hm--html-read-altenate url)))) |
280 (let ((start (point))) | 320 (hm--html-add-tags |
281 (if alt | 321 'hm--html-insert-start-tag |
282 (insert "<IMG ALIGN=TOP SRC=\"" href "\" ALT=\"" alt "\">") | 322 (concat "<IMG ALIGN=TOP SRC=\"" |
283 (insert "<IMG ALIGN=TOP SRC=\"" href "\">")) | 323 href |
284 (html-maybe-deemphasize-region (1+ start) (1- (point))))) | 324 (when alt |
285 | 325 (concat "\" ALT=\"" alt)) |
326 "\">"))) | |
327 | |
328 | |
329 (defun hm--html-add-applet (name code width height) | |
330 "Add an applet." | |
331 (interactive (let ((name (read-string "Applet Name: " "applet")) | |
332 (code (read-file-name "Applet Class File: ")) | |
333 (width (read-number "Width (i.e.: 100): " t)) | |
334 (height (read-number "Height (i.e.: 100): " t))) | |
335 (list name code width height))) | |
336 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
337 (concat "<APPLET " | |
338 (if (string= name "") | |
339 "" | |
340 (concat "NAME=\"" name "\"\n")) | |
341 "CODE=\"" | |
342 code | |
343 "\"\n" | |
344 "WIDTH=\"" | |
345 width | |
346 "\"\n" | |
347 "HEIGHT=\"" | |
348 height | |
349 "\">") | |
350 'hm--html-insert-start-tag-with-newline | |
351 "</APPLET>")) | |
352 | |
353 (defun hm--html-add-applet-parameter (name value) | |
354 "Adds the tag for an applet parameter at the current point. | |
355 This tag must be added between <APPLET> and </APPLET>." | |
356 (interactive "sParameter Name: \nsParameter Value: ") | |
357 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
358 (concat "<PARAM " | |
359 "NAME=\"" | |
360 name | |
361 "\" VALUE=\"" | |
362 value | |
363 "\">"))) | |
364 | |
286 | 365 |
287 (defun hm--html-add-server-side-include-file (file) | 366 (defun hm--html-add-server-side-include-file (file) |
288 "This function adds a server side include file directive in the buffer. | 367 "This function adds a server side include file directive in the buffer. |
289 The directive is only supported by the NCSA http daemon." | 368 The directive is only supported by the NCSA http daemon." |
290 (interactive "FInclude File: ") | 369 (interactive "FInclude File: ") |
291 (let ((start (point))) | 370 (let ((start (point))) |
292 (if (string= file "") | 371 (if (string= file "") |
293 (error "ERROR: No filename specified !") | 372 (error "ERROR: No filename specified !") |
294 (insert "<INC SRV \"" file "\">") | 373 (insert "<INC SRV \"" file "\">")))) |
295 (html-maybe-deemphasize-region (1+ start) (1- (point)))))) | 374 ; (html-maybe-deemphasize-region (1+ start) (1- (point)))))) |
296 | 375 |
297 | 376 |
298 (defun hm--html-add-server-side-include-command-with-isindex-parameter | 377 (defun hm--html-add-server-side-include-command-with-isindex-parameter |
299 (command) | 378 (command) |
300 "This function adds a server side include command directive in the buffer. | 379 "This function adds a server side include command directive in the buffer. |
318 (attribute (if srvurl "SRVURL" "SRV"))) | 397 (attribute (if srvurl "SRVURL" "SRV"))) |
319 (if (string= command "") | 398 (if (string= command "") |
320 (error "ERROR: No command specified !") | 399 (error "ERROR: No command specified !") |
321 (if (= ?| (string-to-char command)) | 400 (if (= ?| (string-to-char command)) |
322 (insert "<INC " attribute" \"" command "\">") | 401 (insert "<INC " attribute" \"" command "\">") |
323 (insert "<INC " attribute " \"|" command "\">") | 402 (insert "<INC " attribute " \"|" command "\">"))))) |
324 (html-maybe-deemphasize-region (1+ start) (1- (point))))))) | 403 ; (html-maybe-deemphasize-region (1+ start) (1- (point))))))) |
325 | 404 |
326 | 405 |
327 ;(defun hm--html-add-server-side-include-command-with-parameter (command | 406 ;(defun hm--html-add-server-side-include-command-with-parameter (command |
328 ; parameter) | 407 ; parameter) |
329 ; "This function adds a server side include command directive in the buffer. | 408 ; "This function adds a server side include command directive in the buffer. |
349 | 428 |
350 | 429 |
351 | 430 |
352 ;;; Functions, which adds tags of the form <starttag> ... </endtag> | 431 ;;; Functions, which adds tags of the form <starttag> ... </endtag> |
353 | 432 |
433 (defun hm--html-add-big () | |
434 "Adds the HTML tags for Big at the point in the current buffer." | |
435 (interactive) | |
436 (hm--html-add-tags 'hm--html-insert-start-tag | |
437 "<BIG>" | |
438 'hm--html-insert-end-tag | |
439 "</BIG>")) | |
440 | |
441 | |
442 (defun hm--html-add-big-to-region () | |
443 "Adds the HTML tags for Big to the region." | |
444 (interactive) | |
445 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
446 "<BIG>" | |
447 'hm--html-insert-end-tag | |
448 "</BIG>")) | |
449 | |
450 | |
451 (defun hm--html-add-small () | |
452 "Adds the HTML tags for Small at the point in the current buffer." | |
453 (interactive) | |
454 (hm--html-add-tags 'hm--html-insert-start-tag | |
455 "<SMALL>" | |
456 'hm--html-insert-end-tag | |
457 "</SMALL>")) | |
458 | |
459 | |
460 (defun hm--html-add-small-to-region () | |
461 "Adds the HTML tags for Small to the region." | |
462 (interactive) | |
463 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
464 "<SMALL>" | |
465 'hm--html-insert-end-tag | |
466 "</SMALL>")) | |
467 | |
468 | |
354 (defun hm--html-add-bold () | 469 (defun hm--html-add-bold () |
355 "Adds the HTML tags for Bold at the point in the current buffer." | 470 "Adds the HTML tags for Bold at the point in the current buffer." |
356 (interactive) | 471 (interactive) |
357 (hm--html-add-tags 'hm--html-insert-start-tag | 472 (hm--html-add-tags 'hm--html-insert-start-tag |
358 "<B>" | 473 "<B>" |
439 "<CODE>" | 554 "<CODE>" |
440 'hm--html-insert-end-tag | 555 'hm--html-insert-end-tag |
441 "</CODE>")) | 556 "</CODE>")) |
442 | 557 |
443 | 558 |
559 (defun hm--html-add-citation () | |
560 "Adds the HTML tags for Citation." | |
561 (interactive) | |
562 (hm--html-add-tags 'hm--html-insert-start-tag | |
563 "<CITE>" | |
564 'hm--html-insert-end-tag | |
565 "</CITE>")) | |
566 | |
444 (defun hm--html-add-citation-to-region () | 567 (defun hm--html-add-citation-to-region () |
445 "Adds the HTML tags for Citation to the region." | 568 "Adds the HTML tags for Citation to the region." |
446 (interactive) | 569 (interactive) |
447 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 570 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
448 "<CITE>" | 571 "<CITE>" |
449 'hm--html-insert-end-tag | 572 'hm--html-insert-end-tag |
450 "</CITE>")) | 573 "</CITE>")) |
451 | 574 |
452 | 575 |
576 (defun hm--html-add-emphasized () | |
577 "Adds the HTML tags for Emphasized." | |
578 (interactive) | |
579 (hm--html-add-tags 'hm--html-insert-start-tag | |
580 "<EM>" | |
581 'hm--html-insert-end-tag | |
582 "</EM>")) | |
583 | |
584 | |
453 (defun hm--html-add-emphasized-to-region () | 585 (defun hm--html-add-emphasized-to-region () |
454 "Adds the HTML tags for Emphasized to the region." | 586 "Adds the HTML tags for Emphasized to the region." |
455 (interactive) | 587 (interactive) |
456 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 588 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
457 "<EM>" | 589 "<EM>" |
458 'hm--html-insert-end-tag | 590 'hm--html-insert-end-tag |
459 "</EM>")) | 591 "</EM>")) |
460 | 592 |
461 | 593 |
594 (defun hm--html-add-fixed () | |
595 "Adds the HTML tags for Fixed." | |
596 (interactive) | |
597 (hm--html-add-tags 'hm--html-insert-start-tag | |
598 "<TT>" | |
599 'hm--html-insert-end-tag | |
600 "</TT>")) | |
601 | |
602 | |
462 (defun hm--html-add-fixed-to-region () | 603 (defun hm--html-add-fixed-to-region () |
463 "Adds the HTML tags for Fixed to the region." | 604 "Adds the HTML tags for Fixed to the region." |
464 (interactive) | 605 (interactive) |
465 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 606 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
466 "<TT>" | 607 "<TT>" |
467 'hm--html-insert-end-tag | 608 'hm--html-insert-end-tag |
468 "</TT>")) | 609 "</TT>")) |
469 | 610 |
470 | 611 |
612 (defun hm--html-add-keyboard () | |
613 "Adds the HTML tags for Keyboard." | |
614 (interactive) | |
615 (hm--html-add-tags 'hm--html-insert-start-tag | |
616 "<KBD>" | |
617 'hm--html-insert-end-tag | |
618 "</KBD>")) | |
619 | |
620 | |
471 (defun hm--html-add-keyboard-to-region () | 621 (defun hm--html-add-keyboard-to-region () |
472 "Adds the HTML tags for Keyboard to the region." | 622 "Adds the HTML tags for Keyboard to the region." |
473 (interactive) | 623 (interactive) |
474 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 624 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
475 "<KBD>" | 625 "<KBD>" |
476 'hm--html-insert-end-tag | 626 'hm--html-insert-end-tag |
477 "</KBD>")) | 627 "</KBD>")) |
478 | 628 |
479 | 629 |
630 (defun hm--html-add-sample () | |
631 "Adds the HTML tags for Sample." | |
632 (interactive) | |
633 (hm--html-add-tags 'hm--html-insert-start-tag | |
634 "<SAMP>" | |
635 'hm--html-insert-end-tag | |
636 "</SAMP>")) | |
637 | |
480 (defun hm--html-add-sample-to-region () | 638 (defun hm--html-add-sample-to-region () |
481 "Adds the HTML tags for Sample to the region." | 639 "Adds the HTML tags for Sample to the region." |
482 (interactive) | 640 (interactive) |
483 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 641 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
484 "<SAMP>" | 642 "<SAMP>" |
485 'hm--html-insert-end-tag | 643 'hm--html-insert-end-tag |
486 "</SAMP>")) | 644 "</SAMP>")) |
487 | 645 |
488 | 646 |
647 (defun hm--html-add-strong () | |
648 "Adds the HTML tags for Strong." | |
649 (interactive) | |
650 (hm--html-add-tags 'hm--html-insert-start-tag | |
651 "<STRONG>" | |
652 'hm--html-insert-end-tag | |
653 "</STRONG>")) | |
654 | |
655 | |
489 (defun hm--html-add-strong-to-region () | 656 (defun hm--html-add-strong-to-region () |
490 "Adds the HTML tags for Strong to the region." | 657 "Adds the HTML tags for Strong to the region." |
491 (interactive) | 658 (interactive) |
492 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 659 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
493 "<STRONG>" | 660 "<STRONG>" |
494 'hm--html-insert-end-tag | 661 'hm--html-insert-end-tag |
495 "</STRONG>")) | 662 "</STRONG>")) |
496 | 663 |
497 | 664 |
665 (defun hm--html-add-variable () | |
666 "Adds the HTML tags for Variable." | |
667 (interactive) | |
668 (hm--html-add-tags 'hm--html-insert-start-tag | |
669 "<VAR>" | |
670 'hm--html-insert-end-tag | |
671 "</VAR>")) | |
672 | |
498 (defun hm--html-add-variable-to-region () | 673 (defun hm--html-add-variable-to-region () |
499 "Adds the HTML tags for Variable to the region." | 674 "Adds the HTML tags for Variable to the region." |
500 (interactive) | 675 (interactive) |
501 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 676 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
502 "<VAR>" | 677 "<VAR>" |
539 "<PRE>" | 714 "<PRE>" |
540 'hm--html-insert-end-tag-with-newline | 715 'hm--html-insert-end-tag-with-newline |
541 "</PRE>")) | 716 "</PRE>")) |
542 | 717 |
543 | 718 |
719 (defun hm--html-add-plaintext () | |
720 "Adds the HTML tags for plaintext." | |
721 (interactive) | |
722 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
723 "<XMP>" | |
724 'hm--html-insert-end-tag-with-newline | |
725 "</XMP>")) | |
726 | |
727 | |
544 (defun hm--html-add-plaintext-to-region () | 728 (defun hm--html-add-plaintext-to-region () |
545 "Adds the HTML tags for plaintext to the region." | 729 "Adds the HTML tags for plaintext to the region." |
546 (interactive) | 730 (interactive) |
547 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 731 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
548 "<XMP>" | 732 "<XMP>" |
549 'hm--html-insert-end-tag-with-newline | 733 'hm--html-insert-end-tag-with-newline |
550 "</XMP>")) | 734 "</XMP>")) |
551 | 735 |
552 | 736 |
737 (defun hm--html-add-blockquote () | |
738 "Adds the HTML tags for blockquote." | |
739 (interactive) | |
740 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
741 "<BLOCKQUOTE>" | |
742 'hm--html-insert-end-tag-with-newline | |
743 "</BLOCKQUOTE>")) | |
744 | |
745 | |
553 (defun hm--html-add-blockquote-to-region () | 746 (defun hm--html-add-blockquote-to-region () |
554 "Adds the HTML tags for blockquote to the region." | 747 "Adds the HTML tags for blockquote to the region." |
555 (interactive) | 748 (interactive) |
556 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 749 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
557 "<BLOCKQUOTE>" | 750 "<BLOCKQUOTE>" |
941 | 1134 |
942 | 1135 |
943 ;;; Lists | 1136 ;;; Lists |
944 | 1137 |
945 | 1138 |
1139 (defun hm--html-add-listing () | |
1140 "Adds the HTML tags for listing." | |
1141 (interactive) | |
1142 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1143 "<LISTING>" | |
1144 'hm--html-insert-end-tag-with-newline | |
1145 "</LISTING>")) | |
1146 | |
1147 | |
946 (defun hm--html-add-listing-to-region () | 1148 (defun hm--html-add-listing-to-region () |
947 "Adds the HTML tags for listing to the region." | 1149 "Adds the HTML tags for listing to the region." |
948 (interactive) | 1150 (interactive) |
949 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 1151 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
950 "<LISTING>" | 1152 "<LISTING>" |
951 'hm--html-insert-end-tag-with-newline | 1153 'hm--html-insert-end-tag-with-newline |
952 "</LISTING>")) | 1154 "</LISTING>")) |
953 | 1155 |
1156 (defun hm--html-add-center () | |
1157 "Adds the HTML tags for center at the current point." | |
1158 (interactive) | |
1159 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1160 "<CENTER>" | |
1161 'hm--html-insert-end-tag-with-newline | |
1162 "</CENTER>")) | |
1163 | |
1164 (defun hm--html-add-center-to-region () | |
1165 "Adds the HTML tags for center to the region." | |
1166 (interactive) | |
1167 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | |
1168 "<CENTER>" | |
1169 'hm--html-insert-end-tag-with-newline | |
1170 "</CENTER>")) | |
954 | 1171 |
955 (defun hm--html-add-numberlist () | 1172 (defun hm--html-add-numberlist () |
956 "Adds the HTML tags for a numbered list at the point in the current buffer." | 1173 "Adds the HTML tags for a numbered list at the point in the current buffer." |
957 (interactive) | 1174 (interactive) |
958 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | 1175 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline |
992 "</DIR>" | 1209 "</DIR>" |
993 'hm--html-insert-start-tag | 1210 'hm--html-insert-start-tag |
994 "<LI> ")) | 1211 "<LI> ")) |
995 | 1212 |
996 | 1213 |
1214 (defun hm--html-add-list () | |
1215 "Adds the HTML tags for a (unnumbered) list to the region." | |
1216 (interactive) | |
1217 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1218 "<UL>" | |
1219 'hm--html-insert-end-tag-with-newline | |
1220 "</UL>" | |
1221 'hm--html-insert-start-tag | |
1222 "<LI> ")) | |
1223 | |
1224 | |
997 (defun hm--html-add-list-to-region () | 1225 (defun hm--html-add-list-to-region () |
998 "Adds the HTML tags for a (unnumbered) list to the region." | 1226 "Adds the HTML tags for a (unnumbered) list to the region." |
999 (interactive) | 1227 (interactive) |
1000 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 1228 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
1001 "<UL>" | 1229 "<UL>" |
1003 "</UL>" | 1231 "</UL>" |
1004 'hm--html-insert-start-tag | 1232 'hm--html-insert-start-tag |
1005 "<LI> ")) | 1233 "<LI> ")) |
1006 | 1234 |
1007 | 1235 |
1236 (defun hm--html-add-menu () | |
1237 "Adds the HTML tags for a menu." | |
1238 (interactive) | |
1239 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1240 "<MENU>" | |
1241 'hm--html-insert-end-tag-with-newline | |
1242 "</MENU>" | |
1243 'hm--html-insert-start-tag | |
1244 "<LI> ")) | |
1245 | |
1246 | |
1247 (defun hm--html-add-menu () | |
1248 "Adds the HTML tags for a menu." | |
1249 (interactive) | |
1250 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1251 "<MENU>" | |
1252 'hm--html-insert-end-tag-with-newline | |
1253 "</MENU>" | |
1254 'hm--html-insert-start-tag | |
1255 "<LI> " | |
1256 'hm--html-insert-end-tag | |
1257 " </LI>")) | |
1258 | |
1259 | |
1008 (defun hm--html-add-menu-to-region () | 1260 (defun hm--html-add-menu-to-region () |
1009 "Adds the HTML tags for a menu to the region." | 1261 "Adds the HTML tags for a menu to the region." |
1010 (interactive) | 1262 (interactive) |
1011 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 1263 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
1012 "<MENU>" | 1264 "<MENU>" |
1013 'hm--html-insert-end-tag-with-newline | 1265 'hm--html-insert-end-tag-with-newline |
1014 "</MENU>" | 1266 "</MENU>")) |
1015 'hm--html-insert-start-tag | 1267 |
1016 "<LI> ")) | 1268 ; 'hm--html-insert-start-tag |
1017 | 1269 ; "<LI> ")) |
1270 | |
1271 | |
1272 (defun hm--html-add-description-title-and-entry () | |
1273 "Adds a definition title and entry. | |
1274 Assumes we're at the end of a previous entry." | |
1275 (interactive) | |
1276 (hm--html-add-description-title) | |
1277 (let ((position (point))) | |
1278 (search-forward "</DT>") | |
1279 (hm--html-add-only-description-entry) | |
1280 (goto-char position))) | |
1281 | |
1282 | |
1283 (defun hm--html-add-description-list () | |
1284 "Adds the HTML tags for a description list. | |
1285 It also inserts a tag for the description title." | |
1286 (interactive) | |
1287 (hm--html-add-tags 'hm--html-insert-start-tag-with-newline | |
1288 "<DL>" | |
1289 'hm--html-insert-end-tag-with-newline | |
1290 "</DL>" | |
1291 'hm--html-insert-start-tag | |
1292 "<DT> " | |
1293 'hm--html-insert-end-tag | |
1294 " </DT>")) | |
1295 | |
1018 | 1296 |
1019 (defun hm--html-add-description-list-to-region () | 1297 (defun hm--html-add-description-list-to-region () |
1020 "Adds the HTML tags for a description list to a region. | 1298 "Adds the HTML tags for a description list to a region. |
1021 It also inserts a tag for the description title." | 1299 It also inserts a tag for the description title." |
1022 (interactive) | 1300 (interactive) |
1023 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline | 1301 (hm--html-add-tags-to-region 'hm--html-insert-start-tag-with-newline |
1024 "<DL>" | 1302 "<DL>" |
1025 'hm--html-insert-end-tag-with-newline | 1303 'hm--html-insert-end-tag-with-newline |
1026 "</DL>" | 1304 "</DL>")) |
1027 'hm--html-insert-start-tag | 1305 |
1028 "<DT> ")) | 1306 ; 'hm--html-insert-start-tag |
1307 ; "<DT> ")) | |
1029 | 1308 |
1030 | 1309 |
1031 (defun hm--html-add-description-title () | 1310 (defun hm--html-add-description-title () |
1032 "Adds the HTML tag for a description title at current point in the buffer." | 1311 "Adds the HTML tags for a description title at current point in the buffer." |
1033 (interactive) | 1312 (interactive) |
1034 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline | 1313 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline |
1035 "<DT> ")) | 1314 "<DT> " |
1036 | 1315 'hm--html-insert-end-tag |
1037 | 1316 " </DT>")) |
1038 (defun hm--html-add-only-description-entry () | 1317 |
1039 "Adds the HTML tag for a description entry at current point in the buffer." | 1318 |
1319 (defun hm--html-add-description-title-to-region () | |
1320 "Adds the HTML tags for a description title to the region in the buffer." | |
1321 (interactive) | |
1322 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
1323 "<DT> " | |
1324 'hm--html-insert-end-tag | |
1325 " </DT>")) | |
1326 | |
1327 | |
1328 (defun hm--html-add-description-entry () | |
1329 "Adds the HTML tags for a description entry at current point in the buffer." | |
1040 (interactive) | 1330 (interactive) |
1041 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline | 1331 (hm--html-add-tags 'hm--html-insert-end-tag-with-newline |
1042 "<DD> ")) | 1332 "<DD> " |
1043 | 1333 'hm--html-insert-end-tag |
1334 " </DD>")) | |
1335 | |
1336 | |
1337 (defun hm--html-add-description-entry-to-region () | |
1338 "Adds the HTML tags for a description entry to the region in the buffer." | |
1339 (interactive) | |
1340 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
1341 "<DD> " | |
1342 'hm--html-insert-end-tag | |
1343 " </DD>")) | |
1344 | |
1345 | |
1346 (defun hm--html-add-address () | |
1347 "Adds the HTML tags for an address." | |
1348 (interactive) | |
1349 (hm--html-add-tags 'hm--html-insert-start-tag | |
1350 "<ADDRESS>" | |
1351 'hm--html-insert-end-tag | |
1352 "</ADDRESS>")) | |
1044 | 1353 |
1045 (defun hm--html-add-address-to-region () | 1354 (defun hm--html-add-address-to-region () |
1046 "Adds the HTML tags for an address to the region" | 1355 "Adds the HTML tags for an address to the region" |
1047 (interactive) | 1356 (interactive) |
1048 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 1357 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
1049 "<ADDRESS> " | 1358 "<ADDRESS>" |
1050 'hm--html-insert-end-tag | 1359 'hm--html-insert-end-tag |
1051 " </ADDRESS>")) | 1360 "</ADDRESS>")) |
1052 | 1361 |
1053 | 1362 |
1054 (defvar hm--html-signature-reference-name "Signature" | 1363 (defvar hm--html-signature-reference-name "Signature" |
1055 "The signature reference name.") | 1364 "The signature reference name.") |
1056 | 1365 |
1395 (hm--html-add-body) | 1704 (hm--html-add-body) |
1396 (hm--html-add-signature) | 1705 (hm--html-add-signature) |
1397 (if hm--html-automatic-created-comment | 1706 (if hm--html-automatic-created-comment |
1398 (hm--html-insert-created-comment))) | 1707 (hm--html-insert-created-comment))) |
1399 | 1708 |
1709 | |
1710 (defun hm--html-add-link-target-to-region (name) | |
1711 "Adds the HTML tags for a link target to the region." | |
1712 (interactive "sName: ") | |
1713 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
1714 (concat "<A NAME=\"" name "\">") | |
1715 'hm--html-insert-end-tag | |
1716 "</A>")) | |
1400 | 1717 |
1401 (defun hm--html-add-link-target (name) | 1718 (defun hm--html-add-link-target (name) |
1402 "Adds the HTML tags for a link target at point in the current buffer." | 1719 "Adds the HTML tags for a link target at point in the current buffer." |
1403 ; (interactive "sName (or RET for numeric): ") | 1720 ; (interactive "sName (or RET for numeric): ") |
1404 (interactive "sName: ") | 1721 (interactive "sName: ") |
1595 (if (not (facep 'hm--html-help-face)) | 1912 (if (not (facep 'hm--html-help-face)) |
1596 ; (if (not hm--html-faces-exist) | 1913 ; (if (not hm--html-faces-exist) |
1597 (progn | 1914 (progn |
1598 (setq hm--html-faces-exist t) | 1915 (setq hm--html-faces-exist t) |
1599 (make-face 'hm--html-help-face) | 1916 (make-face 'hm--html-help-face) |
1600 (and hm--html-help-foreground | 1917 (if hm--html-help-foreground |
1601 (set-face-foreground 'hm--html-help-face | 1918 (set-face-foreground 'hm--html-help-face hm--html-help-foreground)) |
1602 hm--html-help-foreground)) | 1919 (if hm--html-help-background |
1603 (and hm--html-help-background | 1920 (set-face-background 'hm--html-help-face hm--html-help-background)) |
1604 (set-face-background 'hm--html-help-face | 1921 (set-face-font 'hm--html-help-face hm--html-help-font) |
1605 hm--html-help-background)) | |
1606 (and hm--html-help-font | |
1607 (set-face-font 'hm--html-help-face hm--html-help-font)) | |
1608 ))) | 1922 ))) |
1609 | 1923 |
1610 | 1924 |
1611 (defun hm--html-get-prompt-from-parameter-list (parameter-list) | 1925 (defun hm--html-get-prompt-from-parameter-list (parameter-list) |
1612 "Returns the prompt from the PARAMETER-LIST." | 1926 "Returns the prompt from the PARAMETER-LIST." |
2387 nil | 2701 nil |
2388 "" | 2702 "" |
2389 t | 2703 t |
2390 nil) | 2704 nil) |
2391 (list ; servername:port | 2705 (list ; servername:port |
2392 "Mailadresse: " | 2706 "Mailaddress: " |
2393 mailto-alist | 2707 mailto-alist |
2394 nil | 2708 nil |
2395 nil | 2709 nil |
2396 "muenkel@tnt.uni-hannover.de") | 2710 "muenkel@tnt.uni-hannover.de") |
2397 nil ; path/file | 2711 nil ; path/file |
2412 (defun hm--html-add-mailto-link-to-region () | 2726 (defun hm--html-add-mailto-link-to-region () |
2413 "Adds the HTML tags for a mailto link to the region." | 2727 "Adds the HTML tags for a mailto link to the region." |
2414 (interactive) | 2728 (interactive) |
2415 (hm--html-add-mailto-link-1 'hm--html-add-tags-to-region)) | 2729 (hm--html-add-mailto-link-1 'hm--html-add-tags-to-region)) |
2416 | 2730 |
2417 | 2731 (defun hm--html-add-relative-link (relative-file-path) |
2418 (defun hm--html-add-normal-link-to-region () | 2732 "Adds the HTML tags for a relative link at the current point." |
2419 "Adds the HTML tags for a normal general link to region." | 2733 (interactive (list (read-file-name "Relative Filename: " |
2420 (interactive) | 2734 nil |
2735 nil | |
2736 nil | |
2737 ""))) | |
2738 (hm--html-add-tags 'hm--html-insert-start-tag | |
2739 (concat "<A HREF=\"" | |
2740 relative-file-path | |
2741 "\">") | |
2742 'hm--html-insert-end-tag | |
2743 "</A>")) | |
2744 | |
2745 (defun hm--html-add-relative-link-to-region (relative-file-path) | |
2746 "Adds the HTML tags for a relative link to the region." | |
2747 (interactive (list (read-file-name "Relative Filename: " | |
2748 nil | |
2749 nil | |
2750 nil | |
2751 ""))) | |
2421 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | 2752 (hm--html-add-tags-to-region 'hm--html-insert-start-tag |
2422 (concat "<A HREF=\"" | 2753 (concat "<A HREF=\"" |
2423 (read-string "Link to: ") | 2754 relative-file-path |
2755 "\">") | |
2756 'hm--html-insert-end-tag | |
2757 "</A>")) | |
2758 | |
2759 (defun hm--html-add-normal-link (link-object) | |
2760 "Adds the HTML tags for a normal general link. | |
2761 Single argument LINK-OBJECT is value of HREF in the new anchor. | |
2762 Mark is set after anchor." | |
2763 (interactive "sNode Link to: ") | |
2764 (hm--html-add-tags 'hm--html-insert-start-tag | |
2765 (concat "<A HREF=\"" | |
2766 link-object | |
2767 "\">") | |
2768 'hm--html-insert-end-tag | |
2769 "</A>")) | |
2770 | |
2771 (defun hm--html-add-normal-link-to-region (link-object) | |
2772 "Adds the HTML tags for a normal general link to region. | |
2773 Single argument LINK-OBJECT is value of HREF in the new anchor. | |
2774 Mark is set after anchor." | |
2775 (interactive "sNode Link to: ") | |
2776 (hm--html-add-tags-to-region 'hm--html-insert-start-tag | |
2777 (concat "<A HREF=\"" | |
2778 ; (read-string "Link to: ") | |
2779 link-object | |
2424 "\">") | 2780 "\">") |
2425 'hm--html-insert-end-tag | 2781 'hm--html-insert-end-tag |
2426 "</A>")) | 2782 "</A>")) |
2427 | 2783 |
2428 | 2784 |
2614 ; (setq html-use-highlighting t))) | 2970 ; (setq html-use-highlighting t))) |
2615 | 2971 |
2616 | 2972 |
2617 ;;; Functions for font lock mode | 2973 ;;; Functions for font lock mode |
2618 | 2974 |
2619 (if html-running-emacs-19 | 2975 (if (adapt-emacs19p) |
2620 (progn | 2976 (progn |
2621 (make-face 'font-lock-comment-face) | 2977 (make-face 'font-lock-comment-face) |
2622 (make-face 'font-lock-doc-string-face) | 2978 (make-face 'font-lock-doc-string-face) |
2623 (make-face 'font-lock-string-face) | 2979 (make-face 'font-lock-string-face) |
2624 (or (face-differs-from-default-p 'font-lock-doc-string-face) | 2980 (or (face-differs-from-default-p 'font-lock-doc-string-face) |
3305 (insert (format " rowspan=\"%d\"" rows))) | 3661 (insert (format " rowspan=\"%d\"" rows))) |
3306 (error "ERROR: Point not in a table cell!")))) | 3662 (error "ERROR: Point not in a table cell!")))) |
3307 | 3663 |
3308 | 3664 |
3309 ;;; ISO-Characters for Emacs HTML-mode (Berthold Crysmann) | 3665 ;;; ISO-Characters for Emacs HTML-mode (Berthold Crysmann) |
3666 ;(setq buffer-invisibility-spec '(hm--html-iso-entity-invisible-flag)) | |
3667 | |
3668 ;(defvar hm--html-iso-entity-invisible-flag t | |
3669 ; "Controls the visibility of the iso entities.") | |
3670 | |
3671 ;(defvar hm--html-iso-glyph-invisible-flag nil | |
3672 ; "Controls the visibility of the iso character glyphs.") | |
3673 | |
3674 ;(defvar hm--html-glyph-cache nil | |
3675 ; "Internal variable. An assoc list with the already created glyphs.") | |
3676 | |
3677 ;(defun hm--html-create-glyph (string) | |
3678 ; "Creates a glyph from the string or returns an existing one. | |
3679 ;The glyph is stored in `hm--html-glyph-cache'." | |
3680 ; (if nil ;(assoc string hm--html-glyph-cache) | |
3681 ; (cdr (assoc string hm--html-glyph-cache)) | |
3682 ; (let ((glyph (make-glyph string))) | |
3683 ; (setq hm--html-glyph-cache (cons (cons string glyph) | |
3684 ; hm--html-glyph-cache)) | |
3685 ; glyph))) | |
3686 | |
3687 ;(defun hm--html-attach-glyph-to-region (start | |
3688 ; end | |
3689 ; string | |
3690 ; region-invisible-flag | |
3691 ; glyph-invisible-flag) | |
3692 ; "Make the region invisible and attach a glyph STRING. | |
3693 ;The invisible flags could be used, to toggle the visibility." | |
3694 ; (mapcar 'delete-annotation (annotations-at end)) ; delete old anotations | |
3695 ; ;; delete old extents | |
3696 ; (let ((extent (make-extent start end)) | |
3697 ; (annotation nil)) | |
3698 ; (set-extent-property extent 'invisible region-invisible-flag) | |
3699 ; (set-extent-property extent 'end-open t) | |
3700 ; (set-extent-property extent 'start-open t) | |
3701 ; (set-extent-property extent 'intangible t) | |
3702 ; (setq annotation (make-annotation "Hallo Du da" ;(hm--html-create-glyph string) | |
3703 ; end | |
3704 ; 'text)) | |
3705 ; (goto-char end))) | |
3706 | |
3707 | |
3708 ;(defun hm--html-insert-iso-char-as-entity-and-glyph (char entity) | |
3709 ; "Inserts an iso char as html ENTITY and displays a glyph. | |
3710 ;The glyph is created from the string CHAR." | |
3711 ; (let ((start (point))) | |
3712 ; (insert entity) | |
3713 ; (hm--html-attach-glyph-to-region start | |
3714 ; (point) | |
3715 ; char | |
3716 ; 'hm--html-iso-entity-invisible-flag | |
3717 ; 'hm--html-iso-glyph-invisible-flag))) | |
3718 | |
3719 ;(defun hm--html_ue () | |
3720 ; (interactive) | |
3721 ; (hm--html-insert-iso-char-as-entity-and-glyph "ü" "ü")) | |
3722 | |
3723 | |
3724 ;(defun hm--html-insert-iso-char-as-entity-and-glyph (char entity) | |
3725 ; (let ((start (point)) | |
3726 ; (end nil) | |
3727 ; (extent nil)) | |
3728 ; (insert entity) | |
3729 ; (setq end (point)) | |
3730 ; (setq extent (make-extent start end)) | |
3731 ; (set-extent-begin-glyph extent char) | |
3732 ; (set-extent-property extent 'invisible t))) | |
3733 | |
3734 ;(defun hm--html_ue () | |
3735 ; (interactive) | |
3736 ; (hm--html-insert-iso-char-as-entity-and-glyph ?ü "ü")) | |
3310 | 3737 |
3311 (defun hm--html_ue () | 3738 (defun hm--html_ue () |
3312 "Insert the character 'ue'." | 3739 "Insert the character 'ue'." |
3313 (interactive) | 3740 (interactive) |
3314 (insert "ü")) | 3741 (insert "ü")) |
3588 ; | 4015 ; |
3589 ; smart functions | 4016 ; smart functions |
3590 | 4017 |
3591 (defvar hm--just-insert-less-than nil | 4018 (defvar hm--just-insert-less-than nil |
3592 "Internal variable.") | 4019 "Internal variable.") |
4020 | |
4021 (defun hm--html-less-than () | |
4022 "Inserts the entity '>'." | |
4023 (interactive) | |
4024 (insert "<")) | |
3593 | 4025 |
3594 (defun hm--html-smart-less-than () | 4026 (defun hm--html-smart-less-than () |
3595 "Insert a '<' or the entity '<' if you execute this command twice." | 4027 "Insert a '<' or the entity '<' if you execute this command twice." |
3596 (interactive) | 4028 (interactive) |
3597 (if (and (eq last-command 'hm--html-smart-less-than) | 4029 (if (and (eq last-command 'hm--html-smart-less-than) |
3598 hm--just-insert-less-than) | 4030 hm--just-insert-less-than) |
3599 (progn | 4031 (progn |
3600 (delete-char -1) | 4032 (delete-char -1) |
3601 (html-less-than) | 4033 (hm--html-less-than) |
3602 (setq hm--just-insert-less-than nil)) | 4034 (setq hm--just-insert-less-than nil)) |
3603 (insert ?<) | 4035 (insert ?<) |
3604 (setq hm--just-insert-less-than t))) | 4036 (setq hm--just-insert-less-than t))) |
3605 | 4037 |
3606 (defvar hm--just-insert-greater-than nil | 4038 (defvar hm--just-insert-greater-than nil |
3607 "Internal variable.") | 4039 "Internal variable.") |
4040 | |
4041 (defun hm--html-greater-than () | |
4042 "Inserts the entity '>'." | |
4043 (interactive) | |
4044 (insert ">")) | |
3608 | 4045 |
3609 (defun hm--html-smart-greater-than () | 4046 (defun hm--html-smart-greater-than () |
3610 "Insert a '>' or the entity '>' if you execute this command twice." | 4047 "Insert a '>' or the entity '>' if you execute this command twice." |
3611 (interactive) | 4048 (interactive) |
3612 (if (and (eq last-command 'hm--html-smart-greater-than) | 4049 (if (and (eq last-command 'hm--html-smart-greater-than) |
3613 hm--just-insert-greater-than) | 4050 hm--just-insert-greater-than) |
3614 (progn | 4051 (progn |
3615 (delete-char -1) | 4052 (delete-char -1) |
3616 (html-greater-than) | 4053 (hm--html-greater-than) |
3617 (setq hm--just-insert-greater-than nil)) | 4054 (setq hm--just-insert-greater-than nil)) |
3618 (insert ?>) | 4055 (insert ?>) |
3619 (setq hm--just-insert-greater-than t))) | 4056 (setq hm--just-insert-greater-than t))) |
4057 | |
4058 | |
4059 (defvar hm--just-insert-ampersand nil | |
4060 "Internal variable.") | |
4061 | |
4062 (defun hm--html-ampersand () | |
4063 "Inserts the entity '&'." | |
4064 (interactive) | |
4065 (insert "&")) | |
4066 | |
4067 (defun hm--html-smart-ampersand () | |
4068 "Insert a '&' or the entity '&' if you execute this command twice." | |
4069 (interactive) | |
4070 (if (and (eq last-command 'hm--html-smart-ampersand) | |
4071 hm--just-insert-ampersand) | |
4072 (progn | |
4073 (delete-char -1) | |
4074 (hm--html-ampersand) | |
4075 (setq hm--just-insert-ampersand nil)) | |
4076 (insert ?&) | |
4077 (setq hm--just-insert-ampersand t))) | |
3620 | 4078 |
3621 | 4079 |
3622 ;;; | 4080 ;;; |
3623 ; sending the contents of a html buffer to netscape | 4081 ; sending the contents of a html buffer to netscape |
3624 ; (Thanks to Adrian Aichner for providing this function) | 4082 ; (Thanks to Adrian Aichner for providing this function) |
3717 'hm--html-wais-hostname:port-alist | 4175 'hm--html-wais-hostname:port-alist |
3718 'hm--html-wais-hostname:port-default | 4176 'hm--html-wais-hostname:port-default |
3719 'hm--html-wais-path-alist | 4177 'hm--html-wais-path-alist |
3720 'hm--html-wais-servername:port-alist | 4178 'hm--html-wais-servername:port-alist |
3721 'hm--html-wais-servername:port-default | 4179 'hm--html-wais-servername:port-default |
3722 'html-deemphasize-color | 4180 ; 'html-deemphasize-color |
3723 'html-document-previewer | 4181 'html-document-previewer |
3724 'html-document-previewer-args | 4182 ; 'html-document-previewer-args |
3725 'html-emphasize-color | 4183 ; 'html-emphasize-color |
3726 'html-quotify-hrefs-on-find | 4184 ; 'html-quotify-hrefs-on-find |
3727 'html-region-mode | 4185 'hm--html-region-mode |
3728 'html-sigusr1-signal-value | 4186 'html-sigusr1-signal-value |
3729 'html-use-font-lock | 4187 ; 'html-use-font-lock |
3730 'html-use-highlighting | 4188 ; 'html-use-highlighting |
3731 ) | 4189 ) |
3732 nil | 4190 nil |
3733 nil | 4191 nil |
3734 "Decribe your Bug: " | 4192 "Decribe your Bug: " |
3735 ))) | 4193 ))) |
3740 ; | 4198 ; |
3741 | 4199 |
3742 (if (adapt-xemacsp) | 4200 (if (adapt-xemacsp) |
3743 (progn | 4201 (progn |
3744 | 4202 |
3745 (add-hook 'zmacs-activate-region-hook | 4203 (add-hook 'zmacs-activate-region-hook |
3746 (function (lambda () (html-region-mode t)))) | 4204 'hm--html-switch-region-modes-on) |
4205 ; (function (lambda () (hm--html-region-mode 1)))) | |
3747 | 4206 |
3748 (add-hook 'zmacs-deactivate-region-hook | 4207 (add-hook 'zmacs-deactivate-region-hook |
3749 (function (lambda () (html-region-mode nil)))) | 4208 'hm--html-switch-region-modes-off) |
4209 ; (function (lambda () (hm--html-region-mode -1)))) | |
3750 | 4210 |
3751 ) | 4211 ) |
3752 | 4212 |
3753 (transient-mark-mode t) | 4213 (transient-mark-mode t) |
3754 | 4214 |
3755 (add-hook 'activate-mark-hook | 4215 (add-hook 'activate-mark-hook |
3756 (function (lambda () (html-region-mode t)))) | 4216 'hm--html-switch-region-modes-on) |
4217 ; (function (lambda () (hm--html-region-mode t)))) | |
3757 | 4218 |
3758 (add-hook 'deactivate-mark-hook | 4219 (add-hook 'deactivate-mark-hook |
3759 (function (lambda () (html-region-mode nil)))) | 4220 'hm--html-switch-region-modes-off) |
4221 ; (function (lambda () (hm--html-region-mode nil)))) | |
3760 | 4222 |
3761 ) | 4223 ) |
3762 | 4224 |
3763 | 4225 |
3764 (add-hook 'html-mode-hook | 4226 ;(add-hook 'hm--html-mode-hook |
3765 (function | 4227 ; (function |
3766 (lambda () | 4228 ; (lambda () |
3767 (make-variable-buffer-local 'write-file-hooks) | 4229 ; (make-variable-buffer-local 'write-file-hooks) |
3768 (add-hook 'write-file-hooks | 4230 ; (add-hook 'write-file-hooks |
3769 'hm--html-maybe-new-date-and-changed-comment)))) | 4231 ; 'hm--html-maybe-new-date-and-changed-comment)))) |
3770 | 4232 |
3771 ;(add-hook 'zmacs-activate-region-hook 'hm--set-hm--region-active) | 4233 ;(add-hook 'zmacs-activate-region-hook 'hm--set-hm--region-active) |
3772 ; | 4234 ; |
3773 ;(add-hook 'zmacs-deactivate-region-hook 'hm--unset-hm--region-active) | 4235 ;(add-hook 'zmacs-deactivate-region-hook 'hm--unset-hm--region-active) |
3774 | 4236 |
3822 | 4284 |
3823 ;(hm--html-load-config-files) | 4285 ;(hm--html-load-config-files) |
3824 | 4286 |
3825 ;;; Definition of the minor mode html-region-mode | 4287 ;;; Definition of the minor mode html-region-mode |
3826 | 4288 |
3827 (defvar html-region-mode nil | 4289 ;(defvar html-region-mode nil |
3828 "*t, if the minor mode html-region-mode is on and nil otherwise.") | 4290 ; "*t, if the minor mode html-region-mode is on and nil otherwise.") |
3829 | 4291 |
3830 (make-variable-buffer-local 'html-region-mode) | 4292 ;(make-variable-buffer-local 'html-region-mode) |
3831 | 4293 |
3832 (defvar html-region-mode-map nil "") | 4294 ;(defvar html-region-mode-map nil "") |
3833 | 4295 |
3834 (hm--html-load-config-files) | 4296 ;(hm--html-load-config-files) |
3835 | 4297 |
3836 (if hm--html-use-old-keymap | 4298 ;(if hm--html-use-old-keymap |
3837 (progn | 4299 ; (progn |
3838 | 4300 |
3839 ;(setq minor-mode-alist (cons '(html-region-mode " Region") minor-mode-alist)) | 4301 ;;(setq minor-mode-alist (cons '(html-region-mode " Region") minor-mode-alist)) |
3840 (or (assq 'html-region-mode minor-mode-alist) | 4302 ;(or (assq 'html-region-mode minor-mode-alist) |
3841 (setq minor-mode-alist | 4303 ; (setq minor-mode-alist |
3842 (purecopy | 4304 ; (purecopy |
3843 (append minor-mode-alist | 4305 ; (append minor-mode-alist |
3844 '((html-region-mode " Region")))))) | 4306 ; '((html-region-mode " Region")))))) |
3845 | 4307 |
3846 (defun html-region-mode (on) | 4308 ;(defun html-region-mode (on) |
3847 "Turns the minor mode html-region-mode on or off. | 4309 ; "Turns the minor mode html-region-mode on or off. |
3848 The function turns the html-region-mode on, if ON is t and off otherwise." | 4310 ;The function turns the html-region-mode on, if ON is t and off otherwise." |
3849 (if (string= mode-name "HTML") | 4311 ; (if (string= mode-name "HTML") |
3850 (if on | 4312 ; (if on |
3851 ;; html-region-mode on | 4313 ; ;; html-region-mode on |
3852 (progn | 4314 ; (progn |
3853 (setq html-region-mode t) | 4315 ; (setq html-region-mode t) |
3854 (use-local-map html-region-mode-map)) | 4316 ; (use-local-map html-region-mode-map)) |
3855 ;; html-region-mode off | 4317 ; ;; html-region-mode off |
3856 (setq html-region-mode nil) | 4318 ; (setq html-region-mode nil) |
3857 (use-local-map html-mode-map)))) | 4319 ; (use-local-map html-mode-map)))) |
3858 | 4320 |
3859 )) | 4321 ;)) |
3860 | 4322 |
3861 | 4323 |
3862 | 4324 |
3863 | 4325 |
3864 | 4326 |
3865 ;;; | 4327 ;;; |
3866 ; Set font lock color | 4328 ; Set font lock color |
3867 ; (hm--html-font-lock-color should be defined in hm--html-configuration.el | 4329 ; (hm--html-font-lock-color should be defined in hm--html-configuration.el |
3868 ; oder .hm--html-configuration.el) | 4330 ; oder .hm--html-configuration.el) |
3869 ; | 4331 ; |
3870 (require 'font-lock) | 4332 ;(require 'font-lock) |
3871 ;(load-library "font-lock") | 4333 ;(load-library "font-lock") |
3872 ;(set-face-foreground 'font-lock-comment-face hm--html-font-lock-color) | 4334 ;(set-face-foreground 'font-lock-comment-face hm--html-font-lock-color) |
3873 | 4335 |
3874 | 4336 |
3875 (hm--html-generate-help-buffer-faces) | 4337 ;(hm--html-generate-help-buffer-faces) |
3876 | 4338 |
3877 | 4339 |
3878 | 4340 |
3879 | 4341 |
3880 ;;;;;;;; | 4342 ;;;;;;;; |
3884 ;(defun hm--html-get-next-hostname () | 4346 ;(defun hm--html-get-next-hostname () |
3885 ; (interactive) | 4347 ; (interactive) |
3886 ; (search-forward-regexp hm--html-hostname-search-string) | 4348 ; (search-forward-regexp hm--html-hostname-search-string) |
3887 ; (buffer-substring (match-beginning 0) (match-end 0))) | 4349 ; (buffer-substring (match-beginning 0) (match-end 0))) |
3888 ; | 4350 ; |
4351 | |
4352 ;;; Announce the feature hm--html-configuration | |
4353 | |
4354 ;;; quotify href | |
4355 | |
4356 (defvar hm--html-quotify-href-regexp | |
4357 "<[aA][ \t\n]+\\([nN][aA][mM][eE]=[a-zA-Z0-9]+[ \t\n]+\\)?[hH][rR][eE][fF]=" | |
4358 "Regular expression used for searching hrefs.") | |
4359 | |
4360 (defun hm--html-quotify-hrefs () | |
4361 "Insert quotes around all HREF and NAME attribute value literals. | |
4362 | |
4363 This remedies the problem with old HTML files that can't be processed | |
4364 by SGML parsers. That is, changes <A HREF=foo> to <A HREF=\"foo\">. | |
4365 | |
4366 Look also at the variable `hm--html-quotify-href-regexp'." | |
4367 (interactive) | |
4368 (save-excursion | |
4369 (goto-char (point-min)) | |
4370 (while | |
4371 (re-search-forward hm--html-quotify-href-regexp | |
4372 (point-max) | |
4373 t) | |
4374 (cond | |
4375 ((null (looking-at "\"")) | |
4376 (insert "\"") | |
4377 (re-search-forward "[ \t\n>]" (point-max) t) | |
4378 (forward-char -1) | |
4379 (insert "\"")))))) | |
4380 | |
4381 | |
4382 | |
4383 (provide 'hm--html) |