diff options
| author | Chong Yidong | 2009-08-15 14:06:02 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-08-15 14:06:02 +0000 |
| commit | b5b98ff494f06cffd45a84439406048bb61a79a2 (patch) | |
| tree | c1e526eddd8b5cea911c1b913f15a11bec121c27 /src/buffer.c | |
| parent | 8653cf0a6c5e731eda9821beb6862c99a423ecbc (diff) | |
| download | emacs-b5b98ff494f06cffd45a84439406048bb61a79a2.tar.gz emacs-b5b98ff494f06cffd45a84439406048bb61a79a2.zip | |
* buffer.c (set_buffer_internal_1)
(swap_out_buffer_local_variables): Check for unbound local
variables (Bug#4138).
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/buffer.c b/src/buffer.c index f811f162ef2..580d5f004cd 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1921,12 +1921,14 @@ set_buffer_internal_1 (b) | |||
| 1921 | 1921 | ||
| 1922 | for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) | 1922 | for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) |
| 1923 | { | 1923 | { |
| 1924 | valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); | 1924 | if (CONSP (XCAR (tail)) |
| 1925 | if ((BUFFER_LOCAL_VALUEP (valcontents)) | 1925 | && SYMBOLP (XCAR (XCAR (tail))) |
| 1926 | && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))), | ||
| 1927 | (BUFFER_LOCAL_VALUEP (valcontents))) | ||
| 1926 | && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, | 1928 | && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, |
| 1927 | (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) | 1929 | (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) |
| 1928 | /* Just reference the variable | 1930 | /* Just reference the variable to cause it to become set for |
| 1929 | to cause it to become set for this buffer. */ | 1931 | this buffer. */ |
| 1930 | Fsymbol_value (XCAR (XCAR (tail))); | 1932 | Fsymbol_value (XCAR (XCAR (tail))); |
| 1931 | } | 1933 | } |
| 1932 | 1934 | ||
| @@ -1935,12 +1937,14 @@ set_buffer_internal_1 (b) | |||
| 1935 | if (old_buf) | 1937 | if (old_buf) |
| 1936 | for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) | 1938 | for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) |
| 1937 | { | 1939 | { |
| 1938 | valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); | 1940 | if (CONSP (tail) |
| 1939 | if ((BUFFER_LOCAL_VALUEP (valcontents)) | 1941 | && SYMBOLP (XCAR (XCAR (tail))) |
| 1942 | && (valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))), | ||
| 1943 | (BUFFER_LOCAL_VALUEP (valcontents))) | ||
| 1940 | && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, | 1944 | && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, |
| 1941 | (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) | 1945 | (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) |
| 1942 | /* Just reference the variable | 1946 | /* Just reference the variable to cause it to become set for |
| 1943 | to cause it to become set for this buffer. */ | 1947 | this buffer. */ |
| 1944 | Fsymbol_value (XCAR (XCAR (tail))); | 1948 | Fsymbol_value (XCAR (XCAR (tail))); |
| 1945 | } | 1949 | } |
| 1946 | } | 1950 | } |
| @@ -2653,18 +2657,19 @@ static void | |||
| 2653 | swap_out_buffer_local_variables (b) | 2657 | swap_out_buffer_local_variables (b) |
| 2654 | struct buffer *b; | 2658 | struct buffer *b; |
| 2655 | { | 2659 | { |
| 2656 | Lisp_Object oalist, alist, sym, tem, buffer; | 2660 | Lisp_Object oalist, alist, sym, buffer; |
| 2657 | 2661 | ||
| 2658 | XSETBUFFER (buffer, b); | 2662 | XSETBUFFER (buffer, b); |
| 2659 | oalist = b->local_var_alist; | 2663 | oalist = b->local_var_alist; |
| 2660 | 2664 | ||
| 2661 | for (alist = oalist; CONSP (alist); alist = XCDR (alist)) | 2665 | for (alist = oalist; CONSP (alist); alist = XCDR (alist)) |
| 2662 | { | 2666 | { |
| 2663 | sym = XCAR (XCAR (alist)); | 2667 | if (CONSP (XCAR (alist)) |
| 2664 | 2668 | && (sym = XCAR (XCAR (alist)), SYMBOLP (sym)) | |
| 2665 | /* Need not do anything if some other buffer's binding is now encached. */ | 2669 | /* Need not do anything if some other buffer's binding is |
| 2666 | tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer; | 2670 | now encached. */ |
| 2667 | if (EQ (tem, buffer)) | 2671 | && EQ (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer, |
| 2672 | buffer)) | ||
| 2668 | { | 2673 | { |
| 2669 | /* Symbol is set up for this buffer's old local value: | 2674 | /* Symbol is set up for this buffer's old local value: |
| 2670 | swap it out! */ | 2675 | swap it out! */ |