From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#7952: 24.0.50; crash in find_interval Date: Sat, 30 Apr 2011 11:58:17 +0300 Message-ID: <83sjt05d5i.fsf@gnu.org> References: <87r5ag7a72.fsf@silenus.orebokech.com> <87lj0c1bj8.fsf@silenus.orebokech.com> <8339mkrzic.fsf@gnu.org> <87ei6417kl.fsf@silenus.orebokech.com> <87tye1x3mv.fsf@stupidchicken.com> <87y62xh0ep.fsf@silenus.orebokech.com> <83pqo899y4.fsf@gnu.org> <834o5g7wi7.fsf@gnu.org> <87wric23iq.fsf@silenus.orebokech.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1304154422 4117 80.91.229.12 (30 Apr 2011 09:07:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Apr 2011 09:07:02 +0000 (UTC) Cc: cyd@stupidchicken.com, 7952@debbugs.gnu.org To: Romain Francoise Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 30 11:06:58 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QG68f-00049r-Ph for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 11:06:58 +0200 Original-Received: from localhost ([::1]:39007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG68f-0002Aw-7e for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Apr 2011 05:06:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:59057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG68b-00029Z-74 for bug-gnu-emacs@gnu.org; Sat, 30 Apr 2011 05:06:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG68Z-0005xl-Ra for bug-gnu-emacs@gnu.org; Sat, 30 Apr 2011 05:06:53 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG68Z-0005xg-NX for bug-gnu-emacs@gnu.org; Sat, 30 Apr 2011 05:06:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QG60z-0003qh-Qj; Sat, 30 Apr 2011 04:59:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Apr 2011 08:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7952 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7952-submit@debbugs.gnu.org id=B7952.130415390714756 (code B ref 7952); Sat, 30 Apr 2011 08:59:01 +0000 Original-Received: (at 7952) by debbugs.gnu.org; 30 Apr 2011 08:58:27 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QG60R-0003px-2T for submit@debbugs.gnu.org; Sat, 30 Apr 2011 04:58:27 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QG60N-0003pj-LB for 7952@debbugs.gnu.org; Sat, 30 Apr 2011 04:58:25 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LKG00H00JG2IZ00@a-mtaout23.012.net.il> for 7952@debbugs.gnu.org; Sat, 30 Apr 2011 11:58:16 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.185.101]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LKG00HINJL2IO10@a-mtaout23.012.net.il>; Sat, 30 Apr 2011 11:58:16 +0300 (IDT) In-reply-to: <87wric23iq.fsf@silenus.orebokech.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 30 Apr 2011 04:59:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46094 Archived-At: > From: Romain Francoise > 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