summaryrefslogtreecommitdiff
path: root/lisp/textmodes/sgml-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2002-04-08 21:32:05 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2002-04-08 21:32:05 +0000
commit601280966a2944ce5d6bff52cafa7d4b4af46511 (patch)
treeea3a8903f14c6c80ad47224a56066c4ed6235731 /lisp/textmodes/sgml-mode.el
parent0d1bf3f74d13b8d95e00741974f4dbe19e529fc6 (diff)
downloademacs-601280966a2944ce5d6bff52cafa7d4b4af46511.tar.gz
(sgml-comment-indent-new-line): New fun.
(sgml-mode): Use it for comment-line-break-function.
Diffstat (limited to 'lisp/textmodes/sgml-mode.el')
-rw-r--r--lisp/textmodes/sgml-mode.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index cb070457a03..334a1645aeb 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -373,6 +373,13 @@ Otherwise, it is set to be buffer-local when the file has
(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 @@ Do \\[describe-key] on the following bindings to discover what they do.
(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 @@ If non-nil LIMIT is a nearby position before point outside of any tag."
(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 @@ Leave point at the beginning of the tag."
(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