changeset 44443:9e6f2afa9f19

(sgml-comment-indent-new-line): New fun. (sgml-mode): Use it for comment-line-break-function.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 08 Apr 2002 21:32:05 +0000
parents 0a1bd8f47e7f
children 377def17ab0f
files lisp/textmodes/sgml-mode.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/sgml-mode.el	Mon Apr 08 19:44:08 2002 +0000
+++ b/lisp/textmodes/sgml-mode.el	Mon Apr 08 21:32:05 2002 +0000
@@ -373,6 +373,13 @@
 
 (defvar v2)				; free for skeleton
 
+(defun sgml-comment-indent-new-line (&optional soft)
+  (let ((comment-start "-- ")
+	(comment-start-skip "\\(<!\\)?--[ \t]*")
+	(comment-end " --")
+	(comment-style 'plain))
+    (comment-indent-new-line soft)))
+
 (defun sgml-mode-facemenu-add-face-function (face end)
   (if (setq face (cdr (assq face sgml-face-tag-alist)))
       (progn
@@ -416,6 +423,8 @@
   (set (make-local-variable 'comment-start) "<!-- ")
   (set (make-local-variable 'comment-end) " -->")
   (set (make-local-variable 'comment-indent-function) 'sgml-comment-indent)
+  (set (make-local-variable 'comment-line-break-function)
+       'sgml-comment-indent-new-line)
   (set (make-local-variable 'skeleton-further-elements)
        '((completion-ignore-case t)))
   (set (make-local-variable 'skeleton-end-hook)
@@ -885,7 +894,7 @@
 	  (skip-chars-forward "^<" pos)
           (setq state
                 (cond
-                 ((= (point) pos) 
+                 ((= (point) pos)
                   ;; We got to the end without seeing a tag.
                   nil)
                  ((looking-at "<!\\[[A-Z]+\\[")
@@ -988,7 +997,7 @@
       (setq tag-type 'comment
             tag-start (search-backward "<!--" nil t)))
      ((sgml-looking-back-at "]]")   ; cdata
-      (setq tag-type 'cdata 
+      (setq tag-type 'cdata
             tag-start (re-search-backward "<!\\[[A-Z]+\\[" nil t)))
      (t
       (setq tag-start