From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: c-style-alist Date: Tue, 28 Sep 2010 12:41:49 +0200 Message-ID: <4CA1C66D.30108@easy-emacs.de> References: <4C9E00FF.9040105@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1285670589 16659 80.91.229.12 (28 Sep 2010 10:43:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Sep 2010 10:43:09 +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 12:43:08 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 1P0XeM-0003F9-97 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 12:43:06 +0200 Original-Received: from localhost ([127.0.0.1]:52865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0XeL-0000Hl-QF for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Sep 2010 06:43:05 -0400 Original-Received: from [140.186.70.92] (port=50322 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0Xdg-0000Hg-6M for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 06:42:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0Xde-0006tm-OM for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 06:42:24 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]:55155) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0Xde-0006ta-C7 for help-gnu-emacs@gnu.org; Tue, 28 Sep 2010 06:42:22 -0400 Original-Received: from noname.home (brln-4db9e6dc.pool.mediaWays.net [77.185.230.220]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0LrG8W-1OdH840Jhs-0138fH; Tue, 28 Sep 2010 12:42:20 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 In-Reply-To: X-Provags-ID: V02:K0:K38qrmiwbeb6HIvNBbVGQ+RGmXxW3N7u/AJjaGQmnz2 +IU++P6+avx7OtLGLtu24pE/o2AioSU05Z/H4NfZoO4NdG8Aep 0lvFXmXuFkIRw4aQ1uxUIbTochUp1BNRC7K3hlISmMPzxk9IaS ifHSCQ3o2QYa6Jr7lx5hTl6PeoPEpGCn+JRPVXNQp481n++594 IQJzdYZPbLXAuCfN/xRtt8uTI45hH/NqUFonJIX3H8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:75030 Archived-At: Am 28.09.2010 11:00, schrieb Andrea Crotti: > 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? Using a variable is the right thing. Even example code would work, if your mode, once set, returns it. Begin questioning, if the variable is set: (unless my-code-already-active-p ... ACTIVATE (setq my-code-already-active-p t) This should avoid the loop. > > 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 > > >