emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/sgml-mode.el


From: Mike Williams
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/sgml-mode.el
Date: Thu, 11 Apr 2002 17:58:23 -0400

Index: emacs/lisp/textmodes/sgml-mode.el
diff -c emacs/lisp/textmodes/sgml-mode.el:1.81 
emacs/lisp/textmodes/sgml-mode.el:1.82
*** emacs/lisp/textmodes/sgml-mode.el:1.81      Tue Apr  9 08:26:44 2002
--- emacs/lisp/textmodes/sgml-mode.el   Thu Apr 11 17:58:23 2002
***************
*** 889,895 ****
                      (unless (search-forward "]]>" pos 'move)
                        (list 0 nil nil 'cdata nil nil nil nil cdata-start))))
                   (t
!                   ;; We've reached a tag.  Parse it. 
                    ;; FIXME: Handle net-enabling start-tags
                    (parse-partial-sexp (point) pos 0))))))
        (cond
--- 889,895 ----
                      (unless (search-forward "]]>" pos 'move)
                        (list 0 nil nil 'cdata nil nil nil nil cdata-start))))
                   (t
!                   ;; We've reached a tag.  Parse it.
                    ;; FIXME: Handle net-enabling start-tags
                    (parse-partial-sexp (point) pos 0))))))
        (cond
***************
*** 1031,1037 ****
      ;;   enclosing start-tags we'll have to ignore.
      (skip-chars-backward " \t\n")      ; Make sure we're not at indentation.
      (while
!       (and (or ignore 
                   (not (if full (eq full 'empty) context))
                 (not (sgml-at-indentation-p))
                 (and context
--- 1031,1037 ----
      ;;   enclosing start-tags we'll have to ignore.
      (skip-chars-backward " \t\n")      ; Make sure we're not at indentation.
      (while
!       (and (or ignore
                   (not (if full (eq full 'empty) context))
                 (not (sgml-at-indentation-p))
                 (and context
***************
*** 1104,1110 ****
      (text
       (let ((context (save-excursion (sgml-get-context))))
         (if context
!            (progn 
               (insert "</" (sgml-tag-name (car (last context))) ">")
               (indent-according-to-mode)))))
      (otherwise
--- 1104,1110 ----
      (text
       (let ((context (save-excursion (sgml-get-context))))
         (if context
!            (progn
               (insert "</" (sgml-tag-name (car (last context))) ">")
               (indent-according-to-mode)))))
      (otherwise
***************
*** 1226,1231 ****
--- 1226,1246 ----
      (if savep
        (save-excursion (indent-line-to indent-col))
        (indent-line-to indent-col))))
+ 
+ (defun sgml-guess-indent ()
+   "Guess an appropriate value for `sgml-basic-offset'.
+ Base the guessed identation level on the first indented tag in the buffer.
+ Add this to `sgml-mode-hook' for convenience."
+   (interactive)
+   (save-excursion
+     (goto-char (point-min))
+     (if (re-search-forward "^\\([ \t]+\\)<" 100 'noerror)
+         (progn
+           (set (make-local-variable 'sgml-basic-offset)
+                (length (match-string 1)))
+           (message "Guessed sgml-basic-offset = %d"
+                    sgml-basic-offset)
+           ))))
  
  (defun sgml-parse-dtd ()
    "Simplistic parse of the current buffer as a DTD.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]