help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with cc-mode style


From: exits funnel
Subject: Trouble with cc-mode style
Date: Tue, 2 Mar 2004 14:14:41 -0800 (PST)

Hello,

I've recently bugun using Emacs to edit C++.  A couple
of weeks ago, I added the following to my .emacs:

;; BEGIN OLD STUFF
 (defun ef-cish-setup ( )
   (message "exit: In ef-cish-setup( )")
   (setq c-basic-offset 2)
   (setq c-default-style "bsd"))

 (add-hook 'c-mode-hook 'ef-cish-setup)
 (add-hook 'c++-mode-hook 'ef-cish-setup)
 (add-hook 'java-mode-hook 'ef-cish-setup)


 (require 'cc-mode)
 (c-set-offset 'substatement-open 0)
 (c-set-offset 'block-open 0)
 (c-set-offset 'statement-cont 0)
 (c-set-offset 'access-label '*)
 (c-set-offset 'inclass '+)
 (c-set-offset 'topmost-intro '+)
 (c-set-offset 'inline-open '+)
;; END OLD STUFF

It worked pretty well but now I've decided I'd like to
create an explicit style because, well, why not. 
Here's what my .emacs looks like now:

;; BEGIN NEW STUFF
(require 'cc-mode)     
(defconst exits-c++-style
 '(
    (c-offsets-alist . (
                         (substatement-open . 0)
                         (block-open        . 0)
                         (statement-cont    . 0)
                         (access-label      . '*)
                         (inclass           . '+)
                         (topmost-intro     . '+)
                         (inline-open       . '+)
                       )
    )
    (c-echo-syntactic-information-p . t)
  )
  "exit's C++ Programming Style Comment"
)

(defun exits-c-mode-common-hook ()
  (message "In exits-c-mode-common-hook")
  (c-add-style "exits-c++-style" exits-c++-style t)
  (global-set-key "\C-ci" 'c-indent-line-or-region)  
)
    
(add-hook 'c-mode-common-hook
'exits-c-mode-common-hook)

;;C++ Hook
(defun ef-c++-setup ( )
  (message "exit: In ef-c++-setup( )")
  (c-set-style exits-c++-style)
)
(add-hook 'c++-mode-hook 'ef-c++-setup)
;; END NEW STUFF

I've been playing with this stuff all day but I can't
seem to get it working.  When I start emacs and visit
a C++ file I get an error in the mini buffer which
complains about: 'wrong-type-argument
char-or-string-p' I'd paste the whole message but I
can't figure out how to get the stuff out of the
mini-buffer.   I've read most or all of the cc-mode
info but I still have a number of questions.

1) What's wrong with my style that causes the
wrong-type-argument error?
2) Is there any further documentation anywhere on
creating styles?  The cc-mode info stuff documents how
styles interact with cc-mode and gives an example
style but doesn't seem to really cover creating a
style explicitly
3) How can I make my style 'inherit' from the 'bsd'
style.  I seem to recall reading that one could do
this but I can't figure out how to do it?
4) This is completely off-topic to the rest of the
mail but what the heck: what can add to my .emacs file
to force emacs to maximize immediatly after it's
started?  I googled a bit and oddly found several
references to how to do it on w32 but came up empty
with respect to Linux.  

Thanks in advance for any replies and I apologize for
being so long-windeed.

-exits


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]