emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to debug Error during redisplay


From: Stephen Berman
Subject: Re: How to debug Error during redisplay
Date: Sat, 12 Jan 2013 18:17:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

On Sat, 12 Jan 2013 16:31:58 +0200 Eli Zaretskii <address@hidden> wrote:

>> From:  Leo Liu <address@hidden>
>> Cc: address@hidden
>> 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]