unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to prevent abbreviation in c comment?
@ 2008-03-07 14:59 sunway
  2008-03-07 18:33 ` Andreas Röhler
       [not found] ` <mailman.8518.1204914695.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: sunway @ 2008-03-07 14:59 UTC (permalink / raw)
  To: help-gnu-emacs

I have defined an abbreviation of  "main" for "int main () {}" in c-mode using
skeleton,
but I don't want "main" be expanded when it is in c comment blocks, how to?


-- 
sunway

"Never, never, never, never give up."




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to prevent abbreviation in c comment?
  2008-03-07 14:59 how to prevent abbreviation in c comment? sunway
@ 2008-03-07 18:33 ` Andreas Röhler
       [not found] ` <mailman.8518.1204914695.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2008-03-07 18:33 UTC (permalink / raw)
  To: help-gnu-emacs

Am Freitag, 7. März 2008 15:59 schrieb sunway:
> I have defined an abbreviation of  "main" for "int main () {}" in c-mode 
using
> skeleton,
> but I don't want "main" be expanded when it is in c comment blocks, how to?
> 
> 
> -- 
> sunway
> 
> "Never, never, never, never give up."
> 

IMO best solution is to redefine your abbrev.

Maybe, when defining abbrevs, think about how to avoid
such, i.e. don't use existing words as abbreviations,
unless there are reasons to do so.

Andreas Röhler




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to prevent abbreviation in c comment?
       [not found] ` <mailman.8518.1204914695.18990.help-gnu-emacs@gnu.org>
@ 2008-03-10 19:00   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2008-03-10 19:00 UTC (permalink / raw)
  To: help-gnu-emacs

>> I have defined an abbreviation of  "main" for "int main () {}" in c-mode 
> using
>> skeleton,
>> but I don't want "main" be expanded when it is in c comment blocks, how to?
>> 
>> 
>> -- 
>> sunway
>> 
>> "Never, never, never, never give up."
>> 

> IMO best solution is to redefine your abbrev.

> Maybe, when defining abbrevs, think about how to avoid
> such, i.e. don't use existing words as abbreviations,
> unless there are reasons to do so.

In Emacs-23, abbreviations have been reimplemented and they offer some
new features, including an ability to disable them with a hook.
This was specifically designed so that programming modes can set
this :enable-function to a function that disables the abbreviations in
comments and strings.


        Stefan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-10 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-07 14:59 how to prevent abbreviation in c comment? sunway
2008-03-07 18:33 ` Andreas Röhler
     [not found] ` <mailman.8518.1204914695.18990.help-gnu-emacs@gnu.org>
2008-03-10 19:00   ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).