@@ -177,32 +177,19 @@ To delete all the current buffer overlays, use `(clear-overlays)` (you
177177can also call this with ` M-: ` ).
178178
179179
180- ### Text properties, attributes
180+ ### Attributes
181181
182- Attributes allow to display rich text: bold, italic, foreground and background colors… but
183- they also allow to store metadata in buffer strings. In that case,
184- attributes are invisible.
182+ Attributes define how to display rich text: bold, italic, foreground and background colors…
185183
186- For example, Legit's status buffer displays a line of text `Untracked
187- Files` with the built-in attribute ` : header-marker `, like this:
188-
189- ``` lisp
190- (put-text-property start point :header-marker t))
191- ;; ^^ attribute ^^^ attribute value
192- ```
193-
194- Thanks to it, we can implement a keyboard shortcut to navigate from
195- one heading to another.
196-
197- Attributes are created with ` define-attribute name (specs) `
198- where ` specs ` is a list of properties for a ` :light ` theme, a ` :dark ` one, or all (` t ` ).
184+ They are created with ` define-attribute name (specs) `
185+ where ` specs ` is a list of any number of properties for a ` :light ` theme, a ` :dark ` one, or all (` t ` ).
199186
200187``` lisp
201188(define-attribute filename-attribute
202189 (t :foreground :base0D))
203190```
204191
205- Built-in attributes are defined in ` src/attributes.lisp ` , such as:
192+ Built-in attributes are defined in [ ` src/attributes.lisp ` ] ( https://github.com/lem-project/lem/blob/main/src/attribute.lisp ) , such as:
206193
207194``` lisp
208195;; built-in attributes
@@ -228,3 +215,33 @@ Built-in attributes are defined in `src/attributes.lisp`, such as:
228215```
229216
230217and so on.
218+
219+ ### Text properties
220+
221+ Text properties allow to store metadata in buffer strings. They are invisible.
222+
223+ For example, Legit's status buffer displays a line of text `Untracked
224+ Files` with the built-in attribute ` : header-marker `, like this:
225+
226+ ``` lisp
227+ (put-text-property start point :header-marker t))
228+ ;; ^^ attribute ^^^ attribute value
229+ ```
230+
231+ Thanks to it, we can implement a keyboard shortcut to navigate from
232+ one heading to another.
233+
234+ More functions:
235+
236+ ``` lisps
237+ (defun text-property-at (point prop &optional (offset 0))
238+ "Return the property of 'prop' at the offset position from 'point' to 'offset'."
239+
240+ (defun remove-text-property (start-point end-point prop)
241+ "Remove one property from text from START-POINT to END-POINT.
242+ The third argument PROP is a property to remove."
243+ ```
244+
245+ See more:
246+
247+ - [ src/buffer/internal/basic.lisp] ( https://github.com/lem-project/lem/blob/main/src/buffer/internal/basic.lisp )
0 commit comments