Mercurial > hg > xemacs-beta
diff src/keymap.c @ 5470:0af042a0c116
Merge with trunk.
author | Mats Lidell <matsl@xemacs.org> |
---|---|
date | Mon, 07 Feb 2011 21:22:17 +0100 |
parents | 308d34e9f07d cc7d0e19173c |
children | 56144c8593a8 |
line wrap: on
line diff
--- a/src/keymap.c Sat Jan 22 00:59:20 2011 +0100 +++ b/src/keymap.c Mon Feb 07 21:22:17 2011 +0100 @@ -735,10 +735,9 @@ return 0; } -static Lisp_Object map_keymap_sort_predicate (Lisp_Object obj1, - Lisp_Object obj2, - Lisp_Object pred, - Lisp_Object key_func); +static Boolint map_keymap_sort_predicate (Lisp_Object pred, Lisp_Object key, + Lisp_Object obj1, Lisp_Object obj2); + static Lisp_Object keymap_submaps (Lisp_Object keymap) @@ -762,7 +761,7 @@ &keymap_submaps_closure); /* keep it sorted so that the result of accessible-keymaps is ordered */ k->sub_maps_cache = list_sort (result, map_keymap_sort_predicate, - Qnil, Qidentity); + Qnil, Qnil); UNGCPRO; } return k->sub_maps_cache; @@ -2894,10 +2893,9 @@ /* used by map_keymap_sorted(), describe_map_sort_predicate(), and keymap_submaps(). */ -static Lisp_Object -map_keymap_sort_predicate (Lisp_Object obj1, Lisp_Object obj2, - Lisp_Object UNUSED (pred), - Lisp_Object UNUSED (key_func)) +static Boolint +map_keymap_sort_predicate (Lisp_Object UNUSED (pred), Lisp_Object UNUSED (key), + Lisp_Object obj1, Lisp_Object obj2) { /* obj1 and obj2 are conses with keysyms in their cars. Cdrs are ignored. */ @@ -2910,12 +2908,12 @@ obj2 = XCAR (obj2); if (EQ (obj1, obj2)) - return Qnil; + return 0; bit1 = MODIFIER_HASH_KEY_BITS (obj1); bit2 = MODIFIER_HASH_KEY_BITS (obj2); - /* If either is a symbol with a Qcharacter_of_keysym property, then sort it by - that code instead of alphabetically. + /* If either is a symbol with a Qcharacter_of_keysym property, then sort + it by that code instead of alphabetically. */ if (! bit1 && SYMBOLP (obj1)) { @@ -2940,7 +2938,7 @@ /* all symbols (non-ASCIIs) come after characters (ASCIIs) */ if (XTYPE (obj1) != XTYPE (obj2)) - return SYMBOLP (obj2) ? Qt : Qnil; + return SYMBOLP (obj2); if (! bit1 && CHARP (obj1)) /* they're both ASCII */ { @@ -2948,24 +2946,24 @@ int o2 = XCHAR (obj2); if (o1 == o2 && /* If one started out as a symbol and the */ sym1_p != sym2_p) /* other didn't, the symbol comes last. */ - return sym2_p ? Qt : Qnil; - - return o1 < o2 ? Qt : Qnil; /* else just compare them */ + return sym2_p; + + return o1 < o2; /* else just compare them */ } /* else they're both symbols. If they're both buckys, then order them. */ if (bit1 && bit2) - return bit1 < bit2 ? Qt : Qnil; + return bit1 < bit2; /* if only one is a bucky, then it comes later */ if (bit1 || bit2) - return bit2 ? Qt : Qnil; + return bit2; /* otherwise, string-sort them. */ { Ibyte *s1 = XSTRING_DATA (XSYMBOL (obj1)->name); Ibyte *s2 = XSTRING_DATA (XSYMBOL (obj2)->name); - return 0 > qxestrcmp (s1, s2) ? Qt : Qnil; + return 0 > qxestrcmp (s1, s2); } } @@ -4085,10 +4083,10 @@ *(closure->list)); } - -static Lisp_Object -describe_map_sort_predicate (Lisp_Object obj1, Lisp_Object obj2, - Lisp_Object pred, Lisp_Object key_func) +static Boolint +describe_map_sort_predicate (Lisp_Object pred, Lisp_Object key_func, + Lisp_Object obj1, Lisp_Object obj2) + { /* obj1 and obj2 are conses of the form ( ( <keysym> . <modifiers> ) . <binding> ) @@ -4100,9 +4098,9 @@ bit1 = XINT (XCDR (obj1)); bit2 = XINT (XCDR (obj2)); if (bit1 != bit2) - return bit1 < bit2 ? Qt : Qnil; + return bit1 < bit2; else - return map_keymap_sort_predicate (obj1, obj2, pred, key_func); + return map_keymap_sort_predicate (pred, key_func, obj1, obj2); } /* Elide 2 or more consecutive numeric keysyms bound to the same thing, @@ -4210,7 +4208,7 @@ if (!NILP (list)) { - list = list_sort (list, describe_map_sort_predicate, Qnil, Qidentity); + list = list_sort (list, describe_map_sort_predicate, Qnil, Qnil); buffer_insert_ascstring (buf, "\n"); while (!NILP (list)) {