unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: [R.Ekker@ai.rug.nl: highlight-changes-rotate-faces sets buffer modified flag]
Date: Fri, 11 May 2007 11:11:50 +0200	[thread overview]
Message-ID: <46443356.7070103@gmx.at> (raw)
In-Reply-To: <E1HmPnG-0002ph-VO@fencepost.gnu.org>

 >      > Should it use something the font-lock mechanism so that it can update
 >      > when the buffer is edited?
 >
 >     Hmmm ... it does so, in principle, but for the reliance on the undo
 >     mechanism.
 >
 > I don't understand that -- can you explain?

`hilit-chg-set-face-on-change' operates pretty much like the font-lock
after-change mechanism:

If the change _is not_ caused by an undo it assigns the text-property
hilit-chg to the changed text and calls `hilit-chg-fixup' which installs
the overlays necessary for highlighting the changed text in accordance
with the just assigned text-property.

If the change _is_ caused by an undo, `hilit-chg-set-face-on-change'
falls back on the undo mechanism to restore the hilit-chg
text-properties and calls `hilit-chg-fixup' as in the non-undo case.

font-lock (usually) calculates the text properties anew after every
buffer change for the changed region regardless of whether they are
caused by an undo or not.  The idea of using undo for restoring text
(and subsequently overlay) properties strikes me as both clever and
elegant.  It makes it tricky though to keep the buffer-modified state
congruent as I explained in another mail: "face rotations" must show up
in buffer-undo-list but should not mark the buffer as modified.  This is
no problem as long as I'm able to hide rotations from the user, for
example, by running them in a hook which resets the modified flag
anyway.  It is a problem when the hook or function does not set the
modified-flag.  Hence, undoing a rotation may set the modified flag
although no user initiated buffer-change occurred.  If there were a
buffer-undo-list entry type which wouldn't set the modified flag ...

  reply	other threads:[~2007-05-11  9:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08 18:09 [R.Ekker@ai.rug.nl: highlight-changes-rotate-faces sets buffer modified flag] Richard Stallman
2007-05-08 22:00 ` martin rudalics
2007-05-09 14:26   ` Stefan Monnier
2007-05-09 18:05     ` martin rudalics
2007-05-09 19:24       ` Stefan Monnier
2007-05-09 21:27         ` martin rudalics
2007-05-09 21:34   ` Richard Stallman
2007-05-09 21:58     ` martin rudalics
2007-05-09  6:44 ` martin rudalics
2007-05-09 21:34   ` Richard Stallman
2007-05-09 21:59     ` martin rudalics
2007-05-11  7:44       ` Richard Stallman
2007-05-11  9:11         ` martin rudalics [this message]
2007-05-13 17:37           ` Richard Stallman
2007-05-14  9:03             ` martin rudalics
2007-05-15  9:46               ` Richard Stallman
2007-05-16  5:59                 ` martin rudalics
2007-05-16 14:32                   ` 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=46443356.7070103@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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).