aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/enriched.el37
1 files changed, 36 insertions, 1 deletions
diff --git a/lisp/enriched.el b/lisp/enriched.el
index 52eb18174e7..187bacc826e 100644
--- a/lisp/enriched.el
+++ b/lisp/enriched.el
@@ -121,8 +121,10 @@ expression, which is evaluated to get the string to insert.")
121 (PARAMETER (t "param")) ; Argument of preceding annotation 121 (PARAMETER (t "param")) ; Argument of preceding annotation
122 ;; The following are not part of the standard: 122 ;; The following are not part of the standard:
123 (FUNCTION (enriched-decode-foreground "x-color") 123 (FUNCTION (enriched-decode-foreground "x-color")
124 (enriched-decode-background "x-bg-color")) 124 (enriched-decode-background "x-bg-color")
125 (enriched-decode-display-prop "x-display"))
125 (read-only (t "x-read-only")) 126 (read-only (t "x-read-only"))
127 (display (nil enriched-handle-display-prop))
126 (unknown (nil format-annotate-value)) 128 (unknown (nil format-annotate-value))
127; (font-size (2 "bigger") ; unimplemented 129; (font-size (2 "bigger") ; unimplemented
128; (-2 "smaller")) 130; (-2 "smaller"))
@@ -452,4 +454,37 @@ Return value is \(begin end name positive-p), or nil if none was found."
452 (message "Warning: color `%s' can't be displayed" color))) 454 (message "Warning: color `%s' can't be displayed" color)))
453 (list from to 'face face))) 455 (list from to 'face face)))
454 456
457
458
459;;; Handling the `display' property.
460
461
462(defun enriched-handle-display-prop (old new)
463 "Return a list of annotations for a change in the `display' property.
464OLD is the old value of the property, NEW is the new value. Value
465is a list `(CLOSE OPEN)', where CLOSE is a list of annotations to
466close and OPEN a list of annotations to open. Each of these lists
467has the form `(ANNOTATION PARAM ...)'."
468 (let ((annotation "x-display")
469 (param (prin1-to-string (or old new)))
470 close open)
471 (if (null old)
472 (list nil (list annotation param))
473 (list (list annotation param)))))
474
475
476(defun enriched-decode-display-prop (start end &optional param)
477 "Decode a `display' property for text between START and END.
478PARAM is a `<param>' found for the property.
479Value is a list `(START END SYMBOL VALUE)' with START and END denoting
480the range of text to assign text property SYMBOL with value VALUE "
481 (let ((prop (when (stringp param)
482 (condition-case ()
483 (car (read-from-string param))
484 (error nil)))))
485 (unless prop
486 (message "Warning: invalid <x-display> parameter %s" param))
487 (list start end 'display prop)))
488
489
455;;; enriched.el ends here 490;;; enriched.el ends here