From: Eli Zaretskii <eliz@gnu.org>
To: Romain Francoise <romain@orebokech.com>
Cc: cyd@stupidchicken.com, 7952@debbugs.gnu.org
Subject: bug#7952: 24.0.50; crash in find_interval
Date: Sat, 30 Apr 2011 11:58:17 +0300 [thread overview]
Message-ID: <83sjt05d5i.fsf@gnu.org> (raw)
In-Reply-To: <87wric23iq.fsf@silenus.orebokech.com>
> From: Romain Francoise <romain@orebokech.com>
> Cc: cyd@stupidchicken.com, 7952@debbugs.gnu.org
> Date: Fri, 29 Apr 2011 22:42:21 +0200
>
> Not sure if it's related, but using grep results in lots of those in
> the Messages buffer:
>
> | Error during redisplay: (args-out-of-range 26100 26140)
> | Error during redisplay: (args-out-of-range 55792 55803)
> | Error during redisplay: (args-out-of-range 89118 89155)
> | Error during redisplay: (args-out-of-range 107767 107804)
> | Error during redisplay: (args-out-of-range 119160 119176)
> | Error during redisplay: (args-out-of-range 152422 152434)
It's unrelated to the crash, but it's caused by the same reason:
jit-lock's function jit-lock-fontify-now also assumes that buffer
positions don't change as result of fontification. The patch below,
which uses markers for those positions that can change, seems to fix
that.
Before I commit this, I'd appreciate a review by Stefan (and anyone
else who cares to comment), especially wrt to semi-kludgey updating of
jit-lock-context-unfontify-pos (I wasn't sure making it a marker would
be TRT).
=== modified file 'lisp/jit-lock.el'
--- lisp/jit-lock.el 2011-01-25 04:08:28 +0000
+++ lisp/jit-lock.el 2011-04-30 08:45:26 +0000
@@ -315,7 +315,8 @@ Defaults to the whole buffer. END can b
(with-buffer-prepared-for-jit-lock
(save-excursion
(unless start (setq start (point-min)))
- (setq end (if end (min end (point-max)) (point-max)))
+ (setq end (copy-marker
+ (if end (min end (point-max)) (point-max))))
;; This did bind `font-lock-beginning-of-syntax-function' to
;; nil at some point, for an unknown reason. Don't do this; it
;; can make highlighting slow due to expensive calls to
@@ -324,15 +325,16 @@ Defaults to the whole buffer. END can b
;; from the end of a buffer to its start, can do repeated
;; `parse-partial-sexp' starting from `point-min', which can
;; take a long time in a large buffer.
- (let ((orig-start start) next)
+ (let ((orig-start start)
+ (next (make-marker)))
(save-match-data
;; Fontify chunks beginning at START. The end of a
;; chunk is either `end', or the start of a region
;; before `end' that has already been fontified.
(while (and start (< start end))
;; Determine the end of this chunk.
- (setq next (or (text-property-any start end 'fontified t)
- end))
+ (move-marker next (or (text-property-any start end 'fontified t)
+ end))
;; Decide which range of text should be fontified.
;; The problem is that START and NEXT may be in the
@@ -340,7 +342,7 @@ Defaults to the whole buffer. END can b
;; Until someone has a better idea, let's start
;; at the start of the line containing START and
;; stop at the start of the line following NEXT.
- (goto-char next) (setq next (line-beginning-position 2))
+ (goto-char next) (move-marker next (line-beginning-position 2))
(goto-char start) (setq start (line-beginning-position))
;; Make sure the contextual refontification doesn't re-refontify
@@ -353,7 +355,7 @@ Defaults to the whole buffer. END can b
;; it past the end of the multiline property and thus
;; forget about this multiline region altogether.
(not (get-text-property start 'jit-lock-defer-multiline)))
- (setq jit-lock-context-unfontify-pos next))
+ (setq jit-lock-context-unfontify-pos (marker-position next)))
;; Fontify the chunk, and mark it as fontified.
;; We mark it first, to make sure that we don't indefinitely
@@ -366,6 +368,13 @@ Defaults to the whole buffer. END can b
;; before displaying the block again.
(quit (put-text-property start next 'fontified nil)
(funcall 'signal (car err) (cdr err))))
+ ;; If NEXT moved as result of fontifying this chunk, update
+ ;; jit-lock-context-unfontify-pos.
+ (when (and jit-lock-context-unfontify-pos
+ (>= jit-lock-context-unfontify-pos start)
+ (> jit-lock-context-unfontify-pos next)
+ (not (get-text-property start 'jit-lock-defer-multiline)))
+ (setq jit-lock-context-unfontify-pos (marker-position next)))
;; The redisplay engine has already rendered the buffer up-to
;; `orig-start' and won't notice if the above jit-lock-functions
next prev parent reply other threads:[~2011-04-30 8:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.0.1296565545.10637.bug-gnu-emacs@gnu.org>
2011-03-09 12:25 ` bug#7952: 24.0.50; crash in find_interval Romain Francoise
2011-03-09 13:46 ` Eli Zaretskii
2011-03-09 15:16 ` Romain Francoise
2011-03-18 19:19 ` Romain Francoise
2011-03-18 19:37 ` Eli Zaretskii
2011-03-18 20:45 ` Romain Francoise
2011-03-19 10:37 ` Eli Zaretskii
2011-03-19 12:14 ` Andreas Schwab
2011-03-19 12:51 ` Eli Zaretskii
2011-03-19 13:18 ` Andreas Schwab
2011-03-19 13:56 ` Romain Francoise
2011-04-13 21:06 ` Chong Yidong
2011-04-14 4:36 ` Eli Zaretskii
2011-04-14 13:18 ` Romain Francoise
2011-04-26 8:39 ` Romain Francoise
2011-04-26 17:52 ` Eli Zaretskii
2011-04-29 18:17 ` Eli Zaretskii
2011-04-29 20:42 ` Romain Francoise
2011-04-30 8:58 ` Eli Zaretskii [this message]
2011-04-30 13:16 ` Stefan Monnier
2011-04-30 13:24 ` Eli Zaretskii
2011-05-02 14:51 ` Stefan Monnier
2011-05-08 5:18 ` Chong Yidong
2011-05-08 15:28 ` Eli Zaretskii
2011-05-08 20:27 ` Chong Yidong
2011-05-09 6:24 ` Eli Zaretskii
2011-05-09 14:06 ` Stefan Monnier
2011-05-09 14:46 ` Eli Zaretskii
2011-05-09 15:32 ` Stefan Monnier
2011-05-09 15:42 ` Eli Zaretskii
2011-05-09 17:09 ` Stefan Monnier
2011-05-09 19:46 ` Chong Yidong
2011-05-09 20:31 ` Eli Zaretskii
2011-02-01 12:41 Romain Francoise
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=83sjt05d5i.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=7952@debbugs.gnu.org \
--cc=cyd@stupidchicken.com \
--cc=romain@orebokech.com \
/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).