.emacs-my
changeset 964 9382e2dce0ed
parent 963 102845496d41
parent 958 f93fa1c0f480
child 965 72d443fe2b1d
equal deleted inserted replaced
963:102845496d41 964:9382e2dce0ed
   218 (menu-bar-mode -1)
   218 (menu-bar-mode -1)
   219 (when window-system
   219 (when window-system
   220   (mouse-avoidance-mode 'animate)
   220   (mouse-avoidance-mode 'animate)
   221   (scroll-bar-mode 1)
   221   (scroll-bar-mode 1)
   222   (tool-bar-mode -1)
   222   (tool-bar-mode -1)
       
   223   (setq-default line-spacing nil)
   223   (defun my-popup-menu ()
   224   (defun my-popup-menu ()
   224     (interactive)
   225     (interactive)
   225     (mouse-popup-menubar
   226     (mouse-popup-menubar
   226      (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
   227      (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
   227      nil)
   228      nil)
   509         ("marmalade" . "http://marmalade-repo.org/packages/")
   510         ("marmalade" . "http://marmalade-repo.org/packages/")
   510         ("melpa" . "http://melpa.milkbox.net/packages/")
   511         ("melpa" . "http://melpa.milkbox.net/packages/")
   511         ))
   512         ))
   512 
   513 
   513 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   514 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   515 (message "scrolling")
       
   516 
       
   517 (defvar my-scroll-margin 4)
       
   518 
       
   519 (setq-default
       
   520  ;; Set to zero as this recomment documentation.
       
   521  scroll-step 0
       
   522  ;; If the value is greater than 100, redisplay will never recenter point, but
       
   523  ;; will always scroll just enough text to bring point into view
       
   524  scroll-conservatively 1000
       
   525  scroll-preserve-screen-position t
       
   526  )
       
   527 
       
   528 ;; Set margin only for desired modes! Do not frustrate calendar any more.
       
   529 (make-variable-buffer-local 'scroll-margin)
       
   530 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
       
   531       ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
       
   532       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
       
   533 
       
   534 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   535 (message "chars, unicode")
       
   536 
       
   537 (defun my-print-unicode (&optional start end)
       
   538   "Print UNICODE table."
       
   539   (interactive "nstart: \nnend: ")
       
   540   (switch-to-buffer (get-buffer-create "*UNICODE*"))
       
   541   (erase-buffer)
       
   542   (let ( (i start) )
       
   543     (while (<= i end)
       
   544       (insert (format "%s: U+%04x, %s\n" (char-to-string i) i (get-char-code-property i 'name)))
       
   545       (setq i (1+ i))
       
   546       )))
       
   547 
       
   548 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   549 (message "search, isearch, occur")
       
   550 
       
   551 (setq case-fold-search t)
       
   552 
       
   553 (setq query-replace-highlight t)        ; highlight during query
       
   554 (setq search-highlight t)               ; highlight incremental search
       
   555 
       
   556 ;; Make old Emacs key binding like in Emacs 23.x.
       
   557 (when (< emacs-major-version 23)
       
   558   (global-set-key (kbd "M-s o") 'occur)
       
   559   )
       
   560 
       
   561 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   562 (message "grep, find")
       
   563 
       
   564 ;; -ls produce very noisy output:
       
   565 ;; (setq find-ls-option '("-ls" . ""))
       
   566 ;; So I use next expression, which work with GNU find, I replace %s with '0'
       
   567 ;; to avoid unnecessary sys calls and this make output aligned by column:
       
   568 (setq find-ls-option '("-printf ' -rw-rw-rw- 0 %AY-%Am-%Ad %AH:%AM %p\n'" . ""))
       
   569 
       
   570 ;; Do not set t because some grep do not has --color options.
       
   571 (setq grep-highlight-matches nil)
       
   572 (setq grep-use-null-device nil)
       
   573 
       
   574 (eval-after-load 'grep
       
   575   '(progn
       
   576      (add-to-list 'grep-find-ignored-directories "build" t)
       
   577      (add-to-list 'grep-find-ignored-directories "dist" t)
       
   578      (add-to-list 'grep-find-ignored-directories "lib" t)
       
   579      (add-to-list 'grep-find-ignored-directories "_build" t)
       
   580      (add-to-list 'grep-find-ignored-directories "_dist" t)
       
   581      (add-to-list 'grep-find-ignored-directories "_lib" t)
       
   582 
       
   583      (when (boundp 'grep-find-ignored-files)
       
   584        (add-to-list 'grep-find-ignored-files "*TAGS")
       
   585        (add-to-list 'grep-find-ignored-files "GPATH")
       
   586        )
       
   587      ))
       
   588 (global-set-key [f7] 'rgrep)
       
   589 (global-set-key [M-f7] 'rgrep)
       
   590 
       
   591 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   592 (message "highlighting")
       
   593 
       
   594 (setq font-lock-maximum-decoration t)
       
   595 (global-font-lock-mode 1)
       
   596 
       
   597 (global-hi-lock-mode 1)
       
   598 
       
   599 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   600 (message "highlight selected text")
       
   601 
       
   602 (delete-selection-mode 1)
       
   603 
       
   604 (when (<= emacs-major-version 23)
       
   605   ;; 1/-1, when the mark is active, the region is highlighted.
       
   606   (transient-mark-mode 1)
       
   607 
       
   608   ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
       
   609   (require 'pc-select)
       
   610   (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
       
   611   (setq pc-select-meta-moves-sexps t)
       
   612   (cond
       
   613    ((= emacs-major-version 21) (pc-selection-mode))
       
   614    ((>= emacs-major-version 22) (pc-selection-mode 1))
       
   615    )
       
   616   )
       
   617 
       
   618 (when (eq window-system 'x)
       
   619   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
       
   620   )
       
   621 
       
   622 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   623 (message "highlighting current line")
       
   624 
       
   625 (when window-system
       
   626   (custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
       
   627   (global-hl-line-mode 1)
       
   628   )
       
   629 
       
   630 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   631 (message "paren, braces")
       
   632 
       
   633 (show-paren-mode 1) ; Parenthesis matching via highlighting.
       
   634 (setq show-paren-style (quote parenthesis))
       
   635 
       
   636 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   637 (message "keyboard, mouse")
       
   638 
       
   639 ;; cyrillic-jis-russian  for 567 is :,.
       
   640 ;; cyrillic-jcuken  for SHIFT 567 is :,.
       
   641 ;; russian-computer for SHIFT 567 is %^&
       
   642 (if (>= emacs-major-version 22)
       
   643     (setq default-input-method 'russian-computer)
       
   644   (setq default-input-method 'cyrillic-jcuken))
       
   645 ;; (pc-bindings-mode) ; Myself define keybinding, see
       
   646 
       
   647 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   648 (message "mouse")
       
   649 
       
   650 ;; Scroll Bar gets dragged by mouse butn 1
       
   651 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
       
   652 ;; Paste at point NOT at cursor
       
   653 (setq mouse-yank-at-point t)
       
   654 (when window-system
       
   655   (mouse-wheel-mode 1)
       
   656   )
       
   657 
       
   658 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   659 (message "key binding, short-keys")
       
   660 
       
   661 (global-set-key [home]    'beginning-of-line)
       
   662 (global-set-key [end]     'end-of-line)
       
   663 (global-set-key [C-home] 'beginning-of-buffer)
       
   664 (global-set-key [C-end]  'end-of-buffer)
       
   665 (global-set-key [C-delete]  'kill-word)
       
   666 (global-set-key [delete]     'delete-char)
       
   667 ;; (global-set-key [backspace]  'backward-delete-char-untabify) ; not work properly in *info* mode
       
   668 
       
   669 (global-set-key [f2]    'save-buffer)
       
   670 (global-set-key [S-f6]  'rename-buffer)
       
   671 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
       
   672 (global-set-key [M-f4]  'save-buffers-kill-emacs)
       
   673 (global-set-key [f6]    'toggle-truncate-lines)
       
   674 
       
   675 ;; Disable suspend. It ugly.
       
   676 (when window-system
       
   677   (global-set-key (kbd "C-z") nil))
       
   678 (global-set-key (kbd "C-x C-z") nil)
       
   679 
       
   680 ;; (global-set-key [language-change] 'ignore)
       
   681 
       
   682 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   683 (message "coding system, charset, locale, lang")
       
   684 
       
   685 ;; Emacs 23.1 no longer need codepage-setup.
       
   686 (when (<= emacs-major-version 22)
       
   687   (codepage-setup 866)
       
   688   (codepage-setup 1251)
       
   689   )
       
   690 
       
   691 ;; Comment because prefer-coding-system will be ignored.
       
   692 ;; (setq-default coding-system-for-read  'cp1251-dos)
       
   693 ;; (setq-default coding-system-for-write 'cp1251-dos)
       
   694 
       
   695 ;; (setq locale-coding-system  'cp1251-dos)
       
   696 ;; (set-language-environment 'UTF-8)
       
   697 ;; (set-terminal-coding-system 'cp1251)
       
   698 ;; (set-keyboard-coding-system 'cp1251)
       
   699 
       
   700 (modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
       
   701 (cond
       
   702  ((equal window-system 'w32)          ; also (string-equal system-type "windows-nt")
       
   703   ;; (set-selection-coding-system 'utf-16-le-dos)
       
   704   (setq-default buffer-file-coding-system 'cp1251)
       
   705   (setq default-file-name-coding-system 'cp1251)
       
   706   (setq default-process-coding-system '(cp1251 . cp1251))
       
   707   )
       
   708  ((equal window-system 'x)
       
   709   (prefer-coding-system 'utf-8-unix)
       
   710   (setq selection-coding-system 'compound-text-with-extensions)
       
   711   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
       
   712   (modify-coding-system-alist 'process ".*" 'utf-8-unix)
       
   713   )
       
   714  ((eq system-type 'cygwin)
       
   715   (when (string-match "1251\\'" (getenv "LANG"))
       
   716     (prefer-coding-system 'cp1251-unix)
       
   717     (prefer-coding-system 'utf-8-unix)
       
   718     (modify-coding-system-alist 'process ".*" 'cp1251-unix)
       
   719     )
       
   720   )
       
   721  ((eq system-type 'darwin)
       
   722   nil
       
   723   )
       
   724  )
       
   725 
       
   726 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   514 (message "switching, creating, selecting buffers")
   727 (message "switching, creating, selecting buffers")
       
   728 
       
   729 (global-set-key [?\C-x right] 'next-buffer)
       
   730 (global-set-key [?\C-x left]  'previous-buffer)
   515 
   731 
   516 (iswitchb-mode 1)
   732 (iswitchb-mode 1)
   517 (setq iswitchb-buffer-ignore
   733 (setq iswitchb-buffer-ignore
   518       '("^ "
   734       '("^ "
   519         "^\*Buffer"
   735         "^\*Buffer"
   534 
   750 
   535 ;; buffer-menu better then buffer-list, but ibuffer much better.
   751 ;; buffer-menu better then buffer-list, but ibuffer much better.
   536 (global-set-key "\C-x\C-b" 'ibuffer)
   752 (global-set-key "\C-x\C-b" 'ibuffer)
   537 
   753 
   538 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   754 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   539 (message "scrolling")
   755 (message "minibuffer")
   540 
   756 
   541 (defvar my-scroll-margin 4)
   757 (require 'icomplete) ; Interactive completion in minibuffer.
   542 
   758 (icomplete-mode 1)
   543 (setq-default
   759 
   544  ;; Set to zero as this recomment documentation.
   760 (mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
   545  scroll-step 0
   761       '(
   546  ;; If the value is greater than 100, redisplay will never recenter point, but
   762         ".class" "~" ".aux"
   547  ;; will always scroll just enough text to bring point into view
   763         ".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
   548  scroll-conservatively 1000
   764         ;; Place dir at end to appear at the start of completion-ignored-extensions.
   549  scroll-preserve-screen-position t
   765         "CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
   550  )
   766         ) )
   551 
   767 (setq read-file-name-completion-ignore-case t)
   552 ;; Set margin only for desired modes! Do not frustrate calendar any more.
       
   553 (make-variable-buffer-local 'scroll-margin)
       
   554 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
       
   555       ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
       
   556       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
       
   557 
       
   558 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   559 (message "chars, unicode")
       
   560 
       
   561 (defun my-print-unicode (&optional start end)
       
   562   "Print UNICODE table."
       
   563   (interactive "nstart: \nnend: ")
       
   564   (switch-to-buffer (get-buffer-create "*UNICODE*"))
       
   565   (erase-buffer)
       
   566   (let ( (i start) )
       
   567     (while (<= i end)
       
   568       (insert (format "%s: U+%04x, %s\n" (char-to-string i) i (get-char-code-property i 'name)))
       
   569       (setq i (1+ i))
       
   570       )))
       
   571 
       
   572 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   573 (message "search, isearch, occur")
       
   574 
       
   575 (setq case-fold-search t)
       
   576 
       
   577 (setq query-replace-highlight t)        ; highlight during query
       
   578 (setq search-highlight t)               ; highlight incremental search
       
   579 
       
   580 ;; Make old Emacs key binding like in Emacs 23.x.
       
   581 (when (< emacs-major-version 23)
       
   582   (global-set-key (kbd "M-s o") 'occur)
       
   583   )
       
   584 
       
   585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   586 (message "grep, find")
       
   587 
       
   588 ;; -ls produce very noisy output:
       
   589 ;; (setq find-ls-option '("-ls" . ""))
       
   590 ;; So I use next expression, which work with GNU find, I replace %s with '0'
       
   591 ;; to avoid unnecessary sys calls and this make output aligned by column:
       
   592 (setq find-ls-option '("-printf ' -rw-rw-rw- 0 %AY-%Am-%Ad %AH:%AM %p\n'" . ""))
       
   593 
       
   594 ;; Do not set t because some grep do not has --color options.
       
   595 (setq grep-highlight-matches nil)
       
   596 (setq grep-use-null-device nil)
       
   597 
       
   598 (eval-after-load 'grep
       
   599   '(progn
       
   600      (add-to-list 'grep-find-ignored-directories "build" t)
       
   601      (add-to-list 'grep-find-ignored-directories "dist" t)
       
   602      (add-to-list 'grep-find-ignored-directories "lib" t)
       
   603      (add-to-list 'grep-find-ignored-directories "_build" t)
       
   604      (add-to-list 'grep-find-ignored-directories "_dist" t)
       
   605      (add-to-list 'grep-find-ignored-directories "_lib" t)
       
   606 
       
   607      (when (boundp 'grep-find-ignored-files)
       
   608        (add-to-list 'grep-find-ignored-files "*TAGS")
       
   609        (add-to-list 'grep-find-ignored-files "GPATH")
       
   610        )
       
   611      ))
       
   612 (global-set-key [f7] 'rgrep)
       
   613 (global-set-key [M-f7] 'rgrep)
       
   614 
       
   615 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   616 (message "highlighting")
       
   617 
       
   618 (setq font-lock-maximum-decoration t)
       
   619 (global-font-lock-mode 1)
       
   620 
       
   621 (global-hi-lock-mode 1)
       
   622 
       
   623 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   624 (message "highlight selected text")
       
   625 
       
   626 (delete-selection-mode 1)
       
   627 
       
   628 (when (<= emacs-major-version 23)
       
   629   ;; 1/-1, when the mark is active, the region is highlighted.
       
   630   (transient-mark-mode 1)
       
   631 
       
   632   ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
       
   633   (require 'pc-select)
       
   634   (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
       
   635   (setq pc-select-meta-moves-sexps t)
       
   636   (cond
       
   637    ((= emacs-major-version 21) (pc-selection-mode))
       
   638    ((>= emacs-major-version 22) (pc-selection-mode 1))
       
   639    )
       
   640   )
       
   641 
       
   642 (when (eq window-system 'x)
       
   643   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
       
   644   )
       
   645 
       
   646 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   647 (message "highlighting current line")
       
   648 
       
   649 (when window-system
       
   650   (custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
       
   651   (global-hl-line-mode 1)
       
   652   )
       
   653 
       
   654 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   655 (message "paren, braces")
       
   656 
       
   657 (show-paren-mode 1) ; Parenthesis matching via highlighting.
       
   658 (setq show-paren-style (quote parenthesis))
       
   659 
       
   660 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   661 (message "keyboard, mouse")
       
   662 
       
   663 ;; cyrillic-jis-russian  for 567 is :,.
       
   664 ;; cyrillic-jcuken  for SHIFT 567 is :,.
       
   665 ;; russian-computer for SHIFT 567 is %^&
       
   666 (if (>= emacs-major-version 22)
       
   667     (setq default-input-method 'russian-computer)
       
   668   (setq default-input-method 'cyrillic-jcuken))
       
   669 ;; (pc-bindings-mode) ; Myself define keybinding, see
       
   670 
   768 
   671 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   769 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   672 (message "completion")
   770 (message "completion")
   673 
   771 
   674 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   772 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   675 ;; Completion controled by 'completion-styles' variable.
   773 ;; Completion controled by 'completion-styles' variable.
   676 
       
   677 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   678 (message "mouse")
       
   679 
       
   680 ;; Scroll Bar gets dragged by mouse butn 1
       
   681 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
       
   682 ;; Paste at point NOT at cursor
       
   683 (setq mouse-yank-at-point t)
       
   684 (when window-system
       
   685   (mouse-wheel-mode 1)
       
   686   )
       
   687 
       
   688 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   689 (message "key binding, short-keys")
       
   690 
       
   691 (global-set-key [home]    'beginning-of-line)
       
   692 (global-set-key [end]     'end-of-line)
       
   693 (global-set-key [C-home] 'beginning-of-buffer)
       
   694 (global-set-key [C-end]  'end-of-buffer)
       
   695 (global-set-key [C-delete]  'kill-word)
       
   696 (global-set-key [delete]     'delete-char)
       
   697 ;; (global-set-key [backspace]  'backward-delete-char-untabify) ; not work properly in *info* mode
       
   698 
       
   699 ;; setting some f[1-12] keys
       
   700 (global-set-key [f1]    'help)
       
   701 (global-set-key [f2]    'save-buffer)
       
   702 (global-set-key [f4]    'ispell-buffer)
       
   703 (global-set-key [S-f6]  'rename-buffer)
       
   704 (global-set-key [f8]    'kill-this-buffer)
       
   705 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
       
   706 (global-set-key [M-f4]  'save-buffers-kill-emacs)
       
   707 (global-set-key [f6]    'toggle-truncate-lines)
       
   708 
       
   709 ;; frames, windows manipulation, switch buffers
       
   710 (global-set-key [?\C-x right] 'next-buffer)
       
   711 (global-set-key [?\C-x left]  'previous-buffer)
       
   712 
       
   713 (global-set-key (kbd "\e\eg") 'goto-line)
       
   714 (global-set-key (kbd "\e\er") 'query-replace-regexp)
       
   715 
       
   716 ;; Disable suspend. It ugly.
       
   717 (when window-system
       
   718   (global-set-key (kbd "C-z") nil))
       
   719 (global-set-key (kbd "C-x C-z") nil)
       
   720 
       
   721 ;; (global-set-key [language-change] 'ignore)
       
   722 
       
   723 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   724 (message "coding system, charset, locale, lang")
       
   725 
       
   726 ;; Emacs 23.1 no longer need codepage-setup.
       
   727 (when (<= emacs-major-version 22)
       
   728   (codepage-setup 866)
       
   729   (codepage-setup 1251)
       
   730   )
       
   731 
       
   732 ;; Comment because prefer-coding-system will be ignored.
       
   733 ;; (setq-default coding-system-for-read  'cp1251-dos)
       
   734 ;; (setq-default coding-system-for-write 'cp1251-dos)
       
   735 
       
   736 ;; (setq locale-coding-system  'cp1251-dos)
       
   737 ;; (set-language-environment 'UTF-8)
       
   738 ;; (set-terminal-coding-system 'cp1251)
       
   739 ;; (set-keyboard-coding-system 'cp1251)
       
   740 
       
   741 (modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
       
   742 (cond
       
   743  ((equal window-system 'w32)          ; also (string-equal system-type "windows-nt")
       
   744   ;; (set-selection-coding-system 'utf-16-le-dos)
       
   745   (setq-default buffer-file-coding-system 'cp1251)
       
   746   (setq default-file-name-coding-system 'cp1251)
       
   747   (setq default-process-coding-system '(cp1251 . cp1251))
       
   748   )
       
   749  ((equal window-system 'x)
       
   750   (prefer-coding-system 'utf-8-unix)
       
   751   (setq selection-coding-system 'compound-text-with-extensions)
       
   752   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
       
   753   (modify-coding-system-alist 'process ".*" 'utf-8-unix)
       
   754   )
       
   755  ((eq system-type 'cygwin)
       
   756   (when (string-match "1251\\'" (getenv "LANG"))
       
   757     (prefer-coding-system 'cp1251-unix)
       
   758     (prefer-coding-system 'utf-8-unix)
       
   759     (modify-coding-system-alist 'process ".*" 'cp1251-unix)
       
   760     )
       
   761   )
       
   762  ((eq system-type 'darwin)
       
   763   nil
       
   764   )
       
   765  )
       
   766 
   774 
   767 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   775 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   768 (message "open file, ffap, dired")
   776 (message "open file, ffap, dired")
   769 
   777 
   770 (setq-default save-place t)
   778 (setq-default save-place t)
   891      ;; with SVG shared library.
   899      ;; with SVG shared library.
   892      (setq image-file-name-extensions (remove "svg" image-file-name-extensions))
   900      (setq image-file-name-extensions (remove "svg" image-file-name-extensions))
   893      ;; Re-initialize the image-file handler.
   901      ;; Re-initialize the image-file handler.
   894      (auto-image-file-mode t)
   902      (auto-image-file-mode t)
   895      ))
   903      ))
   896 
       
   897 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   898 (message "minibuffer")
       
   899 
       
   900 (require 'icomplete) ; Interactive completion in minibuffer.
       
   901 (icomplete-mode 1)
       
   902 
       
   903 (mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
       
   904       '(
       
   905         ".class" "~" ".aux"
       
   906         ".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
       
   907         ;; Place dir at end to appear at the start of completion-ignored-extensions.
       
   908         "CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
       
   909         ) )
       
   910 (setq read-file-name-completion-ignore-case t)
       
   911 
   904 
   912 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   913 (message "url")
   906 (message "url")
   914 
   907 
   915 ;; http://tools.ietf.org/html/rfc3986
   908 ;; http://tools.ietf.org/html/rfc3986
  1887 (setq diff-switches "-u")
  1880 (setq diff-switches "-u")
  1888 
  1881 
  1889 (setq ediff-diff-options "")
  1882 (setq ediff-diff-options "")
  1890 (setq ediff-custom-diff-options "-u")
  1883 (setq ediff-custom-diff-options "-u")
  1891 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
  1884 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
       
  1885 (setq ediff-split-window-function 'split-window-vertically)
  1892 
  1886 
  1893 (when window-system
  1887 (when window-system
  1894   (eval-after-load 'diff-mode
  1888   (eval-after-load 'diff-mode
  1895     '(progn
  1889     '(progn
  1896        (set-face-foreground 'diff-added-face "DarkGreen")
  1890        (set-face-foreground 'diff-added-face "DarkGreen")
  1958   )
  1952   )
  1959 (eval-after-load 'compile
  1953 (eval-after-load 'compile
  1960   '(progn
  1954   '(progn
  1961      (define-key compilation-mode-map [C-return] 'my-comint-send-string)
  1955      (define-key compilation-mode-map [C-return] 'my-comint-send-string)
  1962      ))
  1956      ))
       
  1957 
       
  1958 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
  1959 (message "scons")
       
  1960 
       
  1961 (add-to-list 'auto-mode-alist '("SConstruct\\'" . python-mode))
       
  1962 (add-to-list 'auto-mode-alist '("SConscript\\'" . python-mode))
  1963 
  1963 
  1964 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1964 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1965 (message "TAGS, etags, ctags, GNU GLOBAL")
  1965 (message "TAGS, etags, ctags, GNU GLOBAL")
  1966 
  1966 
  1967 ;; One of 'tags-table-list' or 'tags-file-name' control which TAGS files to
  1967 ;; One of 'tags-table-list' or 'tags-file-name' control which TAGS files to
  2182   (when (and (boundp 'py-version) (equal py-version "5.1.0"))
  2182   (when (and (boundp 'py-version) (equal py-version "5.1.0"))
  2183     (setq-default py-which-shell py-python-command)
  2183     (setq-default py-which-shell py-python-command)
  2184     ;; (py-toggle-shells 'cpython)
  2184     ;; (py-toggle-shells 'cpython)
  2185     ))
  2185     ))
  2186 
  2186 
       
  2187 ;; Enable "M-/", "C-c g", "C-c d", "C-c f" shortcuts.
       
  2188 (setq ropemacs-enable-shortcuts t)
  2187 (ignore-errors
  2189 (ignore-errors
  2188   (require 'pymacs)
  2190   (require 'pymacs)
  2189   (pymacs-load "ropemacs" "rope-")
  2191   (pymacs-load "ropemacs" "rope-")
  2190   )
  2192   )
  2191 ;; Automatically save project python buffers before refactorings
  2193 ;; Automatically save project python buffers before refactorings
  2287 
  2289 
  2288 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2290 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2289 (message "ECB")
  2291 (message "ECB")
  2290 
  2292 
  2291 (setq ecb-tip-of-the-day nil)
  2293 (setq ecb-tip-of-the-day nil)
       
  2294 
       
  2295 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
  2296 (message "htmlize")
       
  2297 
       
  2298 (setq
       
  2299  htmlize-html-charset "utf-8"
       
  2300  htmlize-output-type 'inline-css
       
  2301  htmlize-html-major-mode 'html-mode
       
  2302  htmlize-convert-nonascii-to-entities nil)
  2292 
  2303 
  2293 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2304 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2294 (message "html")
  2305 (message "html")
  2295 
  2306 
  2296 (add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))
  2307 (add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))