aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-03-07 00:03:50 +0000
committerStefan Monnier2001-03-07 00:03:50 +0000
commit4afa094d3a93dd3e6544f571e0c4671dd19b04cc (patch)
tree384ab00002ed80fdeadb9ad70216b3dc75545ed6
parent04af43bcfcca82a651f960afdf5b62672e88c9c9 (diff)
downloademacs-4afa094d3a93dd3e6544f571e0c4671dd19b04cc.tar.gz
emacs-4afa094d3a93dd3e6544f571e0c4671dd19b04cc.zip
(sgml-mode-common): Correct value of
comment-start-skip and set comment-end-skip as well. (sgml-comment-indent): Fix for new value of comment-start-skip. (html-autoview-mode): Don't bother using make-local-hook.
-rw-r--r--lisp/textmodes/sgml-mode.el58
1 files changed, 24 insertions, 34 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index d5111b2f05c..980f324f24d 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -304,7 +304,6 @@ varables of same name)."
304 (make-local-variable 'comment-start) 304 (make-local-variable 'comment-start)
305 (make-local-variable 'comment-end) 305 (make-local-variable 'comment-end)
306 (make-local-variable 'comment-indent-function) 306 (make-local-variable 'comment-indent-function)
307 (make-local-variable 'comment-start-skip)
308 (make-local-variable 'comment-indent-function) 307 (make-local-variable 'comment-indent-function)
309 (make-local-variable 'sgml-tags-invisible) 308 (make-local-variable 'sgml-tags-invisible)
310 (make-local-variable 'skeleton-transformation) 309 (make-local-variable 'skeleton-transformation)
@@ -336,9 +335,6 @@ varables of same name)."
336 comment-start "<!-- " 335 comment-start "<!-- "
337 comment-end " -->" 336 comment-end " -->"
338 comment-indent-function 'sgml-comment-indent 337 comment-indent-function 'sgml-comment-indent
339 ;; This will allow existing comments within declarations to be
340 ;; recognized.
341 comment-start-skip "--[ \t]*"
342 skeleton-transformation sgml-transformation 338 skeleton-transformation sgml-transformation
343 skeleton-further-elements '((completion-ignore-case t)) 339 skeleton-further-elements '((completion-ignore-case t))
344 skeleton-end-hook (lambda () 340 skeleton-end-hook (lambda ()
@@ -355,10 +351,12 @@ varables of same name)."
355 nil 351 nil
356 t) 352 t)
357 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function) 353 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)
358 (while sgml-display-text 354 ;; This will allow existing comments within declarations to be
359 (put (car (car sgml-display-text)) 'before-string 355 ;; recognized.
360 (cdr (car sgml-display-text))) 356 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
361 (setq sgml-display-text (cdr sgml-display-text)))) 357 (set (make-local-variable 'comment-end-skip) "[ \t]*--\\([ \t\n]*>\\)?")
358 (dolist (pair sgml-display-text)
359 (put (car pair) 'before-string (cdr pair))))
362 360
363 361
364(defun sgml-mode-facemenu-add-face-function (face end) 362(defun sgml-mode-facemenu-add-face-function (face end)
@@ -371,7 +369,7 @@ varables of same name)."
371 369
372 370
373;;;###autoload 371;;;###autoload
374(defun sgml-mode (&optional function) 372(defun sgml-mode ()
375 "Major mode for editing SGML documents. 373 "Major mode for editing SGML documents.
376Makes > match <. Makes / blink matching /. 374Makes > match <. Makes / blink matching /.
377Keys <, &, SPC within <>, \" and ' can be electric depending on 375Keys <, &, SPC within <>, \" and ' can be electric depending on
@@ -404,13 +402,7 @@ Do \\[describe-key] on the following bindings to discover what they do.
404 402
405 403
406(defun sgml-comment-indent () 404(defun sgml-comment-indent ()
407 (if (and (looking-at "--") 405 (if (looking-at "--") comment-column 0))
408 (not (and (eq (preceding-char) ?!)
409 (eq (char-after (- (point) 2)) ?<))))
410 (progn
411 (skip-chars-backward " \t")
412 (max comment-column (1+ (current-column))))
413 0))
414 406
415 407
416 408
@@ -509,24 +501,23 @@ Completion and configuration are done according to `sgml-tag-alist'.
509If you like tags and attributes in uppercase do \\[set-variable] 501If you like tags and attributes in uppercase do \\[set-variable]
510skeleton-transformation RET upcase RET, or put this in your `.emacs': 502skeleton-transformation RET upcase RET, or put this in your `.emacs':
511 (setq sgml-transformation 'upcase)" 503 (setq sgml-transformation 'upcase)"
512 (funcall skeleton-transformation 504 (completing-read "Tag: " sgml-tag-alist)
513 (completing-read "Tag: " sgml-tag-alist)) 505 ?< str |
514 ?< (setq v1 (eval str)) |
515 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above 506 (("") -1 '(undo-boundary) (identity "&lt;")) | ; see comment above
516 (("") '(setq v2 (sgml-attributes v1 t)) ?> 507 `(("") '(setq v2 (sgml-attributes ,str t)) ?>
517 (if (string= "![" v1) 508 (if (string= "![" ,str)
518 (prog1 '(("") " [ " _ " ]]") 509 (prog1 '(("") " [ " _ " ]]")
519 (backward-char)) 510 (backward-char))
520 (if (or (eq v2 t) 511 (if (or (eq v2 t)
521 (string-match "^[/!?]" v1)) 512 (string-match "^[/!?]" ,str))
522 () 513 ()
523 (if (symbolp v2) 514 (if (symbolp v2)
524 '(("") v2 _ v2 "</" v1 ?>) 515 '(("") v2 _ v2 "</" ,str ?>)
525 (if (eq (car v2) t) 516 (if (eq (car v2) t)
526 (cons '("") (cdr v2)) 517 (cons '("") (cdr v2))
527 (append '(("") (car v2)) 518 (append '(("") (car v2))
528 (cdr v2) 519 (cdr v2)
529 '(resume: (car v2) _ "</" v1 ?>)))))))) 520 '(resume: (car v2) _ "</" ,str ?>))))))))
530 521
531(autoload 'skeleton-read "skeleton") 522(autoload 'skeleton-read "skeleton")
532 523
@@ -1261,7 +1252,6 @@ Can be used as a value for `html-mode-hook'."
1261 (and (boundp 'after-save-hook) 1252 (and (boundp 'after-save-hook)
1262 (memq 'browse-url-of-buffer after-save-hook)))) 1253 (memq 'browse-url-of-buffer after-save-hook))))
1263 (setq after-save-hook (delq 'browse-url-of-buffer after-save-hook)) 1254 (setq after-save-hook (delq 'browse-url-of-buffer after-save-hook))
1264 (make-local-hook 'after-save-hook)
1265 (add-hook 'after-save-hook 'browse-url-of-buffer nil t)) 1255 (add-hook 'after-save-hook 'browse-url-of-buffer nil t))
1266 (message "Autoviewing turned %s." 1256 (message "Autoviewing turned %s."
1267 (if arg "off" "on"))) 1257 (if arg "off" "on")))