changeset: 4365:a2af1ff1761f3f9bda5a676bc93b9b3b5bdc1443
parent: 4353:4143b78d0df09521124aed8cd0ed848b978130ba
user: Aidan Kehoe <kehoea(a)parhasard.net>
date: Mon Dec 24 14:00:14 2007 +0100
files: src/ChangeLog src/keymap.c src/lisp.h src/symbols.c
description:
Provide a DEFAULT argument in #'intern-soft.
2007-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
* symbols.c (Fintern_soft):
Provide a new optional third argument, DEFAULT, for those who want
to check if "nil" is a symbol or not. (More realistically, general
code that may get handed "nil" should probably use this argument.)
* keymap.c (define_key_check_and_coerce_keysym):
Call Fintern_soft with its new argument.
* lisp.h:
Update the declaration of Fintern_soft.
diff -r 4143b78d0df09521124aed8cd0ed848b978130ba -r
a2af1ff1761f3f9bda5a676bc93b9b3b5bdc1443 src/ChangeLog
--- a/src/ChangeLog Sun Dec 23 15:29:17 2007 +0100
+++ b/src/ChangeLog Mon Dec 24 14:00:14 2007 +0100
@@ -1,3 +1,10 @@ 2007-12-23 Aidan Kehoe <kehoea@parhasa
+2007-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * symbols.c (Fintern_soft):
+ Provide a new optional third argument, DEFAULT, for those who want
+ to check if "nil" is a symbol or not. (More realistically, general
+ code that may get handed "nil" should probably use this argument.)
+
2007-12-23 Aidan Kehoe <kehoea(a)parhasard.net>
* objects-tty.c (tty_find_charset_font):
diff -r 4143b78d0df09521124aed8cd0ed848b978130ba -r
a2af1ff1761f3f9bda5a676bc93b9b3b5bdc1443 src/keymap.c
--- a/src/keymap.c Sun Dec 23 15:29:17 2007 +0100
+++ b/src/keymap.c Mon Dec 24 14:00:14 2007 +0100
@@ -1388,7 +1388,7 @@ define_key_check_and_coerce_keysym (Lisp
DECLARE_EISTRING (temp);
eicpy_raw (temp, name, qxestrlen (name));
eisetch_char (temp, 2, '-');
- *keysym = Fintern_soft (eimake_string (temp), Qnil);
+ *keysym = Fintern_soft (eimake_string (temp), Qnil, Qnil);
}
else if (EQ (*keysym, QLFD))
*keysym = QKlinefeed;
diff -r 4143b78d0df09521124aed8cd0ed848b978130ba -r
a2af1ff1761f3f9bda5a676bc93b9b3b5bdc1443 src/lisp.h
--- a/src/lisp.h Sun Dec 23 15:29:17 2007 +0100
+++ b/src/lisp.h Mon Dec 24 14:00:14 2007 +0100
@@ -5067,7 +5067,7 @@ EXFUN (Ffboundp, 1);
EXFUN (Ffboundp, 1);
EXFUN (Ffset, 2);
EXFUN (Fintern, 2);
-EXFUN (Fintern_soft, 2);
+EXFUN (Fintern_soft, 3);
EXFUN (Fkill_local_variable, 1);
EXFUN (Fset, 2);
EXFUN (Fset_default, 2);
diff -r 4143b78d0df09521124aed8cd0ed848b978130ba -r
a2af1ff1761f3f9bda5a676bc93b9b3b5bdc1443 src/symbols.c
--- a/src/symbols.c Sun Dec 23 15:29:17 2007 +0100
+++ b/src/symbols.c Mon Dec 24 14:00:14 2007 +0100
@@ -256,17 +256,17 @@ it defaults to the value of the variable
return object;
}
-DEFUN ("intern-soft", Fintern_soft, 1, 2, 0, /*
+DEFUN ("intern-soft", Fintern_soft, 1, 3, 0, /*
Return the canonical symbol named NAME, or nil if none exists.
NAME may be a string or a symbol. If it is a symbol, that exact
symbol is searched for.
Optional second argument OBARRAY specifies the obarray to use;
it defaults to the value of the variable `obarray'.
-*/
- (name, obarray))
-{
- /* #### Bug! (intern-soft "nil") returns nil. Perhaps we should
- add a DEFAULT-IF-NOT-FOUND arg, like in get. */
+Optional third argument DEFAULT says what Lisp object to return if there is
+no canonical symbol named NAME, and defaults to nil.
+*/
+ (name, obarray, default_))
+{
Lisp_Object tem;
Lisp_Object string;
@@ -283,7 +283,7 @@ it defaults to the value of the variable
tem = oblookup (obarray, XSTRING_DATA (string), XSTRING_LENGTH (string));
if (INTP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
- return Qnil;
+ return default_;
else
return tem;
}
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches