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