From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@gmx.net (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: Custom dependencies Date: Fri, 04 Apr 2003 21:42:13 +0200 Organization: University of Duisburg, Germany Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <84a3e0qv3x.fsf@lucy.is.informatik.uni-duisburg.de> References: <8465pvpnhy.fsf@lucy.is.informatik.uni-duisburg.de> <200304041519.h34FJa9n007445@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1049485623 4005 80.91.224.249 (4 Apr 2003 19:47:03 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2003 19:47:03 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 04 21:46:57 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 191X9N-00011f-00 for ; Fri, 04 Apr 2003 21:46:57 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 191XBZ-0004ao-00 for ; Fri, 04 Apr 2003 21:49:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 191X9E-00029O-0B for emacs-devel@quimby.gnus.org; Fri, 04 Apr 2003 14:46:48 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 191X8R-0001VE-00 for emacs-devel@gnu.org; Fri, 04 Apr 2003 14:45:59 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 191X8O-0001TW-00 for emacs-devel@gnu.org; Fri, 04 Apr 2003 14:45:56 -0500 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 191X6k-0007sX-00 for emacs-devel@gnu.org; Fri, 04 Apr 2003 14:44:14 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 191X6N-0000kO-00 for ; Fri, 04 Apr 2003 21:43:51 +0200 Mail-Followup-To: emacs-devel@gnu.org X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 191X6I-0000jj-00 for ; Fri, 04 Apr 2003 21:43:46 +0200 Original-Lines: 70 Original-X-Complaints-To: usenet@main.gmane.org Mail-Copies-To: never User-Agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:GW4dLt0CMP6ldX6XhKf4gp0UhII= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12901 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12901 "Stefan Monnier" writes: > I think the issue of dependencies is important, so let's try and improve > it, rather than keep working around it. Especially since you > mention that it is crucial in order to customize calendar properly. > > I see two different cases: > > - The case as above where variable A has a non-trivial :set function > which depends on variable B, so that when B is changed something > should be done to A. > It seems that the :set-after thingy is a good way to specify the > dependency, but it doesn't describe what should be done to A > when B changes. Agreed. > Kai suggests turn A off and back on, but you seem object to it. No, I suggest to turn utf-translate-cjk-mode off then back on. I think it depends on the various variables what needs to be done when such a change happens. > I believe that you object only to set-language-environment doing it, > not to the off&on thing: it should be done by custom without > set-language-environment (or current-language-environment for that > matter) knowing anything about utf-translate-cjk-mode. I disagree about this. Suppose somebody turns on utf-translate-cjk-mode (via custom or Lisp), then time passes, then they do M-x set-language-environment RET. At that time, something special needs to happen. utf-translate-cjk-mode could add stuff to a language-environment-changed-hook, then set-language-environment could call that hook. This is still a specific solution, not a general one. [[ Later on: Oh, I see that there is such a thing! It seems to be called set-language-environment-hook. Well. That seems to be the solution, doesn't it? ]] > Still, how should custom know that turning the thing off&on is the > right way to refresh A's setting after B was changed ? It can't. Unless we tell it. And the code will depend on the combination of A and B, there will be no general function that will do the right thing. (Except, perhaps, run-hooks -- but that's cheating :-) > - The case where A is set to "the value of E" where E is a sexp > that refers to B. In such a case, the dependency is not part of > A but of A's current setting, so :set-after is not a good solution. > I don't know how custom could find out (or be told about) such > dependencies. OTOH, "what to do when B changes" is trivial to answer > this time. You mean that you could set next-screen-context-lines to `ten percent of the window height'? That doesn't make sense: it needs to be evaluated each time you look at the variable. So such a feature needs to be built in to the variable. This has happened for mode-line-format, for instance. It seems that custom is the wrong place to look for a solution for this: the problem happens when the variable is accessed. -- A preposition is not a good thing to end a sentence with.