diff options
| author | Stefan Monnier | 2004-11-22 05:26:50 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-11-22 05:26:50 +0000 |
| commit | d0bce91e9c99cc5a62e775a3d5eb79af8a28d34f (patch) | |
| tree | 3e7dc4d3694be3bad6dbb50fe44ec8cfada89085 /src | |
| parent | 87ae59e3680c70b7e284c0458c29cf5bc65d39ad (diff) | |
| download | emacs-d0bce91e9c99cc5a62e775a3d5eb79af8a28d34f.tar.gz emacs-d0bce91e9c99cc5a62e775a3d5eb79af8a28d34f.zip | |
(Fdefvar): Warn when var is let-bound but globally void.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/eval.c | 15 |
2 files changed, 25 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0d74afca197..cd09604d4e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2004-11-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * eval.c (Fdefvar): Warn when var is let-bound but globally void. | ||
| 4 | |||
| 1 | 2004-11-21 Kim F. Storm <storm@cua.dk> | 5 | 2004-11-21 Kim F. Storm <storm@cua.dk> |
| 2 | 6 | ||
| 3 | * xdisp.c (erase_phys_cursor): Clear hollow cursor inside TEXT_AREA. | 7 | * xdisp.c (erase_phys_cursor): Clear hollow cursor inside TEXT_AREA. |
| @@ -11,9 +15,9 @@ | |||
| 11 | * macterm.c (x_clip_to_row): Add area arg. Callers changed. | 15 | * macterm.c (x_clip_to_row): Add area arg. Callers changed. |
| 12 | (x_draw_hollow_cursor, x_draw_bar_cursor): Clip to TEXT_AREA. | 16 | (x_draw_hollow_cursor, x_draw_bar_cursor): Clip to TEXT_AREA. |
| 13 | 17 | ||
| 14 | * xdisp.c (move_it_in_display_line_to, display_line): Restore | 18 | * xdisp.c (move_it_in_display_line_to, display_line): |
| 15 | saved_face_id if overflow-newline-into-fringe is enabled and line | 19 | Restore saved_face_id if overflow-newline-into-fringe is enabled and |
| 16 | is continued before or in middle of element from display vector. | 20 | line is continued before or in middle of element from display vector. |
| 17 | 21 | ||
| 18 | * indent.c (Fvertical_motion): Fix last change. Use another | 22 | * indent.c (Fvertical_motion): Fix last change. Use another |
| 19 | method to detect if iterator moved too far ahead after reseat. | 23 | method to detect if iterator moved too far ahead after reseat. |
| @@ -27,8 +31,7 @@ | |||
| 27 | 31 | ||
| 28 | 2004-11-20 Luc Teirlinck <teirllm@auburn.edu> | 32 | 2004-11-20 Luc Teirlinck <teirllm@auburn.edu> |
| 29 | 33 | ||
| 30 | * fns.c (Fyes_or_no_p): Call Fread_from_minibuffer with extra | 34 | * fns.c (Fyes_or_no_p): Call Fread_from_minibuffer with extra argument. |
| 31 | argument. | ||
| 32 | * callint.c (Fcall_interactively): Ditto. | 35 | * callint.c (Fcall_interactively): Ditto. |
| 33 | 36 | ||
| 34 | 2004-11-20 Stefan Monnier <monnier@iro.umontreal.ca> | 37 | 2004-11-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| @@ -44,7 +47,7 @@ | |||
| 44 | (Fread_from_minibuffer): New arg KEEP_ALL. Callers changed. | 47 | (Fread_from_minibuffer): New arg KEEP_ALL. Callers changed. |
| 45 | 48 | ||
| 46 | * search.c (Vsearch_spaces_regexp): | 49 | * search.c (Vsearch_spaces_regexp): |
| 47 | Renamed from Vsearch_whitespace_regexp. All uses changed. | 50 | Rename from Vsearch_whitespace_regexp. All uses changed. |
| 48 | 51 | ||
| 49 | 2004-11-20 Thien-Thi Nguyen <ttn@gnu.org> | 52 | 2004-11-20 Thien-Thi Nguyen <ttn@gnu.org> |
| 50 | 53 | ||
| @@ -86,8 +89,7 @@ | |||
| 86 | 89 | ||
| 87 | 2004-11-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 90 | 2004-11-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 88 | 91 | ||
| 89 | * gtkutil.c (xg_get_file_name): Fix typo in | 92 | * gtkutil.c (xg_get_file_name): Typo in HAVE_GTK_FILE_SELECTION_NEW. |
| 90 | HAVE_GTK_FILE_SELECTION_NEW. | ||
| 91 | 93 | ||
| 92 | * xmenu.c (x_menu_in_use): Remove. | 94 | * xmenu.c (x_menu_in_use): Remove. |
| 93 | (x_menu_set_in_use): Also set popup_activated_flag. | 95 | (x_menu_set_in_use): Also set popup_activated_flag. |
diff --git a/src/eval.c b/src/eval.c index adff3e8670c..e8a8e4668e4 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -786,6 +786,21 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 786 | { | 786 | { |
| 787 | if (NILP (tem)) | 787 | if (NILP (tem)) |
| 788 | Fset_default (sym, Feval (Fcar (tail))); | 788 | Fset_default (sym, Feval (Fcar (tail))); |
| 789 | else | ||
| 790 | { /* Check if there is really a global binding rather than just a let | ||
| 791 | binding that shadows the global unboundness of the var. */ | ||
| 792 | struct specbinding *pdl = specpdl_ptr; | ||
| 793 | while (--pdl >= specpdl) | ||
| 794 | { | ||
| 795 | if (EQ (pdl->symbol, sym) && !pdl->func | ||
| 796 | && EQ (pdl->old_value, Qunbound)) | ||
| 797 | { | ||
| 798 | message_with_string ("Warning: defvar ignored because %s is let-bound", | ||
| 799 | SYMBOL_NAME (sym), 1); | ||
| 800 | break; | ||
| 801 | } | ||
| 802 | } | ||
| 803 | } | ||
| 789 | tail = Fcdr (tail); | 804 | tail = Fcdr (tail); |
| 790 | tem = Fcar (tail); | 805 | tem = Fcar (tail); |
| 791 | if (!NILP (tem)) | 806 | if (!NILP (tem)) |