comparison src/callint.c @ 223:2c611d1463a6 r20-4b10

Import from CVS: tag r20-4b10
author cvs
date Mon, 13 Aug 2007 10:10:54 +0200
parents 3d6bfa290dbd
children 0e522484dd2a
comparison
equal deleted inserted replaced
222:aae4c8b01452 223:2c611d1463a6
143 (args)) 143 (args))
144 { 144 {
145 return Qnil; 145 return Qnil;
146 } 146 }
147 147
148 /* Quotify EXPR: if EXPR is constant, return it. 148 /* Originally, this was just a function -- but `custom' used a
149 If EXPR is not constant, return (quote EXPR). */ 149 garden-variety version, so why not make it a subr? */
150 static Lisp_Object 150 /* #### Move it to another file! */
151 quotify_arg (Lisp_Object expr) 151 DEFUN ("quote-maybe", Fquote_maybe, 1, 1, 0, /*
152 Quote EXPR iff it is not self quoting.
153 */
154 (expr))
152 { 155 {
153 return (INTP (expr) || 156 return ((NILP (expr)
154 CHARP (expr) || 157 || EQ (expr, Qt)
155 STRINGP (expr) || 158 || INTP (expr)
156 NILP (expr) || 159 || FLOATP (expr)
157 EQ (Qt, expr)) ? expr : Fcons (Qquote, Fcons (expr, Qnil)); 160 || CHARP (expr)
161 || STRINGP (expr)
162 || VECTORP (expr)
163 || KEYWORDP (expr)
164 || BIT_VECTORP (expr)
165 || (CONSP (expr) && EQ(XCAR (expr), Qlambda)))
166 ? expr : list2 (Qquote, expr));
158 } 167 }
159 168
160 /* Modify EXPR by quotifying each element (except the first). */ 169 /* Modify EXPR by quotifying each element (except the first). */
161 static Lisp_Object 170 static Lisp_Object
162 quotify_args (Lisp_Object expr) 171 quotify_args (Lisp_Object expr)
164 REGISTER Lisp_Object tail; 173 REGISTER Lisp_Object tail;
165 REGISTER struct Lisp_Cons *ptr; 174 REGISTER struct Lisp_Cons *ptr;
166 for (tail = expr; CONSP (tail); tail = ptr->cdr) 175 for (tail = expr; CONSP (tail); tail = ptr->cdr)
167 { 176 {
168 ptr = XCONS (tail); 177 ptr = XCONS (tail);
169 ptr->car = quotify_arg (ptr->car); 178 ptr->car = Fquote_maybe (ptr->car);
170 } 179 }
171 return expr; 180 return expr;
172 } 181 }
173 182
174 static Bufpos 183 static Bufpos
907 for (argnum = 0; argnum < argcount; argnum++) 916 for (argnum = 0; argnum < argcount; argnum++)
908 { 917 {
909 if (!NILP (varies[argnum])) 918 if (!NILP (varies[argnum]))
910 visargs[argnum] = list1 (varies[argnum]); 919 visargs[argnum] = list1 (varies[argnum]);
911 else 920 else
912 visargs[argnum] = quotify_arg (args[argnum]); 921 visargs[argnum] = Fquote_maybe (args[argnum]);
913 } 922 }
914 Vcommand_history = Fcons (Fcons (args[-1], Flist (argcount, visargs)), 923 Vcommand_history = Fcons (Fcons (args[-1], Flist (argcount, visargs)),
915 Vcommand_history); 924 Vcommand_history);
916 } 925 }
917 926
982 #if 0 /* ill-conceived */ 991 #if 0 /* ill-conceived */
983 defsymbol (&Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook"); 992 defsymbol (&Qmouse_leave_buffer_hook, "mouse-leave-buffer-hook");
984 #endif 993 #endif
985 994
986 DEFSUBR (Finteractive); 995 DEFSUBR (Finteractive);
996 DEFSUBR (Fquote_maybe);
987 DEFSUBR (Fcall_interactively); 997 DEFSUBR (Fcall_interactively);
988 DEFSUBR (Fprefix_numeric_value); 998 DEFSUBR (Fprefix_numeric_value);
989 } 999 }
990 1000
991 void 1001 void