(server-start) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(auto-compression-mode t nil (jka-compr)) '(case-fold-search t) '(current-language-environment "Latin-1") '(default-input-method "latin-1-prefix") '(ecb-options-version "2.32") '(global-font-lock-mode t nil (font-lock)) '(save-place t nil (saveplace)) '(w3m-use-cookies t)) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) ;; PO files ;; ;; Ref.: http://www.gnu.org/software/gettext/manual/html_mono/gettext.html ;; DES-HABILITADO porque me daba error. ;; (setq auto-mode-alist ;; (cons '("\\.po\\'\\|\\.po\\." . po-mode) auto-mode-alist)) ;; (autoload 'po-mode "po-mode" "Major mode for translators to edit PO files" t) ;; ;; ;; (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\." ;; 'po-find-file-coding-system) ;; (autoload 'po-find-file-coding-system "po-mode") ;; (set-default-font ;; "-*-Lucidatypewriter-medium-*-*-*-12-*-*-*-*-*-*-*" ;; ; "-adobe-courier-medium-r-normal--*-130-*-*-m-*-iso8859-1" ;; ) (setq running-emacs-23 (> emacs-major-version 22)) (if running-emacs-23 (progn (set-default-font "Bitstream Vera Sans Mono-7") (set-fontset-font (frame-parameter nil 'font) 'han '("cwTeXHeiBold" . "unicode-bmp")) (add-to-list 'default-frame-alist '(font . "Bitstream Vera Sans Mono-7")) ) ) ; Warns for weird stuff -- http://www.emacswiki.org/cgi-bin/wiki/CWarnMode (require 'cwarn) (global-cwarn-mode t) ;; GNU Herds (gnuherds.org) UTF-8 (setq locale-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (set-selection-coding-system 'utf-8) (prefer-coding-system 'utf-8) ;;usenet news (setq gnus-select-method '(nntp "mail.leals.com")) ;; Git -- Reference from: http://www.emacswiki.org/cgi-bin/wiki/Git (setq load-path (cons (expand-file-name "/usr/share/doc/git-core/contrib/emacs") load-path)) (require 'vc-git) (when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git)) (require 'git) (autoload 'git-blame-mode "git-blame" "Minor mode for incremental blame for Git." t) ;;; ;; git ;;; (require 'git) ;;; ;;; ;; git ;;; (add-to-list 'vc-handled-backends 'GIT) ;; desktop.el ;;; desktop-save-mode 1) ;; Customization follows below ;;; setq history-length 250) ;;; add-to-list 'desktop-globals-to-save 'file-name-history) ;; (setq desktop-buffers-not-to-save ;; (concat "\\(" "^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS" ;; "\\|\\.emacs.*\\|\\.diary\\|\\.newsrc-dribble\\|\\.bbdb" ;; "\\)$")) ;; (add-to-list 'desktop-modes-not-to-save 'dired-mode) ;; (add-to-list 'desktop-modes-not-to-save 'Info-mode) ;; (add-to-list 'desktop-modes-not-to-save 'info-lookup-mode) ;; (add-to-list 'desktop-modes-not-to-save 'fundamental-mode) ;; (setq-default save-place t) ;; You want to set this so your bookmark file is saved after each change ;; (setq bookmark-save-flag 1) ;; (add-hook 'kill-buffer-hook (lambda () (when buffer-file-name (bookmark-set buffer-file-name)))) ;; (desktop-load-default) ;; (desktop-read) ;; How to tell emacs to use TAB characters to indent ? ;;; (setq-default indent-tabs-mode t) ;;; (setq indent-tabs-mode t) ;;; (setq tab-width 8) ;;; johnw, how to tell emacs to use 8 to indent ? ;;; davi: which mode are you in? ;;; why do movement keys work the other way on right-to-left text? ;;; Johbe, php ;;; davi: tab-width sets the length of a tab ;;; hmm ;;; i don't know in php ;;; it's c-basic-offset for the cc-mode derived modes ;;; brb ;;; thanks, I am going to try it ;; Set the load path ;;;; (setq load-path (cons "~/.emacs.d" load-path)) ;; Don't make me type out 'yes' and 'no' ;;;; (fset 'yes-or-no-p 'y-or-n-p) ;; Color the code ;;;; (require 'font-lock) ;;;; (global-font-lock-mode t) ;; Set the starting appearance ;;;; (setq default-frame-alist ;;;; '(;;(cursor-color . "Firebrick") ;;;; (cursor-color . "White") ;;;; (cursor-type . box) ;;;; ;;(foreground-color . "White") ;;;; ;;(background-color . "DarkSlateGray") ;;;; (foreground-color . "White") ;;;; (background-color . "Black") ;;;; (vertical-scroll-bars . right))) ;;;; ;;;;Change backup behavior to save in a directory, not in a miscellany ;;;; ;;;;of files all over the place. ;;;; (setq ;;;; backup-by-copying t ; don't clobber symlinks ;;;; backup-directory-alist ;;;; '(("." . "~/.saves")) ; don't litter my fs tree ;;;; delete-old-versions t ;;;; kept-new-versions 6 ;;;; kept-old-versions 2 ;;;; version-control t) ; use versioned backups ;;;; ;;;;Make sure that .emacs file is edited in lisp mode: ;;;; (setq auto-mode-alist (cons '("\.emacs" . lisp-mode) auto-mode-alist)) ;;;; ;;;; (setq default-tab-width 4) ;;;; ;; Fix the worse part about emacs: indentation craziness ;;;; ;; 1. When I hit the TAB key, I always want a TAB character inserted ;;;; ;; 2. Don't automatically indent the line I am editing. ;;;; ;; 3. When I hit C-j, I always want a newline, plus enough tabs to put me on ;;;; ;; the same column I was at before. ;;;; ;; 4. When I hit the BACKSPACE key to the right of a TAB character, I want the ;;;; ;; TAB character deleted-- not replaced with tabwidth-1 spaces. ;;;; (defun newline-and-indent-relative () ;;;; "Insert a newline, then indent relative to the previous line." ;;;; (interactive "*") (newline) (indent-relative)) ;;;; (defun indent-according-to-mode () ()) ;;;; (defalias 'newline-and-indent 'newline-and-indent-relative) ;;;; (defun my-c-hook () ;;;; (defalias 'c-electric-backspace 'delete-backward-char) ;;;; (defun c-indent-command () (interactive "*") (self-insert-command 1))) ;;;; (add-hook 'c-mode-common-hook 'my-c-hook) ;;;; (defun indent-region-with-tab () ;;;; (interactive) ;;;; (save-excursion ;;;; (if (< (point) (mark)) (exchange-point-and-mark)) ;;;; (let ((save-mark (mark))) ;;;; (if (= (point) (line-beginning-position)) (previous-line 1)) ;;;; (goto-char (line-beginning-position)) ;;;; (while (>= (point) save-mark) ;;;; (goto-char (line-beginning-position)) ;;;; (insert "\t") ;;;; (previous-line 1))))) ;;;; ;;(global-set-key [?\C-x tab] 'indent-region-with-tab) ;;;; (global-set-key [f4] 'indent-region-with-tab) ;;;; (defun unindent-region-with-tab () ;;;; (interactive) ;;;; (save-excursion ;;;; (if (< (point) (mark)) (exchange-point-and-mark)) ;;;; (let ((save-mark (mark))) ;;;; (if (= (point) (line-beginning-position)) (previous-line 1)) ;;;; (goto-char (line-beginning-position)) ;;;; (while (>= (point) save-mark) ;;;; (goto-char (line-beginning-position)) ;;;; (if (= (string-to-char "\t") (char-after (point))) (delete-char 1)) ;;;; (previous-line 1))))) ; Moxley's php-mode customizations (require 'php-mode) (defun my-php-mode-common-hook () ;; my customizations for php-mode (setq tab-width 8) (setq c-basic-offset 8) (c-set-offset 'topmost-intro-cont 8) (c-set-offset 'class-open 0) (c-set-offset 'inline-open 0) (c-set-offset 'substatement-open 0) (c-set-offset 'arglist-intro '+) ) (defun pear-php-mode-hook () (setq tab-width 8 c-basic-offset 8 indent-tabs-mode (string-match "\.php$" (buffer-file-name)))) (add-hook 'php-mode-hook 'pear-php-mode-hook) ;;;; ;; Hide password prompts ;;;; (add-hook 'comint-output-filter-functions ;;;; 'comint-watch-for-password-prompt) ;;;; ;; Display the time ;;;; (setq display-time-day-and-date t ;;;; display-time-24hr-format t) ;;;; (display-time) ;; Show the column number (column-number-mode t) ;;;; ;; Key bindings ;;;; (global-set-key [?\C-z] 'shell) ;;;; (global-set-key [?\C-x ?\C-g] 'goto-line) ;;;; (setq temporary-file-directory "/Users/moxleys/tmp") ;;;; (custom-set-faces ;;;; ;; custom-set-faces was added by Custom. ;;;; ;; If you edit it by hand, you could mess it up, so be careful. ;;;; ;; Your init file should contain only one such instance. ;;;; ;; If there is more than one, they won't work right. ;;;; ) ;;;; (custom-set-variables ;;;; ;; custom-set-variables was added by Custom. ;;;; ;; If you edit it by hand, you could mess it up, so be careful. ;;;; ;; Your init file should contain only one such instance. ;;;; ;; If there is more than one, they won't work right. ;;;; '(c-offsets-alist nil)) ;;;; (setq tramp-default-method "ssh") ;;;; (require 'tramp) ;;;; ;;;;"I always compile my .emacs, saves me about two seconds ;;;; ;;;;startuptime. But that only helps if the .emacs.elc is newer ;;;; ;;;;than the .emacs. So compile .emacs if it's not." ;;;; (defun autocompile nil ;;;; "compile itself if ~/.emacs" ;;;; (interactive) ;;;; (require 'bytecomp) ;;;; (if (string= (buffer-file-name) (expand-file-name (concat ;;;; default-directory ".emacs"))) ;;;; (byte-compile-file (buffer-file-name)))) ;;;; ;;;; (add-hook 'after-save-hook 'autocompile) (tool-bar-mode) (setq viper-mode t) (require 'viper) (put 'scroll-left 'disabled nil) ;;; ;; ;;; (require 'mailcrypt-init) ;;========================== cscope ============= ; -*-Emacs-Lisp-*- ;; Usage: ;; M-x bscope-init ;; M-x bscope-find-global-definition ;; comment: ;; Because xcscope.el open a new process of "cscope -L" for each a ;; definition, it's wasting time for reloading cscope and reopening ;; database. It's so slow that I can't bear. So I wrote a simple ;; lisp script using "cscope -l" instead. It saved a lot of time ;; without reloading cscope. ;; Thanks to xcscope.el and Darryl Okahata, I learn a lot from them. ;; There may be a lot of bugs, and no warranty for this script ;; Joy it. ;; Feel free to hack yourself. Just send me your copy. ;; If you find any bugs, please let me know. ;; I don't assure reply for each. ;; My email address is ;; highfly22 at gmail dot com (defun bscope-canonicalize-directory (dir) (or dir (setq dir default-directory)) (setq dir (file-name-as-directory (expand-file-name (substitute-in-file-name dir)))) dir ) ;; (setq default-directory "g:/software/cscope-15.4/src/") ; process name "bscope" ; buffer name "*bscope*" ; program name "cscope" ; option "-l" ;; (start-process "bscope" "*bscope*" "cscope" "-l") ;; (process-send-string "bscope" "1main\n") ;; (process-send-string "bscope" "0yylex\n") ;; (process-send-string "bscope" "\n") (defvar bscope-marker-ring-length 16 ) (defvar bscope-marker-ring (make-ring bscope-marker-ring-length) ) (defun bscope-init (dir) (interactive "DCscope Initial Directory: ") ;; (interactive) (setq default-directory dir) (start-process "bscope" "*bscope*" "cscope" "-l") ;; (set-process-sentinel (get-process "bscope") 'bscope-msg-me) (set-process-filter (get-process "bscope") 'bscope-filter) (with-current-buffer "*bscope*" (accept-process-output (get-process "bscope") 10) (if (looking-at "^cscope: no source files found") (progn (erase-buffer) (message "bscope: no scope.out file here")) (progn (bscope-wait-for-output) (message "bscope: load ok") ) ) ) ) ;; (defun bscope-msg-me (process event) ;; (message ;; (format "Process: %s had the event %s" process event))) (defun bscope-filter (process string) ;; Write the output into the Tramp Process (with-current-buffer (process-buffer process) (save-excursion (goto-char (point-max)) (insert string) )) ) (defun bscope-query (command) (let ((proc (get-process "bscope")) ) (with-current-buffer (process-buffer proc) (goto-char (point-max)) (insert command) (process-send-string "bscope" command) (bscope-wait-for-output ) (bscope-process-output ) ) ) ) ;; (bscope-query "0yylex\n") ;; (bscope-query "0em_receive\n") (defun bscope-find-global-definition (symbol) (interactive (bscope-interactive "Find this global definition: ")) (setq query-command (concat "1" symbol "\n") ) (ring-insert bscope-marker-ring (point-marker)) (bscope-query query-command) ) (defun bscope-interactive (prompt) (list (let (sym) (setq sym (current-word)) (read-string (if sym (format "%s (default %s): " (substring prompt 0 (string-match "[ :]+\\'" prompt)) sym) prompt) nil nil sym) )) ) (defun bscope-process-output () (with-current-buffer "*bscope*" (setq stuff (buffer-substring-no-properties (point) (point-max))) (while (and stuff (string-match "\\([^\n]+\n\\)\\(\\(.\\|\n\\)*\\)" stuff)) (setq line (substring stuff (match-beginning 1) (match-end 1))) (setq stuff (substring stuff (match-beginning 2) (match-end 2))) (if (= (length stuff) 0) (setq stuff nil)) (if (string-match "^\\([^ \t]+\\)[ \t]+\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\(.*\\)\n" line) (progn (let (str) (setq file (substring line (match-beginning 1) (match-end 1)) function-name (substring line (match-beginning 2) (match-end 2)) line-number (string-to-number (substring line (match-beginning 3) (match-end 3)) ) line (substring line (match-beginning 4) (match-end 4)) ) ;; move to new file (switch-to-buffer (find-file file)) (if (> line-number 0) (progn (goto-line line-number) )) ) ) (progn (message "bscope: Sorry, on found") ) )))) (defun bscope-pop-mark() (interactive) (if (ring-empty-p bscope-marker-ring) (error "No previous locations for bscope invocation")) (let ((marker (ring-remove bscope-marker-ring 0))) (switch-to-buffer (or (marker-buffer marker) (error "The marked buffer has been deleted"))) (goto-char (marker-position marker)) (set-marker marker nil nil))) (defun bscope-wait-for-output (&optional timeout) (let ((proc (get-buffer-process (current-buffer))) (found nil) (start-time (current-time)) (start-point (point))) (save-excursion (while (not found) (accept-process-output proc 1) (goto-char (point-max)) ;move the last line (beginning-of-line) ;move the beginning of last line (setq found (looking-at "^>>"))) ;looking for cscope prompt "^>>" ) ) ) (provide 'bscope) (setq inhibit-splash-screen t)