From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrea Crotti Newsgroups: gmane.emacs.help Subject: Re: c-style-alist Date: Tue, 28 Sep 2010 11:00:01 +0200 Message-ID: References: <4C9E00FF.9040105@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285664467 22870 80.91.229.12 (28 Sep 2010 09:01:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Sep 2010 09:01:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 28 11:01:03 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P0W3W-0002ki-R4 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 11:00:59 +0200 Original-Received: from localhost ([127.0.0.1]:33089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0W3W-0000g6-B1 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 05:00:58 -0400 Original-Received: from [140.186.70.92] (port=42370 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0W2o-0000ea-3i for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 05:00:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0W2m-00012p-LR for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 05:00:13 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:51310) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0W2m-00012j-Fv for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 05:00:12 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P0W2k-0002VT-JW for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 11:00:10 +0200 Original-Received: from 85-230.eduroam.rwth-aachen.de ([134.61.85.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Sep 2010 11:00:10 +0200 Original-Received: from andrea.crotti.0 by 85-230.eduroam.rwth-aachen.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 28 Sep 2010 11:00:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 85-230.eduroam.rwth-aachen.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:zVYp4USeMMdo/xyKbQzQSaaW4T4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:75025 Archived-At: PJ Weisberg writes: > > It looks to me like what's happening is that in the hook it switches > to cpp-omnet-mode, and since that's derived from c++-mode it results > in c++-mode-hooks getting run again, so it again switches to > cpp-omnet-mode and runs c++-mode-hooks, ad infinitum. > > I'm not an expert and I'm sure there's a better way to do it, but one > way I could suggest is to set a buffer-local variable to mark that > you're switching to cpp-omnet-mode, and don't switch to cpp-omnet-mode > again if it's already set. That's exactly what happens, and also the solutions from Andreas doesn't work, it still loops forever. But I don't understand why, since if the OR is short circuiting... But probably I never really pass to cpp-omnet UNTIL all the hooks in c++-mode have been executed. I don't see how the variable could help me with that, maybe an example? Another non related thing, I made a ned-file mode derivate of cc-mode, because it comes handy for many things, but now is there a way to tell yasnippet to expand ONLY the snippets for ned-mode? Otherwise I also see all the snippets for C and C++ which I don't need at all in this case.. Thanks, Andrea