I've got a freshly compiled XEmacs from mercurial head. If I evaluate
this in *scratch*, I get the expected result:
(truncate-string-to-width "j.\n\n" 40 nil nil t)
"j.
"
If I select Options->Troubleshooting->Debug on Signal, then try to
evaluate that again, I get this:
Debugger entered--Lisp error: (args-out-of-range "j.
" 4)
byte-code("..." [last-idx last-column end-column ch idx column
char-width str] 3)
truncate-string-to-width("j.\n\n" 40 nil nil t)
eval((truncate-string-to-width "j.\n\n" 40 nil nil t))
eval-interactive((truncate-string-to-width "j.\n\n" 40 nil nil t))
eval-last-sexp(t)
#<compiled-function (from eval-print-last-sexp) nil "...(13)"
[standard-output terpri eval-last-sexp t] 2 1409437 nil 0x8b6>()
call-interactively(eval-print-last-sexp)
(dispatch-event "[internal]")
This is causing the following practical problem. With an X11 build
and Debug on Signal active, clicking on the menubar causes an
immediate crash due to an assertion failure. A little debugger work
shows the following sequence. Inside of button_item_to_widget_value
(src/gui-x.c), the default-menubar from lisp/menubar-items.el is
evaluated, down to one of the calls to:
(truncate-string-to-width (abbrev-string-to-be-defined nil) 40 nil nil t)
The abbrev-string-to-be-defined call returns "j.\n\n" (which doesn't
seem right; where did that come from?). Evaluating
truncate-string-to-width triggers the args_out_of_range, thereby
unwinding the stack up to the call_trapping_problems call in
menu_item_descriptor_to_widget_value (menubar-x.c). Since retval is
unbound, this function returns NULL, and therefore
compute_menubar_data also returns NULL. This triggers the assert() in
set_frame_menubar (menubar-x.c) just after the call to
compute_menubar_data and *boom* goes XEmacs.
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta