]> code.delx.au - gnu-emacs/blobdiff - src/fns.c
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
[gnu-emacs] / src / fns.c
index f0dff2781172dab57ab51bc24bc5fd6cdc9f10e7..1e26ec9a392c89f80be5b1a417344a6700ddb12d 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,6 +1,7 @@
 /* Random utility Lisp functions.
-   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
-     2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997,
+                 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+                 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -16,8 +17,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
 
@@ -1153,13 +1154,13 @@ Beware, this often doesn't really do what you think it does.
 It is similar to (decode-coding-string STRING 'emacs-mule-unix).
 If you're not sure, whether to use `string-as-multibyte' or
 `string-to-multibyte', use `string-to-multibyte'.  Beware:
-   (aref (string-as-multibyte "\201") 0) -> 129 (aka ?\201)
-   (aref (string-as-multibyte "\300") 0) -> 192 (aka ?\300)
-   (aref (string-as-multibyte "\300\201") 0) -> 192 (aka ?\300)
-   (aref (string-as-multibyte "\300\201") 1) -> 129 (aka ?\201)
+   (aref (string-as-multibyte "\\201") 0) -> 129 (aka ?\\201)
+   (aref (string-as-multibyte "\\300") 0) -> 192 (aka ?\\300)
+   (aref (string-as-multibyte "\\300\\201") 0) -> 192 (aka ?\\300)
+   (aref (string-as-multibyte "\\300\\201") 1) -> 129 (aka ?\\201)
 but
-   (aref (string-as-multibyte "\201\300") 0) -> 2240
-   (aref (string-as-multibyte "\201\300") 1) -> <error>  */)
+   (aref (string-as-multibyte "\\201\\300") 0) -> 2240
+   (aref (string-as-multibyte "\\201\\300") 1) -> <error>  */)
      (string)
      Lisp_Object string;
 {
@@ -1471,7 +1472,7 @@ The value is actually the tail of LIST whose car is ELT.  */)
 
 DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
        doc: /* Return non-nil if ELT is an element of LIST.
-Comparison done with EQ.  The value is actually the tail of LIST
+Comparison done with `eq'.  The value is actually the tail of LIST
 whose car is ELT.  */)
      (elt, list)
      Lisp_Object elt, list;
@@ -1892,7 +1893,7 @@ Lisp_Object merge ();
 DEFUN ("sort", Fsort, Ssort, 2, 2, 0,
        doc: /* Sort LIST, stably, comparing elements using PREDICATE.
 Returns the sorted list.  LIST is modified by side effects.
-PREDICATE is called with two elements of LIST, and should return t
+PREDICATE is called with two elements of LIST, and should return non-nil
 if the first element is "less" than the second.  */)
      (list, predicate)
      Lisp_Object list, predicate;
@@ -2536,19 +2537,19 @@ char_table_range (table, from, to, defalt)
        error ("Characters in the range have inconsistent values");
     }
   return val;
-}  
+}
 
 
 DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
        2, 2, 0,
        doc: /* Return the value in CHAR-TABLE for a range of characters RANGE.
-RANGE should be nil (for the default value)
+RANGE should be nil (for the default value),
 a vector which identifies a character set or a row of a character set,
 a character set name, or a character code.
 If the characters in the specified range have different values,
-an error is signalled.
+an error is signaled.
 
-Note that this function doesn't check the parent of CHAR_TABLE.  */)
+Note that this function doesn't check the parent of CHAR-TABLE.  */)
      (char_table, range)
      Lisp_Object char_table, range;
 {
@@ -2582,7 +2583,7 @@ Note that this function doesn't check the parent of CHAR_TABLE.  */)
     {
       size = ASIZE (range);
       if (size == 0)
-       args_out_of_range (range, 0);
+       args_out_of_range (range, make_number (0));
       CHECK_NUMBER (AREF (range, 0));
       charset_id = XINT (AREF (range, 0));
       if (size > 1)
@@ -2631,7 +2632,7 @@ Note that this function doesn't check the parent of CHAR_TABLE.  */)
        current_default = XCHAR_TABLE (char_table)->contents[defalt];
       return char_table_range (char_table, from, to, current_default);
     }
-  
+
   val = XCHAR_TABLE (char_table)->contents[128 + charset_id];
   if (! SUB_CHAR_TABLE_P (val))
     return (NILP (val) ? current_default : val);
@@ -3132,9 +3133,9 @@ mapcar1 (leni, vals, fn, seq)
   else   /* Must be a list, since Flength did not get an error */
     {
       tail = seq;
-      for (i = 0; i < leni; i++)
+      for (i = 0; i < leni && CONSP (tail); i++)
        {
-         dummy = call1 (fn, Fcar (tail));
+         dummy = call1 (fn, XCAR (tail));
          if (vals)
            vals[i] = dummy;
          tail = XCDR (tail);
@@ -3172,7 +3173,7 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string.  */)
   mapcar1 (leni, args, function, sequence);
   UNGCPRO;
 
-  for (i = leni - 1; i >= 0; i--)
+  for (i = leni - 1; i > 0; i--)
     args[i + i] = args[i];
 
   for (i = 1; i < nargs; i += 2)
@@ -3276,7 +3277,7 @@ is nil and `use-dialog-box' is non-nil.  */)
                        Fcons (Fcons (build_string ("No"), Qnil),
                               Qnil));
          menu = Fcons (prompt, pane);
-         obj = Fx_popup_dialog (Qt, menu);
+         obj = Fx_popup_dialog (Qt, menu, Qnil);
          answer = !NILP (obj);
          break;
        }
@@ -3408,7 +3409,7 @@ is nil, and `use-dialog-box' is non-nil.  */)
                           Qnil));
       GCPRO1 (pane);
       menu = Fcons (prompt, pane);
-      obj = Fx_popup_dialog (Qt, menu);
+      obj = Fx_popup_dialog (Qt, menu, Qnil);
       UNGCPRO;
       return obj;
     }
@@ -5486,7 +5487,7 @@ DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0,
 
 DEFUN ("maphash", Fmaphash, Smaphash, 2, 2, 0,
        doc: /* Call FUNCTION for all entries in hash table TABLE.
-FUNCTION is called with 2 arguments KEY and VALUE.  */)
+FUNCTION is called with two arguments, KEY and VALUE.  */)
      (function, table)
      Lisp_Object function, table;
 {
@@ -5832,7 +5833,7 @@ syms_of_fns ()
   DEFVAR_LISP ("features", &Vfeatures,
     doc: /* A list of symbols which are the features of the executing emacs.
 Used by `featurep' and `require', and altered by `provide'.  */);
-  Vfeatures = Qnil;
+  Vfeatures = Fcons (intern ("emacs"), Qnil);
   Qsubfeatures = intern ("subfeatures");
   staticpro (&Qsubfeatures);