aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorRichard M. Stallman1995-06-17 19:47:30 +0000
committerRichard M. Stallman1995-06-17 19:47:30 +0000
commitf4f04ceee5e2776e1b38dca56a9ad9238f572ebe (patch)
treea1cdf07e238c521213599374d6ea173e68b15b01 /src/data.c
parent01a2b480182e265c825e8e5defc338837389cbc8 (diff)
downloademacs-f4f04ceee5e2776e1b38dca56a9ad9238f572ebe.tar.gz
emacs-f4f04ceee5e2776e1b38dca56a9ad9238f572ebe.zip
(Flocal_variable_if_set_p): New function.
(syms_of_data): Call defsubr.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c
index a40f94d05db..44f651d7c1d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1379,6 +1379,47 @@ BUFFER defaults to the current buffer.")
1379 } 1379 }
1380 return Qnil; 1380 return Qnil;
1381} 1381}
1382
1383DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p,
1384 1, 2, 0,
1385 "Non-nil if VARIABLE will be local in buffer BUFFER if it is set there.\n\
1386BUFFER defaults to the current buffer.")
1387 (sym, buffer)
1388 register Lisp_Object sym, buffer;
1389{
1390 Lisp_Object valcontents;
1391 register struct buffer *buf;
1392
1393 if (NILP (buffer))
1394 buf = current_buffer;
1395 else
1396 {
1397 CHECK_BUFFER (buffer, 0);
1398 buf = XBUFFER (buffer);
1399 }
1400
1401 CHECK_SYMBOL (sym, 0);
1402
1403 valcontents = XSYMBOL (sym)->value;
1404
1405 /* This means that make-variable-buffer-local was done. */
1406 if (BUFFER_LOCAL_VALUEP (valcontents))
1407 return Qt;
1408 /* All these slots become local if they are set. */
1409 if (BUFFER_OBJFWDP (valcontents))
1410 return Qt;
1411 if (SOME_BUFFER_LOCAL_VALUEP (valcontents))
1412 {
1413 Lisp_Object tail, elt;
1414 for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr)
1415 {
1416 elt = XCONS (tail)->car;
1417 if (EQ (sym, XCONS (elt)->car))
1418 return Qt;
1419 }
1420 }
1421 return Qnil;
1422}
1382 1423
1383/* Find the function at the end of a chain of symbol function indirections. */ 1424/* Find the function at the end of a chain of symbol function indirections. */
1384 1425
@@ -2468,6 +2509,7 @@ syms_of_data ()
2468 defsubr (&Smake_local_variable); 2509 defsubr (&Smake_local_variable);
2469 defsubr (&Skill_local_variable); 2510 defsubr (&Skill_local_variable);
2470 defsubr (&Slocal_variable_p); 2511 defsubr (&Slocal_variable_p);
2512 defsubr (&Slocal_variable_if_set_p);
2471 defsubr (&Saref); 2513 defsubr (&Saref);
2472 defsubr (&Saset); 2514 defsubr (&Saset);
2473 defsubr (&Snumber_to_string); 2515 defsubr (&Snumber_to_string);