From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: [drew.adams@oracle.com: RE: weirddefadvicebugwithbyte-compilation] Date: Mon, 12 Dec 2005 13:53:31 -0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1134428511 9703 80.91.229.2 (12 Dec 2005 23:01:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2005 23:01:51 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 13 00:01:50 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Elwd8-0000Cw-W9 for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2005 23:58:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Elwde-0007jT-9Z for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2005 17:59:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ElvcZ-0006DS-ED for emacs-devel@gnu.org; Mon, 12 Dec 2005 16:54:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ElvcY-0006Cv-Ac for emacs-devel@gnu.org; Mon, 12 Dec 2005 16:54:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ElvcY-0006Cp-5l for emacs-devel@gnu.org; Mon, 12 Dec 2005 16:54:10 -0500 Original-Received: from [148.87.122.30] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1ElveK-0003JN-Ri for emacs-devel@gnu.org; Mon, 12 Dec 2005 16:56:01 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id jBCLrXNo024470 for ; Mon, 12 Dec 2005 14:53:33 -0700 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jBCLrXk1014751 for ; Mon, 12 Dec 2005 14:53:33 -0700 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id jBCLrWmA014742 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 12 Dec 2005 14:53:32 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE 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:47570 Archived-At: > This makes me wonder now if byte-compiling in defadvice (i.e. > on the fly) > should display a *Compile Log* buffer at all. I don't know. Why not? It's a byte compilation like any other one, and these warnings do serve a purpose: your code, as posted, had a bug. Where is the bug? The byte-compiler warning presumably arose because it compiled a defadvice that referred to variable my-mode. That variable is not bound in the defadvice body and it might not be bound at the point in the file when the defadvice is compiled. Is that a bug? It is only a warning, so I don't really mind, but I don't see how the code is bugged. Should people systematically place defadvice last in a file or do (provide 'x)(require 'x) just to make sure that all variables in a defadvice body are defined before it is compiled? > In any case, that's clearly the cause of the problem here (but not > the explanation of the crash bug). The explanation of the crash is that, because the *Backtrace* buffer is displayed in its own separate frame, and that separate frame is created in the middle of the process of creating the *Compile-Log*'s frame's menu, Emacs somehow fails to record the *Backtrace* frame in the list of live frames. And then, when Emacs is killed, the function check_glyph_memory, which walks the frame list and releases all the glyph matrices it finds in each frame, misses that one frame which is not recorded in the list of frames. Thanks. Can someone please try reproducing this in a non-toolkit X build? I think that build might have the same problem as the MS-Windows build. > I still have a question, however, about how best to use > define-minor-mode to define the mode variable so that it can be > used in a put 'menu-enable. Is it necessary to do the > define-minor-mode before doing the put? I guess so; but > in that case, I prefer the old method of defining a > minor-mode function and its variable (defcustom) separately. > The problem is the same, but I always place variable definitions > at the top, and such a defcustom would be defined before the > variable was used in the put 'menu-enable. In the new system, I > was calling the minor-mode function first thing (in .emacs), > to set the variable, but that function couldn't be called until > its defining library was loaded, and that meant that the > variable wasn't defined when the *Compile Log* was displayed > when byte-compiling a defadvice in the file. Sorry, I'm not an expert on minor modes. Anyone? I also don't understand, as I mentioned, _why_ the defadvice in foo.el is byte-compiled - it has no `compile' keyword. Only the defadvice in bar.el has `compile', and it does not refer to variable my-mode. If the defadvice in bar.el is removed, the bug is not manifested, presumably because the defadvice in foo.el is not byte-compiled. I don't see why a `compile' in a defadvice in one file would cause compilation of a defadvice in another file. Is that normal?