Added outline-mode-hook to my-devel-mode-hook-list.
;; -*- mode: lisp; coding: utf-8; fill-column: 78 -*-
;;
;; Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008-2010.
;;
;; This file formed from parts and ideas from many sites/docs and
;; placed in public domain.
;;
;; Config file for GNU Emacs.
;;
;; For load order see README.
;; ======================================================================
;; debugging.
;; Shut off message buffer by setting nil.
(setq message-log-max 512)
;; Set the debug option to enable a backtrace when a problem occurs.
(setq debug-on-error nil) ; t/nil
;; ----------------------------------------------------------------------
;; mode groups
(defvar my-devel-mode-list
'(
outline-mode
sh-mode script-mode
c-mode c++-mode java-mode
python-mode
lisp-mode
emacs-lisp-mode
makefile-mode makefile-gmake-mode
)
"List of development modes.")
(defvar my-devel-mode-hook-list
'(
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
'(
vc-dir-mode-hook
recentf-dialog-mode-hook
org-agenda-grid-mode-hook ; XXX for this item not worked!
log-view-mode-hook
diff-mode-hook
dired-mode-hook
compilation-mode-hook
)
"List of mode hooks for enabling scroll margin.")
(defvar my-text-mode-list
'(outline-mode text-mode)
"List of text modes.")
(defvar my-text-mode-hook-list
'(outline-mode-hook text-mode-hook)
"List of text mode hooks.")
;; ======================================================================
;; appearance.
(setq default-directory "~/")
;; To maximize frame on full screen, not work with Windows Emacs 21.4.
;; And maked different height with Emacs 22.3 and 23.1.
;; (setq initial-frame-alist '((fullscreen . fullboth)))
;; Next code work with Emacs 21.4, 22.3, 23.1.
(when window-system
(let (
(px (display-pixel-width))
(py (display-pixel-height))
(fx (frame-char-width))
(fy (frame-char-height))
tx ty
)
;; Next formulas discovered empiric on Windows host with default font.
(setq tx (- (/ px fx) 7))
(setq ty (- (/ py fy) 4))
(setq initial-frame-alist '((top . 0) (left . 0)))
(add-to-list 'initial-frame-alist (cons 'width tx))
(add-to-list 'initial-frame-alist (cons 'height ty))
) )
(menu-bar-mode -1)
(tool-bar-mode -1)
(when window-system
(when (>= emacs-major-version 22) (tooltip-mode -1))
(scroll-bar-mode 1)
)
(setq frame-title-format "Emacs - %b")
(setq default-header-line-format nil)
;; (setq default-mode-line-format nil)
(setq default-left-fringe-width nil)
(setq default-right-fringe-width nil)
(setq default-left-margin-width nil)
(setq default-right-margin-width nil)
(setq default-line-spacing nil)
(setq default-truncate-lines nil)
;; 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)
(setq display-time-default-load-average nil)
(display-time) ; display-time-mode
(if window-system
;; For graphical environment.
(progn
(set-background-color "white")
(set-foreground-color "black")
(set-cursor-color "brown")
;; (set-mouse-color "white")
(setq cursor-type 'box) ; box, hollow, bar, hbar
;;(setq blink-matching-delay 0.01)
(blink-cursor-mode 1)
;; (set-face-font 'default "7x14")
)
;; For tty.
(progn
)
)
;; See what I am typing immediately (for keystroke in minibuffer).
(setq echo-keystrokes 0.2)
;; ----------------------------------------------------------------------
;; silent runing.
;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
(setq inhibit-startup-message t)
;; ----------------------------------------------------------------------
;; whitespaces.
(setq default-indicate-empty-lines t)
(setq default-indicate-buffer-boundaries 'left)
(setq-default show-trailing-whitespace t)
(setq next-line-add-newlines nil)
;; See also 'mode-require-final-newline'.
(add-hook 'text-mode-hook (lambda () (setq require-final-newline nil)))
;; ======================================================================
;; gnu serv, server.
;; (load "~/emacs/bin/gnuserv/gnuserv.el")
;; (require 'gnuserv)
;; (setq gnuserv-frame (selected-frame))
(when (>= emacs-major-version 22)
(require 'server)
(when (and (= emacs-major-version 23) (>= emacs-minor-version 1) (<= emacs-minor-version 2) (equal window-system 'w32))
(defun server-ensure-safe-dir (dir) "Noop" t)) ; Suppress error directory ~/.emacs.d/server is unsafe on windows.
(server-start)
)
;; (desktop-load-default)
;; (desktop-read)
;; ======================================================================
;; standart/general settings.
(if (boundp 'confirm-kill-emacs)
(setq confirm-kill-emacs 'yes-or-no-p))
;; Try to speed things up, especially in VM.
(setq gc-cons-threshold 2000000)
;; Default 'command-history' length too short (in Emacs 23.2 is 30).
(setq history-length 200)
;; Don't beep in my headphones!
(setq ring-bell-function '(lambda () "Empty ring-bell-function." nil))
(setq visible-bell t) ; With default ring-bell-function in text terminal
; revert screen if press [end] or [home]
;; Prompt before evaluating local bits of lisp. This stops people
;; putting things at the end of files which delete all your files!
(setq enable-local-variables t
enable-local-eval 1)
(setq kill-whole-line t)
(setq view-read-only t)
(setq read-quoted-char-radix 16)
;; generic-define-* before (require 'generic-x) allow load all useful extra modes.
(setq generic-define-mswindows-modes t)
(setq generic-define-unix-modes t)
(require 'generic-x)
;; The following commands are usually disabled by default. Enable them...
(put 'eval-expression 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'narrow-to-page 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'scroll-left 'disabled nil)
;; ----------------------------------------------------------------------
;; switching, creating, selecting buffers.
(iswitchb-mode 1)
(setq iswitchb-buffer-ignore nil)
(mapc (lambda (arg) (add-to-list 'iswitchb-buffer-ignore arg))
'("^ "
"^\*Buffer"
"^\*Completions\*"
"^\*tramp"
"^\*Dired log\*"
"^\*Help\*"
"^\*Quail Completions\*"
"^\*Disabled Command\*"
))
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward)
;; buffer-menu better then buffer-list, but ibuffer much better.
(global-set-key "\C-x\C-b" 'ibuffer)
;; ----------------------------------------------------------------------
;; scrolling.
(defvar my-scroll-margin 4)
(setq-default
scroll-step 1
scroll-conservatively my-scroll-margin
scroll-preserve-screen-position t
)
;; Set margin only for desired modes! Do not frustrate calendar any more.
(make-variable-buffer-local 'scroll-margin)
(mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
(append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
;; ----------------------------------------------------------------------
;; search, isearch, occur.
(setq case-fold-search t)
(setq query-replace-highlight t) ; highlight during query
(setq search-highlight t) ; highlight incremental search
;; ----------------------------------------------------------------------
;; grep, find.
;; Assume that we have GNU grep, so -H available.
(setq grep-command "grep -nH ")
;; Assume that we have GNU grep, so -H available.
(setq grep-template "grep <C> -nH <R> <F>")
(setq grep-find-command "find . '(' -name .svn -o -name CVS -o -name .hg -o -name _darcs -o -name .git ')' -prune -o -type f -name '*' -print0 | xargs -0 -e grep -nH ")
;; This pattern oriented to POSIX like sh shell and availability of GNU grep for -H option.
(setq grep-find-template "find . <X> -type f <F> -exec grep <C> -nH <R> {} \\;")
;; Do not set t because some grep do not has --color options.
(setq grep-highlight-matches nil)
(setq grep-use-null-device nil)
;; For find-dired.
;; (setq find-ls-option '("-exec ls -ld {} \\;" . "-ld"))
(global-set-key [M-f7] 'rgrep)
;; ----------------------------------------------------------------------
;; syntax highlighting.
(setq font-lock-maximum-decoration t)
(global-font-lock-mode 1)
;; ----------------------------------------------------------------------
;; highlight selected text.
;; 1/-1, when the mark is active, the region is highlighted.
(transient-mark-mode 1)
(delete-selection-mode 1) ; 1/-1
;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
(require 'pc-select)
(setq pc-select-selection-keys-only t) ; To avoid some key bindings as F6, etc.
(setq pc-select-meta-moves-sexps t)
(cond
((= emacs-major-version 21) (pc-selection-mode))
((>= emacs-major-version 22) (pc-selection-mode 1))
)
(when (eq window-system 'x)
(setq x-select-enable-clipboard t) ; for Emacs 21.2.1 and newer
)
;; ----------------------------------------------------------------------
;; highlighting current line.
(when window-system
(custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
(global-hl-line-mode 1)
)
;; ----------------------------------------------------------------------
;; paren, braces.
(show-paren-mode 1) ; Parenthesis matching via highlighting.
(setq show-paren-style (quote parenthesis))
;; ======================================================================
;; keyboard, mouse.
;; cyrillic-jis-russian for 567 is :,.
;; cyrillic-jcuken for SHIFT 567 is :,.
;; russian-computer for SHIFT 567 is %^&
(if (>= emacs-major-version 22)
(setq default-input-method 'russian-computer)
(setq default-input-method 'cyrillic-jcuken))
;; (pc-bindings-mode) ; Myself define keybinding, see
;; ----------------------------------------------------------------------
;; completion.
;; I remove partial-completion-mode because it depricated in Emacs 24.0.
;; Completion controled by 'completion-styles' variable.
;; ----------------------------------------------------------------------
;; mouse.
;; Scroll Bar gets dragged by mouse butn 1
(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)
;; ----------------------------------------------------------------------
;; key binding, short-keys.
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
(global-set-key [C-home] 'beginning-of-buffer)
(global-set-key [C-end] 'end-of-buffer)
(global-set-key [C-delete] 'kill-word)
(global-set-key [delete] 'delete-char)
;; (global-set-key [backspace] 'backward-delete-char-untabify) ; not work properly in *info* mode
;; setting some f[1-12] keys
(global-set-key [f1] 'help)
(global-set-key [f2] 'save-buffer)
;; (global-set-key [xxx] 'ediff-buffers)
(global-set-key [f4] 'ispell-buffer)
(global-set-key [S-f6] 'rename-buffer)
(global-set-key [f8] 'kill-this-buffer)
(global-set-key [M-f4] 'save-buffers-kill-emacs)
(global-set-key [f6] 'toggle-truncate-lines)
;; frames, windows manipulation, switch buffers
(global-set-key [?\C-x right] 'next-buffer)
(global-set-key [?\C-x left] 'previous-buffer)
;; I usually mistype "C-x C-f" to "C-x d" or "C-x C-d", so always use find-file,
;; because when file if directory find-file load dired, if regular file open it.
(global-set-key (kbd "C-x C-f") 'find-file)
(global-set-key (kbd "C-x C-d") 'find-file)
(global-set-key (kbd "C-x d") 'find-file)
(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))
;; (global-set-key [language-change] 'ignore)
;; ======================================================================
;; coding system, charset, locale, lang.
;; Emacs 23.1 no longer need codepage-setup.
(when (<= emacs-major-version 22)
(codepage-setup 866)
(codepage-setup 1251)
)
;; Comment because prefer-coding-system will be ignored.
;; (setq-default coding-system-for-read 'cp1251-dos)
;; (setq-default coding-system-for-write 'cp1251-dos)
;; (setq locale-coding-system 'cp1251-dos)
;; (set-terminal-coding-system 'cp1251)
;; (set-keyboard-coding-system 'cp1251)
(prefer-coding-system 'koi8-r-dos)
(prefer-coding-system 'utf-16-le)
(prefer-coding-system 'cp866-dos)
(modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
(cond
((equal window-system 'w32) ; also (string-equal system-type "windows-nt")
(progn
(set-selection-coding-system 'utf-16-le-dos)
(prefer-coding-system 'utf-8-unix)
(prefer-coding-system 'cp1251-dos)
))
((equal window-system 'x)
(progn
(prefer-coding-system 'cp1251-dos)
(prefer-coding-system 'utf-8-unix)
(setq selection-coding-system 'compound-text-with-extensions)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(modify-coding-system-alist 'process ".*" 'utf-8-unix)
))
(t
(progn
;; (set-selection-coding-system 'utf-8-unix)
(prefer-coding-system 'cp1251-dos)
(prefer-coding-system 'utf-8-unix)
(modify-coding-system-alist 'process ".*" 'utf-8-unix)
))
)
;; XXXXXXXXXXXXXXXXXXXXXXXX
;; To open from command line file, which names has extended opcode
;; (set-file-name-coding-system 'cp1251)
;; (set-language-environment "Russian") ; XXX not used as set default coding system to koi8-r.
;; ----------------------------------------------------------------------
;; dired.
(setq dired-dwim-target t)
;; dangerous
;; (setq
;; dired-recursive-copies 'top
;; dired-recursive-deletes 'top)
(put 'dired-find-alternate-file 'disabled nil) ; Enable 'a' command.
;; ----------------------------------------------------------------------
;; compression, archive.
(require 'jka-compr) ; Automatic decompression, hooks for tar-mode.
(if (fboundp 'auto-compression-mode)
(auto-compression-mode 1))
(modify-coding-system-alist 'file "\\.\\(war\\|ear\\|sar\\|egg\\)\\'" 'no-conversion)
(add-to-list 'auto-mode-alist '("\\.\\(war\\|ear\\|sar\\|egg\\)\\'" . archive-mode))
;; ----------------------------------------------------------------------
;; image.
(when (fboundp 'auto-image-file-mode)
(auto-image-file-mode 1))
;; ----------------------------------------------------------------------
;; *Recentf*
(require 'recentf)
;; Prevent TRAMP to login on remote host when loading.
;; Its take time and ask passwords!
(setq recentf-auto-cleanup 'never)
(recentf-mode t)
(setq recentf-max-saved-items 1000)
(global-set-key (kbd "\e\eq") 'recentf-open-files)
;; ----------------------------------------------------------------------
;; revert buffer.
(global-set-key [f5] 'revert-buffer)
(setq revert-without-query (quote (".*")))
(setq auto-revert-interval 2)
;; ======================================================================
;; convenient.
(defun reglen()
"Show region length."
(interactive)
(message "%s" (- (region-end) (region-beginning))))
;; ----------------------------------------------------------------------
;; minibuffer.
(require 'icomplete) ; Interactive completion in minibuffer.
(icomplete-mode 1)
(mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
'(
".class" "~" ".aux"
".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
;; Place dir at end to appear at the start of completion-ignored-extensions.
"CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
) )
;; ----------------------------------------------------------------------
;; music.
(setq gnus-audio-au-player "winamp.exe"
gnus-audio-directory "D:\\music"
gnus-audio-wav-player "winamp.exe")
;; ----------------------------------------------------------------------
;; browser.
(cond
((equal window-system 'w32)
(setq browse-url-browser-function 'browse-url-default-windows-browser))
(t
(setq browse-url-browser-function 'browse-url-mozilla)))
;; ----------------------------------------------------------------------
;; calendar.
;; (setq mark-holidays-in-calendar t)
;; (setq all-christian-calendar-holidays t)
;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
;; (setq calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
(setq calendar-week-start-day 1)
(setq european-calendar-style t)
;; ======================================================================
;;
;; STANDARD HOOKS
(add-hook 'write-file-hooks 'time-stamp)
;; ======================================================================
;; *auto-fill*
(setq-default fill-column 78)
(defvar my-fill-column 100
"I use greater value then 78 for comment in prog source.")
;; By default used American convention - sentence and with two spaces. Change
;; it to one space. Has affect on filling and M-a, M-e commands.
(setq sentence-end-double-space nil)
;; Turn on auto-fill mode
(add-hook 'html-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; ----------------------------------------------------------------------
;; unknown.
;; browse-url mailcrypt gnus message sendmail bbdb pilot bibtex eiffel-mode emacs-w3m
;; eudc filladapt hugs-mode mpg123 php-mode ps-print
;; chord-mode - edit guitar music
;; discography - variant of BibTeX mode for discographies
;; ----------------------------------------------------------------------
;; cacl, calculator.
(setq-default calc-group-digits t)
(setq-default calc-group-char "'")
;; ======================================================================
;; TeX, LaTeX.
(setq tex-run-command "initex")
;; ----------------------------------------------------------------------
;; AUC TeX.
;(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar)
;; (setq TeX-parse-self t) ; Enable parse on load.
;; (setq TeX-auto-save t) ; Enable parse on save.
;; Query for master file. If you often use \include or \input, you should make AUCTEX aware of the
;; multi-file document structure.
(setq-default TeX-master nil)
;(setq TeX-PDF-mode t)
;(setq TeX-interactive-mode t)
;(setq TeX-source-specials-mode 1)
;;; some more menu entries in the command list:
;;; see tex-mik.el from package auctex: %v is defined in tex-mik.el
;;; other variables are defined in tex.el from auctex
;;; the meaning of some auctex-varibles:
;symbols defined in tex.el and tex-mik.el:
;%b name slave tex-file %t name master tex-file
;%d dvi-file %f ps-file
;%l "latex --src-specials"
;%n line number %p printcommand %q "lpq"
;%r (TeX-style-check TeX-print-style)
;%s master-file-name without extention
;%v yap command view line
;(eval-after-load "tex"
; '(progn
; (add-to-list 'TeX-command-list
; (list "->PS landscape for pdf"
; "dvips %d -N0 -Ppdf -G0 -T 297mm,210mm -o %f "
; 'TeX-run-command nil t))
; (add-to-list 'TeX-command-list
; (list "All Texify run-viewer"
; "texify --tex-opt=--src --run-viewer --clean %s.tex"
; 'TeX-run-command nil t))))
;; ----------------------------------------------------------------------
;; Reftex activation (Reftex is included with Emacs 21.1).
;; (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
;; (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;; ----------------------------------------------------------------------
;; PreviewLatex.
;(load "preview-latex.el" nil t t)
;(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
;(autoload 'LaTeX-preview-setup "preview")
;; ======================================================================
;; Info.
;; Because of Debian policy documentation covered by FDL license with invariant sections not allowed in packet
;; repository tree. So it must be installed manually. My usual configuration is install user local software
;; into ~/usr DISTDIR.
(unless (getenv "INFOPATH")
(setenv "INFOPATH" "~/usr/share/info:"))
;; ======================================================================
;; man, woman.
(setq woman-use-own-frame nil)
(setq woman-fill-frame t)
;; ======================================================================
;; shell, sh, bash.
;; Setup Emacs to run bash as its primary shell.
;; (setq binary-process-input t)
;; (setq shell-file-name "bash")
;; (setq shell-command-switch "-c")
;; (setenv "SHELL" shell-file-name)
(defvar my-use-windows-shell nil
"If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
commands. If nil, 'sh' will be used." )
(when (eq window-system 'w32) ; may require Cygwin or MSYS
(if my-use-windows-shell
(progn
;; Restore shell name if user set SHELL env var for Cygwin/MSYS.
(setq shell-file-name (concat exec-directory "cmdproxy.exe"))
;; Here is workaround: when explicit-shell-file-name is "bash" and shell-file-name is "cmdproxy.exe"
;; find-dired incorrect quote args (in shell-quote-argument (w32-shell-name) return "bash", but
;; shell-command used shell-file-name which value "cmdproxy.exe"). So I put additional space in pattern to
;; prevent quoting.
(setq find-ls-option '("-exec ls -ld {} ;" . "-ld"))
)
(progn
;; Use shell from Cygwin/MinGW.
(setq shell-file-name "bash")
)
)
;; (setq explicit-shell-file-name "bash")
(setq explicit-bash-args '("-i"))
(setq explicit-sh-args '("-i"))
)
;; ======================================================================
;; spell, ispell, aspell.
;; Settings for spelling done in '.emacs-autogen'.
;(add-hook 'text-mode-hook 'flyspell-mode)
;(setq flyspell-default-dictionary "russianw")
;(setq flyspell-delay '1)
;; ======================================================================
;; GTD, PIM, organize, todo mode.
;; ----------------------------------------------------------------------
;; org-mode.
(if (>= emacs-major-version 22)
(progn
(require 'org)
))
;; XXX org-todo-keywords '((sequence "TODO" "START" "|" "DONE")) for org-version 4.67c
;; XXX (setq org-todo-keywords '("TODO" "START" "DONE")) for org-version 6.05b
(if (or (featurep 'org) (featurep 'org-install))
(progn
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-directory (expand-file-name "~/.gtd"))
(setq org-default-notes-file (expand-file-name "~/.gtd/notes"))
(setq org-agenda-ndays 31
org-deadline-warning-days 7
org-agenda-show-all-dates t
org-agenda-format-date "%Y-%m-%d, %A %e %B"
org-agenda-skip-deadline-if-done t
org-agenda-skip-scheduled-if-done t
org-agenda-start-on-weekday nil
org-reverse-note-order t
org-hide-leading-stars t
org-tags-column 64
)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-agenda-files '("~/.gtd/todo.org")) ))
;; ----------------------------------------------------------------------
;; remember-mode.
(if (or (featurep 'remember) (fboundp 'remember))
(progn
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler))
(add-hook 'remember-mode-hook 'org-remember-apply-template)
(define-key global-map "\C-cr" 'org-remember)
(setq org-remember-templates
;; With one item emacs do not prompt choose template.
'((?t "* TODO %?" "~/.gtd/todo.org")
;; (?j "* %^{topic}\n %T\n" "~/.gtd/journal.org")
))
(setq
org-remember-store-without-prompt t
) ))
;; ----------------------------------------------------------------------
;; TODO, XXX, FIXME highlight.
;; Show blanks and FIXME
;; http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule
(defface my-tab-face
'((t :background "gray"))
"Face for showing TABs."
:group 'basic-faces)
(defface my-conflict-face
'((t :background "pink" :foreground "red" :weight bold))
"Font for showing conflicts."
:group 'basic-faces)
(add-hook 'font-lock-mode-hook (function (lambda ()
(when (member major-mode my-devel-mode-list)
(font-lock-add-keywords nil
'(
("\t+" 0 'my-tab-face t)
("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'font-lock-warning-face t)
("\\(=\\{7,\\}\\|<\\{7,\\}\\|>\\{7,\\}\\)" 1 'my-conflict-face t)
))))))
;; (dolist (mode '(c-mode
;; java-mode
;; cperl-mode
;; html-mode-hook
;; css-mode-hook
;; emacs-lisp-mode))
;; (font-lock-add-keywords mode
;; '(("\\(XXX\\|FIXME\\|TODO\\)"
;; 1 font-lock-warning-face prepend))))
;; ======================================================================
;; communication
;; ----------------------------------------------------------------------
;; jabber.
(when (featurep 'jabber)
(setq
jabber-history-enabled t
jabber-use-global-history nil
jabber-backlog-number 15
jabber-backlog-days 30
jabber-alert-presence-message-function (lambda (who oldstatus newstatus statustext) nil)
)
)
(setq my-chat-prompt "[%t] %n>\n")
(when (featurep 'jabber)
(setq
jabber-chat-foreign-prompt-format my-chat-prompt
jabber-chat-local-prompt-format my-chat-prompt
jabber-groupchat-prompt-format my-chat-prompt
jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n"
)
)
;; fsm used in emacs jabber
(when (featurep 'fsm)
(setq fsm-debug nil) ; Disable *fsm-debug* buffer.
)
;; ----------------------------------------------------------------------
;; rcirc.
;; Turn on logging everything to a special buffer, for debugging.
;; (setq rcirc-debug-flag t)
(add-hook 'rcirc-mode-hook (lambda () (rcirc-track-minor-mode 1)))
(setq rcirc-time-format "%H:%M ")
(defun rcirc-handler-301 (process cmd sender args)
"/away message handler.")
;; ----------------------------------------------------------------------
;; erc.
;; Take off noise message.
(setq erc-track-exclude-types '("JOIN" "PART" "QUIT" "NICK" "MODE"))
(setq erc-current-nick-highlight-type 'nick-or-keyword)
(setq erc-track-use-faces t)
(setq erc-server-coding-system 'utf-8)
;; ======================================================================
;; VCS, version control, cvs, svn, mercurial, hg, bazaar, bzr, git, fossil.
(if (equal window-system 'w32)
(progn
(modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
(modify-coding-system-alist 'process "svn" '(cp1251 . cp1251))
(setq vc-svn-checkin-switches '("--encoding" "utf-8"))
))
;; (setq-default vc-svn-register-switches "--encoding cp1251")
(setq-default vc-svn-register-switches nil)
(if window-system
(progn
(setq
vc-annotate-very-old-color "#0b5b20"
vc-annotate-background "white"
vc-annotate-color-map
'(
(20 . "#EE0000")
(40 . "#E0800D")
(60 . "#D3001A")
(80 . "#C68027")
(100 . "#B90034")
(120 . "#AB8042")
(140 . "#9E004F")
(160 . "#91805C")
(180 . "#840069")
(200 . "#778077")
(220 . "#690084")
(240 . "#5C8091")
(260 . "#4F009E")
(280 . "#4280AB")
(300 . "#3400B9")
(320 . "#2780C6")
(340 . "#1A00D3")
(360 . "#0D80E0")))
)
)
;; ----------------------------------------------------------------------
;; psvn.
(setq svn-status-verbose t)
(setq svn-status-hide-unmodified t)
;; ----------------------------------------------------------------------
;; DVC.
(when (featurep 'dvc-emacs)
(setq dvc-tips-enabled nil)
)
;; ======================================================================
;; devel, prog, programming.
(add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
(setq-default comment-style (quote indent))
(setq-default comment-column 44)
(setq-default comment-fill-column my-fill-column)
(mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) ))
my-devel-mode-hook-list)
;; ----------------------------------------------------------------------
;; diff, patch, ediff, emerge.
(setq diff-switches "-u")
(setq ediff-diff-options "")
;; ----------------------------------------------------------------------
;; indenting.
(setq standard-indent 4)
(setq c-basic-offset 4)
(setq sh-basic-offset 2)
(setq sgml-basic-offset 4)
;; TAB (tab settings)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil) ; spaces instead of tabs by default
(setq tab-always-indent t)
(setq c-tab-always-indent t)
(let ( (line-width 400) i )
(setq i (* (ceiling line-width 4) 4))
(setq tab-stop-list nil)
(while (>= i 0)
(setq tab-stop-list (cons i tab-stop-list))
(setq i (- i 4))))
;; ----------------------------------------------------------------------
;; *Compile*
(setq compile-auto-highlight t
compile-command "make ")
;; compilation window shall scroll down if not 0
(setq compilation-scroll-output 1)
;; My funny error messages.
;; XXX нужно реализовать через hook.
(require 'compile)
(add-to-list 'compilation-error-regexp-alist '("^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4))
(add-to-list 'compilation-error-regexp-alist '("^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2))
(add-to-list 'compilation-error-regexp-alist '("^\"?\\([^\"]*\\)\"?,\\([0-9]*\\) .*\\[.*\\]: " 1 2)) ; KEIL compiler
;; (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ ]+\\)" . 1))
;; (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)
)
;; ----------------------------------------------------------------------
;; windows inf files for driver installing
(add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode))
;; ----------------------------------------------------------------------
;; makefile, make.
(add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode))
;; ----------------------------------------------------------------------
;; asm, assembler.
;; (setq-default asm-comment-char 59)
(add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
(add-to-list 'auto-mode-alist '("\\.\\([sS]79\\|[sS]\\)\\'" . asm-mode))
;; (add-hook 'asm-mode-hook '(lambda () (local-unset-key ":")))
;; (add-hook 'asm-mode-hook '(lambda () (local-set-key ":" ":")))
;; ----------------------------------------------------------------------
;; linker.
(when (fboundp 'iar-linker-config-mode)
(add-to-list 'auto-mode-alist '("\\.icf\\'" . iar-linker-config-mode))
)
(when (fboundp 'iar4-linker-config-mode)
(add-to-list 'auto-mode-alist '("\\.xcl\\'" . iar4-linker-config-mode))
)
;; ----------------------------------------------------------------------
;; lisp.
(setq list-command-history-max 256)
;; ----------------------------------------------------------------------
;; C, c-mode, C++, c++-mode.
(setq c-echo-syntactic-information-p t)
(add-hook 'c-mode-common-hook
(lambda ()
;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
(c-toggle-auto-newline -1)
;; Delete all preceding whitespace by DEL.
(c-toggle-hungry-state -1)
))
(defconst my-c-style
'((c-tab-always-indent . t)
(c-comment-only-line-offset . 4)
(c-hanging-braces-alist
. (
(brace-list-open)
(substatement-open after)
))
(c-hanging-colons-alist
. (
(access-label after)
(case-label after)
(inher-intro)
(label after)
(member-init-intro before)
))
(c-cleanup-list
. (
defun-close-semi
empty-defun-braces
scope-operator
))
(c-offsets-alist
. (
(arglist-close . c-lineup-arglist)
(arglist-cont-nonempty . ++)
(arglist-intro . ++)
(block-open . 0)
(case-label . 0)
(comment-intro . 0)
(func-decl-cont . ++)
(inexpr-class . 0)
(inline-open . 0)
(knr-argdecl-intro . -)
(label . 0)
(statement-block-intro . +)
(statement-cont . ++)
(substatement-open . 0)
))
(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)
;; 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'.
;; ----------------------------------------------------------------------
;; nsis-mode.
(when (fboundp 'nsis-mode)
(add-to-list 'auto-mode-alist '("\\.\\(nsi\\|nsh\\)\\'" . nsis-mode))
)
;; ----------------------------------------------------------------------
;; *csharp*, c-sharp.
(autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
;; ----------------------------------------------------------------------
;; 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
;; (setq defer-loading-jde nil)
;; to read:
;;
;; (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.
;; ----------------------------------------------------------------------
;; xml.
;; ----------------------------------------------------------------------
;; psgml.
(setq sgml-set-face t) ; for highlighting in sgml
;; ======================================================================
;; printing.
;; Use Notepad to print plain text files to the default Windows printer
;(setq lpr-command "notepad")
;(setq lpr-headers-switches '("/p")) ; \ mis-use these
;(setq lpr-switches nil) ; / two variables
;(setq printer-name nil) ; notepad takes the default
;(setq lpr-printer-switch "/P") ;; run notepad as batch printer
;;
;; ----------------------------------------------------------------------
;; printing to file.
;(setq printer-name "~/myprint.txt")
;(setq ps-printer-name nil)
;(setq ps-print-header nil)
;;; some more menu entries in the command list:
;;; see tex-mik.el from package auctex: %v is defined in tex-mik.el
;;; other variables are defined in tex.el from auctex
;;; the meaning of some auctex-varibles:
;symbols defined in tex.el and tex-mik.el:
;%b name slave tex-file %t name master tex-file
;%d dvi-file %f ps-file
;%l "latex --src-specials"
;%n line number %p printcommand %q "lpq"
;%r (TeX-style-check TeX-print-style)
;%s master-file-name without extention
;%v yap command view line
;(eval-after-load "tex"
; '(progn
; (add-to-list 'TeX-command-list
; (list "->PS landscape for pdf"
; "dvips %d -N0 -Ppdf -G0 -T 297mm,210mm -o %f "
; 'TeX-run-command nil t))
; (add-to-list 'TeX-command-list
; (list "All Texify run-viewer"
; "texify --tex-opt=--src --run-viewer --clean %s.tex"
; 'TeX-run-command nil t))))
;; ----------------------------------------------------------------
;; SQL.
(setq sql-password "")
;; ======================================================================
;; backuping.
(setq
make-backup-files t
backup-by-copying t ; don't clobber symlinks
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
kept-new-versions 3 ; store last 3 version
version-control t) ; use versioned backups
;; ======================================================================
;; auto save.
(setq auto-save-default t)
;; If nil autosave to different than original to buffer file.
(setq auto-save-visited-file-name nil)
;; Note: if you kill unsaved file auto save file not deleted.
(setq delete-auto-save-files t)
;; ======================================================================
;; user info.
(setq user-full-name "Oleksandr Gavenko")
(setq user-mail-address "gavenkoa@gmail.com")
(setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address ">"))
(add-hook 'emacs-startup-hook
(lambda ()
(let ( (mgs-list '("Welcome to emacs, the thermonuclear editor."
"You enter to Out Space. Emacs on."
"Nice day for Emacsing!")) )
(message (nth (random (length mgs-list)) mgs-list)))))
;; End loading...