Changeset 4089 for vendor/emacs-CVS_HEAD/lisp/textmodes/sgml-mode.el
- Timestamp:
- 05/27/06 09:57:08 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
vendor/emacs-CVS_HEAD/lisp/textmodes/sgml-mode.el
r4035 r4089 50 50 :group 'sgml) 51 51 52 (defcustom sgml-transformation 'identity53 "*Default value for `skeleton-transformation ' (which see)in SGML mode."52 (defcustom sgml-transformation-function 'identity 53 "*Default value for `skeleton-transformation-function' in SGML mode." 54 54 :type 'function 55 55 :group 'sgml) 56 56 57 (put 'sgml-transformation 'variable-interactive57 (put 'sgml-transformation-function 'variable-interactive 58 58 "aTransformation function: ") 59 (defvaralias 'sgml-transformation 'sgml-transformation-function) 59 60 60 61 (defcustom sgml-mode-hook nil … … 336 337 (repeat :tag "Tag Rule" sexp))) 337 338 :group 'sgml) 339 (put 'sgml-tag-alist 'risky-local-variable t) 338 340 339 341 (defcustom sgml-tag-help … … 392 394 (if (setq face (cdr (assq face sgml-face-tag-alist))) 393 395 (progn 394 (setq face (funcall skeleton-transformation face))396 (setq face (funcall skeleton-transformation-function face)) 395 397 (setq facemenu-end-add-face (concat "</" face ">")) 396 398 (concat "<" face ">")) … … 416 418 N defaults to -1, which means to wrap it around the current region. 417 419 418 If you like upcased tags, put (setq sgml-transformation 'upcase) in419 your `.emacs' file.420 If you like upcased tags, put (setq sgml-transformation-function 'upcase) 421 in your `.emacs' file. 420 422 421 423 Use \\[sgml-validate] to validate your document with an SGML parser. … … 461 463 (if sgml-xml-mode 462 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 467 ;; This will allow existing comments within declarations to be 465 468 ;; recognized. … … 605 608 606 609 ;; When an element of a skeleton is a string "str", it is passed 607 ;; through skeleton-transformation and inserted. If "str" is to be608 ;; inserted literally, one should obtain it as the return value of a609 ;; function, e.g. (identity "str").610 ;; through `skeleton-transformation-function' and inserted. 611 ;; If "str" is to be inserted literally, one should obtain it as 612 ;; the return value of a function, e.g. (identity "str"). 610 613 611 614 (defvar sgml-tag-last nil) … … 615 618 Completion and configuration are done according to `sgml-tag-alist'. 616 619 If you like tags and attributes in uppercase do \\[set-variable] 617 skeleton-transformation RET upcase RET, or put this in your `.emacs': 618 (setq sgml-transformation 'upcase)" 619 (funcall (or skeleton-transformation 'identity) 620 `skeleton-transformation-function' RET `upcase' RET, or put this 621 in your `.emacs': 622 (setq sgml-transformation-function 'upcase)" 623 (funcall (or skeleton-transformation-function 'identity) 620 624 (setq sgml-tag-last 621 625 (completing-read … … 640 644 (if (eq v2 t) (setq v2 nil)) 641 645 ;; We use `identity' to prevent skeleton from passing 642 ;; `str' through skeleton-transformationa second time.646 ;; `str' through `skeleton-transformation-function' a second time. 643 647 '(("") v2 _ v2 "</" (identity ',str) ?>)) 644 648 ((eq (car v2) t) … … 671 675 (progn 672 676 (insert (if (eq (preceding-char) ?\s) "" ?\s) 673 (funcall skeleton-transformation (car alist)))677 (funcall skeleton-transformation-function (car alist))) 674 678 (sgml-value alist)) 675 679 (setq i (length alist)) 676 680 (while (> i 0) 677 681 (insert ?\s) 678 (insert (funcall skeleton-transformation 682 (insert (funcall skeleton-transformation-function 679 683 (setq attribute 680 684 (skeleton-read '(completing-read … … 1982 1986 "\" value=\"" str ?\" 1983 1987 (when (y-or-n-p "Set \"checked\" attribute? ") 1984 (funcall skeleton-transformation 1988 (funcall skeleton-transformation-function 1985 1989 (if sgml-xml-mode " checked=\"checked\"" " checked"))) 1986 1990 (if sgml-xml-mode " />" ">") 1987 1991 (skeleton-read "Text: " (capitalize str)) 1988 1992 (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") 1989 (funcall skeleton-transformation 1993 (funcall skeleton-transformation-function 1990 1994 (if sgml-xml-mode "<br />" "<br>")) 1991 1995 ""))) … … 2002 2006 "\" value=\"" str ?\" 2003 2007 (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) 2004 (funcall skeleton-transformation 2008 (funcall skeleton-transformation-function 2005 2009 (if sgml-xml-mode " checked=\"checked\"" " checked"))) 2006 2010 (if sgml-xml-mode " />" ">") 2007 2011 (skeleton-read "Text: " (capitalize str)) 2008 2012 (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") 2009 (funcall skeleton-transformation 2013 (funcall skeleton-transformation-function 2010 2014 (if sgml-xml-mode "<br />" "<br>")) 2011 2015 "")))
