emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about frame local variable


From: Gerd Moellmann
Subject: Re: question about frame local variable
Date: 10 Nov 2003 11:35:59 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Kenichi Handa <address@hidden> writes:

> I found this code in redisplay_window (xdisp.c).
> 
>   /* Really select the buffer, for the sake of buffer-local
>      variables.  */
>   set_buffer_internal_1 (XBUFFER (w->buffer));
> 
> Perhaps, we should call
> select_frame_internal_for_variables_only around there.

I think the best place is in redisplay_internal, which redisplays
frame by frame.  Otherwise, we'd end up doing this for each window
on a frame again and again.

I can't work on this, but maybe this is helpful:

void
select_frame_for_redisplay (Lisp_Object frame)
{
  Lisp_Object tail, sym, val;
  
  selected_frame = frame;
  
  for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail))
    if (CONSP (XCAR (tail))
        && (sym = XCAR (XCAR (tail)),
            SYMBOLP (sym))
        && (sym = indirect_variable (sym),
            val = SYMBOL_VALUE (sym),
            (BUFFER_LOCAL_VALUEP (val)
             || SOME_BUFFER_LOCAL_VALUEP (val)))
        && XBUFFER_LOCAL_VALUE (val)->check_frame)
      Fsymbol_value (sym);
}

This works analogous to what set_buffer does for buffer-local
variables (hopefully; I haven't tried anything): For all frame
parameters P, check if a frame-local variable P exists.  If so, swap
P's value in by calling Fsymbol_value.  That works because the innards
of Fsymbol_value compare the frame recorded in the local value with
the currently selected frame.

In redisplay_internal, call the function with the frame being
displayed, and in an unwind-protect handler (I think there is already
one), call it to restore the original selected frame and its values.

HTH




reply via email to

[Prev in Thread] Current Thread [Next in Thread]