* Emacs and C source files
@ 2006-11-10 12:01 bcochofel
0 siblings, 0 replies; only message in thread
From: bcochofel @ 2006-11-10 12:01 UTC (permalink / raw)
Hi, I use emacs to edit all my code in different languages and I get this
weard behavior when I use .c files, my CPU goes to 99% busy while the .c
file is open.
Here's my .emacs file:
-------------------------------------------------------------------------------------------------------------------
;;; Ficheiro de configuracao do emacs
;;; seccao de configuracao
;;; ----------------------
;; email
(setq user-mail-address "bc@domain.pt")
;; load dos ficheiros lisp
;; plataforma Dos-Windows
;(setq load-path (cons (expand-file-name "c:/.emacs.d/lisp") load-path))
;; plataforma Linux
(setq load-path (cons (expand-file-name "~/.emacs.d/lisp") load-path))
;; syntax colorization
(if (fboundp 'global-font-lock-mode)
(global-font-lock-mode 1) ; GNU Emacs
(setq font-lock-auto-fontify t)) ; XEmacs
;(global-font-lock-mode t)
;; transient mark mode - fill region
(setq transient-mark-mode 1)
;; hitting delete will delete the highlighted region
(pending-delete-mode 1)
;; Always end a file with a newline
(setq require-final-newline t)
;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
;; don't show the startup message every time, I know I'm using emacs
(setq inhibit-startup-message t)
;; use y or n instead of yes or no
(fset 'yes-or-no-p 'y-or-n-p)
'(ispell-program-name "aspell")
;Agora tornando o dicionario brasileiro como o default
(setq ispell-dictionary "portuguese")
;;; Text mode and Auto Fill mode
;; The next three lines put Emacs into Text mode
;; and Auto Fill mode, and are for writers who
;; want to start writing prose rather than code.
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'text-mode-hook-identify)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; line number mode
(line-number-mode 1)
;; column number mode
(column-number-mode 1)
;; 2 spaces after a colon
(setq colon-double-space t)
;;; seccao de diario/calendario
;;; ---------------------------
;(setq diary-file "~/diario")
;(setq european-calendar-style t)
;; para gerar alertas de apontamentos
;(display-time)
;(add-hook 'diary-hook 'appt-make-list)
;(diary 0)
;;; seccao para programacao em perl
;;; -------------------------------
;; cperl-mode instead of perl-mode
(mapc
(lambda (pair)
(if (eq (cdr pair) 'perl-mode)
(setcdr pair 'cperl-mode)))
(append auto-mode-alist interpreter-mode-alist))
;; cperl-mode is preferred to perl-mode
;; "Brevity is the soul of wit" <foo at acm.org>
(defalias 'perl-mode 'cperl-mode)
;; expand keywords
(setq cperl-electric-keywords t) ;; expands for keywords such as
;; foreach, while, etc...
;;; seccao para programacao em c
;;; ----------------------------
(require 'cc-mode)
;; comment column
(setq-default comment-column 70)
;; hungry delete
(c-toggle-hungry-state 1)
;; c warn mode
(global-cwarn-mode t)
;; definicao do estilo
(add-hook 'c-mode-common-hook
'(lambda () (c-set-style "linux")
(c-set-offset 'case-label 4)
(setq c-basic-offset 4
tab-width 4
indent-tabs-mode t)))
;; hide-ifdef-mode automatico
(add-hook 'c-mode-common-hook '(lambda() (hide-ifdef-mode 1)))
;;; compilacao
;; tamanho da janela de compilacao
(setq compilation-window-height 8)
;; scroll automatico da janela de compilacao
(setq compilation-scroll-output 1)
;; janela de compilacao fecha automaticamente se
;; nao ocorrerem erros
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;;there were errors
(message "compilation errors, press C-x ` to visit")
;;no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "NO COMPILATION ERRORS!"))))
;;; debug
;; estilo de janelas para o gdb
(setq gdb-many-windows 1)
;;; seccao para o cedet
;;; -------------------
;; Load CEDET
(load-file "~/.emacs.d/lisp/cedet-1.0pre3/common/cedet.el")
;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more
ideas.
;; Select one of the following
(semantic-load-enable-code-helpers)
;; (semantic-load-enable-guady-code-helpers)
;; (semantic-load-enable-excessive-code-helpers)
;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)
;; Load ECB
(add-to-list 'load-path
"~/.emacs.d/lisp/ecb")
(require 'ecb)
;; Load Doxygen comments
(require 'doxygen)
;; Load Templates
(require 'template)
(template-initialize)
;;; seccao programacao para latex
;;; -----------------------------
;; auctex
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
; multiple files
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
;;; seccao programacao para a web
;;; -----------------------------
;; programacao em javascript
(require 'javascript-mode)
;; programacao em php
(require 'php-mode)
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
(add-hook 'php-mode-user-hook
'(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends")))
;; programacao css
(autoload 'css-mode "css-mode" "Mode for editing CSS files" t)
(setq auto-mode-alist
(append '(("\\.css$" . css-mode))
auto-mode-alist))
;; programacao psgml
;(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
;(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
;; nxml-mode
(load "~/.emacs.d/lisp/nxml/rng-auto.el")
(add-to-list 'auto-mode-alist
(cons (concat "\\." (regexp-opt '("xml" "xsd" "sch" "rng"
"xslt" "svg" "rss") t) "\\'")
'nxml-mode))
(unify-8859-on-decoding-mode)
(setq magic-mode-alist
(cons '("<\\?xml " . nxml-mode)
magic-mode-alist))
(fset 'xml-mode 'nxml-mode)
; para editar html no modo nxml-mode
;(fset 'html-mode 'nxml-mode)
;; programacao multi mode
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
;;************************************************************
;; configure HTML editing
;;************************************************************
;;
;(require 'php-mode)
;;
;; configure css-mode
;(autoload 'css-mode "css-mode")
;(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level '2)
;;
;(add-hook 'php-mode-user-hook 'turn-on-font-lock)
;;
;(require 'mmm-mode)
;(setq mmm-global-mode 'maybe)
;;
;; set up an mmm group for fancy html editing
(mmm-add-group
'fancy-html
'(
(html-php-tagged
:submode php-mode
:face mmm-code-submode-face
:front "<[?]php"
:back "[?]>")
(html-css-attribute
:submode css-mode
:face mmm-declaration-submode-face
:front "style=\""
:back "\"")))
;;
;; What files to invoke the new html-mode for?
(add-to-list 'auto-mode-alist '("\\.inc\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.php[34]?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.[sj]?html?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))
;;
;; What features should be turned on in this html-mode?
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil html-js))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-css))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html))
;;
;; Not exactly related to editing HTML: enable editing help with mouse-3 in
all sgml files
;(defun go-bind-markup-menu-to-mouse3 ()
; (define-key sgml-mode-map [(down-mouse-3)] 'sgml-tags-menu))
;;
;(add-hook 'sgml-mode-hook 'go-bind-markup-menu-to-mouse3)
(set-face-background 'mmm-default-submode-face nil)
;;; seccao de definicao das teclas de atalho
;;; ----------------------------------------
(global-set-key [f1] 'help)
(global-set-key [f2] 'tmm-menubar)
(global-set-key [f3] 'tags-search)
(global-set-key [f4] 'complete-symbol)
(global-set-key [f5] 'point-to-register)
(global-set-key [f6] 'jump-to-register)
(global-set-key [f7] 'hexl-mode)
(global-set-key [f8] 'perl-mode)
(global-set-key [f9] 'compile)
(global-set-key [f10] 'kill-compilation)
(global-set-key [f11] 'next-error)
(global-set-key [f12] 'add-change-log-entry-other-window)
-------------------------------------------------------------------------------------------------------------------
Can someone help me with this?
Thanks,
Bruno
--
View this message in context: http://www.nabble.com/Emacs-and-C-source-files-tf2607249.html#a7275598
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-11-10 12:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-10 12:01 Emacs and C source files bcochofel
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.