help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hiding text in a shell buffer to unhide later


From: Stefan Monnier
Subject: Re: Hiding text in a shell buffer to unhide later
Date: Wed, 20 Oct 2004 13:33:37 GMT
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> I'm developing for a theorem prover called ACL2, which is written in
> a subset of LISP and often runs in an Emacs buffer. Ideally, I would like
> to actively print a hash mark to the screen and when the user triple
> clicks on it, swap the hash with some text that the hash represents (it's
> hiding that text), hiding the hash and showing that text.

Checkout hs-minor-mode.

> I'm guessing I need to print the hash mark between one type of delimiter
> and the text I want to reveal between another set of dilimiters and create
> a command for the mouse triple click that will somehow reference the
> location of the mouse.

Well, you can just put an overlay on the hidden text with an
`invisible' property, and use add-to-invisibility-spec to make sure it's
replaced by an ellipsis.

This approach has the disadvantage (at least under Emacs) that you can't
really control the appearance and clickability of the ellipsis (your "hash
mark").

OTOH, using a different add-to-invisibility-spec, you can make the text
truly invisible and then use a before-string property on your overlay to
replace the text with any marker of your choice.  This `before-string' can
then have any `face' or `keymap' property you want so you can make it pretty
and clickable.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]