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