comparison lisp/textmodes/sgml-mode.el @ 80889:8938fa90afdb

(sgml-value): Fix handling of attributes which can take any number of values.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 10 May 2007 06:02:15 +0000
parents f46158b1c8bc
children 7a27a4cd50b4 d7172f202ab8
comparison
equal deleted inserted replaced
80888:4005ed72ef83 80889:8938fa90afdb
43 "SGML editing mode." 43 "SGML editing mode."
44 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) 44 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
45 :group 'languages) 45 :group 'languages)
46 46
47 (defcustom sgml-basic-offset 2 47 (defcustom sgml-basic-offset 2
48 "*Specifies the basic indentation level for `sgml-indent-line'." 48 "Specifies the basic indentation level for `sgml-indent-line'."
49 :type 'integer 49 :type 'integer
50 :group 'sgml) 50 :group 'sgml)
51 51
52 (defcustom sgml-transformation-function 'identity 52 (defcustom sgml-transformation-function 'identity
53 "*Default value for `skeleton-transformation-function' 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-function 'variable-interactive 57 (put 'sgml-transformation-function 'variable-interactive
58 "aTransformation function: ") 58 "aTransformation function: ")
164 (modify-syntax-entry char "." table)) 164 (modify-syntax-entry char "." table))
165 table) 165 table)
166 "Syntax table used to parse SGML tags.") 166 "Syntax table used to parse SGML tags.")
167 167
168 (defcustom sgml-name-8bit-mode nil 168 (defcustom sgml-name-8bit-mode nil
169 "*When non-nil, insert non-ASCII characters as named entities." 169 "When non-nil, insert non-ASCII characters as named entities."
170 :type 'boolean 170 :type 'boolean
171 :group 'sgml) 171 :group 'sgml)
172 172
173 (defvar sgml-char-names 173 (defvar sgml-char-names
174 [nil nil nil nil nil nil nil nil 174 [nil nil nil nil nil nil nil nil
223 ;; ftp.jclark.com and otherwise packaged for GNU systems. 223 ;; ftp.jclark.com and otherwise packaged for GNU systems.
224 ;; Its error messages can be parsed by next-error. 224 ;; Its error messages can be parsed by next-error.
225 ;; The -s option suppresses output. 225 ;; The -s option suppresses output.
226 226
227 (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls' 227 (defcustom sgml-validate-command "nsgmls -s" ; replaced old `sgmls'
228 "*The command to validate an SGML document. 228 "The command to validate an SGML document.
229 The file name of current buffer file name will be appended to this, 229 The file name of current buffer file name will be appended to this,
230 separated by a space." 230 separated by a space."
231 :type 'string 231 :type 'string
232 :version "21.1" 232 :version "21.1"
233 :group 'sgml) 233 :group 'sgml)
236 "The command last used to validate in this buffer.") 236 "The command last used to validate in this buffer.")
237 237
238 ;; I doubt that null end tags are used much for large elements, 238 ;; I doubt that null end tags are used much for large elements,
239 ;; so use a small distance here. 239 ;; so use a small distance here.
240 (defcustom sgml-slash-distance 1000 240 (defcustom sgml-slash-distance 1000
241 "*If non-nil, is the maximum distance to search for matching `/'." 241 "If non-nil, is the maximum distance to search for matching `/'."
242 :type '(choice (const nil) integer) 242 :type '(choice (const nil) integer)
243 :group 'sgml) 243 :group 'sgml)
244 244
245 (defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*") 245 (defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*")
246 (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*") 246 (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*")
316 '(("![" ("ignore" t) ("include" t)) 316 '(("![" ("ignore" t) ("include" t))
317 ("!attlist") 317 ("!attlist")
318 ("!doctype") 318 ("!doctype")
319 ("!element") 319 ("!element")
320 ("!entity")) 320 ("!entity"))
321 "*Alist of tag names for completing read and insertion rules. 321 "Alist of tag names for completing read and insertion rules.
322 This alist is made up as 322 This alist is made up as
323 323
324 ((\"tag\" . TAGRULE) 324 ((\"tag\" . TAGRULE)
325 ...) 325 ...)
326 326
346 ("![" . "Embed declarations with parser directive") 346 ("![" . "Embed declarations with parser directive")
347 ("!attlist" . "Tag attributes declaration") 347 ("!attlist" . "Tag attributes declaration")
348 ("!doctype" . "Document type (DTD) declaration") 348 ("!doctype" . "Document type (DTD) declaration")
349 ("!element" . "Tag declaration") 349 ("!element" . "Tag declaration")
350 ("!entity" . "Entity (macro) declaration")) 350 ("!entity" . "Entity (macro) declaration"))
351 "*Alist of tag name and short description." 351 "Alist of tag name and short description."
352 :type '(repeat (cons (string :tag "Tag Name") 352 :type '(repeat (cons (string :tag "Tag Name")
353 (string :tag "Description"))) 353 (string :tag "Description")))
354 :group 'sgml) 354 :group 'sgml)
355 355
356 (defcustom sgml-xml-mode nil 356 (defcustom sgml-xml-mode nil
357 "*When non-nil, tag insertion functions will be XML-compliant. 357 "When non-nil, tag insertion functions will be XML-compliant.
358 If this variable is customized, the custom value is used always. 358 It is set to be buffer-local when the file has
359 Otherwise, it is set to be buffer-local when the file has
360 a DOCTYPE or an XML declaration." 359 a DOCTYPE or an XML declaration."
361 :type 'boolean 360 :type 'boolean
362 :version "22.1" 361 :version "22.1"
363 :group 'sgml) 362 :group 'sgml)
364 363
1008 (setq alist (skeleton-read '(completing-read "Value: " (cdr alist)))) 1007 (setq alist (skeleton-read '(completing-read "Value: " (cdr alist))))
1009 (if (string< "" alist) 1008 (if (string< "" alist)
1010 (insert alist ?\") 1009 (insert alist ?\")
1011 (delete-backward-char 2))) 1010 (delete-backward-char 2)))
1012 (insert "=\"") 1011 (insert "=\"")
1013 (when alist 1012 (if (cdr alist)
1014 (insert (skeleton-read '(completing-read "Value: " alist)))) 1013 (insert (skeleton-read '(completing-read "Value: " alist)))
1014 (when (null alist)
1015 (insert (skeleton-read '(read-string "Value: ")))))
1015 (insert ?\")))) 1016 (insert ?\"))))
1016 1017
1017 (defun sgml-quote (start end &optional unquotep) 1018 (defun sgml-quote (start end &optional unquotep)
1018 "Quote SGML text in region START ... END. 1019 "Quote SGML text in region START ... END.
1019 Only &, < and > are quoted, the rest is left untouched. 1020 Only &, < and > are quoted, the rest is left untouched.