* src/data.c (Fmake_variable_frame_local): Remove

* src/lisp.h (struct Lisp_Buffer_Local_Value): Remove `frame_local'.

* src/data.c (swap_in_symval_forwarding, set_internal)
(set_symbol_trapped_write, make_blv, Fmake_variable_buffer_local)
(Fmake_local_variable, Fkill_local_variable, Flocal_variable_p):
Don't pay attention to ->frame_local any more.
(syms_of_data): Remove Qtrapping_frame_local and don't defsubr
Smake_variable_frame_local.

* etc/NEWS (Incompatible Lisp Changes in Emacs 26.1): Announce removal
of make-variable-frame-local.

* lisp/help-fns.el (describe-variable): Don't handle the now impossible
frame-local case.

* lisp/subr.el (make-variable-frame-local): Remove obsolescence data.

* src/frame.c (store_frame_param):
* src/eval.c (specbind): Don't pay attention to ->frame_local any more.

* src/widget.c (first_frame_p): Remove, unused.
This commit is contained in:
Stefan Monnier 2016-12-21 15:07:43 -05:00
parent cf6ce9a1fe
commit a6063ffe5a
11 changed files with 16 additions and 178 deletions

View file

@ -669,6 +669,7 @@ before running. This is controlled by the 'grep-save-buffers'
variable.
** Some obsolete functions, variables, and faces have been removed:
*** make-variable-frame-local. Variables cannot be frame-local any more.
*** From subr.el: window-dot, set-window-dot, read-input, show-buffer,
eval-current-buffer, string-to-int
*** All the default-FOO variables that hold the default value of the

View file

@ -31,7 +31,7 @@
;; This library permits the setting of override functions for tasks of
;; that nature, and also provides reasonable defaults.
;;
;; There are buffer local variables, and frame local variables.
;; There are buffer local variables (and there were frame local variables).
;; This library gives the illusion of mode specific variables.
;;
;; You should use a mode-local variable or override to allow extension

View file

@ -2170,8 +2170,7 @@ The purpose of this function is so you can properly undo
subsequent changes to the same binding, by passing the status
cons cell to `edebug-restore-status'. The status cons cell
has the form (LOCUS . VALUE), where LOCUS can be a buffer
\(for a buffer-local binding), a frame (for a frame-local binding),
or nil (if the default binding is current)."
\(for a buffer-local binding), or nil (if the default binding is current)."
(cons (variable-binding-locus var)
(symbol-value var)))

View file

@ -863,8 +863,6 @@ it is displayed along with the global value."
((bufferp locus)
(princ (format "Local in buffer %s; "
(buffer-name buffer))))
((framep locus)
(princ (format "It is a frame-local variable; ")))
((terminal-live-p locus)
(princ (format "It is a terminal-local variable; ")))
(t

View file

@ -1310,8 +1310,7 @@ be a list of the form returned by `event-start' and `event-end'."
(make-obsolete 'focus-frame "it does nothing." "22.1")
(defalias 'unfocus-frame 'ignore "")
(make-obsolete 'unfocus-frame "it does nothing." "22.1")
(make-obsolete 'make-variable-frame-local
"explicitly check for a frame-parameter instead." "22.2")
(set-advertised-calling-convention
'all-completions '(string collection &optional predicate) "23.1")
(set-advertised-calling-convention 'unintern '(name obarray) "23.3")

View file

@ -1176,9 +1176,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
tem1 = blv->where;
if (NILP (tem1)
|| (blv->frame_local
? !EQ (selected_frame, tem1)
: current_buffer != XBUFFER (tem1)))
|| current_buffer != XBUFFER (tem1))
{
/* Unload the previously loaded binding. */
@ -1189,16 +1187,8 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
{
Lisp_Object var;
XSETSYMBOL (var, symbol);
if (blv->frame_local)
{
tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
set_blv_where (blv, selected_frame);
}
else
{
tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
set_blv_where (blv, Fcurrent_buffer ());
}
tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
set_blv_where (blv, Fcurrent_buffer ());
}
if (!(blv->found = !NILP (tem1)))
tem1 = blv->defcell;
@ -1266,7 +1256,7 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
}
/* Store the value NEWVAL into SYMBOL.
If buffer/frame-locality is an issue, WHERE specifies which context to use.
If buffer-locality is an issue, WHERE specifies which context to use.
(nil stands for the current buffer/frame).
If BINDFLAG is SET_INTERNAL_SET, then if this symbol is supposed to
@ -1322,15 +1312,10 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
{
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
if (NILP (where))
{
if (blv->frame_local)
where = selected_frame;
else
XSETBUFFER (where, current_buffer);
}
XSETBUFFER (where, current_buffer);
/* If the current buffer is not the buffer whose binding is
loaded, or if there may be frame-local bindings and the frame
isn't the right one, or if it's a Lisp_Buffer_Local_Value and
loaded, or if it's a Lisp_Buffer_Local_Value and
the default binding is loaded, the loaded binding may be the
wrong one. */
if (!EQ (blv->where, where)
@ -1347,9 +1332,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
/* Find the new binding. */
XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
tem1 = assq_no_quit (symbol,
(blv->frame_local
? XFRAME (where)->param_alist
: BVAR (XBUFFER (where), local_var_alist)));
BVAR (XBUFFER (where), local_var_alist));
set_blv_where (blv, where);
blv->found = 1;
@ -1376,9 +1359,6 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
and load that binding. */
else
{
/* local_if_set is only supported for buffer-local
bindings, not for frame-local bindings. */
eassert (!blv->frame_local);
tem1 = Fcons (symbol, XCDR (blv->defcell));
bset_local_var_alist
(XBUFFER (where),
@ -1442,9 +1422,6 @@ set_symbol_trapped_write (Lisp_Object symbol, enum symbol_trapped_write trap)
struct Lisp_Symbol* sym = XSYMBOL (symbol);
if (sym->trapped_write == SYMBOL_NOWRITE)
xsignal1 (Qtrapping_constant, symbol);
else if (sym->redirect == SYMBOL_LOCALIZED
&& SYMBOL_BLV (sym)->frame_local)
xsignal1 (Qtrapping_frame_local, symbol);
sym->trapped_write = trap;
}
@ -1784,7 +1761,6 @@ make_blv (struct Lisp_Symbol *sym, bool forwarded,
eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
blv->fwd = forwarded ? valcontents.fwd : NULL;
set_blv_where (blv, Qnil);
blv->frame_local = 0;
blv->local_if_set = 0;
set_blv_defcell (blv, tem);
set_blv_valcell (blv, tem);
@ -1831,9 +1807,6 @@ The function `default-value' gets the default value and `set-default' sets it.
break;
case SYMBOL_LOCALIZED:
blv = SYMBOL_BLV (sym);
if (blv->frame_local)
error ("Symbol %s may not be buffer-local",
SDATA (SYMBOL_NAME (variable)));
break;
case SYMBOL_FORWARDED:
forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
@ -1908,9 +1881,6 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
forwarded = 0; valcontents.value = SYMBOL_VAL (sym); break;
case SYMBOL_LOCALIZED:
blv = SYMBOL_BLV (sym);
if (blv->frame_local)
error ("Symbol %s may not be buffer-local",
SDATA (SYMBOL_NAME (variable)));
break;
case SYMBOL_FORWARDED:
forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
@ -2027,8 +1997,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
}
case SYMBOL_LOCALIZED:
blv = SYMBOL_BLV (sym);
if (blv->frame_local)
return variable;
break;
default: emacs_abort ();
}
@ -2062,81 +2030,6 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
/* Lisp functions for creating and removing buffer-local variables. */
/* Obsolete since 22.2. NB adjust doc of modify-frame-parameters
when/if this is removed. */
DEFUN ("make-variable-frame-local", Fmake_variable_frame_local, Smake_variable_frame_local,
1, 1, "vMake Variable Frame Local: ",
doc: /* Enable VARIABLE to have frame-local bindings.
This does not create any frame-local bindings for VARIABLE,
it just makes them possible.
A frame-local binding is actually a frame parameter value.
If a frame F has a value for the frame parameter named VARIABLE,
that also acts as a frame-local binding for VARIABLE in F--
provided this function has been called to enable VARIABLE
to have frame-local bindings at all.
The only way to create a frame-local binding for VARIABLE in a frame
is to set the VARIABLE frame parameter of that frame. See
`modify-frame-parameters' for how to set frame parameters.
Note that since Emacs 23.1, variables cannot be both buffer-local and
frame-local any more (buffer-local bindings used to take precedence over
frame-local bindings). */)
(Lisp_Object variable)
{
bool forwarded;
union Lisp_Val_Fwd valcontents;
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
start:
switch (sym->redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL:
forwarded = 0; valcontents.value = SYMBOL_VAL (sym);
if (EQ (valcontents.value, Qunbound))
valcontents.value = Qnil;
break;
case SYMBOL_LOCALIZED:
if (SYMBOL_BLV (sym)->frame_local)
return variable;
else
error ("Symbol %s may not be frame-local",
SDATA (SYMBOL_NAME (variable)));
case SYMBOL_FORWARDED:
forwarded = 1; valcontents.fwd = SYMBOL_FWD (sym);
if (KBOARD_OBJFWDP (valcontents.fwd) || BUFFER_OBJFWDP (valcontents.fwd))
error ("Symbol %s may not be frame-local",
SDATA (SYMBOL_NAME (variable)));
break;
default: emacs_abort ();
}
if (SYMBOL_TRAPPED_WRITE_P (variable))
error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
blv = make_blv (sym, forwarded, valcontents);
blv->frame_local = 1;
sym->redirect = SYMBOL_LOCALIZED;
SET_SYMBOL_BLV (sym, blv);
{
Lisp_Object symbol;
XSETSYMBOL (symbol, sym); /* In case `variable' is aliased. */
if (let_shadows_global_binding_p (symbol))
{
AUTO_STRING (format, "Making %s frame-local while let-bound!");
CALLN (Fmessage, format, SYMBOL_NAME (variable));
}
}
return variable;
}
DEFUN ("local-variable-p", Flocal_variable_p, Slocal_variable_p,
1, 2, 0,
doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER.
@ -2168,10 +2061,7 @@ BUFFER defaults to the current buffer. */)
{
elt = XCAR (tail);
if (EQ (variable, XCAR (elt)))
{
eassert (!blv->frame_local);
return Qt;
}
return Qt;
}
return Qnil;
}
@ -2230,7 +2120,6 @@ DEFUN ("variable-binding-locus", Fvariable_binding_locus, Svariable_binding_locu
1, 1, 0,
doc: /* Return a value indicating where VARIABLE's current binding comes from.
If the current binding is buffer-local, the value is the current buffer.
If the current binding is frame-local, the value is the selected frame.
If the current binding is global (the default), the value is nil. */)
(register Lisp_Object variable)
{
@ -3664,7 +3553,6 @@ syms_of_data (void)
DEFSYM (Qvoid_variable, "void-variable");
DEFSYM (Qsetting_constant, "setting-constant");
DEFSYM (Qtrapping_constant, "trapping-constant");
DEFSYM (Qtrapping_frame_local, "trapping-frame-local");
DEFSYM (Qinvalid_read_syntax, "invalid-read-syntax");
DEFSYM (Qinvalid_function, "invalid-function");
@ -3745,8 +3633,6 @@ syms_of_data (void)
"Attempt to set a constant symbol");
PUT_ERROR (Qtrapping_constant, error_tail,
"Attempt to trap writes to a constant symbol");
PUT_ERROR (Qtrapping_frame_local, error_tail,
"Attempt to trap writes to a frame local variable");
PUT_ERROR (Qinvalid_read_syntax, error_tail, "Invalid read syntax");
PUT_ERROR (Qinvalid_function, error_tail, "Invalid function");
PUT_ERROR (Qwrong_number_of_arguments, error_tail,
@ -3876,7 +3762,6 @@ syms_of_data (void)
defsubr (&Smake_variable_buffer_local);
defsubr (&Smake_local_variable);
defsubr (&Skill_local_variable);
defsubr (&Smake_variable_frame_local);
defsubr (&Slocal_variable_p);
defsubr (&Slocal_variable_if_set_p);
defsubr (&Svariable_binding_locus);

View file

@ -3283,8 +3283,6 @@ specbind (Lisp_Object symbol, Lisp_Object value)
do_specbind (sym, specpdl_ptr - 1, value, SET_INTERNAL_BIND);
break;
case SYMBOL_LOCALIZED:
if (SYMBOL_BLV (sym)->frame_local)
error ("Frame-local vars cannot be let-bound");
case SYMBOL_FORWARDED:
{
Lisp_Object ovalue = find_symbol_value (symbol);

View file

@ -2478,28 +2478,6 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
return;
}
/* If PROP is a symbol which is supposed to have frame-local values,
and it is set up based on this frame, switch to the global
binding. That way, we can create or alter the frame-local binding
without messing up the symbol's status. */
if (SYMBOLP (prop))
{
struct Lisp_Symbol *sym = XSYMBOL (prop);
start:
switch (sym->redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
case SYMBOL_LOCALIZED:
{ struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f)
swap_in_global_binding (sym);
break;
}
default: emacs_abort ();
}
}
/* The tty color needed to be set before the frame's parameter
alist was updated with the new value. This is not true any more,
but we still do this test early on. */
@ -2709,13 +2687,7 @@ The meaningful parameters are acted upon, i.e. the frame is changed
according to their new values, and are also stored in the frame's
parameter list so that `frame-parameters' will return them.
PARMs that are not meaningful are still stored in the frame's parameter
list, but are otherwise ignored.
The value of frame parameter FOO can also be accessed
as a frame-local binding for the variable FOO, if you have
enabled such bindings for that variable with `make-variable-frame-local'.
Note that this functionality is obsolete as of Emacs 22.2, and its
use is not recommended. Explicitly check for a frame-parameter instead. */)
list, but are otherwise ignored. */)
(Lisp_Object frame, Lisp_Object alist)
{
struct frame *f = decode_live_frame (frame);

View file

@ -2466,7 +2466,7 @@ struct Lisp_Buffer_Objfwd
};
/* struct Lisp_Buffer_Local_Value is used in a symbol value cell when
the symbol has buffer-local or frame-local bindings. (Exception:
the symbol has buffer-local bindings. (Exception:
some buffer-local variables are built-in, with their values stored
in the buffer structure itself. They are handled differently,
using struct Lisp_Buffer_Objfwd.)
@ -2494,9 +2494,6 @@ struct Lisp_Buffer_Local_Value
/* True means that merely setting the variable creates a local
binding for the current buffer. */
bool_bf local_if_set : 1;
/* True means this variable can have frame-local bindings, otherwise, it is
can have buffer-local bindings. The two cannot be combined. */
bool_bf frame_local : 1;
/* True means that the binding now loaded was found.
Presumably equivalent to (defcell!=valcell). */
bool_bf found : 1;
@ -3384,7 +3381,7 @@ make_symbol_constant (Lisp_Object sym)
XSYMBOL (sym)->trapped_write = SYMBOL_NOWRITE;
}
/* Buffer-local (also frame-local) variable access functions. */
/* Buffer-local variable access functions. */
INLINE int
blv_found (struct Lisp_Buffer_Local_Value *blv)

View file

@ -212,16 +212,6 @@ mark_shell_size_user_specified (Widget wmshell)
#endif
/* Can't have static frame locals because of some broken compilers.
Normally, initializing a variable like this doesn't work in emacs,
but it's ok in this file because it must come after lastfile (and
thus have its data not go into text space) because Xt needs to
write to initialized data objects too.
*/
#if 0
static Boolean first_frame_p = True;
#endif
static void
set_frame_size (EmacsFrame ew)
{

View file

@ -332,7 +332,6 @@ comparing the subr with a much slower lisp implementation."
;; defvar and defconst modify the local binding [ doesn't matter for us ]
;; various kinds of special internal forwarding objects
;; a couple examples in manual, not enough
;; frame-local vars
;; variable aliases
;; Tests for watchpoints