.emacs-my
changeset 30 762d326dca54
parent 29 5ac22a57c979
child 31 4c2a5adf06e4
equal deleted inserted replaced
29:5ac22a57c979 30:762d326dca54
       
     1 ;; -*- mode: lisp; coding: cp1251 -*-
       
     2 ;;
       
     3 ;; Copyright (C) 2008 by Gavenko Oleksandr
       
     4 ;; Copyright (C) 2008 by Гавенко Алескандр
       
     5 ;;
       
     6 ;; ~/.emacs file for GNU Emacs 21.
       
     7 
       
     8 ;; silent runing
       
     9 (setq inhibit-startup-message t)
       
    10 
       
    11 ;; ======================================================================
       
    12 ;; Debugging.
       
    13 
       
    14 ;; Shut off message buffer by setting nil. Note - if you need to debug emacs,
       
    15 ;; comment these out so you can see what's going on.
       
    16 (setq message-log-max 100)
       
    17 
       
    18 ;;(add-hook 'after-init-hook
       
    19 ;;    '(lambda () (setq debug-on-error t)))
       
    20 ;;(debug-on-entry 'command-line-1)
       
    21 
       
    22 ;; Set the debug option to enable a backtrace when a problem occurs.
       
    23 (setq debug-on-error nil)               ; t/nil
       
    24 
       
    25 ;; ======================================================================
       
    26 ;; Load path.
       
    27 (setq my-el-dir (expand-file-name "~/.el"))
       
    28 (add-to-list 'load-path my-el-dir)
       
    29 
       
    30 ;; ======================================================================
       
    31 ;; GNU Serv.
       
    32 
       
    33 ;; (load "~/emacs/bin/gnuserv/gnuserv.el")
       
    34 ;; (require 'gnuserv)
       
    35 ;; (setq gnuserv-frame (selected-frame))
       
    36 
       
    37 (server-start)
       
    38 
       
    39 ;; (desktop-load-default)
       
    40 ;; (desktop-read)
       
    41 
       
    42 ;; ======================================================================
       
    43 ;; Настройка внешнего вида редактора.
       
    44 ;; View.
       
    45 
       
    46 ; remove menu on nil
       
    47 (menu-bar-mode nil)                     ; t/nil
       
    48 ; remove button on nil
       
    49 (tool-bar-mode nil)                     ; t/nil
       
    50 
       
    51 (if window-system
       
    52     ;; Для X-window и Win
       
    53     (progn
       
    54       ;; size of emacs area and position
       
    55       (set-frame-height (selected-frame) 52)
       
    56       (set-frame-width (selected-frame) 130)
       
    57       (set-frame-position (selected-frame) 30 15)
       
    58 
       
    59       ;;установка цветов экрана
       
    60       (set-background-color "white")
       
    61       (set-foreground-color "black")
       
    62       ;;установка режимов работы курсора
       
    63       (set-cursor-color "brown")
       
    64       ;;(setq blink-matching-delay 0.01)
       
    65       ;; курсор не мигает!
       
    66       ;; (blink-cursor-mode nil)
       
    67       ;; (set-face-font 'default "7x14")
       
    68       )
       
    69   ;; Для tty
       
    70   (progn
       
    71     )
       
    72 )
       
    73 
       
    74 ;; ======================================================================
       
    75 ;; Standart settings
       
    76 
       
    77 ;прикрепляет к каждому окну полоску прокрутки t/nil
       
    78 (scroll-bar-mode t)
       
    79 
       
    80 ;; удаляем строку целиком
       
    81 (setq kill-whole-line t)
       
    82 
       
    83 ;; show column & line numbers in status bar
       
    84 (setq column-number-mode t)
       
    85 (setq line-number-mode t)
       
    86 
       
    87 ;; ----------------------------------------------------------------------
       
    88 ;; Scrolling
       
    89 
       
    90 ;; гладкий скроллинг с полями
       
    91 ;; (setq-default scroll-conservatively 70)
       
    92 ;; (setq-default scroll-preserve-screen-position 't)
       
    93 ;; при перемешении точка останавливается на расстоянии i строк к границе фрейма,
       
    94 ;; далее скролиться текст
       
    95 ;; (setq scroll-margin 2)
       
    96 
       
    97 ;; ----------------------------------------------------------------------
       
    98 ;; *Text*
       
    99 (setq default-major-mode 'text-mode)
       
   100 (add-hook 'text-mode-hook 'turn-on-auto-fill)
       
   101 
       
   102 ;; ----------------------------------------------------------------------
       
   103 ;; Show marked text
       
   104 (setq transient-mark-mode t)
       
   105 (setq font-lock-maximum-decoration t)
       
   106 ;; syntax highlighting
       
   107 (global-font-lock-mode 1 t)
       
   108 
       
   109 ;; ----------------------------------------------------------------------
       
   110 ;; Line
       
   111 (if window-system
       
   112     (progn
       
   113       (global-hl-line-mode t)
       
   114       (custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
       
   115       )
       
   116   )
       
   117 
       
   118 ;; ----------------------------------------------------------------------
       
   119 ;; Paren
       
   120 
       
   121 (show-paren-mode 1) ; Parenthesis matching via highlighting.
       
   122 ;; (setq show-paren-style 'expression) ; выделять все выражение в скобках
       
   123 (setq show-paren-style (quote parenthesis))
       
   124 
       
   125 ;; ======================================================================
       
   126 ;; Keyboard, mouse and selection
       
   127 
       
   128 (setq default-input-method 'cyrillic-jcuken)
       
   129 ;; (pc-bindings-mode) ; Myself define keybinding, see
       
   130 ;; Настройка выделения "как в Windows"
       
   131 (setq pc-select-selection-keys-only t)  ; to avoid some key bindings as F6, etc
       
   132 (pc-selection-mode)     ; This mode enables Delete Selection mode and Transient Mark mode.
       
   133 (transient-mark-mode t)        ; t/nil, when the mark is active, the region is highlighted
       
   134 (delete-selection-mode t)               ; t/nil
       
   135 
       
   136 ;; ----------------------------------------------------------------------
       
   137 ;; Completition
       
   138 (partial-completion-mode t) ; For example, M-x p-c-m expands to M-x partial-completion-mode
       
   139 
       
   140 ;; ----------------------------------------------------------------------
       
   141 ;; Mouse
       
   142 
       
   143 ;; Scroll Bar gets dragged by mouse butn 1
       
   144 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
       
   145 ;; Paste at point NOT at cursor
       
   146 (setq mouse-yank-at-point 't)
       
   147 (mouse-wheel-mode 1)
       
   148 
       
   149 ;; ----------------------------------------------------------------------
       
   150 ;; Key Binding (Short-keys).
       
   151 
       
   152 (global-set-key [home]    'beginning-of-line)
       
   153 (global-set-key [end]     'end-of-line)
       
   154 (global-set-key [C-home] 'beginning-of-buffer)
       
   155 (global-set-key [C-end]  'end-of-buffer)
       
   156 (global-set-key [C-delete]  'kill-word)
       
   157 (global-set-key [delete]     'delete-char)
       
   158 ;; (global-set-key [backspace]  'backward-delete-char-untabify) ; not work properly in *info* mode
       
   159 
       
   160 ;; setting some f[1-12] keys
       
   161 (global-set-key [f1]    'help)
       
   162 (global-set-key [f2]    'save-buffer)
       
   163 ;; (global-set-key [xxx]    'ediff-buffers)
       
   164 (global-set-key [f4]    'ispell-buffer)
       
   165 (global-set-key [f8]    'kill-this-buffer)
       
   166 (global-set-key [M-f4]  'save-buffers-kill-emacs)
       
   167 (global-set-key [f6]    'toggle-truncate-lines)
       
   168 
       
   169 ;; search
       
   170 (global-set-key [f3]  'search-forward)
       
   171 (global-set-key [S-f3]  'search-backward)
       
   172 ;; *Occur*
       
   173 (global-set-key (kbd "\e\eo") 'occur)
       
   174 
       
   175 ;; frames, windows manipulation, switch buffers
       
   176 (global-set-key [C-tab]      'other-window)
       
   177 (global-set-key [?\C-x right] 'next-buffer)
       
   178 (global-set-key [?\C-x left]  'previous-buffer)
       
   179 
       
   180 (global-set-key (kbd "C-x C-d") 'dired)
       
   181 
       
   182 (global-set-key (kbd "\e\eg") 'goto-line)
       
   183 (global-set-key (kbd "\e\er") 'query-replace-regexp)
       
   184 
       
   185 ;; (global-set-key [language-change] 'ignore)
       
   186 
       
   187 (global-set-key (kbd "C-x C-d") 'dired)
       
   188 
       
   189 ;; ======================================================================
       
   190 ;; Coding system, charset, locale, lang.
       
   191 
       
   192 ; Подготовка к использованию соответствующих кодовых страниц.
       
   193 (codepage-setup 866)
       
   194 (codepage-setup 1251)
       
   195 
       
   196 ;; (setq-default coding-system-for-read  'cp1251-dos) ; comment because prefer-coding-system will be ignored
       
   197 ;; (setq-default coding-system-for-write 'cp1251-dos) ;
       
   198 
       
   199 ;; (setq locale-coding-system  'cp1251-dos)
       
   200 ;; (set-terminal-coding-system 'cp1251)
       
   201 ;; (set-keyboard-coding-system 'cp1251)
       
   202 
       
   203 (prefer-coding-system 'koi8-r-dos)
       
   204 (prefer-coding-system 'utf-16-le)
       
   205 (prefer-coding-system 'cp866-dos)
       
   206 
       
   207 (modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
       
   208 (if (equal window-system 'w32)
       
   209     (progn
       
   210       (set-selection-coding-system   'cp1251)
       
   211       (prefer-coding-system 'utf-8-unix)
       
   212       (prefer-coding-system 'cp1251-dos)
       
   213       (modify-coding-system-alist 'file "\\.[ch]$" 'cp1251)
       
   214       (modify-coding-system-alist 'file "[Mm]akefile.*$" 'cp1251)
       
   215       )
       
   216   (progn
       
   217     (set-selection-coding-system   'utf-8-unix)
       
   218     (prefer-coding-system 'cp1251-dos)
       
   219     (prefer-coding-system 'utf-8-unix)
       
   220     (modify-coding-system-alist 'file "\\.[ch]$" 'cp1251-unix)
       
   221     (modify-coding-system-alist 'file "[Mm]akefile.*$" 'cp1251-unix)
       
   222     (modify-coding-system-alist 'process ".*" 'utf-8-unix)
       
   223     )
       
   224   )
       
   225 
       
   226 ;; XXXXXXXXXXXXXXXXXXXXXXXX
       
   227 
       
   228 ;; To open from command line file, which names has extended opcode
       
   229 ;; (set-file-name-coding-system 'cp1251)
       
   230 
       
   231 ;; (set-language-environment "Russian")
       
   232 
       
   233 ;; ======================================================================
       
   234 ;;
       
   235 ;; NON-STANDARD VARIABLES
       
   236 
       
   237 (defvar emacs-base-dir
       
   238   (expand-file-name "~/emacs")
       
   239   "*Name of directory where emacs instaled.")
       
   240 
       
   241 ;; ======================================================================
       
   242 ;;
       
   243 ;; STANDARD VARIABLES
       
   244 
       
   245 (if (boundp 'confirm-kill-emacs)
       
   246     (setq confirm-kill-emacs 'yes-or-no-p))
       
   247 
       
   248 ;; Try to speed things up, especially in VM.
       
   249 (setq gc-cons-threshold 2000000)
       
   250 
       
   251 ;; Don't beep in my headphones!
       
   252 ;; (setq visible-bell t) ; XXX in text terminal revert screen if press [end] or [home]
       
   253 
       
   254 (setq ange-ftp-generate-anonymous-password
       
   255       user-mail-address)
       
   256 
       
   257 ;; Prompt before evaluating local bits of lisp.  This stops people
       
   258 ;; putting things at the end of files which delete all your files!
       
   259 (setq enable-local-variables t
       
   260       enable-local-eval      1)
       
   261 
       
   262 ;; ======================================================================
       
   263 ;;
       
   264 ;; STANDARD LIBRARIES
       
   265 
       
   266 (require 'jka-compr) ; Automatic decompression, hooks for tar-mode.
       
   267 (if (fboundp 'auto-compression-mode)
       
   268     (auto-compression-mode 1))
       
   269 
       
   270 ;; ======================================================================
       
   271 ;; Save
       
   272 (setq auto-save-default nil)
       
   273 
       
   274 ;; ----------------------------------------------------------------------
       
   275 ;; *Recentf*
       
   276 ;; Recent files in menu
       
   277 (require 'recentf)
       
   278 (recentf-mode t)
       
   279 (setq recentf-max-saved-items 200)
       
   280 (global-set-key (kbd "\e\eq")  'recentf-open-files)
       
   281 
       
   282 ;; ----------------------------------------------------------------------
       
   283 ;; revert
       
   284 (global-set-key [f5]    'revert-buffer)
       
   285 (setq revert-without-query (quote (".*")))
       
   286 (setq auto-revert-interval 2)
       
   287 
       
   288 ;; ======================================================================
       
   289 ;; Convenient
       
   290 
       
   291 ;; ----------------------------------------------------------------------
       
   292 ;; Completion
       
   293 (require 'icomplete) ; Interactive completion in minibuffer.
       
   294 (icomplete-mode) ; Toggle incremental minibuffer completion for this Emacs session.
       
   295 ;; может дополнять несколько слов одновременно
       
   296 (load "complete")
       
   297 (setq completion-ignored-extensions (quote ("CVS/" ".o" "~" ".bin" ".bak" ".obj" ".map" ".a" ".ln" ".blg" ".bbl" ".elc"
       
   298                                             ".lof" ".glo" ".idx" ".lot" ".fmt" ".tfm" ".class" ".fas" ".lib" ".x86f" ".sparcf"
       
   299                                             ".lo" ".la" ".toc" ".log" ".aux" ".cp" ".fn" ".ky" ".pg" ".tp" ".vr" ".cps"
       
   300                                             ".fns" ".kys" ".pgs" ".tps" ".vrs")))
       
   301 
       
   302 
       
   303 ;; ----------------------------------------------------------------------
       
   304 ;; *grep*
       
   305 (setq grep-command "find . -name '*' -exec grep -nH '' {} ;"
       
   306       grep-find-command "find . -type f ! -path '*.svn*' ! -path '*CVS*' ! -path '*.hg*' -name '*' -print0 | xargs -0 -e grep -nH "
       
   307       grep-highlight-matches nil ; do not set t because some grep do not has --color options
       
   308       grep-tree-command "find <D> <X> -type f <F> -print0 | xargs -0 -e grep <C> -nH  <R>"
       
   309       grep-use-null-device t)
       
   310 (setq blink-matching-paren-on-screen t)
       
   311 
       
   312 ;; ----------------------------------------------------------------------
       
   313 ;; Music
       
   314 (setq gnus-audio-au-player "winamp.exe"
       
   315       gnus-audio-directory "D:\\music"
       
   316       gnus-audio-wav-player "winamp.exe")
       
   317 
       
   318 
       
   319 ;; ======================================================================
       
   320 ;; TIME SETTING
       
   321 
       
   322 ;; ----------------------------------------------------------------------
       
   323 ;; Time
       
   324 ;;
       
   325 ;; Time in 24 hour format, plus day and date.
       
   326 ;; (setq display-time-day-and-date  t
       
   327 ;;       display-time-24hr-format   t
       
   328 ;;       display-time-use-mail-icon t
       
   329 ;;       display-time-day-and-date  t
       
   330 ;;       display-time-mail-file     nil)
       
   331 ;; (display-time)
       
   332 
       
   333 ;; ----------------------------------------------------------------------
       
   334 ;; Calendar
       
   335 ;; (setq mark-holidays-in-calendar t)
       
   336 ;; (setq all-christian-calendar-holidays t)
       
   337 ;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
       
   338 ;; (setq calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
       
   339 ;; (setq calendar-week-start-day 1)
       
   340 ;; (setq european-calendar-style t)
       
   341 
       
   342 ;; ======================================================================
       
   343 ;;
       
   344 ;; STANDARD HOOKS
       
   345 
       
   346 (add-hook 'write-file-hooks 'time-stamp)
       
   347 
       
   348 ;; ======================================================================
       
   349 ;; *auto-fill*
       
   350 
       
   351 (setq-default fill-column 90)
       
   352 ;; Turn on auto-fill mode
       
   353 (add-hook 'html-mode-hook 'turn-on-auto-fill)
       
   354 (global-set-key (kbd "\e\ef") 'auto-fill-mode)
       
   355 
       
   356 ;; ----------------------------------------------------------------------
       
   357 ;; DESIRE
       
   358 
       
   359 ;; (require 'desire)
       
   360 
       
   361 ;; (add-to-list 'desire-load-path
       
   362 ;;       (expand-file-name "~/share/emacs/desire"))
       
   363 ;; (add-to-list 'auto-mode-alist
       
   364 ;;       (cons (concat (regexp-quote desire-extension) "\\'")
       
   365 ;;         'emacs-lisp-mode))
       
   366 
       
   367 ;; ----------------------------------------------------------------------
       
   368 
       
   369 ;; Pilot support
       
   370 ;; (desire 'pilot)
       
   371 
       
   372 ;; ----------------------------------------------------------------------
       
   373 
       
   374 ;; BBDB - Must be loaded before most other things, since other things
       
   375 ;;        may perform special configuration if BBDB is present.
       
   376 ;;
       
   377 ;; (desire 'bbdb "bbdb")
       
   378 
       
   379 ;; ----------------------------------------------------------------------
       
   380 ;; Appointments, diary, calendar.
       
   381 ;;
       
   382 ;; Use "M-x calendar RET" to display the calendar and start
       
   383 ;; appointment warnings.
       
   384 
       
   385 ;; (desire 'appt)
       
   386 ;; (desire 'calendar)
       
   387 ;; (desire 'todo-mode)
       
   388 ;; (desire 'diary "diary-lib")
       
   389 
       
   390 ;; ----------------------------------------------------------------------
       
   391 
       
   392 ;; These provide options for the various message handling packages.
       
   393 ;; (desire 'browse-url)
       
   394 ;; (desire 'mailcrypt)
       
   395 ;; (desire 'supercite)
       
   396 
       
   397 ;; Message handing packages.
       
   398 ;; (desire 'gnus)
       
   399 ;; (desire 'message)
       
   400 ;; (desire 'vm)
       
   401 ;; (desire 'sendmail)
       
   402 
       
   403 ;; ----------------------------------------------------------------------
       
   404 
       
   405 ;; Miscellaneous
       
   406 
       
   407 ;; (desire 'abbrev)
       
   408 ;; (desire 'bibtex)
       
   409 ;; (desire 'calc)
       
   410 ;; (desire 'cc-mode)
       
   411 ;; (desire 'ediff)
       
   412 ;; (desire 'eiffel-mode)
       
   413 ;; (desire 'emacs-w3m)
       
   414 ;; (desire 'eudc)
       
   415 ;; (desire 'filladapt)
       
   416 ;;;; (desire 'hugs-mode)
       
   417 ;; (desire 'haskell-mode)
       
   418 ;; (desire 'ispell)
       
   419 ;; (desire 'latex)
       
   420 ;; (desire 'lispdir)
       
   421 ;; (desire 'mpg123)
       
   422 ;; (desire 'php-mode)
       
   423 ;; (desire 'ps-print)
       
   424 ;; (desire 'psgml)
       
   425 ;; (desire 'sh-script)
       
   426 ;; (desire 'shell)
       
   427 ;;; (desire 'sql-mode)
       
   428 ;; (desire 'tex)
       
   429 ;; (desire 'w3)
       
   430 
       
   431 ;; ======================================================================
       
   432 ;;
       
   433 ;; PERSONAL
       
   434 
       
   435 ;; (require 'chord-mode)  ; edit guitar music.
       
   436 ;; (require 'discography) ; variant of BibTeX mode for discographies.
       
   437 
       
   438 ;; ======================================================================
       
   439 ;;
       
   440 ;; unNOVICEd commands...
       
   441 ;;
       
   442 ;; The following commands are usually disabled by default.  Enable
       
   443 ;; them...
       
   444 
       
   445 (put 'eval-expression  'disabled nil)
       
   446 (put 'downcase-region  'disabled nil)
       
   447 (put 'upcase-region    'disabled nil)
       
   448 (put 'narrow-to-page   'disabled nil)
       
   449 (put 'narrow-to-region 'disabled nil)
       
   450 
       
   451 ;; ======================================================================
       
   452 ;; TEX
       
   453 (setq tex-run-command "initex")
       
   454 
       
   455 
       
   456 ;; ======================================================================
       
   457 ;; AUC TeX
       
   458 
       
   459 ;; (load "tex-site")
       
   460 
       
   461 ;(require 'tex-mik)
       
   462 ;(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar)
       
   463 ;; (setq TeX-parse-self t)             ; Enable parse on load.
       
   464 ;; (setq TeX-auto-save t)              ; Enable parse on save.
       
   465 ;; (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
       
   466 
       
   467 ;(setq TeX-PDF-mode t)
       
   468 ;(setq TeX-interactive-mode t)
       
   469 ;(setq TeX-source-specials-mode 1)
       
   470 ;(load "tex-site")
       
   471 ;(load "tex-mik")
       
   472 
       
   473 ;;модифицируем меню
       
   474 ;;; some more menu entries in the command list:
       
   475 ;;; see tex-mik.el from package auctex: %v is defined in tex-mik.el
       
   476 ;;; other variables are defined in tex.el from auctex
       
   477 ;;; the meaning of some auctex-varibles:
       
   478         ;symbols defined in tex.el and tex-mik.el:
       
   479         ;%b name slave tex-file  %t name master tex-file
       
   480         ;%d dvi-file  %f ps-file
       
   481         ;%l "latex --src-specials"
       
   482         ;%n line number  %p printcommand  %q "lpq"
       
   483         ;%r (TeX-style-check TeX-print-style)
       
   484         ;%s master-file-name without extention
       
   485         ;%v yap command view line
       
   486 ;(eval-after-load "tex"
       
   487 ;  '(progn
       
   488 ;     (add-to-list 'TeX-command-list
       
   489 ;         (list "->PS landscape for pdf"
       
   490 ;           "dvips %d -N0 -Ppdf -G0 -T 297mm,210mm -o %f "
       
   491 ;           'TeX-run-command nil t))
       
   492 ;     (add-to-list 'TeX-command-list
       
   493 ;         (list "All Texify run-viewer"
       
   494 ;           "texify --tex-opt=--src --run-viewer --clean %s.tex"
       
   495 ;           'TeX-run-command nil t))))
       
   496 
       
   497 
       
   498 ;; ======================================================================
       
   499 ;;
       
   500 ;; Reftex activation (Reftex is included with Emacs 21.1)
       
   501 
       
   502 ;; (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
       
   503 ;; (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
       
   504 ;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
       
   505 ;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
       
   506 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
       
   507 ;; (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
       
   508 
       
   509 ;; ======================================================================
       
   510 ;;
       
   511 ;;Настройки PreviewLatex
       
   512 
       
   513 ;(load "preview-latex.el" nil t t)
       
   514 
       
   515 ;(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
       
   516 ;(autoload 'LaTeX-preview-setup "preview")
       
   517 
       
   518 
       
   519 ;; ======================================================================
       
   520 ;;
       
   521 ;; Info
       
   522 
       
   523 (require 'info)
       
   524 (if (equal window-system 'w32)
       
   525     (progn
       
   526       (setq Info-directory-list (list (expand-file-name "~/../bin/emacs/info")))
       
   527       (add-to-list 'Info-directory-list (expand-file-name "~/../bin/MinGW/info") t) ; t - append to the end
       
   528       ))
       
   529 
       
   530 ;; ======================================================================
       
   531 ;;
       
   532 ;; SHELL
       
   533 
       
   534 ;; If you plan to use the bash shell, add the following lines to your .emacs file:
       
   535 ;; (setq binary-process-input t)
       
   536 ;; (setq w32-quote-process-args ?\")
       
   537 ;; (setq shell-file-name "bash") ;; or sh if you rename your bash executable to sh.
       
   538 ;; (setenv "SHELL" shell-file-name)
       
   539 ;; (setq explicit-shell-file-name shell-file-name)
       
   540 ;; (setq explicit-sh-args '("-login" "-i"))
       
   541 
       
   542 ;; Include the following only if you want to run
       
   543 ;; bash as your shell.
       
   544 
       
   545 ;; Setup Emacs to run bash as its primary shell.
       
   546 ;; (setq shell-file-name "bash")
       
   547 ;; (setq shell-command-switch "-c")
       
   548 ;; (setq explicit-shell-file-name shell-file-name)
       
   549 ;; (setenv "SHELL" shell-file-name)
       
   550 ;; (setq explicit-sh-args '("-login" "-i"))
       
   551 ;; (if (boundp 'w32-quote-process-args)
       
   552 ;;     (setq w32-quote-process-args ?\")) ;; Include only for MS Windows.
       
   553 
       
   554 ;; (setq sh-shell-file "D:\\home\\cygwin\\bin\\sh.exe")
       
   555 ;; (setq sh-shell-arg (quote ((bash) (csh . "-f") (pdksh) (ksh88) (rc . "-p") (wksh) (zsh . "-f") (sh . "-i"))))
       
   556 (setq explicit-bash-args (quote ("-login" "-i")))
       
   557 
       
   558 
       
   559 (if (equal window-system 'w32)
       
   560     (progn
       
   561       (setq auto-mode-alist
       
   562             (append
       
   563              (list (cons "\\.[bB][aA][tT]$" 'bat-mode))
       
   564              ;; For DOS init files
       
   565              (list (cons "CONFIG\\."   'bat-mode))
       
   566              (list (cons "AUTOEXEC\\." 'bat-mode))
       
   567              auto-mode-alist))
       
   568       (require 'bat-mode)
       
   569       )
       
   570   )
       
   571 
       
   572 ;; ======================================================================
       
   573 ;;
       
   574 ;; Spell
       
   575 
       
   576 ;(setq ispell-dictionary "russianw"); default dictionary
       
   577 ;(setq ispell-local-dictionary "russianw"); default dictionary
       
   578 ;(add-hook 'text-mode-hook 'flyspell-mode)
       
   579 ;(setq flyspell-default-dictionary "russianw")
       
   580 ;(setq flyspell-delay '1)
       
   581 ;; (setq ispell-local-dictionary-alist
       
   582 ;;   '((nil             ; default (english.aff)
       
   583 ;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
       
   584 ;;     ("UK-xlg"                ; english large version
       
   585 ;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "UK-xlg") nil iso-8859-1)
       
   586 ;;     ("US-xlg"                ; american large version
       
   587 ;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "US-xlg") nil iso-8859-1)
       
   588 ;;    )
       
   589 ;; )
       
   590 
       
   591 ;; ======================================================================
       
   592 ;; VCS, version control, cvs, svn.
       
   593 
       
   594 (if (equal window-system 'w32)
       
   595     (progn
       
   596       (modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
       
   597       (modify-coding-system-alist 'process "svn" '(cp866-dos . cp1251-dos))
       
   598       ))
       
   599 
       
   600 ;; (setq-default vc-svn-register-switches "--encoding cp1251")
       
   601 (setq-default vc-svn-register-switches nil)
       
   602 
       
   603 (setq my-svn-dir (concat my-el-dir "/svn"))
       
   604 (if (file-exists-p my-svn-dir)
       
   605     (progn
       
   606       (add-to-list 'load-path my-svn-dir)
       
   607       (require 'vc-svn)
       
   608       )
       
   609   )
       
   610 
       
   611 (if (file-exists-p (concat my-el-dir "/mercurial.el"))
       
   612     (require 'mercurial)
       
   613   )
       
   614 
       
   615 (if window-system
       
   616     (setq-default vc-annotate-background "white")
       
   617   )
       
   618 
       
   619 ;; ======================================================================
       
   620 ;; Devel, prog
       
   621 
       
   622 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
       
   623 
       
   624 (setq-default show-trailing-whitespace t)
       
   625 ;; (add-hook 'c-mode-hook '(lambda ()
       
   626 ;;                           (setq show-trailing-whitespace t)))
       
   627 
       
   628 ;; ----------------------------------------------------------------------
       
   629 ;; TODO, XXX, FIXME highlight.
       
   630 ;; Show blanks and FIXME
       
   631 ;; http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule
       
   632 
       
   633 (defface my-tab-face
       
   634   '((t :background "gray"))
       
   635   "Face for showing TABs."
       
   636   :group 'basic-faces)
       
   637 
       
   638 (defface my-todo-face
       
   639   '((t :foreground "red" :weight bold))
       
   640   "Font for showing TODO words."
       
   641   :group 'basic-faces)
       
   642 
       
   643 (defface my-conflict-face
       
   644   '((t :background "pink" :foreground "red" :weight bold))
       
   645   "Font for showing conflicts."
       
   646   :group 'basic-faces)
       
   647 
       
   648 (add-hook 'font-lock-mode-hook (function (lambda ()
       
   649   (unless (or (eq 'diff-mode major-mode) (eq 'script-mode major-mode))
       
   650     (font-lock-add-keywords nil
       
   651      '(
       
   652        ("\t+" 0 'my-tab-face t)
       
   653        ("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'my-todo-face t)
       
   654        ("\\(=\\{7,\\}\\|<\\{7,\\}\\|>\\{7,\\}\\)" 1 'my-conflict-face t)
       
   655        ))))))
       
   656 
       
   657 ;; ----------------------------------------------------------------------
       
   658 ;; Diff, patch
       
   659 (setq diff-switches "-u")
       
   660 
       
   661 ;; ----------------------------------------------------------------------
       
   662 ;; Indent
       
   663 
       
   664 (setq standard-indent 4)
       
   665 (setq c-basic-offset 4)
       
   666 (setq sh-basic-offset 2)
       
   667 (setq sgml-basic-offset 4)
       
   668 
       
   669 ;; TAB (tab settings)
       
   670 (setq-default tab-width 4)
       
   671 (setq-default indent-tabs-mode nil)     ; t - будут вставляться \t
       
   672 (setq tab-always-indent t)
       
   673 (setq tab-stop-list (quote (0 4 8 12 16 20 24 28 32 36 40)))
       
   674 (setq c-tab-always-indent t)
       
   675 
       
   676 (setq comment-style (quote indent))
       
   677 
       
   678 ;; ----------------------------------------------------------------------
       
   679 ;; Diff.
       
   680 (setq ediff-diff-options "")
       
   681 
       
   682 ;; ----------------------------------------------------------------------
       
   683 ;; *Compile*
       
   684 (setq compile-auto-highlight t
       
   685       compile-command "make ")
       
   686 ;; compilation window shall scroll down if not 0
       
   687 (setq compilation-scroll-output 1)
       
   688 
       
   689 ;; My funny error messages.
       
   690 ;; XXX нужно реализовать через hook.
       
   691 (require 'compile)
       
   692 (add-to-list 'compilation-error-regexp-alist-alist '(nant "^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4))
       
   693 (add-to-list 'compilation-error-regexp-alist 'nant)
       
   694 (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ 	]+\\)" . 1))
       
   695 (add-to-list 'compilation-mode-font-lock-keywords '("[ 	]\\(/F[oe][^ 	]+\\)" . 1))
       
   696 
       
   697 ;; ----------------------------------------------------------------------
       
   698 ;; asm
       
   699 (setq-default asm-comment-char 0)
       
   700 
       
   701 
       
   702 ;; ----------------------------------------------------------------------
       
   703 ;; LISP
       
   704 (setq list-command-history-max 256)
       
   705 
       
   706 ;; ----------------------------------------------------------------------
       
   707 ;; C, c-lang
       
   708 (setq c-echo-syntactic-information-p t)
       
   709 
       
   710 (defconst my-c-style
       
   711   '((c-tab-always-indent        . t)
       
   712     (c-comment-only-line-offset . 4)
       
   713     (c-hanging-braces-alist     . ((substatement-open after)
       
   714                                    (brace-list-open)))
       
   715     (c-hanging-colons-alist     . ((member-init-intro before)
       
   716                                    (inher-intro)
       
   717                                    (case-label after)
       
   718                                    (label after)
       
   719                                    (access-label after)))
       
   720     (c-cleanup-list             . (scope-operator
       
   721                                    empty-defun-braces
       
   722                                    defun-close-semi))
       
   723     (c-offsets-alist            . ((arglist-intro . ++)
       
   724                                    (arglist-close . c-lineup-arglist)
       
   725                                    (arglist-cont-nonempty . ++)
       
   726                                    (statement-block-intro . +)
       
   727                                    (inline-open . 0)
       
   728                                    (inexpr-class . 0)
       
   729                                    (statement-cont . ++)
       
   730                                    (label . 0)
       
   731                                    (substatement-open . 0)
       
   732                                    (case-label        . 0)
       
   733                                    (block-open        . 0)
       
   734                                    (comment-intro     . 0)
       
   735                                    (knr-argdecl-intro . -)))
       
   736     (c-echo-syntactic-information-p . t))
       
   737   "My C Programming Style")
       
   738 
       
   739 ;; (objc-mode . "my-mode") (c++-mode . "cc-mode")
       
   740 (add-hook 'c-initialization-hook (lambda ()
       
   741                                    (c-add-style "my" my-c-style t)))
       
   742 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (other . "my")))
       
   743 
       
   744 ;; Customizations for all modes in CC Mode.
       
   745 ;; (defun my-c-mode-common-hook ()
       
   746 ;;   ;; add my personal style and set it for the current buffer
       
   747 ;;   (c-add-style "PERSONAL" my-c-style t)
       
   748 ;;   ;; other customizations
       
   749 ;;   (setq tab-width 8
       
   750 ;;         ;; this will make sure spaces are used instead of tabs
       
   751 ;;         indent-tabs-mode nil)
       
   752 ;;   ;; we like auto-newline and hungry-delete
       
   753 ;;   (c-toggle-auto-hungry-state 1)
       
   754 ;;   ;; key bindings for all supported languages.  We can put these in
       
   755 ;;   ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
       
   756 ;;   ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
       
   757 ;;   (define-key c-mode-base-map "\C-m" 'c-context-line-break))
       
   758 
       
   759 ;; (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
       
   760 
       
   761 ;; ----------------------------------------------------------------------
       
   762 ;; *csharp*, c-sharp
       
   763 ;;
       
   764 (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
       
   765 (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
       
   766 
       
   767 ;; ----------------------------------------------------------------------
       
   768 ;; *Java*
       
   769 ;; Update the Emacs load-path to include the path to
       
   770 ;; the JDE and its require packages. This code assumes
       
   771 ;; that you have installed the packages in the emacs/site
       
   772 ;; subdirectory of your home directory.
       
   773 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/semantic"))
       
   774 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/speedbar"))
       
   775 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/elib-1.0"))
       
   776 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/eieio"))
       
   777 ;; (add-to-list 'load-path (expand-file-name "~/emacs/site/jde-2.3.5.1/lisp"))
       
   778 
       
   779 ;; Load CEDET
       
   780 ;; (load-file "~/emacs/site/common/cedet.el")
       
   781 ;; Enabling SEMANTIC minor modes.  See semantic/INSTALL for more ideas.
       
   782 ;; (semantic-load-enable-code-helpers)
       
   783 
       
   784 ;; If you want Emacs to defer loading the JDE until you open a
       
   785 ;; Java file, edit the following line
       
   786 ;; (setq defer-loading-jde nil)
       
   787 ;; to read:
       
   788 ;;
       
   789 ;;  (setq defer-loading-jde t)
       
   790 ;;
       
   791 
       
   792 ;; (if defer-loading-jde
       
   793 ;;     (progn
       
   794 ;;       (autoload 'jde-mode "jde" "JDE mode." t)
       
   795 ;;       (add-to-list 'auto-mode-alist '("\\.java\\'" . jde-mode))
       
   796 ;;       (require 'jde)))
       
   797 
       
   798 
       
   799 ;; Sets the basic indentation for Java source files
       
   800 ;; to two spaces.
       
   801 ;; (defun my-jde-mode-hook ()
       
   802 ;;   (setq c-basic-offset 2))
       
   803 
       
   804 ;; (add-hook 'jde-mode-hook 'my-jde-mode-hook)
       
   805 
       
   806 ;; (require 'jde)
       
   807 
       
   808 ;; ********************
       
   809 ;; ECB
       
   810 ;; *******************
       
   811 
       
   812 ;; load ECB
       
   813 ;; (add-to-list 'load-path  "~/emacs/site/ecb-2.32")
       
   814 ;; (require 'ecb)
       
   815 
       
   816 ;; load ECB
       
   817 ;(add-to-list 'load-path  "~/emacs/site/ecb-2.32")
       
   818 ;(require 'ecb)
       
   819 ;'(ecb-options-version "2.32")
       
   820 ;'(ecb-wget-setup (quote cons))
       
   821 ;(global-set-key (kbd "\e\eE") 'ecb-activate)
       
   822 
       
   823 ;; ======================================================================
       
   824 ;; Printing
       
   825 
       
   826 ;; Use Notepad to print plain text files to the default Windows printer
       
   827 ;(setq lpr-command "notepad")
       
   828 ;(setq lpr-headers-switches '("/p"))    ; \ mis-use these
       
   829 ;(setq lpr-switches nil)                ; / two variables
       
   830 ;(setq printer-name nil)        ; notepad takes the default
       
   831 ;(setq lpr-printer-switch "/P") ;; run notepad as batch printer
       
   832 ;;
       
   833 ;;Печать в файл
       
   834 ;(setq printer-name "~/myprint.txt")
       
   835 ;(setq ps-printer-name nil)
       
   836 ;(setq ps-print-header nil)
       
   837 ;;модифицируем меню
       
   838 ;;; some more menu entries in the command list:
       
   839 ;;; see tex-mik.el from package auctex: %v is defined in tex-mik.el
       
   840 ;;; other variables are defined in tex.el from auctex
       
   841 ;;; the meaning of some auctex-varibles:
       
   842         ;symbols defined in tex.el and tex-mik.el:
       
   843         ;%b name slave tex-file  %t name master tex-file
       
   844         ;%d dvi-file  %f ps-file
       
   845         ;%l "latex --src-specials"
       
   846         ;%n line number  %p printcommand  %q "lpq"
       
   847         ;%r (TeX-style-check TeX-print-style)
       
   848         ;%s master-file-name without extention
       
   849         ;%v yap command view line
       
   850 ;(eval-after-load "tex"
       
   851 ;  '(progn
       
   852 ;     (add-to-list 'TeX-command-list
       
   853 ;         (list "->PS landscape for pdf"
       
   854 ;           "dvips %d -N0 -Ppdf -G0 -T 297mm,210mm -o %f "
       
   855 ;           'TeX-run-command nil t))
       
   856 ;     (add-to-list 'TeX-command-list
       
   857 ;         (list "All Texify run-viewer"
       
   858 ;           "texify --tex-opt=--src --run-viewer --clean %s.tex"
       
   859 ;           'TeX-run-command nil t))))
       
   860 
       
   861 
       
   862 ;; ======================================================================
       
   863 ;;
       
   864 ;; Установка режима CUA - все как в Windows
       
   865 ;; поддержка Ctr-c,v,x,d как в windows через пакет CUA
       
   866 
       
   867 ;; версия 21.3
       
   868 
       
   869 ;(require 'cua)
       
   870 ;(CUA-mode t)
       
   871 ;;установка режимов работы курсора через CUA
       
   872 ;(setq CUA-mode-normal-cursor-color "black")
       
   873 ;(setq CUA-mode-overwrite-cursor-color "red")
       
   874 ;(setq CUA-mode-read-only-cursor-color "green")
       
   875 ;(CUA-keypad-mode 'numeric t); доп.клавиатура - цифры
       
   876 ;(CUA-keypad-mode 'prefix t); доп.клавиатура - префиксы регистров (М-2)
       
   877 
       
   878 ;; версия 21.3.50 и старше
       
   879 
       
   880 ;(require 'cua-base)
       
   881 ;(cua-mode t)
       
   882 ;;установка режимов работы курсора через CUA
       
   883 ;(setq cua-normal-cursor-color "black")
       
   884 ;(setq cua-overwrite-cursor-color "red")
       
   885 ;(setq cua-read-only-cursor-color "green")
       
   886 
       
   887 
       
   888 ;; ======================================================================
       
   889 ;; Backup
       
   890 
       
   891 ;; (setq
       
   892 ;;    backup-by-copying t      ; don't clobber symlinks
       
   893 ;;    backup-directory-alist
       
   894 ;;     '(("." . "~/backup"))    ; don't litter my fs tree
       
   895 ;;    delete-old-versions t
       
   896 ;;    kept-new-versions 6
       
   897 ;;    kept-old-versions 2
       
   898 ;;    version-control t)       ; use versioned backups
       
   899 ;(setq version-control t);нумерованный бэкап - 2 первых и 2 последних
       
   900 ;(setq delete-old-versions t);удаление промежуточных бэкапов
       
   901 
       
   902 
       
   903 ;; ======================================================================
       
   904 
       
   905 (cd "~/")
       
   906 (setq my-author-name (getenv "USER"))
       
   907 (setq user-full-name (getenv "USER"))
       
   908 
       
   909 (message ".emacs loaded OK.")
       
   910 
       
   911 ;;
       
   912 ;; End loading...