emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Buffer sometimes changes to modified with truncate-p


From: Chong Yidong
Subject: Re: address@hidden: Buffer sometimes changes to modified with truncate-partial-width-windows set to nil]
Date: Tue, 15 Aug 2006 19:19:04 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> From: Klaus Zeitler <address@hidden>
> 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




reply via email to

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