From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to debug Error during redisplay Date: Sat, 12 Jan 2013 16:31:58 +0200 Message-ID: <83r4lqsc9t.fsf@gnu.org> References: <83bocwuidc.fsf@gnu.org> <837gnjvmlg.fsf@gnu.org> <83a9seu47p.fsf@gnu.org> <83zk0ese8v.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1358001116 10497 80.91.229.3 (12 Jan 2013 14:31:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 14:31:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Liu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 12 15:32:13 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 1Tu280-0004TY-5z for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2013 15:32:08 +0100 Original-Received: from localhost ([::1]:60557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu27k-0007Bm-5z for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2013 09:31:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:44417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu27d-0007BT-G9 for emacs-devel@gnu.org; Sat, 12 Jan 2013 09:31:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tu27X-00028w-Pt for emacs-devel@gnu.org; Sat, 12 Jan 2013 09:31:45 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:63865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tu27X-00028n-CJ for emacs-devel@gnu.org; Sat, 12 Jan 2013 09:31:39 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MGI00M00O9U5B00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 12 Jan 2013 16:31:37 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MGI00L6VOCLSEB0@a-mtaout20.012.net.il>; Sat, 12 Jan 2013 16:31:34 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 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:156285 Archived-At: > 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. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Here's the backtrace: Breakpoint 3, wrong_type_argument (predicate=56455034, value=56403994) at data.c:99 99 xsignal2 (Qwrong_type_argument, predicate, value); (gdb) bt #0 wrong_type_argument (predicate=56455034, value=56403994) at data.c:99 #1 0x01290bd4 in Fstring_width (str=56403994) at character.c:501 #2 0x010131a1 in eval_sub (form=60154182) at eval.c:2037 #3 0x0100fdfb in FletX (args=60186150) at eval.c:723 #4 0x01012d17 in eval_sub (form=60154846) at eval.c:1985 #5 0x0100f188 in Fprogn (args=60184958) at eval.c:359 #6 0x01015c8c in funcall_lambda (fun=60184862, nargs=2, arg_vector=0x82a960) at eval.c:2897 #7 0x010155d0 in apply_lambda (fun=60184862, args=60178750) at eval.c:2781 #8 0x01013748 in eval_sub (form=60178758) at eval.c:2112 #9 0x0101308e in eval_sub (form=60181702) at eval.c:2022 #10 0x0100f188 in Fprogn (args=60178630) at eval.c:359 #11 0x010103ce in Flet (args=60181710) at eval.c:818 #12 0x01012d17 in eval_sub (form=60181886) at eval.c:1985 #13 0x0100f188 in Fprogn (args=60178622) at eval.c:359 #14 0x01010474 in Fwhile (args=60181902) at eval.c:840 #15 0x01012d17 in eval_sub (form=60181950) at eval.c:1985 #16 0x0100f188 in Fprogn (args=60178022) at eval.c:359 #17 0x01015c8c in funcall_lambda (fun=60177702, nargs=2, arg_vector=0x82b23c) at eval.c:2897 #18 0x0101536c in Ffuncall (nargs=3, args=0x82b238) at eval.c:2733 #19 0x010140cd in funcall_nil (nargs=3, args=0x82b238) at eval.c:2218 #20 0x01014536 in run_hook_with_args (nargs=3, args=0x82b238, funcall=0x10140b5 ) at eval.c:2403 #21 0x01014145 in Frun_hook_with_args (nargs=3, args=0x82b238) at eval.c:2264 #22 0x01014bfd in Ffuncall (nargs=4, args=0x82b234) at eval.c:2653 #23 0x0112765f in exec_byte_code (bytestr=20387929, vector=20946773, maxdepth=16, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898 #24 0x01126ad2 in Fbyte_code (bytestr=20387929, vector=20946773, maxdepth=16) at bytecode.c:473 #25 0x01013283 in eval_sub (form=20946726) at eval.c:2043 #26 0x01010caf in internal_lisp_condition_case (var=58254626, bodyform=20946726, handlers=20946798) at eval.c:1147 #27 0x011280de in exec_byte_code (bytestr=20946369, vector=20946525, maxdepth=32, args_template=56403994, nargs=0, args=0x0) at bytecode.c:1094 #28 0x01015dc0 in funcall_lambda (fun=20946349, nargs=2, arg_vector=0x82b818) at eval.c:2904 #29 0x01015298 in Ffuncall (nargs=3, args=0x82b814) at eval.c:2721 #30 0x0112765f in exec_byte_code (bytestr=20945985, vector=20946101, maxdepth=40, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898 #31 0x01015dc0 in funcall_lambda (fun=20945965, nargs=1, arg_vector=0x82bb64) at eval.c:2904 #32 0x01015298 in Ffuncall (nargs=2, args=0x82bb60) at eval.c:2721 #33 0x01011105 in internal_condition_case_n (bfun=0x1014852 , nargs=2, args=0x82bb60, handlers=56404018, hfun=0x1167501 ) at eval.c:1317 #34 0x0116761c in safe_call (nargs=2, func=60505498) at xdisp.c:2454 #35 0x0116765c in safe_call1 (fn=60505498, arg=768) at xdisp.c:2470 #36 0x0116ae0a in handle_fontified_prop (it=0x82c8b0) at xdisp.c:3690 #37 0x01169e55 in handle_stop (it=0x82c8b0) at xdisp.c:3254 #38 0x01179215 in next_element_from_buffer (it=0x82c8b0) at xdisp.c:7958 #39 0x01174ca6 in get_next_display_element (it=0x82c8b0) at xdisp.c:6623 #40 0x011a14e9 in display_line (it=0x82c8b0) at xdisp.c:19437 #41 0x011962f9 in try_window (window=59219973, pos=..., flags=0) at xdisp.c:16301 #42 0x01192f34 in redisplay_window (window=59219973, just_this_one_p=0) at xdisp.c:15632 #43 0x0118c9e7 in redisplay_window_0 (window=59219973) at xdisp.c:13881 #44 0x01010ec9 in internal_condition_case_1 ( bfun=0x118c9b2 , arg=59219973, handlers=56388574, hfun=0x118c98e ) at eval.c:1231 #45 0x0118c97e in redisplay_windows (window=59219973) at xdisp.c:13861 #46 0x0118af1d in redisplay_internal () at xdisp.c:13453 #47 0x0118bf45 in redisplay_preserve_echo_area (from_where=2) at xdisp.c:13706 #48 0x01080a7c in Fredisplay (force=56403994) at dispnew.c:5936 #49 0x01014e91 in Ffuncall (nargs=1, args=0x82efa4) at eval.c:2672 #50 0x0112765f in exec_byte_code (bytestr=20208233, vector=20208325, maxdepth=20, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898 #51 0x01015dc0 in funcall_lambda (fun=20208181, nargs=1, arg_vector=0x82f208) at eval.c:2904 #52 0x01015298 in Ffuncall (nargs=2, args=0x82f204) at eval.c:2721 #53 0x0112765f in exec_byte_code (bytestr=58311649, vector=56710557, maxdepth=28, args_template=56403994, nargs=0, args=0x0) at bytecode.c:898 #54 0x01015dc0 in funcall_lambda (fun=56710669, nargs=2, arg_vector=0x82f3d0) at eval.c:2904 #55 0x010155d0 in apply_lambda (fun=56710669, args=60243686) at eval.c:2781 #56 0x010135a5 in eval_sub (form=60243694) at eval.c:2082 #57 0x01012877 in Feval (form=60243694, lexical=56403994) at eval.c:1902 #58 0x01014efc in Ffuncall (nargs=3, args=0x82f654) at eval.c:2675 #59 0x0112765f in exec_byte_code (bytestr=20695897, vector=20695989, maxdepth=28, args_template=2052, nargs=2, args=0x82f8ac) at bytecode.c:898 #60 0x0101597d in funcall_lambda (fun=20695869, nargs=2, arg_vector=0x82f8a4) at eval.c:2838 #61 0x01015298 in Ffuncall (nargs=3, args=0x82f8a0) at eval.c:2721 #62 0x01014089 in Fapply (nargs=2, args=0x82f940) at eval.c:2206 #63 0x0101460d in apply1 (fn=58199234, arg=60243158) at eval.c:2440 #64 0x0112489e in Fcall_interactively (function=58199234, record_flag=56403994, keys=56425333) at callint.c:377 #65 0x01014f71 in Ffuncall (nargs=4, args=0x82fb80) at eval.c:2679 #66 0x010146e2 in call3 (fn=56521306, arg1=58199234, arg2=56403994, arg3=56403994) at eval.c:2497 #67 0x010aef10 in Fcommand_execute (cmd=58199234, record_flag=56403994, keys=56403994, special=56403994) at keyboard.c:10251 #68 0x010954d5 in command_loop_1 () at keyboard.c:1588 #69 0x01010db9 in internal_condition_case (bfun=0x109477b , handlers=56454362, hfun=0x1093fbb ) at eval.c:1193 #70 0x01094407 in command_loop_2 (ignore=56403994) at keyboard.c:1175 #71 0x010107c1 in internal_catch (tag=56444218, func=0x10943e4 , arg=56403994) at eval.c:964 #72 0x010943bf in command_loop () at keyboard.c:1154 #73 0x0109398c in recursive_edit_1 () at keyboard.c:787 #74 0x01093cae in Frecursive_edit () at keyboard.c:851 #75 0x01002872 in main (argc=2, argv=0xa427c8) at emacs.c:1573 Lisp Backtrace: "string-width" (0x82a670) "let*" (0x82a890) "adaptive-wrap-fill-context-prefix" (0x82a960) "put-text-property" (0x82ac00) "let" (0x82ae00) "while" (0x82afa0) "adaptive-wrap-prefix-function" (0x82b23c) "run-hook-with-args" (0x82b238) "byte-code" (0x82b410) "jit-lock-fontify-now" (0x82b818) "jit-lock-function" (0x82bb64) "redisplay_internal (C function)" (0x166c7f0) "redisplay" (0x82efa8) "sit-for" (0x82f208) "animate-string" (0x82f3d0) "eval" (0x82f658) "eval-expression" (0x82f8a4) "call-interactively" (0x82fb84) (gdb)