;; -*-emacs-lisp-*- ;; ;; My .emacs: ;; Alvaro Lopez Ortega ;; ;; Modified and Composed from: ;; ;; Gunnar Wolf ;; Alvaro Lopez ;; K. Arun ;; Chema Celorio ;; Miguel de Icaza ;; Mattias Nyrell 199911 ;; .. ;; My info ;; (setq user-full-name "Alvaro Lopez Ortega") (setq user-mail-address "alvaro@alobbs.com") ;; Set the short-cut keys ;; (define-key global-map [f1] (lambda () (interactive) (manual-entry (current-word)))) ;; Help (define-key global-map [f2] 'gdb) (define-key global-map [f3] 'kill-buffer-fast) ;; Close (define-key global-map [f4] 'goto-line) ;; Goto line (define-key global-map [f5] 'other-window) (define-key global-map [f7] 'replace-string) ;; Replace (define-key global-map [f9] 'undo) ;; Undo (define-key global-map [f10] 'compile) ;; Compile (define-key global-map [f11] 'next-error) ;; Error (define-key global-map [f12] 'add-change-log-entry-other-window) ;; Changelog ;; Fix 'home' and 'end' keys ;; ( global-set-key [home] 'beginning-of-line) ( global-set-key [end] 'end-of-line) ;; Set Meta + P to next error ;; ( global-set-key "\M-p" 'next-error) ;; yes -> y, no -> n ;; (fset 'yes-or-no-p 'y-or-n-p) ;; Make control+pageup/down scroll the other buffer ;; (global-set-key [C-next] 'scroll-other-window) (global-set-key [C-prior] 'scroll-other-window-down) ;; Dont show the GNU splash screen ;; (setq inhibit-startup-message t) ;; Make all "yes or no" prompts show "y or n" instead ;; (fset 'yes-or-no-p 'y-or-n-p) ;; Paste at point NOT at cursor ;; ; (setq mouse-yank-at-point 't) ;; Open unidentified files in text mode ;; (setq default-major-mode 'text-mode) ;; Windows-like selection ;; ; (pc-selection-mode) ;; Automagically read compressed files ;; (auto-compression-mode 1) ;; Display clock ;; (display-time) ;; Auto fill in all major modes ;; ;; (setq-default auto-fill-function 'do-auto-fill) ;; Compile command line to use : ;; (setq compile-command "make CFLAGS=\"-O0 -g3 -Wall\" -j3") ;; over the filesystem. ;; (defun make-backup-file-name (file-name) "Create the non-numeric backup file name for `file-name'." (require 'dired) (if (file-exists-p "~/.backups") (concat (expand-file-name "~/.backups/") (dired-replace-in-string "/" "|" file-name)) (concat file-name "~"))) ;; tab, colour, and misc options ;; (custom-set-variables '(compilation-window-height 6 t) '(c-default-style "K&R") '(line-number-mode t) '(font-lock-maximum-decoration t) '(c-progress-interval 8) '(auto-revert-stop-on-user-input nil) '(compilation-scroll-output t) '(tab-width 5) '(compilation-ask-about-save nil t) '(c-basic-offset 8) '(c-tab-always-indent (quote other)) '(font-lock-support-mode (quote jit-lock-mode)) '(delete-old-versions t) '(standard-indent 8) '(auto-revert-interval 2) '(column-number-mode t) '(indent-tabs-mode t) '(next-line-add-newlines nil) '(global-font-lock-mode t nil (font-lock)) '(global-auto-revert-mode t nil (autorevert)) '(font-lock-global-modes t) '(gdb-many-windows t) ) ;; disable line split (setq fill-column nil) ;; disable any noice ;; (setq bell-volume 0) (setq visible-bell t) ;; hide the menu bar ;; (menu-bar-mode nil) (tool-bar-mode nil) (setq menubar-visible-p nil) (setq default-toolbar-visible-p nil) ;; hide the scroll bar ;; (scroll-bar-mode nil) ;; Useful function: ;; convert dos (^M) end of line to unix end of line (defun dos2unix() (interactive) (goto-char(point-min)) (while (search-forward "\r" nil t) (replace-match ""))) ;; Useful function: ;; unix2dos (defun unix2dos() (interactive) (goto-char(point-min)) (while (search-forward "\n" nil t) (replace-match "\r\n"))) ;; Useful function: ;; Insert date into buffer (defun insert-date () "Insert date at point." (interactive) (insert (format-time-string "%A, %B %e, %Y %k:%M:%S %z"))) ;; Useful function: ;; Compute the length of the marked region (defun region-length () "length of a region" (interactive) (message (format "%d" (- (region-end) (region-beginning))))) ;; Active the mouse wheel: ;; Add scrolling with mouse (mouse-wheel-mode) (global-set-key [mouse-4] '(lambda () (interactive) (scroll-down 5))) (global-set-key [mouse-5] '(lambda () (interactive) (scroll-up 5))) (global-set-key [S-mouse-4] '(lambda () (interactive) (scroll-down 1))) (global-set-key [S-mouse-5] '(lambda () (interactive) (scroll-up 1))) (global-set-key [C-mouse-5] '(lambda () (interactive) (scroll-up (/ (window-height) 2)))) (global-set-key [C-mouse-4] '(lambda () (interactive) (scroll-down (/ (window-height) 2)))) ;; Carbon Emacs: OS X ;; (when (featurep 'mac-carbon) ;; Look and Feel (setq default-frame-alist '( (cursor-color . "red") (cursor-type . box) (foreground-color . "lightcyan") (background-color . "#001125") (font . "-*-Courier-medium-*-*--12-*") )) ;; Spell program (setq ispell-really-aspell t) (setq ispell-program-name "/usr/local/bin/aspell") (setq ispell-extra-args '("-d" "/Library/Application Support/cocoAspell/aspell6-en-6.0-0/en.multi")) (setenv "ASPELL_CONF" nil) ;; Mouse (setq mac-emulate-three-button-mouse nil) (global-set-key [wheel-up]'(lambda ()(interactive)(scroll-down 2))) (global-set-key [wheel-down]'(lambda ()(interactive)(scroll-up 2))) (setq mouse-wheel-scroll-amount '(2.1)) ) (setq w32-pass-lwindow-to-system 'control) (setq w32-lwindow-modifier 'control) ;(autoload 'nuke-trailing-whitespace "nuke-trailing-whitespace" nil t) ;(add-hook 'mail-send-hook 'nuke-trailing-whitespace) ;(add-hook 'write-file-hooks 'nuke-trailing-whitespace) ;; Prevent flyspell from finding mistakes in the code. ;; From Jim Meyering. (add-hook 'c-mode-hook 'flyspell-prog-mode 1) (add-hook 'c++-mode-hook 'flyspell-prog-mode 1) (add-hook 'cperl-mode-hook 'flyspell-prog-mode 1) (add-hook 'autoconf-mode-hook 'flyspell-prog-mode 1) (add-hook 'autotest-mode-hook 'flyspell-prog-mode 1) (add-hook 'sh-mode-hook 'flyspell-prog-mode 1) (add-hook 'makefile-mode-hook 'flyspell-prog-mode 1) (add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode 1)