unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: kifer@cs.sunysb.edu, emacs-devel@gnu.org
Subject: Re: [kzeitler@sfsws1.de.lucent.com: Buffer sometimes changes to modified with truncate-partial-width-windows set to nil]
Date: Tue, 15 Aug 2006 19:19:04 -0400	[thread overview]
Message-ID: <877j19lh93.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1GAz72-0002m1-E1@fencepost.gnu.org> (Richard Stallman's message of "Wed, 09 Aug 2006 21:13:28 -0400")

> From: Klaus Zeitler <kzeitler@sfsws1.de.lucent.com>
> Subject: Buffer sometimes changes to modified with
> 	truncate-partial-width-windows set to nil
>
> 1. start emacs -Q
> 2. in scratch buffer evaluate the following 2 expressions
> (setq ediff-split-window-function 'split-window-horizontally)
> (setq truncate-partial-width-windows nil)
> 3. M-x ediff-files file1 file2
>
> Now when I move (with <n> in Ediff Control Panel) from diff to diff, it's
> only a matter of time till at least one of the buffers changes the
> buffer-modified flag without any apparent reason.

This seems to be an effect of the "orig-start" code that Stefan added
to `jit-lock-fontify-now'.  The problem goes away if this chunk is
commented out.  I don't know why the chunk has the effect, though; as
far as I can tell, it ought to preserve buffer modification status
since everything is wrapped in a `with-buffer-prepared-for-jit-lock'
macro.  I can confirm that `buffer-modified-p' is nil when the timer
function is run:

     ;; The redisplay engine has already rendered the buffer up-to
     ;; `orig-start' and won't notice if the above jit-lock-functions
     ;; changed the appearance of any part of the buffer prior
     ;; to that.  So if `start' is before `orig-start', we need to
     ;; cause a new redisplay cycle after this one so that any changes
     ;; are properly reflected on screen.
     ;; To make such repeated redisplay happen less often, we can
     ;; eagerly extend the refontified region with
     ;; jit-lock-after-change-extend-region-functions.
     (when (< start orig-start)
       (lexical-let ((start start)
                     (orig-start orig-start)
                     (buf (current-buffer)))
         (run-with-timer
          0 nil (lambda ()
                  (with-buffer-prepared-for-jit-lock
                      (put-text-property start orig-start
                                         'fontified t buf))))))

Even more bizaarely, tweaking set-buffer-modified-p inside the
`with-buffer-prepared-for-jit-lock' block, as shown below, also causes
the bug to go away.  By right, it should do nothing.  The
set-buffer-modified-p call can be put later in `jit-lock-fontify-now',
but putting it any earlier causes the bug to resurface.  Anyone have
any idea what's going on here?

*** emacs/lisp/jit-lock.el.~1.53.~	2006-08-15 18:27:36.000000000 -0400
--- emacs/lisp/jit-lock.el	2006-08-15 19:16:50.000000000 -0400
***************
*** 368,373 ****
--- 368,375 ----
  	   ;; We mark it first, to make sure that we don't indefinitely
  	   ;; re-execute this fontification if an error occurs.
  	   (put-text-property start next 'fontified t)
+ 	   (set-buffer-modified-p nil)
+ 
  	   (condition-case err
  	       (run-hook-with-args 'jit-lock-functions start next)
  	     ;; If the user quits (which shouldn't happen in normal on-the-fly

  parent reply	other threads:[~2006-08-15 23:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10  1:13 [kzeitler@sfsws1.de.lucent.com: Buffer sometimes changes to modified with truncate-partial-width-windows set to nil] Richard Stallman
2006-08-10 22:50 ` Chong Yidong
2006-08-11  6:50   ` Klaus Zeitler
2006-08-11 19:23     ` Richard Stallman
2006-08-15 23:19 ` Chong Yidong [this message]
2006-08-16  7:50   ` martin rudalics
2006-08-16 11:55     ` Klaus Zeitler
2006-08-16 12:51       ` martin rudalics
2006-08-16 14:07     ` Chong Yidong
2006-08-17  6:19       ` Klaus Zeitler
2006-08-17 15:07     ` Stefan Monnier
2006-08-17 15:19   ` Richard Stallman
2006-08-25 20:23   ` Richard Stallman
2006-08-26  0:03     ` Stefan Monnier

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=877j19lh93.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=kifer@cs.sunysb.edu \
    /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).