* Debugger and mode-line
@ 2006-06-28 16:38 Lars Hansen
2006-06-29 12:58 ` Richard Stallman
0 siblings, 1 reply; 13+ messages in thread
From: Lars Hansen @ 2006-06-28 16:38 UTC (permalink / raw)
For a long time, I have had problems with the Emacs lisp debugger: The
value returned from match-string calls was often wrong. Now I have found
out that match-data was overwritten during evaluation of the mode-line
because I have an abbreviate-file-name call there, and
abbreviate-file-name overwrites match-data.
Is this a debugger bug? Or should evaluation of the mode-line save
match-data?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-06-28 16:38 Debugger and mode-line Lars Hansen
@ 2006-06-29 12:58 ` Richard Stallman
2006-06-29 15:21 ` Lars Hansen
0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2006-06-29 12:58 UTC (permalink / raw)
Cc: emacs-devel
Is this a debugger bug? Or should evaluation of the mode-line save
match-data?
It should save the match-data, because it is a generally useful
function and regexp matching is not part of its _purpose_.
I'll install that sometime soon.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-06-29 12:58 ` Richard Stallman
@ 2006-06-29 15:21 ` Lars Hansen
2006-06-30 11:07 ` Richard Stallman
2006-07-08 1:12 ` Richard Stallman
0 siblings, 2 replies; 13+ messages in thread
From: Lars Hansen @ 2006-06-29 15:21 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman wrote:
> Is this a debugger bug? Or should evaluation of the mode-line save
> match-data?
>
>It should save the match-data, because it is a generally useful
>function and regexp matching is not part of its _purpose_.
>
>
I agree that abbreviate-file-name should save match data.
But what I meant was: Maybe Emacs should save match data when
*evaluating the modeline*. Otherwise someone will run into the problem
of malfunctioning debugger because they happen to have something else in
the modeline that overwrite match data.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-06-29 15:21 ` Lars Hansen
@ 2006-06-30 11:07 ` Richard Stallman
2006-07-08 1:12 ` Richard Stallman
1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2006-06-30 11:07 UTC (permalink / raw)
Cc: emacs-devel
I agree that abbreviate-file-name should save match data.
But what I meant was: Maybe Emacs should save match data when
*evaluating the modeline*.
That is a good idea. Can someone please implement it and ack?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-06-29 15:21 ` Lars Hansen
2006-06-30 11:07 ` Richard Stallman
@ 2006-07-08 1:12 ` Richard Stallman
2006-07-08 9:53 ` Thien-Thi Nguyen
1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2006-07-08 1:12 UTC (permalink / raw)
Cc: emacs-devel
[I sent this message a week ago but did not get a response.
Could we get the discussion moving again?]
I agree that abbreviate-file-name should save match data.
But what I meant was: Maybe Emacs should save match data when
*evaluating the modeline*.
That is a good idea. Can someone please implement it and ack?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-08 1:12 ` Richard Stallman
@ 2006-07-08 9:53 ` Thien-Thi Nguyen
2006-07-08 14:23 ` Andreas Schwab
2006-07-08 20:57 ` Richard Stallman
0 siblings, 2 replies; 13+ messages in thread
From: Thien-Thi Nguyen @ 2006-07-08 9:53 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> writes:
> That is a good idea. Can someone please implement it and ack?
does this patch look ok?
thi
_________________________________________________________
*** xdisp.c 1 Jul 2006 23:29:04 -0000 1.1109
--- xdisp.c 8 Jul 2006 09:50:41 -0000
***************
*** 16522,16527 ****
--- 16522,16528 ----
{
struct it it;
struct face *face;
+ Lisp_Object match_data;
int count = SPECPDL_INDEX ();
init_iterator (&it, w, -1, -1, NULL, face_id);
***************
*** 16542,16548 ****
--- 16543,16551 ----
kboard-local variables in the mode_line_format will get the right
values. */
push_frame_kboard (it.f);
+ match_data = Fmatch_data (Qnil, Qnil, Qnil);
display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
+ Fset_match_data (match_data, Qnil);
pop_frame_kboard ();
unbind_to (count, Qnil);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-08 9:53 ` Thien-Thi Nguyen
@ 2006-07-08 14:23 ` Andreas Schwab
2006-07-08 14:58 ` Stefan Monnier
2006-07-08 20:57 ` Richard Stallman
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2006-07-08 14:23 UTC (permalink / raw)
Cc: emacs-devel
Thien-Thi Nguyen <ttn@gnu.org> writes:
> ***************
> *** 16542,16548 ****
> --- 16543,16551 ----
> kboard-local variables in the mode_line_format will get the right
> values. */
> push_frame_kboard (it.f);
> + match_data = Fmatch_data (Qnil, Qnil, Qnil);
> display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
> + Fset_match_data (match_data, Qnil);
You'll need to protect match_data from GC, since display_mode_element can
call eval.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-08 14:23 ` Andreas Schwab
@ 2006-07-08 14:58 ` Stefan Monnier
0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2006-07-08 14:58 UTC (permalink / raw)
Cc: Thien-Thi Nguyen, emacs-devel
>> + match_data = Fmatch_data (Qnil, Qnil, Qnil);
>> display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
>> + Fset_match_data (match_data, Qnil);
> You'll need to protect match_data from GC, since display_mode_element can
> call eval.
And from non-local exits as well, I believe,
Stefan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-08 9:53 ` Thien-Thi Nguyen
2006-07-08 14:23 ` Andreas Schwab
@ 2006-07-08 20:57 ` Richard Stallman
2006-07-16 10:26 ` Thien-Thi Nguyen
1 sibling, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2006-07-08 20:57 UTC (permalink / raw)
Cc: emacs-devel
This change should use record_unwind_protect.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-08 20:57 ` Richard Stallman
@ 2006-07-16 10:26 ` Thien-Thi Nguyen
2006-07-17 1:41 ` Richard Stallman
0 siblings, 1 reply; 13+ messages in thread
From: Thien-Thi Nguyen @ 2006-07-16 10:26 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> This change should use record_unwind_protect.
how about the following? is it true that using
`record_unwind_save_match_data' means it is not
necessary to use a separate auto var?
thi
___________________________________________________________
*** xdisp.c 1 Jul 2006 23:29:04 -0000 1.1109
--- xdisp.c 16 Jul 2006 10:24:53 -0000
***************
*** 16542,16547 ****
--- 16542,16548 ----
kboard-local variables in the mode_line_format will get the right
values. */
push_frame_kboard (it.f);
+ record_unwind_save_match_data ();
display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
pop_frame_kboard ();
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-16 10:26 ` Thien-Thi Nguyen
@ 2006-07-17 1:41 ` Richard Stallman
2006-07-17 7:48 ` Thien-Thi Nguyen
0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2006-07-17 1:41 UTC (permalink / raw)
Cc: eliz, emacs-devel
how about the following? is it true that using
`record_unwind_save_match_data' means it is not
necessary to use a separate auto var?
Yes. Would someone please install this change:
*** xdisp.c 1 Jul 2006 23:29:04 -0000 1.1109
--- xdisp.c 16 Jul 2006 10:24:53 -0000
***************
*** 16542,16547 ****
--- 16542,16548 ----
kboard-local variables in the mode_line_format will get the right
values. */
push_frame_kboard (it.f);
+ record_unwind_save_match_data ();
display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
pop_frame_kboard ();
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-17 1:41 ` Richard Stallman
@ 2006-07-17 7:48 ` Thien-Thi Nguyen
2006-07-17 16:21 ` Lars Hansen
0 siblings, 1 reply; 13+ messages in thread
From: Thien-Thi Nguyen @ 2006-07-17 7:48 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> writes:
> how about the following? is it true that using
> `record_unwind_save_match_data' means it is not
> necessary to use a separate auto var?
>
> Yes. Would someone please install this change:
thanks for the confirmation. installed.
thi
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Debugger and mode-line
2006-07-17 7:48 ` Thien-Thi Nguyen
@ 2006-07-17 16:21 ` Lars Hansen
0 siblings, 0 replies; 13+ messages in thread
From: Lars Hansen @ 2006-07-17 16:21 UTC (permalink / raw)
Cc: emacs-devel
Thien-Thi Nguyen wrote:
>thanks for the confirmation. installed.
>
>
Thanks for fixing this!
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-07-17 16:21 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 16:38 Debugger and mode-line Lars Hansen
2006-06-29 12:58 ` Richard Stallman
2006-06-29 15:21 ` Lars Hansen
2006-06-30 11:07 ` Richard Stallman
2006-07-08 1:12 ` Richard Stallman
2006-07-08 9:53 ` Thien-Thi Nguyen
2006-07-08 14:23 ` Andreas Schwab
2006-07-08 14:58 ` Stefan Monnier
2006-07-08 20:57 ` Richard Stallman
2006-07-16 10:26 ` Thien-Thi Nguyen
2006-07-17 1:41 ` Richard Stallman
2006-07-17 7:48 ` Thien-Thi Nguyen
2006-07-17 16:21 ` Lars Hansen
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.