diff options
| author | Richard M. Stallman | 1993-07-15 05:36:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-07-15 05:36:59 +0000 |
| commit | 553defa4042c7f99eb1cce76f40f86bc41a6bd3a (patch) | |
| tree | 05749ed3324b309f47a619ac4fef53f8b86516af /src/buffer.c | |
| parent | fc53efda7ff7c404586c4cd66559568c8006c225 (diff) | |
| download | emacs-553defa4042c7f99eb1cce76f40f86bc41a6bd3a.tar.gz emacs-553defa4042c7f99eb1cce76f40f86bc41a6bd3a.zip | |
(Fbuffer_local_variables): For local var that is unbound,
put just the symbol in the result, not a cons of (symbol . value).
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c index ce07c2a21d3..b12ce2ac141 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -400,14 +400,15 @@ No argument or nil as argument means use the current buffer.") | |||
| 400 | DEFUN ("buffer-local-variables", Fbuffer_local_variables, | 400 | DEFUN ("buffer-local-variables", Fbuffer_local_variables, |
| 401 | Sbuffer_local_variables, 0, 1, 0, | 401 | Sbuffer_local_variables, 0, 1, 0, |
| 402 | "Return an alist of variables that are buffer-local in BUFFER.\n\ | 402 | "Return an alist of variables that are buffer-local in BUFFER.\n\ |
| 403 | Each element looks like (SYMBOL . VALUE) and describes one variable.\n\ | 403 | Most elements look like (SYMBOL . VALUE), describing one variable.\n\ |
| 404 | For a symbol that is locally unbound, just the symbol appears in the value.\n\ | ||
| 404 | Note that storing new VALUEs in these elements doesn't change the variables.\n\ | 405 | Note that storing new VALUEs in these elements doesn't change the variables.\n\ |
| 405 | No argument or nil as argument means use current buffer as BUFFER.") | 406 | No argument or nil as argument means use current buffer as BUFFER.") |
| 406 | (buffer) | 407 | (buffer) |
| 407 | register Lisp_Object buffer; | 408 | register Lisp_Object buffer; |
| 408 | { | 409 | { |
| 409 | register struct buffer *buf; | 410 | register struct buffer *buf; |
| 410 | register Lisp_Object val; | 411 | register Lisp_Object result; |
| 411 | 412 | ||
| 412 | if (NILP (buffer)) | 413 | if (NILP (buffer)) |
| 413 | buf = current_buffer; | 414 | buf = current_buffer; |
| @@ -417,24 +418,35 @@ No argument or nil as argument means use current buffer as BUFFER.") | |||
| 417 | buf = XBUFFER (buffer); | 418 | buf = XBUFFER (buffer); |
| 418 | } | 419 | } |
| 419 | 420 | ||
| 421 | result = Qnil; | ||
| 422 | |||
| 420 | { | 423 | { |
| 421 | /* Reference each variable in the alist in our current buffer. | 424 | /* Reference each variable in the alist in our current buffer. |
| 422 | If inquiring about the current buffer, this gets the current values, | 425 | If inquiring about the current buffer, this gets the current values, |
| 423 | so store them into the alist so the alist is up to date. | 426 | so store them into the alist so the alist is up to date. |
| 424 | If inquiring about some other buffer, this swaps out any values | 427 | If inquiring about some other buffer, this swaps out any values |
| 425 | for that buffer, making the alist up to date automatically. */ | 428 | for that buffer, making the alist up to date automatically. */ |
| 426 | register Lisp_Object tem; | 429 | register Lisp_Object tail; |
| 427 | for (tem = buf->local_var_alist; CONSP (tem); tem = XCONS (tem)->cdr) | 430 | for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
| 428 | { | 431 | { |
| 429 | Lisp_Object v1 = Fsymbol_value (XCONS (XCONS (tem)->car)->car); | 432 | Lisp_Object val, elt; |
| 433 | |||
| 434 | elt = XCONS (tail)->car; | ||
| 435 | |||
| 430 | if (buf == current_buffer) | 436 | if (buf == current_buffer) |
| 431 | XCONS (XCONS (tem)->car)->cdr = v1; | 437 | val = find_symbol_value (XCONS (elt)->car); |
| 438 | else | ||
| 439 | val = XCONS (elt)->cdr; | ||
| 440 | |||
| 441 | /* If symbol is unbound, put just the symbol in the list. */ | ||
| 442 | if (EQ (val, Qunbound)) | ||
| 443 | result = Fcons (XCONS (elt)->car, result); | ||
| 444 | /* Otherwise, put (symbol . value) in the list. */ | ||
| 445 | else | ||
| 446 | result = Fcons (Fcons (XCONS (elt)->car, val), result); | ||
| 432 | } | 447 | } |
| 433 | } | 448 | } |
| 434 | 449 | ||
| 435 | /* Make a copy of the alist, to return it. */ | ||
| 436 | val = Fcopy_alist (buf->local_var_alist); | ||
| 437 | |||
| 438 | /* Add on all the variables stored in special slots. */ | 450 | /* Add on all the variables stored in special slots. */ |
| 439 | { | 451 | { |
| 440 | register int offset, mask; | 452 | register int offset, mask; |
| @@ -447,12 +459,13 @@ No argument or nil as argument means use current buffer as BUFFER.") | |||
| 447 | if (mask == -1 || (buf->local_var_flags & mask)) | 459 | if (mask == -1 || (buf->local_var_flags & mask)) |
| 448 | if (XTYPE (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols)) | 460 | if (XTYPE (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols)) |
| 449 | == Lisp_Symbol) | 461 | == Lisp_Symbol) |
| 450 | val = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols), | 462 | result = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols), |
| 451 | *(Lisp_Object *)(offset + (char *)buf)), | 463 | *(Lisp_Object *)(offset + (char *)buf)), |
| 452 | val); | 464 | result); |
| 453 | } | 465 | } |
| 454 | } | 466 | } |
| 455 | return (val); | 467 | |
| 468 | return result; | ||
| 456 | } | 469 | } |
| 457 | 470 | ||
| 458 | 471 | ||