.emacs-my
changeset 56 7cb8a2dc4a53
parent 55 7faba42a825d
parent 54 d8b07256d33c
child 57 635e1a8a3ed9
equal deleted inserted replaced
55:7faba42a825d 56:7cb8a2dc4a53
     1 ;; -*- mode: lisp; coding: cp1251 -*-
     1 ;; -*- mode: lisp; coding: cp1251 -*-
     2 ;;
     2 ;;
     3 ;; Copyright (C) 2008 by Gavenko Oleksandr
     3 ;; Copyright (C) 2008 by Oleksandr Gavenko <gavenkoa@gmail.com>
     4 ;; Copyright (C) 2008 by Гавенко Алескандр
       
     5 ;;
     4 ;;
     6 ;; ~/.emacs file for GNU Emacs 21.
     5 ;; ~/.emacs file for GNU Emacs 21.
     7 
     6 
     8 ;; silent runing
     7 ;; silent runing
     9 (setq inhibit-startup-message t)
     8 (setq inhibit-startup-message t)
    50 
    49 
    51 (if window-system
    50 (if window-system
    52     ;; Для X-window и Win
    51     ;; Для X-window и Win
    53     (progn
    52     (progn
    54       ;; size of emacs area and position
    53       ;; size of emacs area and position
    55       (set-frame-height (selected-frame) 52)
    54       (set-frame-height (selected-frame) 60)
    56       (set-frame-width (selected-frame) 130)
    55       (set-frame-width (selected-frame) 120)
    57       (set-frame-position (selected-frame) 30 15)
    56       (set-frame-position (selected-frame) 10 25)
    58 
    57 
    59       ;;установка цветов экрана
    58       ;;установка цветов экрана
    60       (set-background-color "white")
    59       (set-background-color "white")
    61       (set-foreground-color "black")
    60       (set-foreground-color "black")
    62       ;;установка режимов работы курсора
    61       ;;установка режимов работы курсора
   133 (setq show-paren-style (quote parenthesis))
   132 (setq show-paren-style (quote parenthesis))
   134 
   133 
   135 ;; ======================================================================
   134 ;; ======================================================================
   136 ;; Keyboard, mouse and selection
   135 ;; Keyboard, mouse and selection
   137 
   136 
   138 (setq default-input-method 'cyrillic-jcuken)
   137 ;; cyrillic-jcuken  for 567 is :,.
       
   138 ;; russian-computer for 567 is %^&
       
   139 (setq default-input-method 'russian-computer)
       
   140 
   139 ;; (pc-bindings-mode) ; Myself define keybinding, see
   141 ;; (pc-bindings-mode) ; Myself define keybinding, see
   140 ;; Настройка выделения "как в Windows"
   142 ;; Настройка выделения "как в Windows"
   141 (setq pc-select-selection-keys-only t)  ; to avoid some key bindings as F6, etc
   143 (setq pc-select-selection-keys-only t)  ; to avoid some key bindings as F6, etc
   142 (pc-selection-mode)     ; This mode enables Delete Selection mode and Transient Mark mode.
   144 (pc-selection-mode)     ; This mode enables Delete Selection mode and Transient Mark mode.
   143 (transient-mark-mode t)        ; t/nil, when the mark is active, the region is highlighted
   145 (transient-mark-mode t)        ; t/nil, when the mark is active, the region is highlighted
   201 
   203 
   202 ; Подготовка к использованию соответствующих кодовых страниц.
   204 ; Подготовка к использованию соответствующих кодовых страниц.
   203 (codepage-setup 866)
   205 (codepage-setup 866)
   204 (codepage-setup 1251)
   206 (codepage-setup 1251)
   205 
   207 
   206 ;; (setq-default coding-system-for-read  'cp1251-dos) ; comment because prefer-coding-system will be ignored
   208 ;; Comment because prefer-coding-system will be ignored.
   207 ;; (setq-default coding-system-for-write 'cp1251-dos) ;
   209 ;; (setq-default coding-system-for-read  'cp1251-dos)
       
   210 ;; (setq-default coding-system-for-write 'cp1251-dos)
   208 
   211 
   209 ;; (setq locale-coding-system  'cp1251-dos)
   212 ;; (setq locale-coding-system  'cp1251-dos)
   210 ;; (set-terminal-coding-system 'cp1251)
   213 ;; (set-terminal-coding-system 'cp1251)
   211 ;; (set-keyboard-coding-system 'cp1251)
   214 ;; (set-keyboard-coding-system 'cp1251)
   212 
   215 
   236 ;; XXXXXXXXXXXXXXXXXXXXXXXX
   239 ;; XXXXXXXXXXXXXXXXXXXXXXXX
   237 
   240 
   238 ;; To open from command line file, which names has extended opcode
   241 ;; To open from command line file, which names has extended opcode
   239 ;; (set-file-name-coding-system 'cp1251)
   242 ;; (set-file-name-coding-system 'cp1251)
   240 
   243 
   241 ;; (set-language-environment "Russian")
   244 ;; (set-language-environment "Russian") ; XXX not used as set default coding system to koi8-r.
   242 
   245 
   243 ;; ======================================================================
   246 ;; ======================================================================
   244 ;;
   247 ;;
   245 ;; NON-STANDARD VARIABLES
   248 ;; NON-STANDARD VARIABLES
   246 
       
   247 (defvar emacs-base-dir
       
   248   (expand-file-name "~/emacs")
       
   249   "*Name of directory where emacs instaled.")
       
   250 
   249 
   251 ;; ======================================================================
   250 ;; ======================================================================
   252 ;;
   251 ;;
   253 ;; STANDARD VARIABLES
   252 ;; STANDARD VARIABLES
   254 
   253 
   258 ;; Try to speed things up, especially in VM.
   257 ;; Try to speed things up, especially in VM.
   259 (setq gc-cons-threshold 2000000)
   258 (setq gc-cons-threshold 2000000)
   260 
   259 
   261 ;; Don't beep in my headphones!
   260 ;; Don't beep in my headphones!
   262 ;; (setq visible-bell t) ; XXX in text terminal revert screen if press [end] or [home]
   261 ;; (setq visible-bell t) ; XXX in text terminal revert screen if press [end] or [home]
   263 
       
   264 (setq ange-ftp-generate-anonymous-password
       
   265       user-mail-address)
       
   266 
   262 
   267 ;; Prompt before evaluating local bits of lisp.  This stops people
   263 ;; Prompt before evaluating local bits of lisp.  This stops people
   268 ;; putting things at the end of files which delete all your files!
   264 ;; putting things at the end of files which delete all your files!
   269 (setq enable-local-variables t
   265 (setq enable-local-variables t
   270       enable-local-eval      1)
   266       enable-local-eval      1)
   344 ;; Calendar
   340 ;; Calendar
   345 ;; (setq mark-holidays-in-calendar t)
   341 ;; (setq mark-holidays-in-calendar t)
   346 ;; (setq all-christian-calendar-holidays t)
   342 ;; (setq all-christian-calendar-holidays t)
   347 ;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
   343 ;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-int month) (string-to-int day)))))
   348 ;; (setq calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
   344 ;; (setq calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
   349 ;; (setq calendar-week-start-day 1)
   345 (setq calendar-week-start-day 1)
   350 ;; (setq european-calendar-style t)
   346 (setq european-calendar-style t)
   351 
   347 
   352 ;; ======================================================================
   348 ;; ======================================================================
   353 ;;
   349 ;;
   354 ;; STANDARD HOOKS
   350 ;; STANDARD HOOKS
   355 
   351 
   385 ;;        may perform special configuration if BBDB is present.
   381 ;;        may perform special configuration if BBDB is present.
   386 ;;
   382 ;;
   387 ;; (desire 'bbdb "bbdb")
   383 ;; (desire 'bbdb "bbdb")
   388 
   384 
   389 ;; ----------------------------------------------------------------------
   385 ;; ----------------------------------------------------------------------
   390 ;; Appointments, diary, calendar.
       
   391 ;;
       
   392 ;; Use "M-x calendar RET" to display the calendar and start
       
   393 ;; appointment warnings.
       
   394 
       
   395 ;; (desire 'appt)
       
   396 ;; (desire 'calendar)
       
   397 ;; (desire 'todo-mode)
       
   398 ;; (desire 'diary "diary-lib")
       
   399 
       
   400 ;; ----------------------------------------------------------------------
       
   401 
   386 
   402 ;; These provide options for the various message handling packages.
   387 ;; These provide options for the various message handling packages.
   403 ;; (desire 'browse-url)
   388 ;; (desire 'browse-url)
   404 ;; (desire 'mailcrypt)
   389 ;; (desire 'mailcrypt)
   405 ;; (desire 'supercite)
       
   406 
   390 
   407 ;; Message handing packages.
   391 ;; Message handing packages.
   408 ;; (desire 'gnus)
   392 ;; (desire 'gnus)
   409 ;; (desire 'message)
   393 ;; (desire 'message)
   410 ;; (desire 'vm)
       
   411 ;; (desire 'sendmail)
   394 ;; (desire 'sendmail)
   412 
   395 
   413 ;; ----------------------------------------------------------------------
   396 ;; ----------------------------------------------------------------------
   414 
   397 
   415 ;; Miscellaneous
   398 ;; Miscellaneous
   597 ;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "US-xlg") nil iso-8859-1)
   580 ;;      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "US-xlg") nil iso-8859-1)
   598 ;;    )
   581 ;;    )
   599 ;; )
   582 ;; )
   600 
   583 
   601 ;; ======================================================================
   584 ;; ======================================================================
   602 ;; VCS, version control, cvs, svn.
   585 ;; Organize, todo mode.
   603 
   586 
   604 (if (equal window-system 'w32)
   587 ;; ----------------------------------------------------------------------
       
   588 ;; org-mode
       
   589 
       
   590 (if (featurep 'org)
   605     (progn
   591     (progn
   606       (modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
   592       (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
   607       (modify-coding-system-alist 'process "svn" '(cp866-dos . cp1251-dos))
   593       (setq org-agenda-files "~/todo.org"
   608       ))
   594             org-default-notes-file "~/notes.org"
   609 
   595             org-agenda-ndays 20
   610 ;; (setq-default vc-svn-register-switches "--encoding cp1251")
   596             org-deadline-warning-days 14
   611 (setq-default vc-svn-register-switches nil)
   597             org-agenda-show-all-dates t
   612 
   598             org-agenda-skip-deadline-if-done t
   613 (setq my-svn-dir (concat my-el-dir "/svn"))
   599             org-agenda-skip-scheduled-if-done t
   614 (if (file-exists-p my-svn-dir)
   600             org-agenda-start-on-weekday nil
   615     (progn
   601             org-reverse-note-order t
   616       (add-to-list 'load-path my-svn-dir)
   602             org-todo-keywords '((sequence "TODO" "START" "|" "DONE"))
   617       (require 'vc-svn)
   603             org-remember-store-without-prompt t)))
   618       )
       
   619   )
       
   620 
       
   621 (if (file-exists-p (concat my-el-dir "/mercurial.el"))
       
   622     (require 'mercurial)
       
   623   )
       
   624 
       
   625 (if window-system
       
   626     (setq-default vc-annotate-background "white")
       
   627   )
       
   628 
       
   629 ;; ======================================================================
       
   630 ;; Devel, prog
       
   631 
       
   632 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
       
   633 
       
   634 (setq-default show-trailing-whitespace t)
       
   635 ;; (add-hook 'c-mode-hook '(lambda ()
       
   636 ;;                           (setq show-trailing-whitespace t)))
       
   637 
   604 
   638 ;; ----------------------------------------------------------------------
   605 ;; ----------------------------------------------------------------------
   639 ;; TODO, XXX, FIXME highlight.
   606 ;; TODO, XXX, FIXME highlight.
   640 ;; Show blanks and FIXME
   607 ;; Show blanks and FIXME
   641 ;; http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule
   608 ;; http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule
   662        ("\t+" 0 'my-tab-face t)
   629        ("\t+" 0 'my-tab-face t)
   663        ("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'my-todo-face t)
   630        ("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'my-todo-face t)
   664        ("\\(=\\{7,\\}\\|<\\{7,\\}\\|>\\{7,\\}\\)" 1 'my-conflict-face t)
   631        ("\\(=\\{7,\\}\\|<\\{7,\\}\\|>\\{7,\\}\\)" 1 'my-conflict-face t)
   665        ))))))
   632        ))))))
   666 
   633 
   667 ;; ----------------------------------------------------------------------
   634 ;; ======================================================================
   668 ;; org-mode
   635 ;; VCS, version control, cvs, svn.
   669 (setq org-agenda-skip-scheduled-if-done t)
   636 
       
   637 (if (equal window-system 'w32)
       
   638     (progn
       
   639       (modify-coding-system-alist 'process "cvs" '(cp1251-dos . cp1251-dos))
       
   640       (modify-coding-system-alist 'process "svn" '(cp866-dos . cp1251-dos))
       
   641       ))
       
   642 
       
   643 ;; (setq-default vc-svn-register-switches "--encoding cp1251")
       
   644 (setq-default vc-svn-register-switches nil)
       
   645 
       
   646 (setq my-svn-dir (concat my-el-dir "/svn"))
       
   647 (if (file-exists-p my-svn-dir)
       
   648     (progn
       
   649       (add-to-list 'load-path my-svn-dir)
       
   650       (require 'vc-svn)
       
   651       )
       
   652   )
       
   653 
       
   654 (if (file-exists-p (concat my-el-dir "/mercurial.el"))
       
   655     (require 'mercurial)
       
   656   )
       
   657 
       
   658 (if window-system
       
   659     (setq-default vc-annotate-background "white")
       
   660   )
       
   661 
       
   662 ;; ======================================================================
       
   663 ;; Devel, prog
       
   664 
       
   665 (add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
       
   666 
       
   667 (setq comment-style (quote indent))
       
   668 
       
   669 (setq-default show-trailing-whitespace t)
   670 
   670 
   671 ;; ----------------------------------------------------------------------
   671 ;; ----------------------------------------------------------------------
   672 ;; Diff, patch
   672 ;; Diff, patch
   673 (setq diff-switches "-u")
   673 (setq diff-switches "-u")
   674 
   674 
   682 
   682 
   683 ;; TAB (tab settings)
   683 ;; TAB (tab settings)
   684 (setq-default tab-width 4)
   684 (setq-default tab-width 4)
   685 (setq-default indent-tabs-mode nil)     ; t - будут вставляться \t
   685 (setq-default indent-tabs-mode nil)     ; t - будут вставляться \t
   686 (setq tab-always-indent t)
   686 (setq tab-always-indent t)
   687 (setq tab-stop-list (quote (0 4 8 12 16 20 24 28 32 36 40)))
       
   688 (setq c-tab-always-indent t)
   687 (setq c-tab-always-indent t)
   689 
   688 (loop for x downfrom 40 to 1 do
   690 (setq comment-style (quote indent))
   689       (setq tab-stop-list (cons (* x 4) tab-stop-list)))
   691 
   690 
   692 ;; ----------------------------------------------------------------------
   691 ;; ----------------------------------------------------------------------
   693 ;; Diff.
   692 ;; Diff.
   694 (setq ediff-diff-options "")
   693 (setq ediff-diff-options "")
   695 
   694 
   701 (setq compilation-scroll-output 1)
   700 (setq compilation-scroll-output 1)
   702 
   701 
   703 ;; My funny error messages.
   702 ;; My funny error messages.
   704 ;; XXX нужно реализовать через hook.
   703 ;; XXX нужно реализовать через hook.
   705 (require 'compile)
   704 (require 'compile)
   706 (add-to-list 'compilation-error-regexp-alist-alist '(nant "^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4))
   705 (add-to-list 'compilation-error-regexp-alist '("^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4))
   707 (add-to-list 'compilation-error-regexp-alist 'nant)
   706 (add-to-list 'compilation-error-regexp-alist '("^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2))
   708 (add-to-list 'compilation-error-regexp-alist-alist '(msvc "^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2))
   707 ;; (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ 	]+\\)" . 1))
   709 (add-to-list 'compilation-error-regexp-alist 'msvc)
   708 ;; (add-to-list 'compilation-mode-font-lock-keywords '("[ 	]\\(/F[oe][^ 	]+\\)" . 1))
   710 (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^ 	]+\\)" . 1))
       
   711 (add-to-list 'compilation-mode-font-lock-keywords '("[ 	]\\(/F[oe][^ 	]+\\)" . 1))
       
   712 
   709 
   713 ;; ----------------------------------------------------------------------
   710 ;; ----------------------------------------------------------------------
   714 ;; asm
   711 ;; asm
   715 ;; (setq-default asm-comment-char 59)
   712 ;; (setq-default asm-comment-char 59)
   716 (add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
   713 (add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
   760 ;; Customizations for all modes in CC Mode.
   757 ;; Customizations for all modes in CC Mode.
   761 ;; (defun my-c-mode-common-hook ()
   758 ;; (defun my-c-mode-common-hook ()
   762 ;;   ;; add my personal style and set it for the current buffer
   759 ;;   ;; add my personal style and set it for the current buffer
   763 ;;   (c-add-style "PERSONAL" my-c-style t)
   760 ;;   (c-add-style "PERSONAL" my-c-style t)
   764 ;;   ;; other customizations
   761 ;;   ;; other customizations
   765 ;;   (setq tab-width 8
       
   766 ;;         ;; this will make sure spaces are used instead of tabs
       
   767 ;;         indent-tabs-mode nil)
       
   768 ;;   ;; we like auto-newline and hungry-delete
   762 ;;   ;; we like auto-newline and hungry-delete
   769 ;;   (c-toggle-auto-hungry-state 1)
   763 ;;   (c-toggle-auto-hungry-state 1)
   770 ;;   ;; key bindings for all supported languages.  We can put these in
   764 ;;   ;; key bindings for all supported languages.  We can put these in
   771 ;;   ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
   765 ;;   ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
   772 ;;   ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
   766 ;;   ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
   915 ;(setq version-control t);нумерованный бэкап - 2 первых и 2 последних
   909 ;(setq version-control t);нумерованный бэкап - 2 первых и 2 последних
   916 ;(setq delete-old-versions t);удаление промежуточных бэкапов
   910 ;(setq delete-old-versions t);удаление промежуточных бэкапов
   917 
   911 
   918 
   912 
   919 ;; ======================================================================
   913 ;; ======================================================================
       
   914 ;; Setup user info.
   920 
   915 
   921 (cd "~/")
   916 (cd "~/")
   922 (setq my-author-name (getenv "USER"))
   917 (setq user-full-name "Oleksandr Gavenko")
   923 (setq user-full-name (getenv "USER"))
   918 (setq user-mail-address "gavenkoa@gmail.com")
   924 (setenv "ORGANIZATION" "Oleksandr Gavenko <gavenkoa@gmail.com>")
   919 (setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address  ">"))
   925 
   920 
   926 (message ".emacs loaded OK.")
   921 (message ".emacs loaded OK.")
   927 
   922 
   928 ;;
   923 ;;
   929 ;; End loading...
   924 ;; End loading...