all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* text properties
@ 2004-07-28  0:55 Paul Pogonyshev
  2004-07-28 15:35 ` Stefan Monnier
  2004-07-28 22:09 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2004-07-28  0:55 UTC (permalink / raw)


Is it expected that evaluating this form sets `modified' flag
of the current buffer even though fontifying by adding a hook
by `jit-lock-register' does not?

	(add-text-properties 1 (1+ (buffer-size))
			     '(face nil invisible nil))

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: text properties
  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 22:09 ` Richard Stallman
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2004-07-28 15:35 UTC (permalink / raw)
  Cc: emacs-devel

> Is it expected that evaluating this form sets `modified' flag
> of the current buffer

Yes.

> even though fontifying by adding a hook
> by `jit-lock-register' does not?

Yes: jit-lock is careful to not change the modified flag (it resets it to
its original value after having done the fontification).


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: text properties
  2004-07-28 15:35 ` Stefan Monnier
@ 2004-07-28 16:39   ` Paul Pogonyshev
  2004-07-28 17:39     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Pogonyshev @ 2004-07-28 16:39 UTC (permalink / raw)
  Cc: emacs-devel

> > Is it expected that evaluating this form sets `modified' flag
> > of the current buffer
> 
> Yes.

OK, since this is not a bug I have to rephrase my question.

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

I have also noted this strange (from my point of view) behaviour
of overlays:

* `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.

* Consider two overlays set on consequent regions of text, for
  instance an overlay over each of the two `x' letters here:

	xx

  Each of the overlays is set to invisible and has a
  `before-string'.  Only one `before-string' is displayed, even
  though the overlays are still considered different (i.e.
  `overlays-in' lists both of them).

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.

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: text properties
  2004-07-28 16:39   ` Paul Pogonyshev
@ 2004-07-28 17:39     ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2004-07-28 17:39 UTC (permalink / raw)
  Cc: emacs-devel

> 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

  (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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: text properties
  2004-07-28  0:55 text properties Paul Pogonyshev
  2004-07-28 15:35 ` Stefan Monnier
@ 2004-07-28 22:09 ` Richard Stallman
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Stallman @ 2004-07-28 22:09 UTC (permalink / raw)
  Cc: emacs-devel

    Is it expected that evaluating this form sets `modified' flag
    of the current buffer even though fontifying by adding a hook
    by `jit-lock-register' does not?

	    (add-text-properties 1 (1+ (buffer-size))
				 '(face nil invisible nil))

Calling add-text-properties counts as modifying the buffer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-07-28 22:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2004-07-28 22:09 ` Richard Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.