diff options
| author | Lars Magne Ingebrigtsen | 2013-06-17 17:28:22 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-06-17 17:28:22 +0200 |
| commit | 708e05f6d1b39313a63e34a5b4e1a16ae809ae25 (patch) | |
| tree | 406e73905374997269b8d123e5c0ec98dcbd872e /doc | |
| parent | 2c149f93b425ffbb2de02e9b41e1aa98ae40e0e7 (diff) | |
| download | emacs-708e05f6d1b39313a63e34a5b4e1a16ae809ae25.tar.gz emacs-708e05f6d1b39313a63e34a5b4e1a16ae809ae25.zip | |
Implement new function `add-face-text-property'
* doc/lispref/text.texi (Changing Properties): Document `add-face-text-property'.
* src/textprop.c (property_set_type): New enum.
(add_properties): Allow appending/prepending text properties.
(add_text_properties_1): Factored out of Fadd_text_properties.
(Fadd_text_properties): Moved all the code into
add_text_properties_1.
(Fadd_face_text_property): New function that calls
add_text_properties_1.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index af9aa2919e9..6c945dd244e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-06-17 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * text.texi (Changing Properties): Document `add-face-text-property'. | ||
| 4 | |||
| 1 | 2013-06-17 Kenichi Handa <handa@gnu.org> | 5 | 2013-06-17 Kenichi Handa <handa@gnu.org> |
| 2 | 6 | ||
| 3 | * display.texi (Face Attributes): Refer to "Low-Level font" (not | 7 | * display.texi (Face Attributes): Refer to "Low-Level font" (not |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 6d5a39d887a..fdfc16f3f64 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -2805,6 +2805,28 @@ from the specified range of text. Here's an example: | |||
| 2805 | Do not rely on the return value of this function. | 2805 | Do not rely on the return value of this function. |
| 2806 | @end defun | 2806 | @end defun |
| 2807 | 2807 | ||
| 2808 | @defun add-face-text-property start end face &optional appendp object | ||
| 2809 | @code{face} text attributes can be combined. If you want to make a | ||
| 2810 | section both italic and green, you can either define a new face that | ||
| 2811 | have those attributes, or you can add both these attributes separately | ||
| 2812 | to text: | ||
| 2813 | |||
| 2814 | @example | ||
| 2815 | (add-face-text-property @var{start} @var{end} 'italic) | ||
| 2816 | (add-face-text-property @var{start} @var{end} '(:foreground "#00ff00")) | ||
| 2817 | @end example | ||
| 2818 | |||
| 2819 | The attribute is (by default) prepended to the list of face | ||
| 2820 | attributes, and the first attribute of the same type takes | ||
| 2821 | presedence. So if you have two @code{:foreground} specifications, the | ||
| 2822 | first one will take effect. | ||
| 2823 | |||
| 2824 | If you pass in @var{appendp}, the attribute will be appended instead | ||
| 2825 | of prepended, which means that it will have no effect if there is | ||
| 2826 | already an attribute of the same type. | ||
| 2827 | |||
| 2828 | @end defun | ||
| 2829 | |||
| 2808 | The easiest way to make a string with text properties | 2830 | The easiest way to make a string with text properties |
| 2809 | is with @code{propertize}: | 2831 | is with @code{propertize}: |
| 2810 | 2832 | ||