* How to disable ':' from the electric feature?
@ 2008-03-16 19:45 pierreth
2008-03-16 23:13 ` pierreth
0 siblings, 1 reply; 2+ messages in thread
From: pierreth @ 2008-03-16 19:45 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
I have a problem with the electric feature of emacs when I am writing
in C++. I wrote my switch like this:
switch(value)
case dfsfds:
{
fsdff();
}
break;
While Emacs expect me to write it like this:
switch(value)
case dfsfds:
fsdff();
break;
But this is not my style. Can I disable to the ':' character from the
electric feature?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to disable ':' from the electric feature?
2008-03-16 19:45 How to disable ':' from the electric feature? pierreth
@ 2008-03-16 23:13 ` pierreth
0 siblings, 0 replies; 2+ messages in thread
From: pierreth @ 2008-03-16 23:13 UTC (permalink / raw)
To: help-gnu-emacs
I was able to change the style to be more the way I want:
; Make a non-standard key binding. We can put this in
;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
;; inherit from it.
(defun my-c-initialization-hook ()
(define-key c-mode-base-map "\C-m" 'c-context-line-break))
(add-hook 'c-initialization-hook 'my-c-initialization-hook)
;; offset customizations not in my-c-style
;; This will take precedence over any setting of the syntactic symbol
;; made by a style.
(setq c-offsets-alist '((member-init-intro . ++)))
;; Create my personal style.
(defconst my-c-style
'((c-tab-always-indent . t)
(c-comment-only-line-offset . 4)
(c-hanging-braces-alist . ((substatement-open after)
(brace-list-open)))
(c-hanging-colons-alist . ((member-init-intro before)
(inher-intro)
(case-label after)
(label after)
(access-label after)))
(c-cleanup-list . (scope-operator
empty-defun-braces
defun-close-semi))
(c-offsets-alist . ((arglist-close . c-lineup-arglist)
(substatement-open . 0)
(case-label . 4)
(block-open . 0)
(knr-argdecl-intro . -)))
(c-echo-syntactic-information-p . t))
"My C Programming Style")
(c-add-style "PERSONAL" my-c-style)
;; Customizations for all modes in CC Mode.
(defun my-c-mode-common-hook ()
;; set my personal style for the current buffer
(c-set-style "PERSONAL")
;; other customizations
(setq tab-width 8
;; this will make sure spaces are used instead of tabs
indent-tabs-mode nil)
;; we like auto-newline, but not hungry-delete
(c-toggle-auto-newline 1))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
But I am still having a little problem with the switch:
switch(dsfds)
case fsdfsd:
{
fsdfsdfs;
fsd;
}
break;
case fsfad:
{
}
break;
How can I remove the two spaces just before the first case?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-16 23:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-16 19:45 How to disable ':' from the electric feature? pierreth
2008-03-16 23:13 ` pierreth
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).