From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Leo Liu <sdl.web@gmail.com>, emacs-devel@gnu.org
Subject: Re: How to debug Error during redisplay
Date: Sat, 12 Jan 2013 18:17:03 +0100 [thread overview]
Message-ID: <874nim9v8w.fsf@rosalinde.fritz.box> (raw)
In-Reply-To: <83r4lqsc9t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 12 Jan 2013 16:31:58 +0200")
On Sat, 12 Jan 2013 16:31:58 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Leo Liu <sdl.web@gmail.com>
>> 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))
next prev parent reply other threads:[~2013-01-12 17:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 9:03 How to debug Error during redisplay Leo Liu
2013-01-11 10:25 ` Eli Zaretskii
2013-01-11 11:02 ` Leo Liu
2013-01-11 14:08 ` Eli Zaretskii
2013-01-12 5:25 ` Leo Liu
2013-01-12 9:43 ` Eli Zaretskii
2013-01-12 11:56 ` Leo Liu
2013-01-12 12:03 ` Leo Liu
2013-01-12 13:49 ` Eli Zaretskii
2013-01-12 13:58 ` Leo Liu
2013-01-12 14:31 ` Eli Zaretskii
2013-01-12 17:17 ` Stephen Berman [this message]
2013-01-12 12:30 ` Eli Zaretskii
2013-01-11 14:56 ` Stefan Monnier
2013-01-12 5:26 ` Leo Liu
2013-01-12 13:08 ` Stefan Monnier
2013-01-12 13:38 ` Leo Liu
2013-01-12 13:52 ` Eli Zaretskii
2013-01-12 14:07 ` Leo Liu
2013-01-12 14:38 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874nim9v8w.fsf@rosalinde.fritz.box \
--to=stephen.berman@gmx.net \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=sdl.web@gmail.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.