GNU bug report logs -
#33492
buffer-local-variables does not include buffer-undo-list
Previous Next
Reported by: Terje Larsen <terlar <at> gmail.com>
Date: Sat, 24 Nov 2018 20:55:02 UTC
Severity: normal
Tags: confirmed
Found in versions 27.0.50, 24.3
Fixed in version 28.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Glenn Morris wrote:
> This issue (buffer-local-variables does not include buffer-undo-list)
> is present since Emacs 24.3, due to 36429c8, which moved undo_list to
> the end of struct buffer.
The following works, but I don't know if it is the best solution.
--- i/src/buffer.c
+++ w/src/buffer.c
@@ -1266,6 +1266,20 @@ buffer_lisp_local_variables (struct buffer *buf, bool clone)
return result;
}
+Lisp_Object
+buffer_local_variables_1 (struct buffer *buf, int offset)
+{
+ int idx = PER_BUFFER_IDX (offset);
+ if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
+ && SYMBOLP (PER_BUFFER_SYMBOL (offset)))
+ {
+ Lisp_Object sym = PER_BUFFER_SYMBOL (offset);
+ Lisp_Object val = per_buffer_value (buf, offset);
+ return EQ (val, Qunbound) ? sym : Fcons (sym, val);
+ }
+ return Qnil;
+}
+
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.
@@ -1277,6 +1291,7 @@ No argument or nil as argument means use current buffer as BUFFER. */)
{
struct buffer *buf = decode_buffer (buffer);
Lisp_Object result = buffer_lisp_local_variables (buf, 0);
+ Lisp_Object tem;
/* Add on all the variables stored in special slots. */
{
@@ -1284,18 +1299,16 @@ No argument or nil as argument means use current buffer as BUFFER. */)
FOR_EACH_PER_BUFFER_OBJECT_AT (offset)
{
- idx = PER_BUFFER_IDX (offset);
- if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
- && SYMBOLP (PER_BUFFER_SYMBOL (offset)))
- {
- 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);
- }
+ tem = buffer_local_variables_1 (buf, offset);
+ if (!NILP (tem))
+ result = Fcons (tem, result);
}
}
+ tem = buffer_local_variables_1 (buf, PER_BUFFER_VAR_OFFSET (undo_list));
+ if (!NILP (tem))
+ result = Fcons (tem, result);
+
return result;
}
This bug report was last modified 5 years and 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.