[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/buffer.c,v
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/src/buffer.c,v |
Date: |
Mon, 10 Dec 2007 03:47:47 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 07/12/10 03:47:47
Index: buffer.c
===================================================================
RCS file: /sources/emacs/emacs/src/buffer.c,v
retrieving revision 1.542
retrieving revision 1.543
diff -u -b -r1.542 -r1.543
--- buffer.c 9 Dec 2007 23:49:00 -0000 1.542
+++ buffer.c 10 Dec 2007 03:47:46 -0000 1.543
@@ -107,12 +107,14 @@
int last_per_buffer_idx;
-Lisp_Object Fset_buffer ();
-void set_buffer_internal ();
-void set_buffer_internal_1 ();
-static void call_overlay_mod_hooks ();
-static void swap_out_buffer_local_variables ();
-static void reset_buffer_local_variables ();
+EXFUN (Fset_buffer, 1);
+void set_buffer_internal P_ ((struct buffer *b));
+void set_buffer_internal_1 P_ ((struct buffer *b));
+static void call_overlay_mod_hooks P_ ((Lisp_Object list, Lisp_Object overlay,
+ int after, Lisp_Object arg1,
+ Lisp_Object arg2, Lisp_Object arg3));
+static void swap_out_buffer_local_variables P_ ((struct buffer *b));
+static void reset_buffer_local_variables P_ ((struct buffer *b, int
permanent_too));
/* Alist of all buffer names vs the buffers. */
/* This used to be a variable, but is no longer,
@@ -716,7 +718,7 @@
it does not treat permanent locals consistently.
Instead, use Fkill_all_local_variables.
- If PERMANENT_TOO is 1, then we reset permanent built-in
+ If PERMANENT_TOO is 1, then we reset permanent
buffer-local variables. If PERMANENT_TOO is 0,
we preserve those. */
@@ -754,7 +756,23 @@
#endif
/* Reset all (or most) per-buffer variables to their defaults. */
+ if (permanent_too)
b->local_var_alist = Qnil;
+ else
+ {
+ Lisp_Object tmp, last = Qnil;
+ for (tmp = b->local_var_alist; CONSP (tmp); tmp = XCDR (tmp))
+ if (CONSP (XCAR (tmp))
+ && SYMBOLP (XCAR (XCAR (tmp)))
+ && !NILP (Fget (XCAR (XCAR (tmp)), Qpermanent_local)))
+ /* If permanent-local, keep it. */
+ last = tmp;
+ else if (NILP (last))
+ b->local_var_alist = XCDR (tmp);
+ else
+ XSETCDR (last, XCDR (tmp));
+ }
+
for (i = 0; i < last_per_buffer_idx; ++i)
if (permanent_too || buffer_permanent_local_flags[i] == 0)
SET_PER_BUFFER_VALUE_P (b, i, 0);
@@ -2452,14 +2470,10 @@
the normal hook `change-major-mode-hook'. */)
()
{
- register Lisp_Object alist, sym, tem;
- Lisp_Object oalist;
-
if (!NILP (Vrun_hooks))
call1 (Vrun_hooks, Qchange_major_mode_hook);
- oalist = current_buffer->local_var_alist;
- /* Make sure none of the bindings in oalist
+ /* Make sure none of the bindings in local_var_alist
remain swapped in, in their symbols. */
swap_out_buffer_local_variables (current_buffer);
@@ -2468,20 +2482,6 @@
reset_buffer_local_variables (current_buffer, 0);
- /* Any which are supposed to be permanent,
- make local again, with the same values they had. */
-
- for (alist = oalist; CONSP (alist); alist = XCDR (alist))
- {
- sym = XCAR (XCAR (alist));
- tem = Fget (sym, Qpermanent_local);
- if (! NILP (tem))
- {
- Fmake_local_variable (sym);
- Fset (sym, XCDR (XCAR (alist)));
- }
- }
-
/* Force mode-line redisplay. Useful here because all major mode
commands call this function. */
update_mode_lines++;