aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Winkler2006-05-21 22:19:59 +0000
committerRoland Winkler2006-05-21 22:19:59 +0000
commitaa18ec07ffd3550c614588dbb416ce7b1da2d63d (patch)
treebe28bbd5d9bb25f6f2279447579418f0a3fd0caf
parent5598ca2b624cc5db045c2c3d06898d8546db711d (diff)
downloademacs-aa18ec07ffd3550c614588dbb416ce7b1da2d63d.tar.gz
emacs-aa18ec07ffd3550c614588dbb416ce7b1da2d63d.zip
(sgml-transformation): Make this the alias for the following variable.
(sgml-transformation-function): Make this the real name. (sgml-tag-alist): Mark as risky.
-rw-r--r--lisp/textmodes/sgml-mode.el44
1 files changed, 24 insertions, 20 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index ff6df4a5a56..6136d22e432 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -49,13 +49,14 @@
49 :type 'integer 49 :type 'integer
50 :group 'sgml) 50 :group 'sgml)
51 51
52(defcustom sgml-transformation 'identity 52(defcustom sgml-transformation-function 'identity
53 "*Default value for `skeleton-transformation' (which see) in SGML mode." 53 "*Default value for `skeleton-transformation-function' in SGML mode."
54 :type 'function 54 :type 'function
55 :group 'sgml) 55 :group 'sgml)
56 56
57(put 'sgml-transformation 'variable-interactive 57(put 'sgml-transformation-function 'variable-interactive
58 "aTransformation function: ") 58 "aTransformation function: ")
59(defvaralias 'sgml-transformation 'sgml-transformation-function)
59 60
60(defcustom sgml-mode-hook nil 61(defcustom sgml-mode-hook nil
61 "Hook run by command `sgml-mode'. 62 "Hook run by command `sgml-mode'.
@@ -335,6 +336,7 @@ an optional alist of possible values."
335 :type '(repeat (cons (string :tag "Tag Name") 336 :type '(repeat (cons (string :tag "Tag Name")
336 (repeat :tag "Tag Rule" sexp))) 337 (repeat :tag "Tag Rule" sexp)))
337 :group 'sgml) 338 :group 'sgml)
339(put 'sgml-tag-alist 'risky-local-variable t)
338 340
339(defcustom sgml-tag-help 341(defcustom sgml-tag-help
340 '(("!" . "Empty declaration for comment") 342 '(("!" . "Empty declaration for comment")
@@ -391,7 +393,7 @@ a DOCTYPE or an XML declaration."
391(defun sgml-mode-facemenu-add-face-function (face end) 393(defun sgml-mode-facemenu-add-face-function (face end)
392 (if (setq face (cdr (assq face sgml-face-tag-alist))) 394 (if (setq face (cdr (assq face sgml-face-tag-alist)))
393 (progn 395 (progn
394 (setq face (funcall skeleton-transformation face)) 396 (setq face (funcall skeleton-transformation-function face))
395 (setq facemenu-end-add-face (concat "</" face ">")) 397 (setq facemenu-end-add-face (concat "</" face ">"))
396 (concat "<" face ">")) 398 (concat "<" face ">"))
397 (error "Face not configured for %s mode" mode-name))) 399 (error "Face not configured for %s mode" mode-name)))
@@ -415,8 +417,8 @@ An argument of N to a tag-inserting command means to wrap it around
415the next N words. In Transient Mark mode, when the mark is active, 417the next N words. In Transient Mark mode, when the mark is active,
416N defaults to -1, which means to wrap it around the current region. 418N defaults to -1, which means to wrap it around the current region.
417 419
418If you like upcased tags, put (setq sgml-transformation 'upcase) in 420If you like upcased tags, put (setq sgml-transformation-function 'upcase)
419your `.emacs' file. 421in your `.emacs' file.
420 422
421Use \\[sgml-validate] to validate your document with an SGML parser. 423Use \\[sgml-validate] to validate your document with an SGML parser.
422 424
@@ -460,7 +462,8 @@ Do \\[describe-key] on the following bindings to discover what they do.
460 (sgml-xml-guess) 462 (sgml-xml-guess)
461 (if sgml-xml-mode 463 (if sgml-xml-mode
462 (setq mode-name "XML") 464 (setq mode-name "XML")
463 (set (make-local-variable 'skeleton-transformation) sgml-transformation)) 465 (set (make-local-variable 'skeleton-transformation-function)
466 sgml-transformation-function))
464 ;; This will allow existing comments within declarations to be 467 ;; This will allow existing comments within declarations to be
465 ;; recognized. 468 ;; recognized.
466 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*") 469 (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*")
@@ -604,9 +607,9 @@ This only works for Latin-1 input."
604 (if sgml-name-8bit-mode "ON" "OFF"))) 607 (if sgml-name-8bit-mode "ON" "OFF")))
605 608
606;; When an element of a skeleton is a string "str", it is passed 609;; When an element of a skeleton is a string "str", it is passed
607;; through skeleton-transformation and inserted. If "str" is to be 610;; through `skeleton-transformation-function' and inserted.
608;; inserted literally, one should obtain it as the return value of a 611;; If "str" is to be inserted literally, one should obtain it as
609;; function, e.g. (identity "str"). 612;; the return value of a function, e.g. (identity "str").
610 613
611(defvar sgml-tag-last nil) 614(defvar sgml-tag-last nil)
612(defvar sgml-tag-history nil) 615(defvar sgml-tag-history nil)
@@ -614,9 +617,10 @@ This only works for Latin-1 input."
614 "Prompt for a tag and insert it, optionally with attributes. 617 "Prompt for a tag and insert it, optionally with attributes.
615Completion and configuration are done according to `sgml-tag-alist'. 618Completion and configuration are done according to `sgml-tag-alist'.
616If you like tags and attributes in uppercase do \\[set-variable] 619If you like tags and attributes in uppercase do \\[set-variable]
617skeleton-transformation RET upcase RET, or put this in your `.emacs': 620`skeleton-transformation-function' RET `upcase' RET, or put this
618 (setq sgml-transformation 'upcase)" 621in your `.emacs':
619 (funcall (or skeleton-transformation 'identity) 622 (setq sgml-transformation-function 'upcase)"
623 (funcall (or skeleton-transformation-function 'identity)
620 (setq sgml-tag-last 624 (setq sgml-tag-last
621 (completing-read 625 (completing-read
622 (if (> (length sgml-tag-last) 0) 626 (if (> (length sgml-tag-last) 0)
@@ -639,7 +643,7 @@ skeleton-transformation RET upcase RET, or put this in your `.emacs':
639 ;; For xhtml's `tr' tag, we should maybe use \n instead. 643 ;; For xhtml's `tr' tag, we should maybe use \n instead.
640 (if (eq v2 t) (setq v2 nil)) 644 (if (eq v2 t) (setq v2 nil))
641 ;; We use `identity' to prevent skeleton from passing 645 ;; We use `identity' to prevent skeleton from passing
642 ;; `str' through skeleton-transformation a second time. 646 ;; `str' through `skeleton-transformation-function' a second time.
643 '(("") v2 _ v2 "</" (identity ',str) ?>)) 647 '(("") v2 _ v2 "</" (identity ',str) ?>))
644 ((eq (car v2) t) 648 ((eq (car v2) t)
645 (cons '("") (cdr v2))) 649 (cons '("") (cdr v2)))
@@ -670,12 +674,12 @@ If QUIET, do not print a message when there are no attributes for TAG."
670 (if (stringp (car alist)) 674 (if (stringp (car alist))
671 (progn 675 (progn
672 (insert (if (eq (preceding-char) ?\s) "" ?\s) 676 (insert (if (eq (preceding-char) ?\s) "" ?\s)
673 (funcall skeleton-transformation (car alist))) 677 (funcall skeleton-transformation-function (car alist)))
674 (sgml-value alist)) 678 (sgml-value alist))
675 (setq i (length alist)) 679 (setq i (length alist))
676 (while (> i 0) 680 (while (> i 0)
677 (insert ?\s) 681 (insert ?\s)
678 (insert (funcall skeleton-transformation 682 (insert (funcall skeleton-transformation-function
679 (setq attribute 683 (setq attribute
680 (skeleton-read '(completing-read 684 (skeleton-read '(completing-read
681 "Attribute: " 685 "Attribute: "
@@ -1981,12 +1985,12 @@ Can be used as a value for `html-mode-hook'."
1981 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) 1985 "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: ")))
1982 "\" value=\"" str ?\" 1986 "\" value=\"" str ?\"
1983 (when (y-or-n-p "Set \"checked\" attribute? ") 1987 (when (y-or-n-p "Set \"checked\" attribute? ")
1984 (funcall skeleton-transformation 1988 (funcall skeleton-transformation-function
1985 (if sgml-xml-mode " checked=\"checked\"" " checked"))) 1989 (if sgml-xml-mode " checked=\"checked\"" " checked")))
1986 (if sgml-xml-mode " />" ">") 1990 (if sgml-xml-mode " />" ">")
1987 (skeleton-read "Text: " (capitalize str)) 1991 (skeleton-read "Text: " (capitalize str))
1988 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") 1992 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ")
1989 (funcall skeleton-transformation 1993 (funcall skeleton-transformation-function
1990 (if sgml-xml-mode "<br />" "<br>")) 1994 (if sgml-xml-mode "<br />" "<br>"))
1991 ""))) 1995 "")))
1992 \n)) 1996 \n))
@@ -2001,12 +2005,12 @@ Can be used as a value for `html-mode-hook'."
2001 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) 2005 "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: ")))
2002 "\" value=\"" str ?\" 2006 "\" value=\"" str ?\"
2003 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) 2007 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? ")))
2004 (funcall skeleton-transformation 2008 (funcall skeleton-transformation-function
2005 (if sgml-xml-mode " checked=\"checked\"" " checked"))) 2009 (if sgml-xml-mode " checked=\"checked\"" " checked")))
2006 (if sgml-xml-mode " />" ">") 2010 (if sgml-xml-mode " />" ">")
2007 (skeleton-read "Text: " (capitalize str)) 2011 (skeleton-read "Text: " (capitalize str))
2008 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") 2012 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ")
2009 (funcall skeleton-transformation 2013 (funcall skeleton-transformation-function
2010 (if sgml-xml-mode "<br />" "<br>")) 2014 (if sgml-xml-mode "<br />" "<br>"))
2011 ""))) 2015 "")))
2012 \n)) 2016 \n))