comparison lisp/enriched.el @ 42567:b1eda5349a48

(enriched-make-annotation): Fix the change from 2002-01-05. (enriched-handle-display-prop): Return proper values.
author Pavel Janík <Pavel@Janik.cz>
date Sun, 06 Jan 2002 11:35:17 +0000
parents 190c648a9f3e
children 00aef3a1182b
comparison
equal deleted inserted replaced
42566:6c1d733d1794 42567:b1eda5349a48
313 (defun enriched-make-annotation (internal-ann positive) 313 (defun enriched-make-annotation (internal-ann positive)
314 "Format an annotation INTERNAL-ANN. 314 "Format an annotation INTERNAL-ANN.
315 INTERNAL-ANN may be a string, for a flag, or a list of the form (PARAM VALUE). 315 INTERNAL-ANN may be a string, for a flag, or a list of the form (PARAM VALUE).
316 If POSITIVE is non-nil, this is the opening annotation; 316 If POSITIVE is non-nil, this is the opening annotation;
317 if nil, the matching close." 317 if nil, the matching close."
318 (cond ((stringp name) 318 (cond ((stringp internal-ann)
319 (format enriched-annotation-format (if positive "" "/") name)) 319 (format enriched-annotation-format (if positive "" "/") internal-ann))
320 ;; Otherwise it is an annotation with parameters, represented as a list 320 ;; Otherwise it is an annotation with parameters, represented as a list
321 (positive 321 (positive
322 (let ((item (car name)) 322 (let ((item (car internal-ann))
323 (params (cdr name))) 323 (params (cdr internal-ann)))
324 (concat (format enriched-annotation-format "" item) 324 (concat (format enriched-annotation-format "" item)
325 (mapconcat (lambda (i) (concat "<param>" i "</param>")) 325 (mapconcat (lambda (i) (concat "<param>" i "</param>"))
326 params "")))) 326 params ""))))
327 (t (format enriched-annotation-format "/" (car name))))) 327 (t (format enriched-annotation-format "/" (car internal-ann)))))
328 328
329 (defun enriched-encode-other-face (old new) 329 (defun enriched-encode-other-face (old new)
330 "Generate annotations for random face change. 330 "Generate annotations for random face change.
331 One annotation each for foreground color, background color, italic, etc." 331 One annotation each for foreground color, background color, italic, etc."
332 (cons (and old (enriched-face-ans old)) 332 (cons (and old (enriched-face-ans old))
463 close and OPEN a list of annotations to open. Each of these lists 463 close and OPEN a list of annotations to open. Each of these lists
464 has the form `(ANNOTATION PARAM ...)'." 464 has the form `(ANNOTATION PARAM ...)'."
465 (let ((annotation "x-display") 465 (let ((annotation "x-display")
466 (param (prin1-to-string (or old new)))) 466 (param (prin1-to-string (or old new))))
467 (if (null old) 467 (if (null old)
468 (list nil (list annotation param)) 468 (cons nil (list (list annotation param)))
469 (list (list annotation param))))) 469 (cons (list (list annotation param)) nil))))
470
471 470
472 (defun enriched-decode-display-prop (start end &optional param) 471 (defun enriched-decode-display-prop (start end &optional param)
473 "Decode a `display' property for text between START and END. 472 "Decode a `display' property for text between START and END.
474 PARAM is a `<param>' found for the property. 473 PARAM is a `<param>' found for the property.
475 Value is a list `(START END SYMBOL VALUE)' with START and END denoting 474 Value is a list `(START END SYMBOL VALUE)' with START and END denoting