[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: frame-local variables weirdness
From: |
Stefan Monnier |
Subject: |
Re: frame-local variables weirdness |
Date: |
Thu, 11 Oct 2007 10:21:19 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
> 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.
I'd much rather disallow variables that are both buffer-local and frame-local.
What is the use-case?
Stefan
> 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.
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel
- Re: frame-local variables weirdness, Juanma Barranquero, 2007/10/11
- Re: frame-local variables weirdness,
Stefan Monnier <=
- Re: frame-local variables weirdness, Richard Stallman, 2007/10/12
- Re: frame-local variables weirdness, Stefan Monnier, 2007/10/12
- Re: frame-local variables weirdness, Richard Stallman, 2007/10/14
- Re: frame-local variables weirdness, Juanma Barranquero, 2007/10/14
- Re: frame-local variables weirdness, David Kastrup, 2007/10/14
- Re: frame-local variables weirdness, Richard Stallman, 2007/10/15
- Re: frame-local variables weirdness, Stefan Monnier, 2007/10/15