From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: How to debug modification to a variable value? Date: Tue, 26 Jan 2010 13:04:49 -0800 (PST) Message-ID: <45732.130.55.118.19.1264539889.squirrel@webmail.lanl.gov> References: <87636pvrdj.fsf@thinkpad.tsdh.de> <52428.130.55.118.19.1264458645.squirrel@webmail.lanl.gov> <87636p5k9u.fsf@thinkpad.tsdh.de> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1264539915 14428 80.91.229.12 (26 Jan 2010 21:05:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jan 2010 21:05:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Tassilo Horn" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 26 22:05:07 2010 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 1NZsav-0001B9-K9 for ged-emacs-devel@m.gmane.org; Tue, 26 Jan 2010 22:05:06 +0100 Original-Received: from localhost ([127.0.0.1]:50693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZsaw-00078a-IZ for ged-emacs-devel@m.gmane.org; Tue, 26 Jan 2010 16:05:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZsao-00078P-43 for emacs-devel@gnu.org; Tue, 26 Jan 2010 16:04:58 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZsai-00077u-Tp for emacs-devel@gnu.org; Tue, 26 Jan 2010 16:04:57 -0500 Original-Received: from [199.232.76.173] (port=46137 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZsai-00077r-Pj for emacs-devel@gnu.org; Tue, 26 Jan 2010 16:04:52 -0500 Original-Received: from proofpoint2.lanl.gov ([204.121.3.26]:48934) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZsai-0003Iu-CP for emacs-devel@gnu.org; Tue, 26 Jan 2010 16:04:52 -0500 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint2.lanl.gov (8.14.3/8.14.3) with ESMTP id o0QL4nsa021807; Tue, 26 Jan 2010 14:04:49 -0700 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 825BF1C530D; Tue, 26 Jan 2010 14:04:49 -0700 (MST) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 5B5981C5305; Tue, 26 Jan 2010 14:04:49 -0700 (MST) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 5919C1DE0228; Tue, 26 Jan 2010 14:04:49 -0700 (MST) Original-Received: from 130.55.118.19 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Tue, 26 Jan 2010 13:04:49 -0800 (PST) In-Reply-To: <87636p5k9u.fsf@thinkpad.tsdh.de> User-Agent: SquirrelMail/1.4.8-5.7.lanl7 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2010-01-26_11:2010-01-20, 2010-01-26, 2010-01-26 signatures=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:120466 Archived-At: > "Gone" means, it has the buffer-local value nil. So there seems to be > no call to `kill-local-variable'. That narrows the possibilities, although `make-local-variable' could have happened later. > There's no `kill-[all-]local-variable[s]', and the `setq' of that > variable is isolated in one command (see end of this message), which is > never called internally, only by a keybinding. Don't forget `set'. It's unlikely but not impossible some generic code is doing something like (set (caar (buffer-local-variables)) nil). So of course check with "emacs -Q", and enable as little as possible that might be trying to be clever like that. > Sounds good, but how do I do that? Especially the "find where the > buffer-local value of the variable is stored" part... (I think this has been adequately addressed by others.) >> Meanwhile, my psychic powers suggest that you have a `let' binding of >> the variable in question and switch buffers within the `let', or else >> that something is reasserting your major mode so that >> `kill-all-local-variables' is getting called. > > Hm, the problem occured while I was using many different frames, which I > didn't use till now, so something in this direction seems possible. But > between the variable is set buffer-locally to some alist and the > variable is set buffer-locally to nil, there was only one C-x C-s > without switching frames/buffers at all. And you're sure that there are no relevant `let's? There's actually a bug there, which I failed to actually mention: see http://debbugs.gnu.org/cgi-bin/bugreport.cgi?bug=3467 >> You could test for the latter with the `permanent-local' property. > > Oh, I didn't know that property. > [...] > I don't know if this is appropriate for `tg-schema-alist'. It > determines the completion possibilities and highlighting, and is not > strictly related to the current buffer/file, but to another file a user > can select and switch. I didn't mean that your variables should really use it. Just that you could put it on them for debugging to see whether they were getting killed by `kill-all-local-variables', since it will spare permanent locals. Of course, you say it still has a local value, so that's probably not happening, but you could check anyway, for the odd case of `kill-all-local-variables' + `make-local-variable' (not `make-variable-buffer-local') that looks very much like `setq' with nil. > So tg-mode contains > [...] > and in greql-mode (which requires tg-mode), there is the only function > modifying the value of `tg-schema-alist' by assigning the buffer-local > value of a temporary buffer to the buffer-local value in the query > buffer. Aha! Now we can ignore most of what I've written so far (except perhaps for reference for future bugs). `tg-init-schema' also sets `tg-schema-alist', of course; that's how `greql-set-graph' gets it. And I see that `tg-eldoc-init' adds that function to `after-save-hook' (globally!), and that `tg-initialize' adds -that- to `eldoc-mode-hook' (globally!), and that `tg-mode' calls -that-. While greql-mode.el never actually invokes `tg-mode' for you, I suspect that at some point your Emacs did run `tg-mode', which called `tg-initialize', which registered `tg-eldoc-init', which got called (perhaps in some other buffer) by `eldoc-mode' and registered `tg-init-schema', which got called by `basic-save-buffer' in your GReQL buffer. This non-local, delayed effect probably does look a lot like magic and probably does only happen in some Emacs sessions. Am I right? Davis PS - (lambda (elem) (car elem)) is usually just written 'car or #'car. -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.