;;; sgml-mode.el --- SGML- and HTML-editing modes -*- coding: utf-8 -*-
-;; Copyright (C) 1992, 1995, 1996, 1998, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1995-1996, 1998, 2001-2011
+;; Free Software Foundation, Inc.
;; Author: James Clark <jjc@jclark.com>
;; Maintainer: FSF
(define-key map "\C-c\C-d" 'sgml-delete-tag)
(define-key map "\C-c\^?" 'sgml-delete-tag)
(define-key map "\C-c?" 'sgml-tag-help)
+ (define-key map "\C-c]" 'sgml-close-tag)
(define-key map "\C-c/" 'sgml-close-tag)
;; Redundant keybindings, for consistency with TeX mode.
(save-excursion
(goto-char (point-min))
(or (string= "xml" (file-name-extension (or buffer-file-name "")))
+ ;; Maybe the buffer-size check isn't needed, I don't know.
+ (and (zerop (buffer-size))
+ (string= "xhtml" (file-name-extension (or buffer-file-name ""))))
(looking-at "\\s-*<\\?xml")
(when (re-search-forward
(eval-when-compile
(format-mode-line mode-name))))))
(defun sgml-fill-nobreak ()
- ;; Don't break between a tag name and its first argument.
+ "Don't break between a tag name and its first argument.
+This function is designed for use in `fill-nobreak-predicate'.
+
+ <a href=\"some://where\" type=\"text/plain\">
+ ^ ^
+ | no break here | but still allowed here"
(save-excursion
(skip-chars-backward " \t")
(and (not (zerop (skip-syntax-backward "w_")))
(delete-overlay (pop sgml-electric-tag-pair-overlays))))
(define-minor-mode sgml-electric-tag-pair-mode
- "Automatically update the closing tag when editing the opening one."
+ "Toggle SGML Electric Tag Pair mode.
+With a prefix argument ARG, enable the mode if ARG is positive,
+and disable it otherwise. If called from Lisp, enable the mode
+if ARG is omitted or nil.
+
+SGML Electric Tag Pair mode is a buffer-local minor mode for use
+with `sgml-mode' and related maor modes. When enabled, editing
+an opening markup tag automatically updates the closing tag."
:lighter "/e"
(if sgml-electric-tag-pair-mode
(progn
(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.
+Base the guessed indentation level on the first indented tag in the buffer.
Add this to `sgml-mode-hook' for convenience."
(interactive)
(save-excursion
("dir" . "Directory list (obsolete)")
("div" . "Generic block-level container")
("dl" . "Definition list")
- ("dt" . "Term to be definined")
+ ("dt" . "Term to be defined")
("em" . "Emphasized")
("embed" . "Embedded data in foreign format")
("fig" . "Figure")
("input" . "Form input field")
("ins" . "Inserted text")
("isindex" . "Input field for index search")
- ("kbd" . "Keybard example face")
+ ("kbd" . "Keyboard example face")
("lang" . "Natural language")
("li" . "List item")
("link" . "Link relationship")
(nreverse toc-index)))
(define-minor-mode html-autoview-mode
- "Toggle automatic viewing via `browse-url-of-buffer' upon saving buffer.
-With positive prefix ARG always turns viewing on, with negative ARG always off.
-Can be used as a value for `html-mode-hook'."
+ "Toggle viewing of HTML files on save (HTML Autoview mode).
+With a prefix argument ARG, enable HTML Autoview mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+the mode if ARG is omitted or nil.
+
+HTML Autoview mode is a buffer-local minor mode for use with
+`html-mode'. If enabled, saving the file automatically runs
+`browse-url-of-buffer' to view it."
nil nil nil
:group 'sgml
(if html-autoview-mode
(provide 'sgml-mode)
-;; arch-tag: 9675da94-b7f9-4bda-ad19-73ed7b4fb401
;;; sgml-mode.el ends here