From: Stefan Monnier Date: Wed, 17 Oct 2007 23:43:52 +0000 (+0000) Subject: * xselect.c (x_own_selection, x_handle_selection_clear) X-Git-Tag: emacs-pretest-23.0.90~10274 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99784d6399c1f49ca5d98a3156a7c3262b5e7ee9;p=emacs.git * xselect.c (x_own_selection, x_handle_selection_clear) (x_clear_frame_selections): * w32menu.c (list_of_panes, list_of_items): * w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list): * textprop.c (validate_plist, interval_has_all_properties) (interval_has_some_properties, interval_has_some_properties_list) (add_properties, text_property_list): * process.c (Fget_buffer_process, list_processes_1, status_notify): * minibuf.c (Fassoc_string): * macselect.c (x_own_selection, x_clear_frame_selections) (Fx_disown_selection_internal): * keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree): Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r. --- diff --git a/src/ChangeLog b/src/ChangeLog index 98bf9978907..dcd9f0955dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2007-10-17 Stefan Monnier + + * xselect.c (x_own_selection, x_handle_selection_clear) + (x_clear_frame_selections): + * w32menu.c (list_of_panes, list_of_items): + * w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list): + * textprop.c (validate_plist, interval_has_all_properties) + (interval_has_some_properties, interval_has_some_properties_list) + (add_properties, text_property_list): + * process.c (Fget_buffer_process, list_processes_1, status_notify): + * minibuf.c (Fassoc_string): + * macselect.c (x_own_selection, x_clear_frame_selections) + (Fx_disown_selection_internal): + * keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree): + Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r. + 2007-10-17 Chong Yidong * process.c: Link to libs for calling res_init() if available. diff --git a/src/keymap.c b/src/keymap.c index be23c20a3aa..2edad90b732 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1247,9 +1247,9 @@ remapping in all currently active keymaps. */) { Lisp_Object maps, binding; - for (maps = keymaps; !NILP (maps); maps = Fcdr (maps)) + for (maps = keymaps; CONSP (maps); maps = XCDR (maps)) { - binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil); + binding = Flookup_key (XCAR (maps), command_remapping_vector, Qnil); if (!NILP (binding) && !INTEGERP (binding)) return binding; } @@ -2681,7 +2681,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) && !NILP (Fcommand_remapping (definition, Qnil, keymaps))) RETURN_UNGCPRO (Qnil); - for (; !NILP (maps); maps = Fcdr (maps)) + for (; CONSP (maps); maps = XCDR (maps)) { /* Key sequence to reach map, and the map that it reaches */ register Lisp_Object this, map, tem; @@ -2693,8 +2693,8 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) Lisp_Object last; int last_is_meta; - this = Fcar (Fcar (maps)); - map = Fcdr (Fcar (maps)); + this = Fcar (XCAR (maps)); + map = Fcdr (XCAR (maps)); last = make_number (XINT (Flength (this)) - 1); last_is_meta = (XINT (last) >= 0 && EQ (Faref (this, last), meta_prefix_char)); @@ -3179,11 +3179,11 @@ key binding\n\ Lisp_Object list; /* Delete from MAPS each element that is for the menu bar. */ - for (list = maps; !NILP (list); list = XCDR (list)) + for (list = maps; CONSP (list); list = XCDR (list)) { Lisp_Object elt, prefix, tem; - elt = Fcar (list); + elt = XCAR (list); prefix = Fcar (elt); if (XVECTOR (prefix)->size >= 1) { @@ -3210,11 +3210,11 @@ key binding\n\ something = 1; } - for (; !NILP (maps); maps = Fcdr (maps)) + for (; CONSP (maps); maps = XCDR (maps)) { register Lisp_Object elt, prefix, tail; - elt = Fcar (maps); + elt = XCAR (maps); prefix = Fcar (elt); sub_shadows = Qnil; diff --git a/src/macselect.c b/src/macselect.c index 9515a5774ec..f8038effd8b 100644 --- a/src/macselect.c +++ b/src/macselect.c @@ -487,7 +487,7 @@ x_own_selection (selection_name, selection_value) if (!NILP (prev_value)) { Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (prev_value, Fcar (XCDR (rest)))) { XSETCDR (rest, Fcdr (XCDR (rest))); @@ -619,7 +619,7 @@ x_clear_frame_selections (f) } /* Delete elements after the beginning of Vselection_alist. */ - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) { /* Let random Lisp code notice that the selection has been stolen. */ @@ -762,7 +762,7 @@ Disowning it means there is no such selection. */) else { Lisp_Object rest; - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (local_selection_data, Fcar (XCDR (rest)))) { XSETCDR (rest, Fcdr (XCDR (rest))); diff --git a/src/minibuf.c b/src/minibuf.c index e7c2aec7b3f..d3c9eb505b6 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2110,10 +2110,10 @@ string rather than a cons cell whose car is a string. */) if (SYMBOLP (key)) key = Fsymbol_name (key); - for (tail = list; !NILP (tail); tail = Fcdr (tail)) + for (tail = list; CONSP (tail); tail = XCDR (tail)) { register Lisp_Object elt, tem, thiscar; - elt = Fcar (tail); + elt = XCAR (tail); thiscar = CONSP (elt) ? XCAR (elt) : elt; if (SYMBOLP (thiscar)) thiscar = Fsymbol_name (thiscar); diff --git a/src/process.c b/src/process.c index 6749ebda117..37181158a19 100644 --- a/src/process.c +++ b/src/process.c @@ -739,9 +739,9 @@ BUFFER may be a buffer or the name of one. */) buf = Fget_buffer (buffer); if (NILP (buf)) return Qnil; - for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) { - proc = Fcdr (Fcar (tail)); + proc = Fcdr (XCAR (tail)); if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf)) return proc; } @@ -1345,11 +1345,11 @@ list_processes_1 (query_only) w_buffer = 6; /* Buffer */ w_tty = 0; /* Omit if no ttys */ - for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) { int i; - proc = Fcdr (Fcar (tail)); + proc = Fcdr (XCAR (tail)); p = XPROCESS (proc); if (NILP (p->childp)) continue; @@ -1408,11 +1408,11 @@ list_processes_1 (query_only) Findent_to (i_command, minspace); write_string ("-------", -1); write_string ("\n", -1); - for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) { Lisp_Object symbol; - proc = Fcdr (Fcar (tail)); + proc = Fcdr (XCAR (tail)); p = XPROCESS (proc); if (NILP (p->childp)) continue; @@ -6799,12 +6799,12 @@ status_notify (deleting_process) that we run, we get called again to handle their status changes. */ update_tick = process_tick; - for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) { Lisp_Object symbol; register struct Lisp_Process *p; - proc = Fcdr (Fcar (tail)); + proc = Fcdr (XCAR (tail)); p = XPROCESS (proc); if (p->tick != p->update_tick) diff --git a/src/textprop.c b/src/textprop.c index 8ce5656e5a2..e8ba1d87afc 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -201,9 +201,9 @@ validate_plist (list) { register int i; register Lisp_Object tail; - for (i = 0, tail = list; !NILP (tail); i++) + for (i = 0, tail = list; CONSP (tail); i++) { - tail = Fcdr (tail); + tail = XCDR (tail); QUIT; } if (i & 1) @@ -226,18 +226,18 @@ interval_has_all_properties (plist, i) register int found; /* Go through each element of PLIST. */ - for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) + for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) { - sym1 = Fcar (tail1); + sym1 = XCAR (tail1); found = 0; /* Go through I's plist, looking for sym1 */ - for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) - if (EQ (sym1, Fcar (tail2))) + for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) + if (EQ (sym1, XCAR (tail2))) { /* Found the same property on both lists. If the values are unequal, return zero. */ - if (! EQ (Fcar (Fcdr (tail1)), Fcar (Fcdr (tail2)))) + if (! EQ (Fcar (XCDR (tail1)), Fcar (XCDR (tail2)))) return 0; /* Property has same value on both lists; go to next one. */ @@ -263,13 +263,13 @@ interval_has_some_properties (plist, i) register Lisp_Object tail1, tail2, sym; /* Go through each element of PLIST. */ - for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) + for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) { - sym = Fcar (tail1); + sym = XCAR (tail1); /* Go through i's plist, looking for tail1 */ - for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) - if (EQ (sym, Fcar (tail2))) + for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) + if (EQ (sym, XCAR (tail2))) return 1; } @@ -287,12 +287,12 @@ interval_has_some_properties_list (list, i) register Lisp_Object tail1, tail2, sym; /* Go through each element of LIST. */ - for (tail1 = list; ! NILP (tail1); tail1 = XCDR (tail1)) + for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1)) { sym = Fcar (tail1); /* Go through i's plist, looking for tail1 */ - for (tail2 = i->plist; ! NILP (tail2); tail2 = XCDR (XCDR (tail2))) + for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2))) if (EQ (sym, XCAR (tail2))) return 1; } @@ -391,21 +391,21 @@ add_properties (plist, i, object) GCPRO3 (tail1, sym1, val1); /* Go through each element of PLIST. */ - for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) + for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1))) { - sym1 = Fcar (tail1); - val1 = Fcar (Fcdr (tail1)); + sym1 = XCAR (tail1); + val1 = Fcar (XCDR (tail1)); found = 0; /* Go through I's plist, looking for sym1 */ - for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) - if (EQ (sym1, Fcar (tail2))) + for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2))) + if (EQ (sym1, XCAR (tail2))) { /* No need to gcpro, because tail2 protects this and it must be a cons cell (we get an error otherwise). */ register Lisp_Object this_cdr; - this_cdr = Fcdr (tail2); + this_cdr = XCDR (tail2); /* Found the property. Now check its value. */ found = 1; @@ -1965,10 +1965,10 @@ text_property_list (object, start, end, prop) plist = i->plist; if (!NILP (prop)) - for (; !NILP (plist); plist = Fcdr (Fcdr (plist))) - if (EQ (Fcar (plist), prop)) + for (; CONSP (plist); plist = Fcdr (XCDR (plist))) + if (EQ (XCAR (plist), prop)) { - plist = Fcons (prop, Fcons (Fcar (Fcdr (plist)), Qnil)); + plist = Fcons (prop, Fcons (Fcar (XCDR (plist)), Qnil)); break; } diff --git a/src/w32fns.c b/src/w32fns.c index 8af99a2d0b9..41a1994f3fe 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -845,11 +845,11 @@ w32_color_map_lookup (colorname) BLOCK_INPUT; - for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) + for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail)) { register Lisp_Object elt, tem; - elt = Fcar (tail); + elt = XCAR (tail); if (!CONSP (elt)) continue; tem = Fcar (elt); @@ -4450,7 +4450,7 @@ This function is an internal primitive--use `make-frame' instead. */) /* All remaining specified parameters, which have not been "used" by x_get_arg and friends, now go in the misc. alist of the frame. */ - for (tem = parameters; !NILP (tem); tem = XCDR (tem)) + for (tem = parameters; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) f->param_alist = Fcons (XCAR (tem), f->param_alist); @@ -6838,7 +6838,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, Lisp_Object tail, result; result = Qnil; - for (tail = w32_display_name_list; ! NILP (tail); tail = XCDR (tail)) + for (tail = w32_display_name_list; CONSP (tail); tail = XCDR (tail)) result = Fcons (XCAR (XCAR (tail)), result); return result; diff --git a/src/w32menu.c b/src/w32menu.c index a94be08902d..a0ce8c655cb 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -567,10 +567,10 @@ list_of_panes (menu) init_menu_items (); - for (tail = menu; !NILP (tail); tail = Fcdr (tail)) + for (tail = menu; CONSP (tail); tail = XCDR (tail)) { Lisp_Object elt, pane_name, pane_data; - elt = Fcar (tail); + elt = XCAR (tail); pane_name = Fcar (elt); CHECK_STRING (pane_name); push_menu_pane (pane_name, Qnil); @@ -590,9 +590,9 @@ list_of_items (pane) { Lisp_Object tail, item, item1; - for (tail = pane; !NILP (tail); tail = Fcdr (tail)) + for (tail = pane; CONSP (tail); tail = XCDR (tail)) { - item = Fcar (tail); + item = XCAR (tail); if (STRINGP (item)) push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil); else if (NILP (item)) diff --git a/src/xselect.c b/src/xselect.c index d71ac42aa7c..0db5ef57767 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -442,7 +442,7 @@ x_own_selection (selection_name, selection_value) if (!NILP (prev_value)) { Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (prev_value, Fcar (XCDR (rest)))) { XSETCDR (rest, Fcdr (XCDR (rest))); @@ -1072,7 +1072,7 @@ x_handle_selection_clear (event) else { Lisp_Object rest; - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (local_selection_data, Fcar (XCDR (rest)))) { XSETCDR (rest, Fcdr (XCDR (rest))); @@ -1153,7 +1153,7 @@ x_clear_frame_selections (f) } /* Delete elements after the beginning of Vselection_alist. */ - for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) + for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest)) if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) { /* Let random Lisp code notice that the selection has been stolen. */