diff options
author | Chong Yidong <cyd@gnu.org> | 2012-02-07 14:34:52 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-02-07 14:34:52 +0800 |
commit | 0992bd9c06b90c8f316187467bcc005cbe51050e (patch) | |
tree | 8dc76890f747f5aaccd2e2754fad74616c7d18bf /src | |
parent | 75ded89ba50f0b1758fe5c70701e0ae422b0c497 (diff) | |
download | emacs-0992bd9c06b90c8f316187467bcc005cbe51050e.tar.gz |
Fix and doc-fix for `buffer-local-variables'.
* src/buffer.c (Fbuffer_local_variables)
(buffer_lisp_local_variables): Handle unbound vars correctly;
don't let Qunbound leak into Lisp.
* doc/lispref/variables.texi (Creating Buffer-Local): Minor clarification
to buffer-local-variables doc.
Fixes: debbugs:10715
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/buffer.c | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5e4d995d857..71af862cdac 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-02-07 Chong Yidong <cyd@gnu.org> + + * buffer.c (Fbuffer_local_variables) + (buffer_lisp_local_variables): Handle unbound vars correctly; + don't let Qunbound leak into Lisp. + 2012-02-07 Glenn Morris <rgm@gnu.org> * image.c (Fimagemagick_types): Doc fix. diff --git a/src/buffer.c b/src/buffer.c index 01418956c8d..a6f61a1936a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1022,7 +1022,10 @@ buffer_lisp_local_variables (struct buffer *buf) if (buf != current_buffer) val = XCDR (elt); - result = Fcons (Fcons (XCAR (elt), val), result); + result = Fcons (EQ (val, Qunbound) + ? XCAR (elt) + : Fcons (XCAR (elt), val), + result); } return result; @@ -1064,9 +1067,12 @@ No argument or nil as argument means use current buffer as BUFFER. */) idx = PER_BUFFER_IDX (offset); if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) && SYMBOLP (PER_BUFFER_SYMBOL (offset))) - result = Fcons (Fcons (PER_BUFFER_SYMBOL (offset), - PER_BUFFER_VALUE (buf, offset)), - result); + { + Lisp_Object sym = PER_BUFFER_SYMBOL (offset); + Lisp_Object val = PER_BUFFER_VALUE (buf, offset); + result = Fcons (EQ (val, Qunbound) ? sym : Fcons (sym, val), + result); + } } } |