Skip to content

Commit 9fab6c2

Browse files
committed
experiment with overlays++
1 parent 3b8cf43 commit 9fab6c2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

content/en/development/displaying.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,36 @@ list of overlays, and is displayed.
154154
For example:
155155

156156
~~~lisp
157-
(make-overlay (current-point) (current-point) 'syntax-warning-attribute)
157+
LEM> (defparameter myoverlay (make-overlay (current-point) (current-point) 'syntax-warning-attribute))
158+
;; => #<LEM-CORE::OVERLAY {1206A500A3}>
159+
LEM>
158160
~~~
159161

160-
buuut… it might be difficult to see.
162+
To best see this snippet's effect, run this in the REPL, in the `lem`
163+
package. You will see the REPL output and the last REPL prompt printed
164+
in red. This is because the overlay is taking effect. Continue typing,
165+
it still has effect.
166+
167+
You can try with another attribute, for example `'region` will give you a light grey background.
161168

162169
Here we create an overlay at the line end with some text to display:
163170

164171
```lisp
165172
(make-line-endings-overlay (current-point) (current-point) 'syntax-warning-attribute :text "hello")
166173
```
167174

168-
This creates an overlay at the end of the line, showing "hello" in red (the color of our attribute).
175+
This shows "hello" in red (the color of our attribute) at the end of the current line.
169176

170177
Learn about attributes below.
171178

172179
#### How to delete overlays
173180

174181
To delete a given overlay, use `delete-overlay` with your overlay object as argument.
175182

183+
```lisp
184+
LEM> (delete-overlay myoverlay)
185+
```
186+
176187
To delete all the current buffer overlays, use `(clear-overlays)` (you
177188
can also call this with `M-:`).
178189

0 commit comments

Comments
 (0)