all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using current style in C?
@ 2013-03-04 15:04 Doug Lewan
  2013-03-04 18:59 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Lewan @ 2013-03-04 15:04 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Once upon a time, I'll swear I read somewhere about being able to configure C-mode to "use the current style", but now I can't find it. I'd like to use such a feature.

That is, upon finding a file, I'd like emacs to examine it and use its indentation style while editing it. 

Does such a feature really exist? (I have been known to make stuff up.) A quick scan of the emacs Wiki didn't reveal anything to me.

Thanks.

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

When I do good, I feel good. When I do bad, I feel bad and that's my religion. - Abraham Lincoln




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

* Re: Using current style in C?
  2013-03-04 15:04 Using current style in C? Doug Lewan
@ 2013-03-04 18:59 ` Stefan Monnier
  2013-03-04 21:38   ` Doug Lewan
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefan Monnier @ 2013-03-04 18:59 UTC (permalink / raw)
  To: help-gnu-emacs

> Once upon a time, I'll swear I read somewhere about being able to configure
> C-mode to "use the current style", but now I can't find it. I'd like to use
> such a feature.

Check c-guess (in cc-guess.el).


        Stefan




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

* RE: Using current style in C?
  2013-03-04 18:59 ` Stefan Monnier
@ 2013-03-04 21:38   ` Doug Lewan
  2013-03-04 22:14   ` "Jérôme M. Berger"
  2013-03-05 12:39   ` Doug Lewan
  2 siblings, 0 replies; 5+ messages in thread
From: Doug Lewan @ 2013-03-04 21:38 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Stefan,

Thank you. 

c-guess looks exactly like what I was thinking about. I won't have any more time today to look at it, but tomorrow morning I will give it a try!

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

When I do good, I feel good. When I do bad, I feel bad and that's my religion. - Abraham Lincoln


> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Stefan Monnier
> Sent: Monday, 2013 March 04 14:00
> To: help-gnu-emacs@gnu.org
> Subject: Re: Using current style in C?
> 
> > Once upon a time, I'll swear I read somewhere about being able to
> configure
> > C-mode to "use the current style", but now I can't find it. I'd like
> to use
> > such a feature.
> 
> Check c-guess (in cc-guess.el).
> 
> 
>         Stefan
> 




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

* Re: Using current style in C?
  2013-03-04 18:59 ` Stefan Monnier
  2013-03-04 21:38   ` Doug Lewan
@ 2013-03-04 22:14   ` "Jérôme M. Berger"
  2013-03-05 12:39   ` Doug Lewan
  2 siblings, 0 replies; 5+ messages in thread
From: "Jérôme M. Berger" @ 2013-03-04 22:14 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

Stefan Monnier wrote:
>> Once upon a time, I'll swear I read somewhere about being able to configure
>> C-mode to "use the current style", but now I can't find it. I'd like to use
>> such a feature.
> 
> Check c-guess (in cc-guess.el).
> 
	Thanks, that could be very useful. However, I just tried adding the
following to my c-mode-hook to configure the style automatically
when I open a file:


(setq c-guess-guessed-basic-offset nil)
(setq c-guess-guessed-offsets-alist nil)
(c-guess-no-install)
(if c-guess-guessed-basic-offset
    (setq c-basic-offset c-guess-guessed-basic-offset))
(if c-guess-guessed-offsets-alist
    (setq c-offsets-alist c-guess-guessed-offsets-alist))


	For some reason, this is horribly slow (takes several minutes to
complete). When I remove those lines and launch c-guess-no-install
interactively with M-x, then it is almost instantaneous (less than
one second). Anybody knows what's happening?

	Thanks,
		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* RE: Using current style in C?
  2013-03-04 18:59 ` Stefan Monnier
  2013-03-04 21:38   ` Doug Lewan
  2013-03-04 22:14   ` "Jérôme M. Berger"
@ 2013-03-05 12:39   ` Doug Lewan
  2 siblings, 0 replies; 5+ messages in thread
From: Doug Lewan @ 2013-03-05 12:39 UTC (permalink / raw)
  To: Stefan Monnier, help-gnu-emacs@gnu.org

Stefan,

c-guess does just what I want (and need to remain socially acceptable). Thanks!

,Douglas
Douglas Lewan
Shubert Ticketing
(201) 489-8600 ext 224

When I do good, I feel good. When I do bad, I feel bad and that's my religion. - Abraham Lincoln


> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Stefan Monnier
> Sent: Monday, 2013 March 04 14:00
> To: help-gnu-emacs@gnu.org
> Subject: Re: Using current style in C?
> 
> > Once upon a time, I'll swear I read somewhere about being able to
> configure
> > C-mode to "use the current style", but now I can't find it. I'd like
> to use
> > such a feature.
> 
> Check c-guess (in cc-guess.el).
> 
> 
>         Stefan
> 




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

end of thread, other threads:[~2013-03-05 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-04 15:04 Using current style in C? Doug Lewan
2013-03-04 18:59 ` Stefan Monnier
2013-03-04 21:38   ` Doug Lewan
2013-03-04 22:14   ` "Jérôme M. Berger"
2013-03-05 12:39   ` Doug Lewan

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.