emacs-devel
[Top][All Lists]
Advanced

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

Re: frame-local variables weirdness


From: Juanma Barranquero
Subject: Re: frame-local variables weirdness
Date: Thu, 11 Oct 2007 11:42:44 +0200

Another bug report from the pre-22.1 past.

This one is an interaction between frame-local and buffer-local variables.

 (defun test (sym bug)
   ;; Default (global) value for the symbol
   (set sym 'default)
   (make-variable-frame-local sym)
   ;; Frame-local value
   (modify-frame-parameters nil (list (cons sym 'frame)))
   (when bug
     ;; Getting the value of sym changes the result
     (symbol-value sym))
   ;; Buffer-local value
   (make-variable-buffer-local sym)
   (set sym 'local)
   ;; Now let's get back the local values
   (list (local-variable-p sym)       ;; should be t
         (symbol-value sym)           ;; should be 'local
         (frame-parameter nil sym)))  ;; should be 'frame

Note that passing t to the BUG argument only changes one thing: that
(symbol-value sym) is run.

  (test 'foo nil) => (t local frame)     ;; correct
  (test 'bar t)   => (nil local local)   ;; incorrect

Richard proposed the attached patch, with fixes the test case but
causes other problems.

             Juanma


Index: src/data.c
===================================================================
RCS file: /sources/emacs/emacs/src/data.c,v
retrieving revision 1.278
diff -u -2 -r1.278 data.c
--- src/data.c  10 Sep 2007 09:41:44 -0000      1.278
+++ src/data.c  11 Oct 2007 09:30:16 -0000
@@ -1238,7 +1238,8 @@
          || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame
              && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame))
+         /* After make-variable-buffer-local, if we haven't got a
+            buffer-local binding in place, we need to make one.  */
          || (BUFFER_LOCAL_VALUEP (valcontents)
-             && EQ (XCAR (current_alist_element),
-                    current_alist_element)))
+             && ! XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer))
        {
          /* The currently loaded binding is not necessarily valid.




reply via email to

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