[Top][All Lists]

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

Re: text properties

From: Stefan Monnier
Subject: Re: text properties
Date: 28 Jul 2004 13:39:12 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> How do I quickly remove all text properties from a buffer without
> touching the `modified' flag?

   (let ((mod (buffer-modified-p)))
     ...do the modiffs...
     (restore-buffer-modified-p mod))

Note that there are other things that you might want to disable as well,
depending on your circumstance (e.g. you might want to disable messages
like "file has been modified, do you really want to edit this buffer", or
disable the deactivation of the mark, ...).

See with-buffer-prepared-for-jit-lock in jit-lock.el for an example.

> * `after-string' seems to never get highlighted with the value
>   of `face' property.  `before-string' is normally highlighted,
>   but when the overlay's text is invisible, it doesn't.

Maybe this depends on the `type' of the bounds of the overlay (whether they
are insert-before or insert-after)?
[ Or maybe it's just the way the code work, for no good reason. ]

> In case you wonder what the hell I'm doing with invisible overlays:
> I'm trying to get `—' displayed as `---', but with a non-
> default face, so that I can distinguish between a dash and three
> hyphens in a row.

Have you tried to use the `display' property instead.
Or better yet, use a composition and turn it into a `—'.  E.g. I use

   nil `(("\\<lambda\\>"
          (0 (progn (compose-region (match-beginning 0) (match-end 0)
                                    ;; ,(make-char 'greek-iso8859-7 107)

as a quick hack to display the symbol `lambda' as a character `λ' in Lisp
buffers.  Face properties placed on the `lambda' text are correctly applied
to the λ char displayed.  Additionally cursor movement and display works
fairly well (which is usually not the case with before-string+invisible


reply via email to

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