From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: How to debug Error during redisplay Date: Sat, 12 Jan 2013 18:17:03 +0100 Message-ID: <874nim9v8w.fsf@rosalinde.fritz.box> References: <83bocwuidc.fsf@gnu.org> <837gnjvmlg.fsf@gnu.org> <83a9seu47p.fsf@gnu.org> <83zk0ese8v.fsf@gnu.org> <83r4lqsc9t.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1358011040 31412 80.91.229.3 (12 Jan 2013 17:17:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 17:17:20 +0000 (UTC) Cc: Leo Liu , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 12 18:17:38 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tu4i8-0008Ny-Uj for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2013 18:17:37 +0100 Original-Received: from localhost ([::1]:54540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu4hs-0003nw-Dv for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2013 12:17:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu4hj-0003nY-Vk for emacs-devel@gnu.org; Sat, 12 Jan 2013 12:17:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tu4hf-0003iJ-9V for emacs-devel@gnu.org; Sat, 12 Jan 2013 12:17:11 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:54080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu4he-0003i7-VY for emacs-devel@gnu.org; Sat, 12 Jan 2013 12:17:07 -0500 Original-Received: from mailout-de.gmx.net ([10.1.76.10]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0LmQuq-1TLHql1CYU-00a0Um for ; Sat, 12 Jan 2013 18:17:05 +0100 Original-Received: (qmail invoked by alias); 12 Jan 2013 17:17:04 -0000 Original-Received: from i59F56A2E.versanet.de (EHLO rosalinde.fritz.box) [89.245.106.46] by mail.gmx.net (mp010) with SMTP; 12 Jan 2013 18:17:04 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+oP2R1ry+ox8Okmw0toveRbFakqK5A2QPT9wHVir ZOmDVzX4oFqQTZ In-Reply-To: <83r4lqsc9t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 12 Jan 2013 16:31:58 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156293 Archived-At: On Sat, 12 Jan 2013 16:31:58 +0200 Eli Zaretskii wrote: >> From: Leo Liu >> Cc: emacs-devel@gnu.org >> Date: Sat, 12 Jan 2013 21:58:20 +0800 >> >> On 2013-01-12 21:49 +0800, Eli Zaretskii wrote: >> > . M-: (animate-string "hello" 0) RET >> > >> > And I don't see any error messages in *Messages*. >> >> Your frame needs to be a wide as possible so that the inserted string by >> animate-string is visible. > > Thanks, that was the missing link. The backtrace is below, I hope > this will allow to fix adaptive-wrap. > > For the record, here's how I got it caught red-handed: > > $ gdb ./emacs > (gdb) break wrong_type_argument > (gdb) r -Q > > Now do whatever it takes to reproduce the problem, and the > breakpoint will break. > > Evidently, the bug is here: > > (defun adaptive-wrap-fill-context-prefix (beg en) > "Like `fill-context-prefix', but with length adjusted by `adaptive-wrap-extra-indent'." > (let* ((fcp (fill-context-prefix beg en)) > (fcp-len (string-width fcp)) <<<<<<<<<<<<<<<<<<< > > It looks like this function doesn't expect that fill-context-prefix > could return nil. But the ELisp manual says: > > Usually, this function returns the fill prefix, a string. However, > before doing this, the function makes a final check (not specially > mentioned in the following) that a line starting with this prefix > wouldn't look like the start of a paragraph. Should this happen, > the function signals the anomaly by returning `nil' instead. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The simplest fix seems to be for the fill prefix to default to "", as in the patch below, which prevents the redisplay error, though I cannot tell whether the resulting failure to "signal the anomaly" could have undesirable consequences. Steve Berman *** /tmp/ediff4143yqw 2013-01-12 18:02:35.482163188 +0100 --- /tmp/ediff4143_02 2013-01-12 18:02:35.525164198 +0100 *************** *** 1,6 **** (defun adaptive-wrap-fill-context-prefix (beg en) ! "Like `fill-context-prefix', but with length adjusted by `adaptive-wrap-extra-indent'." ! (let* ((fcp (fill-context-prefix beg en)) (fcp-len (string-width fcp)) (fill-char (if (< 0 fcp-len) (string-to-char (substring fcp -1)) --- 1,8 ---- (defun adaptive-wrap-fill-context-prefix (beg en) ! "Compute a fill prefix from the text between BEG and EN. ! Like `fill-context-prefix', but with length adjusted by ! `adaptive-wrap-extra-indent'." ! (let* ((fcp (or (fill-context-prefix beg en) "")) (fcp-len (string-width fcp)) (fill-char (if (< 0 fcp-len) (string-to-char (substring fcp -1))