[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hiding text
From: |
Stefan Monnier |
Subject: |
Re: Hiding text |
Date: |
Fri, 16 Feb 2007 23:56:17 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) |
> I tried doing this with font-lock, and was able to do everything i
> wanted, except that the underscores--which i make invisible--leave a
> blank space instead of completely disappearing.
My crystal ball tells me you did the "invisible" improperly (e.g. by setting
their foreground color to the background color or some other hack).
If you place an "invisible" property on those chars, they really will not
appear at all, not even as spaces.
Try font-lock rules like
(defvar foo-mode-font-lock-keywords
'(("\\(_\\)\\([^_ \t\n][^_\n]*\\)\\(_\\)"
(1 '(face nil invisible t))
(2 'italics)
(3 '(face nil invisible t)))))
You may want to add `invisible' to font-lock-extra-managed-props so that
those _ re-appear when they're not properly paired.
On the other hand, I would recommend against adding an `intangible' property
(as someone else suggested), because this has pretty far reaching
consequences and thus tends to break a lot of unsuspecting code in very
subtle ways. In Emacs-22, such invisible text is automatically treated
as "somewhat intangible", so you get the intangible-like behavior you want,
but without the nasty far reaching consequences of the
`intangible' property.
Stefan
- Hiding text, thorne, 2007/02/16
- Re: Hiding text,
Stefan Monnier <=