diff options
| author | Gerd Moellmann | 1999-07-21 21:43:03 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-07-21 21:43:03 +0000 |
| commit | d9e28c1ca1d95f51a05d052dcf1fe06888d52476 (patch) | |
| tree | 8af6c9b8a0e03bbb660f499a33d97dc31ea673ed /lisp | |
| parent | 34c804a914d834139048c54aeb4783808a5f5f97 (diff) | |
| download | emacs-d9e28c1ca1d95f51a05d052dcf1fe06888d52476.tar.gz emacs-d9e28c1ca1d95f51a05d052dcf1fe06888d52476.zip | |
(enriched-translations): Add `display' and "x-display".
(enriched-handle-display-prop): New.
(enriched-decode-display-prop): New.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/enriched.el | 37 |
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. | ||
| 464 | OLD is the old value of the property, NEW is the new value. Value | ||
| 465 | is a list `(CLOSE OPEN)', where CLOSE is a list of annotations to | ||
| 466 | close and OPEN a list of annotations to open. Each of these lists | ||
| 467 | has 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. | ||
| 478 | PARAM is a `<param>' found for the property. | ||
| 479 | Value is a list `(START END SYMBOL VALUE)' with START and END denoting | ||
| 480 | the 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 |