Mercurial > emacs
diff src/buffer.c @ 83271:1830bcd0eec0
Merged from miles@gnu.org--gnu-2005 (patch 39-44, 184-191)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-184
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-185
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-186
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-187
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-188
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-189
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-190
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-191
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-39
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-40
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-41
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-42
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-43
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-44
Merge from emacs--cvs-trunk--0
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-311
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Sat, 19 Mar 2005 17:55:13 +0000 |
| parents | 92c8be21e2c3 d2f6fa8790f3 |
| children | 9deb6323655c |
line wrap: on
line diff
--- a/src/buffer.c Wed Mar 16 16:06:45 2005 +0000 +++ b/src/buffer.c Sat Mar 19 17:55:13 2005 +0000 @@ -182,6 +182,7 @@ static void free_buffer_text P_ ((struct buffer *b)); static struct Lisp_Overlay * copy_overlays P_ ((struct buffer *, struct Lisp_Overlay *)); static void modify_overlay P_ ((struct buffer *, EMACS_INT, EMACS_INT)); +static Lisp_Object buffer_lisp_local_variables P_ ((struct buffer *)); /* For debugging; temporary. See set_buffer_internal. */ @@ -515,16 +516,11 @@ to->overlays_before = copy_overlays (to, from->overlays_before); to->overlays_after = copy_overlays (to, from->overlays_after); - /* Copy the alist of local variables, - and all the alist elements too. */ - to->local_var_alist - = Fcopy_sequence (from->local_var_alist); - for (tem = to->local_var_alist; CONSP (tem); - tem = XCDR (tem)) - XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem)))); + /* Get (a copy of) the alist of Lisp-level local variables of FROM + and install that in TO. */ + to->local_var_alist = buffer_lisp_local_variables (from); } - DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 2, 3, "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", @@ -934,6 +930,43 @@ return result; } +/* Return an alist of the Lisp-level buffer-local bindings of + buffer BUF. That is, do't include the variables maintained + in special slots in the buffer object. */ + +static Lisp_Object +buffer_lisp_local_variables (buf) + struct buffer *buf; +{ + Lisp_Object result = Qnil; + register Lisp_Object tail; + for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) + { + Lisp_Object val, elt; + + elt = XCAR (tail); + + /* Reference each variable in the alist in buf. + If inquiring about the current buffer, this gets the current values, + so store them into the alist so the alist is up to date. + If inquiring about some other buffer, this swaps out any values + for that buffer, making the alist up to date automatically. */ + val = find_symbol_value (XCAR (elt)); + /* Use the current buffer value only if buf is the current buffer. */ + if (buf != current_buffer) + val = XCDR (elt); + + /* If symbol is unbound, put just the symbol in the list. */ + if (EQ (val, Qunbound)) + result = Fcons (XCAR (elt), result); + /* Otherwise, put (symbol . value) in the list. */ + else + result = Fcons (Fcons (XCAR (elt), val), result); + } + + return result; +} + DEFUN ("buffer-local-variables", Fbuffer_local_variables, Sbuffer_local_variables, 0, 1, 0, doc: /* Return an alist of variables that are buffer-local in BUFFER. @@ -955,34 +988,7 @@ buf = XBUFFER (buffer); } - result = Qnil; - - { - register Lisp_Object tail; - for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object val, elt; - - elt = XCAR (tail); - - /* Reference each variable in the alist in buf. - If inquiring about the current buffer, this gets the current values, - so store them into the alist so the alist is up to date. - If inquiring about some other buffer, this swaps out any values - for that buffer, making the alist up to date automatically. */ - val = find_symbol_value (XCAR (elt)); - /* Use the current buffer value only if buf is the current buffer. */ - if (buf != current_buffer) - val = XCDR (elt); - - /* If symbol is unbound, put just the symbol in the list. */ - if (EQ (val, Qunbound)) - result = Fcons (XCAR (elt), result); - /* Otherwise, put (symbol . value) in the list. */ - else - result = Fcons (Fcons (XCAR (elt), val), result); - } - } + result = buffer_lisp_local_variables (buf); /* Add on all the variables stored in special slots. */ { @@ -1004,7 +1010,6 @@ return result; } - DEFUN ("buffer-modified-p", Fbuffer_modified_p, Sbuffer_modified_p, 0, 1, 0,
