My buffer has one line as,
i am sitting on an overlay
Now when i do, M-x some-function-to-hide
, i like to hide the text from display, and show three dots as,
...
I am looking forward to have a "hello world" program to understand overlays.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityMy buffer has one line as,
i am sitting on an overlay
Now when i do, M-x some-function-to-hide
, i like to hide the text from display, and show three dots as,
...
I am looking forward to have a "hello world" program to understand overlays.
Reproducing lawlist's comments here, To make an overlay and minify the code block as "...", you can do,
(overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'display "...")
Now, to expand the contents and bring the buffer to its original form,
(remove-overlays (point-min) (point-max) 'display "...")
(overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'display "...")
(remove-overlays)
(remove-overlays (point-min) (point-max) 'display "...")
I am at work today and won't have a chance to do an answer until later. I'm not picky -- anyone can write-up an answer, even yourself if you are so inclined.