unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: text properties
Date: 28 Jul 2004 13:39:12 -0400	[thread overview]
Message-ID: <jwvzn5k9hd4.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <200407281939.52104.pogonyshev@gmx.net>

> 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 `&mdash;' 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

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

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
overlays).


        Stefan

  reply	other threads:[~2004-07-28 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-28  0:55 text properties Paul Pogonyshev
2004-07-28 15:35 ` Stefan Monnier
2004-07-28 16:39   ` Paul Pogonyshev
2004-07-28 17:39     ` Stefan Monnier [this message]
2004-07-28 22:09 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvzn5k9hd4.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).