# HG changeset patch # User Oleksandr Gavenko # Date 1281212155 -10800 # Node ID 8515d1e0cc34d0d41a4df82228245acb04618c38 # Parent 0020fc7a24e12febac798f6a2bb4df766be5cb74# Parent a1910375f39e712db16ebc22f51ba10ab6398a16 merged diff -r 0020fc7a24e1 -r 8515d1e0cc34 .emacs-my --- a/.emacs-my Sat Aug 07 22:53:36 2010 +0300 +++ b/.emacs-my Sat Aug 07 23:15:55 2010 +0300 @@ -10,7 +10,7 @@ ;; For load order see README. ;; ====================================================================== -;; debugging. +;; emacs debugging. ;; Shut off message buffer by setting nil. (setq message-log-max 512) @@ -34,9 +34,13 @@ "List of development modes.") (defvar my-devel-mode-hook-list - '(sh-mode-hook script-mode-hook java-mode-hook c-mode-hook - makefile-mode-hook makefile-gmake-mode-hook python-mode-hook - lisp-mode-hook emacs-lisp-mode-hook) + '( + outline-mode-hook + sh-mode-hook script-mode-hook + c-mode-hook c++-mode-hook java-mode-hook + python-mode-hook + makefile-mode-hook makefile-gmake-mode-hook + lisp-mode-hook emacs-lisp-mode-hook) "List of development mode hooks.") (defvar my-scroll-margin-mode-hook-list @@ -87,8 +91,17 @@ (menu-bar-mode -1) (tool-bar-mode -1) -(when (>= emacs-major-version 22) (tooltip-mode -1)) -(scroll-bar-mode 1) +(when window-system + (defun my-popup-menu () + (interactive) + (popup-menu + (mouse-menu-bar-map) ;; (mouse-menu-major-mode-map) + (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name))))) + (global-set-key [f10] 'my-popup-menu) + (global-set-key [apps] 'my-popup-menu) + (when (>= emacs-major-version 22) (tooltip-mode -1)) + (scroll-bar-mode 1) + ) (setq frame-title-format "Emacs - %b") @@ -107,6 +120,7 @@ ;; show column & line numbers in status bar (setq column-number-mode t) (setq line-number-mode t) +(setq size-indication-mode t) ;; Also useful such format: (setq display-time-format " %H:%M %d-%m-%y ") (setq display-time-24hr-format t) @@ -210,6 +224,11 @@ (put 'narrow-to-region 'disabled nil) (put 'scroll-left 'disabled nil) +(setq + use-dialog-box t + x-gtk-show-hidden-files t + ) + ;; ---------------------------------------------------------------------- ;; switching, creating, selecting buffers. @@ -250,7 +269,7 @@ (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) ) ;; ---------------------------------------------------------------------- -;; searching. +;; search, isearch, occur. (setq case-fold-search t) @@ -258,10 +277,6 @@ (setq search-highlight t) ; highlight incremental search ;; ---------------------------------------------------------------------- -;; *Occur* -(global-set-key [f7] 'occur) ; Key binding as in mc - -;; ---------------------------------------------------------------------- ;; grep, find. ;; Assume that we have GNU grep, so -H available. @@ -331,11 +346,10 @@ ;; (pc-bindings-mode) ; Myself define keybinding, see ;; ---------------------------------------------------------------------- -;; completition. +;; completion. -;; partial-completion-mode cause bug in read-file-name with Emacs v22.3.1 (but not with v23.1). -;; read-file-name used in rgrep, so I disable partial-completion-mode. -(partial-completion-mode -1) ; For example, M-x p-c-m expands to M-x partial-completion-mode +;; I remove partial-completion-mode because it depricated in Emacs 24.0. +;; Completion controled by 'completion-styles' variable. ;; ---------------------------------------------------------------------- ;; mouse. @@ -344,7 +358,9 @@ (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag) ;; Paste at point NOT at cursor (setq mouse-yank-at-point t) -(mouse-wheel-mode 1) +(when window-system + (mouse-wheel-mode 1) + ) ;; ---------------------------------------------------------------------- ;; key binding, short-keys. @@ -380,8 +396,9 @@ (global-set-key (kbd "\e\eg") 'goto-line) (global-set-key (kbd "\e\er") 'query-replace-regexp) -;; Disable C-z, it ugly. -(if window-system (global-set-key (kbd "C-z") 'nil)) +;; Disable suspend. It ugly. +(if window-system (global-set-key (kbd "C-z") nil)) +(global-set-key (kbd "C-x C-z") nil) ;; (global-set-key [language-change] 'ignore) @@ -642,6 +659,14 @@ (setq woman-use-own-frame nil) (setq woman-fill-frame t) +;; ---------------------------------------------------------------------- +;; comint + +;; If non-nil, add a `/' to completed directories, ` ' to file names. +(setq comint-completion-addsuffix t) +;; Non-nil means go to the end of the line before sending input. +(setq comint-eol-on-send t) + ;; ====================================================================== ;; shell, sh, bash. @@ -888,10 +913,12 @@ my-devel-mode-hook-list) ;; ---------------------------------------------------------------------- -;; diff, patch. +;; diff, patch, ediff, emerge. (setq diff-switches "-u") +(setq ediff-diff-options "") + ;; ---------------------------------------------------------------------- ;; indenting. @@ -913,11 +940,6 @@ (setq i (- i 4)))) ;; ---------------------------------------------------------------------- -;; diff. - -(setq ediff-diff-options "") - -;; ---------------------------------------------------------------------- ;; *Compile* (setq compile-auto-highlight t @@ -935,6 +957,48 @@ ;; (add-to-list 'compilation-mode-font-lock-keywords '("[ ]\\(/F[oe][^ ]+\\)" . 1)) ;; ---------------------------------------------------------------------- +;; TAGS, etags, ctags, GNU GLOBAL. + +(when (featurep 'etags-table) + (setq etags-table-search-up-depth 1) + ) + +;; ---------------------------------------------------------------------- +;; CEDET, semantic. + +;; For debug use 'semantic-debug-idle-function' and 'semantic-debug-idle-work-function'. +(when (or (and (= emacs-major-version 23) (= emacs-minor-version 2)) + (>= emacs-minor-version 24)) + (semantic-mode 1) + (global-semantic-idle-summary-mode 1) + (global-semantic-idle-scheduler-mode 1) + (setq semantic-idle-scheduler-idle-time 1) ; 1 sec. + (global-semanticdb-minor-mode 1) + (global-semantic-decoration-mode 1) + (global-semantic-mru-bookmark-mode 1) + ;; (global-semantic-idle-completions-mode -1) + ;; (global-semantic-stickyfunc-mode 1) + ;; (setq semantic-stickyfunc-sticky-classes '(function type variable include package)) + + ;; (semantic-add-system-include "~/include" 'c++-mode) + ;; (semantic-add-system-include "~/include" 'c-mode) + ) + +;; ---------------------------------------------------------------------- +;; imenu. + +(require 'imenu) +(when window-system + (mapc (lambda (hook) + (add-hook hook + (lambda () + (imenu-add-menubar-index) + (run-hooks 'menu-bar-update-hook) + ) )) + my-devel-mode-hook-list) + ) + +;; ---------------------------------------------------------------------- ;; windows inf files for driver installing (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode)) @@ -1024,9 +1088,20 @@ (c-echo-syntactic-information-p . t)) "My C Programming Style") -(add-hook 'c-mode-common-hook - (lambda () (c-add-style "my" my-c-style t))) -(setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") (other . "my"))) +(add-hook + 'c-mode-common-hook + '(lambda () + (c-add-style "my" my-c-style t) + ;; If set 'c-default-style' before 'c-add-style' + ;; "Undefined style: my" error occured from 'c-get-style-variables'. + (setq c-default-style + '( + (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") + (awk-mode . "awk") + (other . "my") + )) + )) + ;; ---------------------------------------------------------------------- ;; bat file, batch, loaded from 'generic-x.el'. @@ -1047,53 +1122,20 @@ ;; ---------------------------------------------------------------------- ;; java. -;; Update the Emacs load-path to include the path to -;; the JDE and its require packages. This code assumes -;; that you have installed the packages in the emacs/site -;; subdirectory of your home directory. -;; (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic")) -;; (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar")) -;; (add-to-list 'load-path (expand-file-name "~/emacs/site/elib-1.0")) -;; (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio")) -;; (add-to-list 'load-path (expand-file-name "~/emacs/site/jde-2.3.5.1/lisp")) +;; If you want Emacs to defer loading the JDE until you open a Java file, edit +;; the following line: -;; Load CEDET -;; (load-file "~/emacs/site/common/cedet.el") -;; Enabling SEMANTIC minor modes. See semantic/INSTALL for more ideas. -;; (semantic-load-enable-code-helpers) - -;; If you want Emacs to defer loading the JDE until you open a -;; Java file, edit the following line -;; (setq defer-loading-jde nil) -;; to read: -;; -;; (setq defer-loading-jde t) -;; - +;; (setq defer-loading-jde t) ;; (if defer-loading-jde ;; (progn ;; (autoload 'jde-mode "jde" "JDE mode." t) ;; (add-to-list 'auto-mode-alist '("\\.java\\'" . jde-mode)) ;; (require 'jde))) - -;; Sets the basic indentation for Java source files -;; to two spaces. -;; (defun my-jde-mode-hook () -;; (setq c-basic-offset 2)) - -;; (add-hook 'jde-mode-hook 'my-jde-mode-hook) - -;; (require 'jde) - ;; ---------------------------------------------------------------------- ;; ECB. (setq ecb-tip-of-the-day nil) -;; (add-to-list 'load-path "~/emacs/site/ecb-2.32") -;; (require 'ecb) - -;; (global-set-key (kbd "\e\eE") 'ecb-activate) ;; ---------------------------------------------------------------------- ;; html. @@ -1106,6 +1148,11 @@ (setq sgml-set-face t) ; for highlighting in sgml +;; ---------------------------------------------------------------------- +;; sh, bash. + +(add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode)) + ;; ====================================================================== ;; printing. @@ -1156,7 +1203,8 @@ (setq make-backup-files t - backup-by-copying t ; don't clobber symlinks + ;; In other case (by renaming) you loose original file creation date. + backup-by-copying t backup-directory-alist '(("." . "~/.backup")) ; don't litter my fs tree delete-old-versions t ; delete excess backup versions silently kept-old-versions 1 ; store first original version