Mercurial > emacs
changeset 70823:ca1b3788f58d
(sgml-transformation): Make this the alias for the following variable.
(sgml-transformation-function): Make this the real name.
(sgml-tag-alist): Mark as risky.
author | Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> |
---|---|
date | Sun, 21 May 2006 22:19:59 +0000 |
parents | 2139854814c1 |
children | 9ce3cc1e5e89 |
files | lisp/textmodes/sgml-mode.el |
diffstat | 1 files changed, 24 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/sgml-mode.el Sun May 21 22:06:18 2006 +0000 +++ b/lisp/textmodes/sgml-mode.el Sun May 21 22:19:59 2006 +0000 @@ -49,13 +49,14 @@ :type 'integer :group 'sgml) -(defcustom sgml-transformation 'identity - "*Default value for `skeleton-transformation' (which see) in SGML mode." +(defcustom sgml-transformation-function 'identity + "*Default value for `skeleton-transformation-function' in SGML mode." :type 'function :group 'sgml) -(put 'sgml-transformation 'variable-interactive +(put 'sgml-transformation-function 'variable-interactive "aTransformation function: ") +(defvaralias 'sgml-transformation 'sgml-transformation-function) (defcustom sgml-mode-hook nil "Hook run by command `sgml-mode'. @@ -335,6 +336,7 @@ :type '(repeat (cons (string :tag "Tag Name") (repeat :tag "Tag Rule" sexp))) :group 'sgml) +(put 'sgml-tag-alist 'risky-local-variable t) (defcustom sgml-tag-help '(("!" . "Empty declaration for comment") @@ -391,7 +393,7 @@ (defun sgml-mode-facemenu-add-face-function (face end) (if (setq face (cdr (assq face sgml-face-tag-alist))) (progn - (setq face (funcall skeleton-transformation face)) + (setq face (funcall skeleton-transformation-function face)) (setq facemenu-end-add-face (concat "</" face ">")) (concat "<" face ">")) (error "Face not configured for %s mode" mode-name))) @@ -415,8 +417,8 @@ the next N words. In Transient Mark mode, when the mark is active, N defaults to -1, which means to wrap it around the current region. -If you like upcased tags, put (setq sgml-transformation 'upcase) in -your `.emacs' file. +If you like upcased tags, put (setq sgml-transformation-function 'upcase) +in your `.emacs' file. Use \\[sgml-validate] to validate your document with an SGML parser. @@ -460,7 +462,8 @@ (sgml-xml-guess) (if sgml-xml-mode (setq mode-name "XML") - (set (make-local-variable 'skeleton-transformation) sgml-transformation)) + (set (make-local-variable 'skeleton-transformation-function) + sgml-transformation-function)) ;; This will allow existing comments within declarations to be ;; recognized. (set (make-local-variable 'comment-start-skip) "\\(?:<!\\)?--[ \t]*") @@ -604,9 +607,9 @@ (if sgml-name-8bit-mode "ON" "OFF"))) ;; When an element of a skeleton is a string "str", it is passed -;; through skeleton-transformation and inserted. If "str" is to be -;; inserted literally, one should obtain it as the return value of a -;; function, e.g. (identity "str"). +;; through `skeleton-transformation-function' and inserted. +;; If "str" is to be inserted literally, one should obtain it as +;; the return value of a function, e.g. (identity "str"). (defvar sgml-tag-last nil) (defvar sgml-tag-history nil) @@ -614,9 +617,10 @@ "Prompt for a tag and insert it, optionally with attributes. Completion and configuration are done according to `sgml-tag-alist'. If you like tags and attributes in uppercase do \\[set-variable] -skeleton-transformation RET upcase RET, or put this in your `.emacs': - (setq sgml-transformation 'upcase)" - (funcall (or skeleton-transformation 'identity) +`skeleton-transformation-function' RET `upcase' RET, or put this +in your `.emacs': + (setq sgml-transformation-function 'upcase)" + (funcall (or skeleton-transformation-function 'identity) (setq sgml-tag-last (completing-read (if (> (length sgml-tag-last) 0) @@ -639,7 +643,7 @@ ;; For xhtml's `tr' tag, we should maybe use \n instead. (if (eq v2 t) (setq v2 nil)) ;; We use `identity' to prevent skeleton from passing - ;; `str' through skeleton-transformation a second time. + ;; `str' through `skeleton-transformation-function' a second time. '(("") v2 _ v2 "</" (identity ',str) ?>)) ((eq (car v2) t) (cons '("") (cdr v2))) @@ -670,12 +674,12 @@ (if (stringp (car alist)) (progn (insert (if (eq (preceding-char) ?\s) "" ?\s) - (funcall skeleton-transformation (car alist))) + (funcall skeleton-transformation-function (car alist))) (sgml-value alist)) (setq i (length alist)) (while (> i 0) (insert ?\s) - (insert (funcall skeleton-transformation + (insert (funcall skeleton-transformation-function (setq attribute (skeleton-read '(completing-read "Attribute: " @@ -1981,12 +1985,12 @@ "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) "\" value=\"" str ?\" (when (y-or-n-p "Set \"checked\" attribute? ") - (funcall skeleton-transformation + (funcall skeleton-transformation-function (if sgml-xml-mode " checked=\"checked\"" " checked"))) (if sgml-xml-mode " />" ">") (skeleton-read "Text: " (capitalize str)) (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") - (funcall skeleton-transformation + (funcall skeleton-transformation-function (if sgml-xml-mode "<br />" "<br>")) ""))) \n)) @@ -2001,12 +2005,12 @@ "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) "\" value=\"" str ?\" (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) - (funcall skeleton-transformation + (funcall skeleton-transformation-function (if sgml-xml-mode " checked=\"checked\"" " checked"))) (if sgml-xml-mode " />" ">") (skeleton-read "Text: " (capitalize str)) (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") - (funcall skeleton-transformation + (funcall skeleton-transformation-function (if sgml-xml-mode "<br />" "<br>")) ""))) \n))