From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: watching for variable assignment Date: Fri, 21 Mar 2014 18:26:01 +0800 Message-ID: <874n2rhmpy.fsf@ericabrahamsen.net> References: <87lhwih0ij.fsf@ericabrahamsen.net> <87lhwicsgc.fsf@gmail.com> <87y50iibni.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1395397740 32664 80.91.229.3 (21 Mar 2014 10:29:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2014 10:29:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 21 11:29:07 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WQwhH-0000NE-6Q for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 11:29:07 +0100 Original-Received: from localhost ([::1]:51881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwhG-0005O4-Ju for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Mar 2014 06:29:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwbz-0005fq-Bb for help-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:23:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQwbt-0002hW-Hh for help-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:23:39 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwbt-0002hO-BH for help-gnu-emacs@gnu.org; Fri, 21 Mar 2014 06:23:33 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WQwbo-0000qM-B0 for help-gnu-emacs@gnu.org; Fri, 21 Mar 2014 11:23:28 +0100 Original-Received: from 111.197.157.237 ([111.197.157.237]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Mar 2014 11:23:28 +0100 Original-Received: from eric by 111.197.157.237 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Mar 2014 11:23:28 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 111.197.157.237 User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:NXqdbEKt4BqOqedQqv15SwXD/Ek= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96669 Archived-At: Stefan Monnier writes: >> No, this isn't going to work -- the only way I could find the code >> that's resetting the variable would be to instrument it directly, >> which would require knowing which code it was in the first place. >> Not much use! > > FWIW, I think I'd accept a patch which adds support for "watchers" on > symbols (by extending the read-only bit to 2 bits, so we can > distinguish a "really read-only symbol" from a "symbol with watchers"). > >> I've got git emacs installed on my system, and I think the newer version >> of advising functions might work better. I'm hoping that if I add a >> function to "setq" with the :before key, I can avoid the infinite loop >> problem. > > No, you can't advise special forms (and even if you changed nadvice.el to > try and support it, it still wouldn't apply to byte-compiled code). > >> I read the manual, and found it pretty unhelpful on the question of how >> to tell it what function you're actually trying to advise. A "setf-able >> place" doesn't mean much to me when I'm just trying to hijack "setq" and >> check its args. > > Can you point to the offending documentation (it's still in the process > of being written, so it would be helpful). > I don't see any "setf-able" anywhere, but FWIW such a thing is also > called "an lvalue" in other languages. I saw "Generalized Variable" in the first paragraph, and in my brain I conflate "generalized variable" with "setf-able place", probably incorrectly. FWIW, I updated git emacs recently. The docs seem to have been greatly expanded, and now make a lot of sense. E