From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: c-style-alist
Date: Tue, 28 Sep 2010 12:41:49 +0200 [thread overview]
Message-ID: <4CA1C66D.30108@easy-emacs.de> (raw)
In-Reply-To: <m1wrq6xmy6.fsf@gmail.com>
Am 28.09.2010 11:00, schrieb Andrea Crotti:
> PJ Weisberg<pj@irregularexpressions.net> 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
>
>
>
next prev parent reply other threads:[~2010-09-28 10:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-16 14:42 c-style-alist Andrea Crotti
2010-09-25 11:54 ` c-style-alist Andrea Crotti
2010-09-25 14:02 ` c-style-alist Andreas Röhler
2010-09-25 22:07 ` c-style-alist PJ Weisberg
2010-09-28 9:00 ` c-style-alist Andrea Crotti
2010-09-28 10:41 ` Andreas Röhler [this message]
[not found] ` <AANLkTinKPzz3aNY0e-7uOvK=3nN7Gs+dgf_3xv4+pLva@mail.gmail.com>
[not found] ` <B10177A4-D04A-417D-944C-F21564A9C4A9@gmail.com>
2010-09-29 22:02 ` c-style-alist PJ Weisberg
2010-10-06 14:13 ` c-style-alist Andrea Crotti
2010-10-06 21:40 ` c-style-alist PJ Weisberg
2010-10-07 16:30 ` c-style-alist Andrea Crotti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CA1C66D.30108@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.