all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: rms@gnu.org
Cc: lekktu@gmail.com, emacs-devel@gnu.org
Subject: Re: frame-local variables weirdness
Date: Wed, 17 Oct 2007 19:53:03 -0400	[thread overview]
Message-ID: <jwvwstlwbcu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <jwv4pgs2rxd.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon\, 15 Oct 2007 13\:50\:36 -0400")

>> I found the discussion.  I see that someone asked for a feature to
>> display frame-specific data in the mode line, and I decided this
>> general feature (with which the job could be done) was cleaner and
>> simpler than a specific feature which could do only that one job.

> That's a reasonable request, and indeed there are situations where we can
> lookup a variable but we cannot call a function which could potentially run
> arbitrary code.
> Maybe that's enough to keep the feature.

>> Since it isn't very useful, we can take it out if we cannot fix it.
>> But first let's try to fix it.

> But the above request does not mean we need to be able to mix&match
> let-bindings, buffer-local, and frame-local variables.  If we disallowed the
> buffer-local&frame-local variables, the problem would disappear.  This part
> of the language is already complex enough as it stands.

More specifically, I propose to change the manual to say that we cannot mix
buffer-local and frame-local with a single variable (just like a variable
cannot be both buffer-local and keyboard-local or keyboard-local and
frame-local).

This could come with the attached change in the code, which would fix the
OP's problem by signalling the odd situation earlier.  This would be
installed on the 22 branch, since it's obviously safe.


        Stefan


Index: data.c
===================================================================
RCS file: /sources/emacs/emacs/src/data.c,v
retrieving revision 1.280
diff -u -u -b -r1.280 data.c
--- data.c	16 Oct 2007 15:42:58 -0000	1.280
+++ data.c	17 Oct 2007 23:47:34 -0000
@@ -1521,7 +1521,9 @@
   variable = indirect_variable (variable);
 
   valcontents = SYMBOL_VALUE (variable);
-  if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
+  if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents)
+      || (BUFFER_LOCAL_VALUEP (valcontents)
+	  && XBUFFER_LOCAL_VALUE (valcontents)->check_frame))
     error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
 
   if (BUFFER_OBJFWDP (valcontents))
@@ -1578,7 +1580,9 @@
   variable = indirect_variable (variable);
 
   valcontents = SYMBOL_VALUE (variable);
-  if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
+  if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents)
+      || (BUFFER_LOCAL_VALUEP (valcontents)
+	  && XBUFFER_LOCAL_VALUE (valcontents)->check_frame))
     error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
 
   if ((BUFFER_LOCAL_VALUEP (valcontents)
@@ -1733,8 +1737,9 @@
   variable = indirect_variable (variable);
 
   valcontents = SYMBOL_VALUE (variable);
-  if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)
-      || BUFFER_OBJFWDP (valcontents))
+  if (XSYMBOL (variable)->constant || KBOARD_OBJFWDP (valcontents)
+      || (BUFFER_LOCAL_VALUEP (valcontents)
+	  && !XBUFFER_LOCAL_VALUE (valcontents)->check_frame))
     error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
 
   if (BUFFER_LOCAL_VALUEP (valcontents))


Diffs between working revision and workfile end here.

  parent reply	other threads:[~2007-10-17 23:53 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-05 13:41 frame-local variables weirdness Juanma Barranquero
2006-12-08  2:28 ` Juanma Barranquero
2006-12-09  1:26   ` Richard Stallman
2006-12-09 14:11     ` Juanma Barranquero
2006-12-10  4:24       ` Richard Stallman
2006-12-10 12:58         ` Juanma Barranquero
2007-10-11  9:42   ` Juanma Barranquero
2007-10-11 14:21     ` Stefan Monnier
2007-10-11 14:37       ` Juanma Barranquero
2007-10-11 17:33         ` Stefan Monnier
2007-10-11 19:00           ` Juanma Barranquero
2007-10-12 15:59     ` Richard Stallman
2007-10-12 16:33       ` Stefan Monnier
2007-10-14 16:29         ` Richard Stallman
2007-10-14 17:13           ` Juanma Barranquero
2007-10-14 17:51           ` David Kastrup
2007-10-15 16:04             ` Richard Stallman
2007-10-15 17:50               ` Stefan Monnier
2007-10-17 17:29                 ` Stephen J. Turnbull
2007-10-17 18:05                   ` Stefan Monnier
2007-10-18  5:03                     ` Richard Stallman
2007-10-18 13:53                       ` Stefan Monnier
2007-10-19  5:40                         ` Richard Stallman
2007-10-19 13:56                           ` Stefan Monnier
2007-10-20  3:30                             ` Richard Stallman
2007-10-20 13:15                               ` Stefan Monnier
2007-10-21  7:25                                 ` Richard Stallman
2007-10-21 14:24                                   ` Stefan Monnier
2007-10-21 14:56                                     ` Miles Bader
2007-10-21 19:20                                       ` Stefan Monnier
2007-10-22  2:26                                         ` Miles Bader
2007-10-22  9:01                                     ` Richard Stallman
2007-10-17 21:03                   ` David Kastrup
2007-10-19  1:57                     ` Stephen J. Turnbull
2007-10-17 23:53                 ` Stefan Monnier [this message]
2007-10-18 12:45                   ` Juanma Barranquero
2007-10-18 13:38                     ` Stefan Monnier
2007-10-18 13:45                       ` Juanma Barranquero
2007-10-18 14:10                         ` Johan Bockgård
2007-10-18 16:40                           ` Stefan Monnier
2007-10-19 17:42                   ` Richard Stallman
2007-10-19 18:56                     ` Stefan Monnier
2007-10-20 14:57                       ` Richard Stallman
2007-10-21  2:03                         ` Stefan Monnier
2007-10-22  9:00                           ` Richard Stallman
2007-10-22 15:28                             ` Stefan Monnier
2007-10-22 15:47                               ` Juanma Barranquero
2007-10-22 16:01                                 ` Stefan Monnier
2007-10-22 16:17                                   ` Juanma Barranquero
2007-10-23 10:38                                   ` Richard Stallman
2007-10-23 20:31                                     ` Stefan Monnier
2007-10-24  8:33                                       ` Richard Stallman
2007-10-24  8:54                                     ` Johan Bockgård
2007-11-06  4:31                   ` Chong Yidong
2007-11-06  8:37                     ` Stefan Monnier
2007-11-06 10:48                       ` Juanma Barranquero
2007-10-12 16:41       ` Juanma Barranquero
2007-10-13  6:41         ` Richard Stallman
2007-10-13 23:06           ` Juanma Barranquero
2007-10-18 12:44             ` Juanma Barranquero
2007-10-21 16:26               ` Richard Stallman
2007-10-21 16:33                 ` Juanma Barranquero
2006-12-09 14:24 ` Juanma Barranquero
2006-12-09 15:26   ` Stefan Monnier
2006-12-09 17:59     ` Juanma Barranquero
2006-12-11 14:59 ` Richard Stallman
2006-12-11 15:57   ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwstlwbcu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.