* using the cc mode @ 2005-07-30 19:29 Baloff 2005-07-30 23:30 ` Alan Mackenzie 0 siblings, 1 reply; 4+ messages in thread From: Baloff @ 2005-07-30 19:29 UTC (permalink / raw) Hello when I am writing stuff in a .cpp file, emacs is using the cc mode by default? correct in the mode line I have (C++/ah Abbrev Fill). If I have stuff in my .emacs, does that cancel the default cc mode or adds to it? not before I study emacs and Lisp in more details will I be able to answer my question. so here is my .emacs .......... many thanks (load "~/.emacs-mc394") ;; This defines the mc304-style. We put it in a ;; load file so that we can use it or not, as needed (add-hook 'octave-mode-hook '(lambda () (local-set-key [f9] 'octave-send-line))) (add-hook 'c++-mode-hook '(lambda () (turn-on-auto-fill) ;;Insert a newline if line gets to long. (c-toggle-auto-state 1) ;;Make ; and { and } and : all electric (c-set-style "mc394-style"))) ;; Color highlighting stuff (defvar xemacs-p (string-match "XEmacs" emacs-version)) (if (not xemacs-p) (progn (global-font-lock-mode t) ; If using global-font-lock-mode, make control-L update colors (global-set-key "\C-l" (function (lambda (arg) (interactive "P") (font-lock-fontify-block 100) (recenter arg)))))) (setq auto-mode-alist (append '(("\\.h$" . c++-mode)) auto-mode-alist)) (setq auto-mode-alist (append '( ("configure.in" . m4-mode) ("\\.m4\\'" . m4-mode) ("\\.am\\'" . makefile-mode)) auto-mode-alist)) (defun other-window-backward (&optional n) "Select Nth previous window" (interactive "P") (other-window (- (prefix-numeric-value n)))) (global-set-key "\C-x\C-p" 'other-window-backward) (windmove-default-keybindings) (global-set-key [f5] 'cut-ctrlM) ; cut all ^M. (defun cut-ctrlM () "Cut all visible ^M." (interactive) (beginning-of-buffer) (while (search-forward "\r" nil t) (replace-match "" nil t)) ) (global-set-key [f6] 'setnu-mode) ;set-number use twice after C-y (global-set-key "\C-x\C-b" 'buffer-menu) ;binds the key C-x C-b to buffer-menu (global-set-key [f7] (kbd "M-h C-c C-c")) ;comment region (global-set-key [f8] (kbd "M-h C-u C-c C-c")) ;uncomment region (global-set-key [f11] 'compile) ;compiles a program (global-set-key [f12] 'clipboard-kill-ring-save);copy marked region to Primary Selection, M-w copies to Clipboard, middle mouse botton to paste Primary, M-y pastes the clipboard contents (setq user-full-name "Baloff") (setq user-mail-address "washdc@wash.edu") (setq fill-column 70) ;Text lines limited to 70 chars (setq make-backup-files nil) ;don't make backup files (setq kill-whole-line t) ;killing line also deletes \n (setq next-line-add-newlines nil) ;down arror won't add \n at end (setq line-number-mode t) ;put line number in display (setq column-number-mode t) ;put column number in display (setq inhibit-startup-message t) ;disable startup message (setq display-time-24hr-format t) ;display 24h time formate (display-time) (setq transient-mark-mode t) ;highlight marked (setq default-major-mode 'text-mode) ;new buffers are text mode (add-hook 'text-mode-hook 'turn-on-auto-fill) ;line limit in text mode (add-hook 'text-mode-hook 'flyspell-mode t) ; check spelling (add-hook 'text-mode-hook 'text-mode-hook-identify) (setq scroll-step 1) ;scroll 1 line at a time (setq-default visible-bell t) ; no beeps, flash on errors (setq semantic-load-turn-useful-things-on t) ;; Replace the path below with the install location. (load-file "/usr/share/emacs/site-lisp/cedet-common/cedet.el") (setq semanticdb-project-roots (list "/Exercies/ThinkingInC++/Vol1/C03/9/main.cpp" "/Exercies/ThinkingInC++/Vol1/C03/8/main.cpp" "/Exercies/ThinkingInC++/Vol1/C03/7/main.cpp" "/Exercies/ThinkingInC++/Vol1/C03/6/main.cpp")) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on);ls not show ^[[0m (add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt) ;don't show password (defun htv-horizontal-to-vertical () ;makes a vertical split along the horisontal line (interactive) (let ((one-buf (window-buffer (selected-window))) (buf-point (point))) (other-window 1) (delete-other-windows) (split-window-horizontally) (switch-to-buffer one-buf) (goto-char buf-point))) (defun vth-vertical-to-horizontal () ;makes a vertical split along the horisontal line (interactive) (let ((one-buf (window-buffer (selected-window))) (buf-point (point))) (other-window 1) (delete-other-windows) (split-window-vertically) (switch-to-buffer one-buf) (goto-char buf-point))) (add-hook 'c++-mode-hook 'setnu-mode) ;line numbers (add-hook 'c++-mode-hook 'bar-cursor-mode) ;cursor to a bar (add-hook 'c++-mode-hook 'show-paren-mode) ;marrying brackets show (require 'xcscope) ;"$man cscope" for more info (custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(ecb-options-version "2.27")) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. ) ;; Modified by Mike Hvidsten from MC38J emacs file ;; Feb. 4, 2004 (c-add-style "mc394-style" '("cc-mode" (c-basic-offset . 3) ; In general, indent 3 spaces (c-hanging-braces-alist (defun-open after)) ; brace that opens a function definition (c-cleanup-list brace-else-brace brace-elseif-brace empty-defun-braces defun-close-semi scope-operator) (c-hanging-braces-alist ; These determine whether a newline appears before ; and/or after a brace in various situations. (brace-list-open) (block-open after) ; statement block open brace (defun-open after) ; brace that opens a function definition (substatement-open after); the brace that opens a substatement block (block-close . c-snug-do-while)) (c-hanging-colons-alist (access-label after)) ; Newline after protected: or private: (c-hungry-delete-key t))) ; delete black space all at once ;; Variable should be t if we are running xemacs. (defvar xemacs-p (string-match "XEmacs" emacs-version)) (if (not xemacs-p) (progn (global-font-lock-mode t) ; If using global-font-lock-mode, make control-L update colors (global-set-key "\C-l" (function (lambda (arg) (interactive "P") (font-lock-fontify-block 100) (recenter arg)))))) (setq auto-mode-alist (append '(("\\.h$" . c++-mode)) auto-mode-alist)) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: using the cc mode 2005-07-30 19:29 using the cc mode Baloff @ 2005-07-30 23:30 ` Alan Mackenzie 2005-07-31 3:09 ` Baloff 0 siblings, 1 reply; 4+ messages in thread From: Alan Mackenzie @ 2005-07-30 23:30 UTC (permalink / raw) Baloff <washdc@wash.edu> wrote on 31 Jul 2005 05:29:34 +1000: > Hello > when I am writing stuff in a .cpp file, emacs is using the cc mode by > default? correct in the mode line I have (C++/ah Abbrev Fill). If I > have stuff in my .emacs, does that cancel the default cc mode or adds > to it? CC Mode is a collection of 7 similar modes, of which C++ Mode is one. (The others are C, Java, Objective C, IDL, Pike and AWK.) The stuff in your .emacs _configures_ CC Mode in two ways: It makes the defaults for indentation, etc., conform to your team's coding standards, and it sets up your own personal preferences (things like Auto New Line.) > not before I study emacs and Lisp in more details will I be able to > answer my question. A study which I earnestly urge you to embark upon. Lisp is a much nicer, more regular language than C or C++, and higher level, too. You asked in another thread about making an "enum {" insert an auto-newline. I'll get back to you on that one. :-) [ .... ] -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a"). ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: using the cc mode 2005-07-30 23:30 ` Alan Mackenzie @ 2005-07-31 3:09 ` Baloff 2005-07-31 8:47 ` Alan Mackenzie 0 siblings, 1 reply; 4+ messages in thread From: Baloff @ 2005-07-31 3:09 UTC (permalink / raw) Alan Mackenzie <acm@muc.de> writes: > Baloff <washdc@wash.edu> wrote on 31 Jul 2005 05:29:34 +1000: > > > Hello > > A study which I earnestly urge you to embark upon. Lisp is a much nicer, > more regular language than C or C++, and higher level, too. it may be as you described it, but what about efficiency? its use in the scientific/academic circle? mission critical applications... etc > > You asked in another thread about making an "enum {" insert an > auto-newline. I'll get back to you on that one. :-) > thanks allot, I applicate your help. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: using the cc mode 2005-07-31 3:09 ` Baloff @ 2005-07-31 8:47 ` Alan Mackenzie 0 siblings, 0 replies; 4+ messages in thread From: Alan Mackenzie @ 2005-07-31 8:47 UTC (permalink / raw) Baloff <washdc@wash.edu> wrote on 31 Jul 2005 13:09:28 +1000: > Alan Mackenzie <acm@muc.de> writes: >> Baloff <washdc@wash.edu> wrote on 31 Jul 2005 05:29:34 +1000: >> > Hello >> A study which I earnestly urge you to embark upon. Lisp is a much >> nicer, more regular language than C or C++, and higher level, too. > it may be as you described it, but what about efficiency? its use in > the scientific/academic circle? mission critical applications... etc Efficiency, as in Whetstones, Dhrystones, Rhollingstones, and so on, is not Lisp's thing - it's (usually) an interpreted language. As for the scientific/academic circle, I don't really know, but I'd think so. And I don't know what a "mission critical application" is. :-) No, the thing about Lisp is its culture and history. It goes back to 1957, when processing speeds were measured in kHz, not GHz, and core store was a few thousand 36-words of little iron beads threaded on wires, and RMS was just another little boy. And if computer programming still exists in 2057, Lisp probably has a better chance of surviving through till then than any of the thousands of other Johnny-come-lately languages which have popped up in the last few decades. If you learn Lisp, you'll get a good insight into just how badly designed most other programming languages are. Get Lisp onto your CV, and you'll be making the statement to your next employer "I am a man of culture, an island of stability in the maelstrom of chaos, a possessor of shrewd judgement, somebody who takes the long sober view, unswayed by the vagaries of transient fashion." And, of course, you'll be able to use Emacs more effectively. -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a"). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-31 8:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-07-30 19:29 using the cc mode Baloff 2005-07-30 23:30 ` Alan Mackenzie 2005-07-31 3:09 ` Baloff 2005-07-31 8:47 ` Alan Mackenzie
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).