.emacs
author Oleksander Gavenko <gavenko_a@3g.ua>
Thu, 17 Apr 2008 23:55:33 +0300
changeset 1 30e99e01ddc4
parent 0 aef1d0017234
child 2 98c662ae8707
permissions -rw-r--r--
add auto-mode-alist for bat-files and load mercurial

;; -*- mode: lisp; coding: cp1251 -*-
;; Gavenko Alexander, ~/.emacs file for GNU Emacs 21.
;; Гавенко Алескандр, ~/.emacs файл для GNU Emacs 21.

;; silent runing
(setq inhibit-startup-message t)

;; ======================================================================
;;* DEBUGGING

;; Shut off message buffer by setting nil. Note - if you need to debug emacs,
;; comment these out so you can see what's going on.
(setq message-log-max 100)

;;(add-hook 'after-init-hook
;;	  '(lambda () (setq debug-on-error t)))
;;(debug-on-entry 'command-line-1)

;; Set the debug option to enable a backtrace when a problem occurs.
(setq debug-on-error nil)               ; t/nil

;; ======================================================================
;; Load path
(add-to-list 'load-path (expand-file-name "~/emacs/site-lisp"))

;; ======================================================================
;;* GNU Serv

;; (load "~/emacs/bin/gnuserv/gnuserv.el")
;; (require 'gnuserv)
;; (setq gnuserv-frame (selected-frame))

(server-start)

;; Rely on dtemacs to do this, otherwise a race condition can cause
;; dtemacs to fail.
;;(gnuserv-start)

;(add-to-list 'load-path (expand-file-name "~/../bin/emacs/bin/gnuserv"))
;(load "e:/bin/emacs/bin/gnuserv/gnuserv.el")
;(require 'gnuserv)
;; if you would rather have gnuserv load files into an existing frame
;(setq gnuserv-frame (selected-frame))

;; (desktop-load-default)
;; (desktop-read)

;; ======================================================================
;; настройка внешнего вида редактора
;;* View

; remove menu on nil
(menu-bar-mode nil)                     ; t/nil
; remove button on nil
(tool-bar-mode nil)                     ; t/nil

(if window-system
    ;; Для X-window и Win
    (progn
      ;; size of emacs area and position
      (set-frame-height (selected-frame) 52)
      (set-frame-width (selected-frame) 130)
      (set-frame-position (selected-frame) 30 15)

      ;;установка цветов экрана
      (set-background-color "white")
      (set-foreground-color "black")
      ;;установка режимов работы курсора
      (set-cursor-color "brown")
      ;;(setq blink-matching-delay 0.01)
      ;; курсор не мигает!
      ;; (blink-cursor-mode nil)
      ;; (set-face-font 'default "7x14")
      )
  ;; Для tty
  (progn
    )
)

;; ======================================================================
;;* Standart settings

;прикрепляет к каждому окну полоску прокрутки t/nil
(scroll-bar-mode t)

;; удаляем строку целиком
(setq kill-whole-line t)

;; show column & line numbers in status bar
(setq column-number-mode t)
(setq line-number-mode t)

(load "~/.emacs-custom.el")

;; ----------------------------------------------------------------------
;;* Scrolling

;; гладкий скроллинг с полями
;; (setq-default scroll-conservatively 70)
;; (setq-default scroll-preserve-screen-position 't)
;; при перемешении точка останавливается на расстоянии i строк к границе фрейма,
;; далее скролиться текст
;; (setq scroll-margin 2)

;; ----------------------------------------------------------------------
;; *Text*
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;; ----------------------------------------------------------------------
;; Show marked text
(setq transient-mark-mode t)
(setq font-lock-maximum-decoration t)
;; syntax highlighting
(global-font-lock-mode 1 t)

;; ----------------------------------------------------------------------
;;* Line
(if window-system
    (progn
      (global-hl-line-mode t)
      (custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
      )
  )

;; ----------------------------------------------------------------------
;;* Paren

(show-paren-mode 1) ; Parenthesis matching via highlighting.
;; (setq show-paren-style 'expression) ; выделять все выражение в скобках
(setq show-paren-style (quote parenthesis))

;; ======================================================================
;;* Keyboard, mouse and selection

(setq default-input-method 'cyrillic-jcuken)
;; (pc-bindings-mode) ; Myself define keybinding, see
;; Настройка выделения "как в Windows"
(setq pc-select-selection-keys-only t)  ; to avoid some key bindings as F6, etc
(pc-selection-mode)     ; This mode enables Delete Selection mode and Transient Mark mode.
(transient-mark-mode t)        ; t/nil, when the mark is active, the region is highlighted
(delete-selection-mode t)               ; t/nil

;; ----------------------------------------------------------------------
;; Completition
(partial-completion-mode t) ; For example, M-x p-c-m expands to M-x partial-completion-mode

;; ----------------------------------------------------------------------
;; 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 [f3]    'ediff-buffers)
(global-set-key [f4]    'ispell-buffer)
(global-set-key [f8]    'kill-this-buffer)
(global-set-key [M-f4]  'save-buffers-kill-emacs)

;; search
(global-set-key [M-f7]  'search-forward)
;; *Occur*
(global-set-key (kbd "\e\eo") 'occur)

;; frames, windows manipulation, switch buffers
(global-set-key [C-tab]      'other-window)
(global-set-key [?\C-x right] 'next-buffer)
(global-set-key [?\C-x left]  'previous-buffer)


(global-set-key (kbd "\e\eg") 'goto-line)
(global-set-key (kbd "\e\er") 'query-replace-regexp)

;; (global-set-key [language-change] 'ignore)


;; ======================================================================
;;* Coding system, charset, locale, lang.

; Подготовка к использованию соответствующих кодовых страниц.
(codepage-setup 866)
(codepage-setup 1251)

;; (setq-default coding-system-for-read  'cp1251-dos) ; comment because prefer-coding-system will be ignored
;; (setq-default coding-system-for-write 'cp1251-dos) ;

;; (setq locale-coding-system  'cp1251-dos)
;; (set-terminal-coding-system 'cp1251)
;; (set-keyboard-coding-system 'cp1251)
(set-selection-coding-system   'cp1251) ; utf-8-unix

;; (modify-coding-system-alist 'file "\.*" 'cp1251-dos)
;; (modify-coding-system-alist 'file "\.utf8?$" 'utf-8)
(modify-coding-system-alist 'file "\\.el\\'" 'iso-2022-7bit)
(modify-coding-system-alist 'file ".*\\.[ch]" 'cp1251-dos)
(modify-coding-system-alist 'file "[Mm]akefile.*" 'cp1251-dos)

(prefer-coding-system 'koi8-r-dos)
(prefer-coding-system 'utf-16-le)
(prefer-coding-system 'cp866-dos)
(prefer-coding-system 'cp1251-dos)

;; XXXXXXXXXXXXXXXXXXXXXXXX

;; To open from command line file, which names has extended opcode
;; (set-file-name-coding-system 'cp1251)

;; (set-language-environment "Russian")

;; ======================================================================
;;
;; NON-STANDARD VARIABLES

(defvar emacs-base-dir
  (expand-file-name "~/emacs")
  "*Name of directory where emacs instaled.")

;; ======================================================================
;;
;; STANDARD VARIABLES

(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)

;; Don't beep in my headphones!
;; (setq visible-bell t) ; XXX in text terminal revert screen if press [end] or [home]

(setq ange-ftp-generate-anonymous-password
      user-mail-address)

;; 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)

;; ======================================================================
;;
;; STANDARD LIBRARIES

(require 'jka-compr) ; Automatic decompression, hooks for tar-mode.
(if (fboundp 'auto-compression-mode)
    (auto-compression-mode 1))

;; ======================================================================
;;* Save
(setq auto-save-default nil)

;; ----------------------------------------------------------------------
;; *Recentf*
;; Recent files in menu
(require 'recentf)
(recentf-mode t)
(setq recentf-max-saved-items 200)
(global-set-key (kbd "\e\eq")  'recentf-open-files)

;; ----------------------------------------------------------------------
;; revert
(global-set-key [f5]    'revert-buffer)
(setq revert-without-query (quote (".*")))
(setq auto-revert-interval 2)

;; ======================================================================
;;* Convenient

;; ----------------------------------------------------------------------
;; Completion
(require 'icomplete) ; Interactive completion in minibuffer.
(icomplete-mode) ; Toggle incremental minibuffer completion for this Emacs session.
;; может дополнять несколько слов одновременно
(load "complete")
(setq completion-ignored-extensions (quote ("CVS/" ".o" "~" ".bin" ".bak" ".obj" ".map" ".a" ".ln" ".blg" ".bbl" ".elc"
											".lof" ".glo" ".idx" ".lot" ".fmt" ".tfm" ".class" ".fas" ".lib" ".x86f" ".sparcf"
											".lo" ".la" ".toc" ".log" ".aux" ".cp" ".fn" ".ky" ".pg" ".tp" ".vr" ".cps"
											".fns" ".kys" ".pgs" ".tps" ".vrs")))


;; ----------------------------------------------------------------------
;; *grep*
(setq grep-command "find . -name '*' -exec grep -nH '' {} ;"
      grep-find-command "find . -type f ! -path '*.svn' ! -path '*CVS' -name \"*\" -print0 | xargs -0 -e grep -nH "
      ;; grep-highlight-matches t
      grep-tree-command "find <D> <X> -type f <F> -print0 | xargs -0 -e grep <C> -nH  <R>"
      grep-use-null-device t)
(setq blink-matching-paren-on-screen t)

;; ----------------------------------------------------------------------
;; Music
(setq gnus-audio-au-player "winamp.exe"
      gnus-audio-directory "D:\\music"
      gnus-audio-wav-player "winamp.exe")


;; ======================================================================
;;* TIME SETTING

;; ----------------------------------------------------------------------
;; Time
;;
;; Time in 24 hour format, plus day and date.
;; (setq display-time-day-and-date  t
;;       display-time-24hr-format   t
;;       display-time-use-mail-icon t
;;       display-time-day-and-date  t
;;       display-time-mail-file     nil)
;; (display-time)

;; ----------------------------------------------------------------------
;; 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 90)
;; Turn on auto-fill mode
(add-hook 'html-mode-hook 'turn-on-auto-fill)
(global-set-key (kbd "\e\ef") 'auto-fill-mode)

;; ----------------------------------------------------------------------
;; DESIRE

;; (require 'desire)

;; (add-to-list 'desire-load-path
;; 	     (expand-file-name "~/share/emacs/desire"))
;; (add-to-list 'auto-mode-alist
;; 	     (cons (concat (regexp-quote desire-extension) "\\'")
;; 		   'emacs-lisp-mode))

;; ----------------------------------------------------------------------

;; Pilot support
;; (desire 'pilot)

;; ----------------------------------------------------------------------

;; BBDB - Must be loaded before most other things, since other things
;;        may perform special configuration if BBDB is present.
;;
;; (desire 'bbdb "bbdb")

;; ----------------------------------------------------------------------
;; Appointments, diary, calendar.
;;
;; Use "M-x calendar RET" to display the calendar and start
;; appointment warnings.

;; (desire 'appt)
;; (desire 'calendar)
;; (desire 'todo-mode)
;; (desire 'diary "diary-lib")

;; ----------------------------------------------------------------------

;; These provide options for the various message handling packages.
;; (desire 'browse-url)
;; (desire 'mailcrypt)
;; (desire 'supercite)

;; Message handing packages.
;; (desire 'gnus)
;; (desire 'message)
;; (desire 'vm)
;; (desire 'sendmail)

;; ----------------------------------------------------------------------

;; Miscellaneous

;; (desire 'abbrev)
;; (desire 'bibtex)
;; (desire 'calc)
;; (desire 'cc-mode)
;; (desire 'ediff)
;; (desire 'eiffel-mode)
;; (desire 'emacs-w3m)
;; (desire 'eudc)
;; (desire 'filladapt)
;;;; (desire 'hugs-mode)
;; (desire 'haskell-mode)
;; (desire 'ispell)
;; (desire 'latex)
;; (desire 'lispdir)
;; (desire 'mpg123)
;; (desire 'php-mode)
;; (desire 'ps-print)
;; (desire 'psgml)
;; (desire 'sh-script)
;; (desire 'shell)
;;; (desire 'sql-mode)
;; (desire 'tex)
;; (desire 'w3)

;; ======================================================================
;;
;; PERSONAL

;; (require 'chord-mode)  ; edit guitar music.
;; (require 'discography) ; variant of BibTeX mode for discographies.

;; ======================================================================
;;
;; unNOVICEd commands...
;;
;; 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)

;; ======================================================================
;;* TEX
(setq tex-run-command "initex")


;; ======================================================================
;;* AUC TeX

;; (add-to-list 'load-path "c:/program files/emacs/site-lisp/auctex/")
;; (load "tex-site")

;(require 'tex-mik)
;(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.
;; (setq-default TeX-master nil)       ; Query for master file. Finally, if you often use \include or \input, you should make AUCTEX aware of the multi-file document structure

;(setq TeX-PDF-mode t)
;(setq TeX-interactive-mode t)
;(setq TeX-source-specials-mode 1)
;(add-to-list 'load-path "c:/emacs/site-lisp/auctex/")
;(load "tex-site")
;(load "tex-mik")

;;модифицируем меню
;;; 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-to-list 'load-path "c:/emacs/site-lisp/previewlatex/")
;(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
;(autoload 'LaTeX-preview-setup "preview")


;; ======================================================================
;;
;; Info

(require 'info)
(setq Info-directory-list (list (expand-file-name "~/../bin/emacs-22.1/info")))
:; t - append at the end
(add-to-list 'Info-directory-list (expand-file-name "~/../bin/MinGW/info") t)

;; ======================================================================
;;
;; SHELL

;; If you plan to use the bash shell, add the following lines to your .emacs file:
;; (setq binary-process-input t)
;; (setq w32-quote-process-args ?\")
;; (setq shell-file-name "bash") ;; or sh if you rename your bash executable to sh.
;; (setenv "SHELL" shell-file-name)
;; (setq explicit-shell-file-name shell-file-name)
;; (setq explicit-sh-args '("-login" "-i"))

;; Include the following only if you want to run
;; bash as your shell.

;; Setup Emacs to run bash as its primary shell.
;; (setq shell-file-name "bash")
;; (setq shell-command-switch "-c")
;; (setq explicit-shell-file-name shell-file-name)
;; (setenv "SHELL" shell-file-name)
;; (setq explicit-sh-args '("-login" "-i"))
;; (if (boundp 'w32-quote-process-args)
;;     (setq w32-quote-process-args ?\")) ;; Include only for MS Windows.

;; (setq sh-shell-file "D:\\home\\cygwin\\bin\\sh.exe")
;; (setq sh-shell-arg (quote ((bash) (csh . "-f") (pdksh) (ksh88) (rc . "-p") (wksh) (zsh . "-f") (sh . "-i"))))
(setq explicit-bash-args (quote ("-login" "-i")))

(setq auto-mode-alist
      (append
       (list (cons "\\.[bB][aA][tT]$" 'bat-mode))
       ;; For DOS init files
       (list (cons "CONFIG\\."   'bat-mode))
       (list (cons "AUTOEXEC\\." 'bat-mode))
       auto-mode-alist))

(if (equal window-system 'w32)
    (require 'bat-mode))

;; ======================================================================
;;
;; Spell

;(setq ispell-dictionary "russianw"); default dictionary
;(setq ispell-local-dictionary "russianw"); default dictionary
;(add-hook 'text-mode-hook 'flyspell-mode)
;(setq flyspell-default-dictionary "russianw")
;(setq flyspell-delay '1)
;; (setq ispell-local-dictionary-alist
;;   '((nil				; default (english.aff)
;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
;;     ("UK-xlg"				; english large version
;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "UK-xlg") nil iso-8859-1)
;;     ("US-xlg"				; american large version
;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "US-xlg") nil iso-8859-1)
;;    )
;; )

;; ======================================================================
;; VCS, version control, cvs, svn.

(modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
(modify-coding-system-alist 'process "svn" '(cp866-dos . cp1251-dos))

;; (setq-default vc-svn-register-switches "--encoding cp1251")
(setq-default vc-svn-register-switches nil)

(require 'mercurial)

;; ======================================================================
;;* Devel, prog

(add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))

(setq-default show-trailing-whitespace t)
;; (add-hook 'c-mode-hook '(lambda ()
;;                           (setq show-trailing-whitespace t)))

;; ----------------------------------------------------------------------
;;* Diff, patch
;; (add-hook 'diff-mode-hook '(lambda ()
;;                              (setq show-trailing-whitespace t)) nil t)
(setq diff-switches "-u")

;; ----------------------------------------------------------------------
;; Indent

(setq standard-indent 4)
(setq c-basic-offset 4)
(setq sgml-basic-offset 4)

;; TAB (tab settings)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)     ; t - будут вставляться \t
(setq tab-always-indent t)
(setq tab-stop-list (quote (0 4 8 12 16 20 24 28 32 36 40)))
(setq c-tab-always-indent t)

(setq comment-style (quote indent))

;; ----------------------------------------------------------------------
;; Diff.
(setq ediff-diff-options "")

;; ----------------------------------------------------------------------
;; *Compile*
(setq compile-auto-highlight t
      compile-command "make ")
;; compilation window shall scroll down if not 0
(setq compilation-scroll-output 1)


;; ----------------------------------------------------------------------
;; asm
(setq-default asm-comment-char 0)


;; ----------------------------------------------------------------------
;; LISP
(setq list-command-history-max 256)

;; ----------------------------------------------------------------------
;; C, c-lang
(setq c-echo-syntactic-information-p t)

(defconst my-c-style
  '((c-tab-always-indent        . t)
    (c-comment-only-line-offset . 4)
    (c-hanging-braces-alist     . ((substatement-open after)
                                   (brace-list-open)))
    (c-hanging-colons-alist     . ((member-init-intro before)
                                   (inher-intro)
                                   (case-label after)
                                   (label after)
                                   (access-label after)))
    (c-cleanup-list             . (scope-operator
                                   empty-defun-braces
                                   defun-close-semi))
    (c-offsets-alist            . ((arglist-intro . ++)
                                   (arglist-close . c-lineup-arglist)
                                   (arglist-cont-nonempty . ++)
                                   (statement-block-intro . +)
                                   (inline-open . 0)
                                   (inexpr-class . 0)
                                   (statement-cont . ++)
                                   (label . 0)
                                   (substatement-open . 0)
                                   (case-label        . 0)
                                   (block-open        . 0)
                                   (comment-intro     . 0)
                                   (knr-argdecl-intro . -)))
    (c-echo-syntactic-information-p . t))
  "My C Programming Style")

;; (objc-mode . "my-mode") (c++-mode . "cc-mode")
(add-hook 'c-initialization-hook (lambda ()
                                   (c-add-style "my" my-c-style t)))
(setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (other . "my")))

;; Customizations for all modes in CC Mode.
;; (defun my-c-mode-common-hook ()
;;   ;; add my personal style and set it for the current buffer
;;   (c-add-style "PERSONAL" my-c-style t)
;;   ;; other customizations
;;   (setq tab-width 8
;;         ;; this will make sure spaces are used instead of tabs
;;         indent-tabs-mode nil)
;;   ;; we like auto-newline and hungry-delete
;;   (c-toggle-auto-hungry-state 1)
;;   ;; key bindings for all supported languages.  We can put these in
;;   ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
;;   ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
;;   (define-key c-mode-base-map "\C-m" 'c-context-line-break))

;; (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

;; ----------------------------------------------------------------------
;; *Csharp*
(require 'cc-mode)
(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"))

;; 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)
;;

;; (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
;; *******************

;; load ECB
;; (add-to-list 'load-path  "~/emacs/site/ecb-2.32")
;; (require 'ecb)

;; load ECB
;(add-to-list 'load-path  "~/emacs/site/ecb-2.32")
;(require 'ecb)
;'(ecb-options-version "2.32")
;'(ecb-wget-setup (quote cons))
;(global-set-key (kbd "\e\eE") 'ecb-activate)

;; ======================================================================
;;* 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
;;
;;Печать через prfile32
;(setq lpr-command "c:/program files/printfile/prfile32.exe")
;(setq lpr-headers-switches '("/p"))
;(setq lpr-switches '("/q"))
;(setq lpr-add-switches nil)
;(setq printer-name nil)
;;
;;Печать в файл
;(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))))


;; ======================================================================
;;
;; Установка режима CUA - все как в Windows
;; поддержка Ctr-c,v,x,d как в windows через пакет CUA

;; версия 21.3

;(require 'cua)
;(CUA-mode t)
;;установка режимов работы курсора через CUA
;(setq CUA-mode-normal-cursor-color "black")
;(setq CUA-mode-overwrite-cursor-color "red")
;(setq CUA-mode-read-only-cursor-color "green")
;(CUA-keypad-mode 'numeric t); доп.клавиатура - цифры
;(CUA-keypad-mode 'prefix t); доп.клавиатура - префиксы регистров (М-2)

;; версия 21.3.50 и старше

;(require 'cua-base)
;(cua-mode t)
;;установка режимов работы курсора через CUA
;(setq cua-normal-cursor-color "black")
;(setq cua-overwrite-cursor-color "red")
;(setq cua-read-only-cursor-color "green")


;; ======================================================================
;;* Backup

;; (setq
;;    backup-by-copying t      ; don't clobber symlinks
;;    backup-directory-alist
;;     '(("." . "~/backup"))    ; don't litter my fs tree
;;    delete-old-versions t
;;    kept-new-versions 6
;;    kept-old-versions 2
;;    version-control t)       ; use versioned backups
;(setq version-control t);нумерованный бэкап - 2 первых и 2 последних
;(setq delete-old-versions t);удаление промежуточных бэкапов


;; ======================================================================
;; Start off in "C:/home" dir.
(cd "~/")
(setq my-author-name (getenv "USER"))
(setq user-full-name (getenv "USER"))

(message ".emacs loaded OK.")

;;
;; End loading...