* Mark for refontification
@ 2010-04-06 0:47 Lennart Borgman
2010-04-09 2:53 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-04-06 0:47 UTC (permalink / raw)
To: Emacs-Devel devel
Just one of my usual complaints: Could we please include a function
for marking a region for refontification? (Something like the function
mumamo-mark-for-refontification perhaps.)
Please also move the definition of the defmacro save-buffer-state
outside of eval-when-compile so that it could be used in other places
than font-lock.el. (Would it be enough to change to eval-and-compile?)
;;;###autoload
(defun mumamo-mark-for-refontification (min max)
"Mark region between MIN and MAX for refontification."
(save-restriction
(widen)
;;(mumamo-with-buffer-prepared-for-jit-lock
(mumamo-save-buffer-state nil
(put-text-property min max 'fontified nil)
)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mark for refontification
2010-04-06 0:47 Mark for refontification Lennart Borgman
@ 2010-04-09 2:53 ` Stefan Monnier
2010-04-09 6:42 ` Lennart Borgman
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2010-04-09 2:53 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs-Devel devel
> Please also move the definition of the defmacro save-buffer-state
> outside of eval-when-compile so that it could be used in other places
> than font-lock.el.
We have with-silent-modifications.
> ;;;###autoload
> (defun mumamo-mark-for-refontification (min max)
> "Mark region between MIN and MAX for refontification."
> (save-restriction
> (widen)
> ;;(mumamo-with-buffer-prepared-for-jit-lock
> (mumamo-save-buffer-state nil
> (put-text-property min max 'fontified nil)
> )))
Why widen?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mark for refontification
2010-04-09 2:53 ` Stefan Monnier
@ 2010-04-09 6:42 ` Lennart Borgman
2010-04-10 0:57 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-04-09 6:42 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs-Devel devel
On Fri, Apr 9, 2010 at 4:53 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> Please also move the definition of the defmacro save-buffer-state
>> outside of eval-when-compile so that it could be used in other places
>> than font-lock.el.
>
> We have with-silent-modifications.
Thanks, I did not notice.
>> ;;;###autoload
>> (defun mumamo-mark-for-refontification (min max)
>> "Mark region between MIN and MAX for refontification."
>> (save-restriction
>> (widen)
>> ;;(mumamo-with-buffer-prepared-for-jit-lock
>> (mumamo-save-buffer-state nil
>> (put-text-property min max 'fontified nil)
>> )))
>
> Why widen?
You mean it is not necessary for put-text-property?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mark for refontification
2010-04-09 6:42 ` Lennart Borgman
@ 2010-04-10 0:57 ` Stefan Monnier
2010-04-10 1:12 ` Lennart Borgman
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2010-04-10 0:57 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs-Devel devel
>>> (defun mumamo-mark-for-refontification (min max)
>>> "Mark region between MIN and MAX for refontification."
>>> (save-restriction
>>> (widen)
>>> ;;(mumamo-with-buffer-prepared-for-jit-lock
>>> (mumamo-save-buffer-state nil
>>> (put-text-property min max 'fontified nil)
>>> )))
>>
>> Why widen?
> You mean it is not necessary for put-text-property?
No, my question doesn't have anything to do with put-text-property.
It's just that usually Elisp functions don't take buffer positions
outside of point-min...point-max and I see no reason why this one should
be an exception.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mark for refontification
2010-04-10 0:57 ` Stefan Monnier
@ 2010-04-10 1:12 ` Lennart Borgman
2010-04-10 15:02 ` Stefan Monnier
0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2010-04-10 1:12 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Emacs-Devel devel
On Sat, Apr 10, 2010 at 2:57 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>
> >>> (defun mumamo-mark-for-refontification (min max)
> >>> "Mark region between MIN and MAX for refontification."
> >>> (save-restriction
> >>> (widen)
> >>> ;;(mumamo-with-buffer-prepared-for-jit-lock
> >>> (mumamo-save-buffer-state nil
> >>> (put-text-property min max 'fontified nil)
> >>> )))
> >>
> >> Why widen?
>
> > You mean it is not necessary for put-text-property?
>
> No, my question doesn't have anything to do with put-text-property.
> It's just that usually Elisp functions don't take buffer positions
> outside of point-min...point-max and I see no reason why this one should
> be an exception.
I can't remember why I did it this way, but it is probably due to that
any change in the chunk dividing can result in that the rest of the
buffer should be refontified.
That can of course be optimized since it really may not need
refontification. I am trying to do that and reuse old chunk
fontification, but I don't remember how far I get with this at the
moment. (I have finally rewritten the chunk dividing routines so that
chunks always is part of a chain starting from the top of the buffer.
As usual the code can be improved.)
Still, when I find that an old chunk really is invalid I must mark (at
least part of) it for refontification.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Mark for refontification
2010-04-10 1:12 ` Lennart Borgman
@ 2010-04-10 15:02 ` Stefan Monnier
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2010-04-10 15:02 UTC (permalink / raw)
To: Lennart Borgman; +Cc: Emacs-Devel devel
> Still, when I find that an old chunk really is invalid I must mark (at
> least part of) it for refontification.
That's perfectly fine. But if *you* need to refer to buffer positions
outside of point-min...point-max then *you* need to widen, not
"mark-for-refontification",
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-10 15:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 0:47 Mark for refontification Lennart Borgman
2010-04-09 2:53 ` Stefan Monnier
2010-04-09 6:42 ` Lennart Borgman
2010-04-10 0:57 ` Stefan Monnier
2010-04-10 1:12 ` Lennart Borgman
2010-04-10 15:02 ` Stefan Monnier
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.