/* 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.
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>
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;
{
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;
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
-if the first element is "less" than the second. */)
+PREDICATE is called with two elements of LIST, and should return non-nil
+if the first element should sort before the second. */)
(list, predicate)
Lisp_Object list, predicate;
{
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;
{
{
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)
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);
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);
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)
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;
}
Qnil));
GCPRO1 (pane);
menu = Fcons (prompt, pane);
- obj = Fx_popup_dialog (Qt, menu);
+ obj = Fx_popup_dialog (Qt, menu, Qnil);
UNGCPRO;
return obj;
}
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;
{
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);