From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: frame-local variables weirdness Date: Fri, 19 Oct 2007 09:56:06 -0400 Message-ID: References: <858x65lh4m.fsf@lola.goethe.zz> <2bfd4e060710171029g30a62313naf31c5363d85d6ca@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1192802831 27382 80.91.229.12 (19 Oct 2007 14:07:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Oct 2007 14:07:11 +0000 (UTC) Cc: lekktu@gmail.com, stephen@xemacs.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 19 16:07:11 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IisVB-0000Qq-Ag for ged-emacs-devel@m.gmane.org; Fri, 19 Oct 2007 16:07:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IisV0-0007ac-Ne for ged-emacs-devel@m.gmane.org; Fri, 19 Oct 2007 10:06:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IisUV-0007K7-AS for emacs-devel@gnu.org; Fri, 19 Oct 2007 10:06:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IisUM-0007GI-Jg for emacs-devel@gnu.org; Fri, 19 Oct 2007 10:06:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IisUM-0007GF-FW for emacs-devel@gnu.org; Fri, 19 Oct 2007 10:06:10 -0400 Original-Received: from tomts25.bellnexxia.net ([209.226.175.188] helo=tomts25-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IisTv-0004Yy-KM; Fri, 19 Oct 2007 10:05:46 -0400 Original-Received: from pastel.home ([74.12.207.168]) by tomts25-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071019140528.MKTE19497.tomts25-srv.bellnexxia.net@pastel.home>; Fri, 19 Oct 2007 10:05:28 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 49CD47F79; Fri, 19 Oct 2007 09:56:06 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Fri\, 19 Oct 2007 01\:40\:27 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81221 Archived-At: >> I don't follow. What would that function do? > It would behave similarly to `symbol-value' now. > I understand that, though it is rather general. > The main difference is that it wouldn't be implicitly used just by > using the SYMBOL because it wouldn't be considered as > a normal variable. > What wouldn't be considered as a normal variable? > I am lost here. I'm suggesting we introduce a new concept which we could call "specifier" or "localizable quasi variable". We could create them with: (defconst new-interprogram-cut-function (make-specifier 'x-select-text)) Now new-interprogram-cut-function is a normal global variable (actually a constant: we will never `setq' it). Its value is a "specifier". Then we get get the value of this specifier with: (specifier-value new-interprogram-cut-function) which would return `x-select-text' because it's currently its only value. But we could later on change its value on a per-frame basis via maybe: (specifier-set new-interprogram-cut-function 'my-fun) so that the `specifier-value' function returns `my-fun' if the selected frame is and `x-select-text' otherwise. > It sounds like a step backwards, though. If we can make the function work > right, we can make it work right for variable values. Again, because this is not a variable, it does not have to be optimized in the same way and it does not have to interact with let-binding so making it work correctly is a *lot* easier. But similarly to variables, we can make sure that `specifier-value' does not run any elisp code (or even allocate), so it can easily be used in places where full elisp is undesirable (e.g. the mode-line-format, although nowadays this accepts full elisp anyway), which was the original motivation for adding frame-local variables. Stefan