.emacs-my
changeset 953 3ad3abeec5f9
parent 952 6ec8b1014d11
child 954 1ba0418d2d82
equal deleted inserted replaced
952:6ec8b1014d11 953:3ad3abeec5f9
   510         ("marmalade" . "http://marmalade-repo.org/packages/")
   510         ("marmalade" . "http://marmalade-repo.org/packages/")
   511         ("melpa" . "http://melpa.milkbox.net/packages/")
   511         ("melpa" . "http://melpa.milkbox.net/packages/")
   512         ))
   512         ))
   513 
   513 
   514 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   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 ;; setting some f[1-12] keys
       
   670 (global-set-key [f1]    'help)
       
   671 (global-set-key [f2]    'save-buffer)
       
   672 (global-set-key [f4]    'ispell-buffer)
       
   673 (global-set-key [S-f6]  'rename-buffer)
       
   674 (global-set-key [f8]    'kill-this-buffer)
       
   675 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
       
   676 (global-set-key [M-f4]  'save-buffers-kill-emacs)
       
   677 (global-set-key [f6]    'toggle-truncate-lines)
       
   678 
       
   679 ;; frames, windows manipulation, switch buffers
       
   680 (global-set-key [?\C-x right] 'next-buffer)
       
   681 (global-set-key [?\C-x left]  'previous-buffer)
       
   682 
       
   683 (global-set-key (kbd "\e\eg") 'goto-line)
       
   684 (global-set-key (kbd "\e\er") 'query-replace-regexp)
       
   685 
       
   686 ;; Disable suspend. It ugly.
       
   687 (when window-system
       
   688   (global-set-key (kbd "C-z") nil))
       
   689 (global-set-key (kbd "C-x C-z") nil)
       
   690 
       
   691 ;; (global-set-key [language-change] 'ignore)
       
   692 
       
   693 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   694 (message "coding system, charset, locale, lang")
       
   695 
       
   696 ;; Emacs 23.1 no longer need codepage-setup.
       
   697 (when (<= emacs-major-version 22)
       
   698   (codepage-setup 866)
       
   699   (codepage-setup 1251)
       
   700   )
       
   701 
       
   702 ;; Comment because prefer-coding-system will be ignored.
       
   703 ;; (setq-default coding-system-for-read  'cp1251-dos)
       
   704 ;; (setq-default coding-system-for-write 'cp1251-dos)
       
   705 
       
   706 ;; (setq locale-coding-system  'cp1251-dos)
       
   707 ;; (set-language-environment 'UTF-8)
       
   708 ;; (set-terminal-coding-system 'cp1251)
       
   709 ;; (set-keyboard-coding-system 'cp1251)
       
   710 
       
   711 (modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
       
   712 (cond
       
   713  ((equal window-system 'w32)          ; also (string-equal system-type "windows-nt")
       
   714   ;; (set-selection-coding-system 'utf-16-le-dos)
       
   715   (setq-default buffer-file-coding-system 'cp1251)
       
   716   (setq default-file-name-coding-system 'cp1251)
       
   717   (setq default-process-coding-system '(cp1251 . cp1251))
       
   718   )
       
   719  ((equal window-system 'x)
       
   720   (prefer-coding-system 'utf-8-unix)
       
   721   (setq selection-coding-system 'compound-text-with-extensions)
       
   722   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
       
   723   (modify-coding-system-alist 'process ".*" 'utf-8-unix)
       
   724   )
       
   725  ((eq system-type 'cygwin)
       
   726   (when (string-match "1251\\'" (getenv "LANG"))
       
   727     (prefer-coding-system 'cp1251-unix)
       
   728     (prefer-coding-system 'utf-8-unix)
       
   729     (modify-coding-system-alist 'process ".*" 'cp1251-unix)
       
   730     )
       
   731   )
       
   732  ((eq system-type 'darwin)
       
   733   nil
       
   734   )
       
   735  )
       
   736 
       
   737 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   515 (message "switching, creating, selecting buffers")
   738 (message "switching, creating, selecting buffers")
   516 
   739 
   517 (iswitchb-mode 1)
   740 (iswitchb-mode 1)
   518 (setq iswitchb-buffer-ignore
   741 (setq iswitchb-buffer-ignore
   519       '("^ "
   742       '("^ "
   535 
   758 
   536 ;; buffer-menu better then buffer-list, but ibuffer much better.
   759 ;; buffer-menu better then buffer-list, but ibuffer much better.
   537 (global-set-key "\C-x\C-b" 'ibuffer)
   760 (global-set-key "\C-x\C-b" 'ibuffer)
   538 
   761 
   539 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   762 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   540 (message "scrolling")
   763 (message "minibuffer")
   541 
   764 
   542 (defvar my-scroll-margin 4)
   765 (require 'icomplete) ; Interactive completion in minibuffer.
   543 
   766 (icomplete-mode 1)
   544 (setq-default
   767 
   545  ;; Set to zero as this recomment documentation.
   768 (mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
   546  scroll-step 0
   769       '(
   547  ;; If the value is greater than 100, redisplay will never recenter point, but
   770         ".class" "~" ".aux"
   548  ;; will always scroll just enough text to bring point into view
   771         ".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
   549  scroll-conservatively 1000
   772         ;; Place dir at end to appear at the start of completion-ignored-extensions.
   550  scroll-preserve-screen-position t
   773         "CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
   551  )
   774         ) )
   552 
   775 (setq read-file-name-completion-ignore-case t)
   553 ;; Set margin only for desired modes! Do not frustrate calendar any more.
       
   554 (make-variable-buffer-local 'scroll-margin)
       
   555 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin))))
       
   556       ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
       
   557       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
       
   558 
       
   559 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   560 (message "chars, unicode")
       
   561 
       
   562 (defun my-print-unicode (&optional start end)
       
   563   "Print UNICODE table."
       
   564   (interactive "nstart: \nnend: ")
       
   565   (switch-to-buffer (get-buffer-create "*UNICODE*"))
       
   566   (erase-buffer)
       
   567   (let ( (i start) )
       
   568     (while (<= i end)
       
   569       (insert (format "%s: U+%04x, %s\n" (char-to-string i) i (get-char-code-property i 'name)))
       
   570       (setq i (1+ i))
       
   571       )))
       
   572 
       
   573 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   574 (message "search, isearch, occur")
       
   575 
       
   576 (setq case-fold-search t)
       
   577 
       
   578 (setq query-replace-highlight t)        ; highlight during query
       
   579 (setq search-highlight t)               ; highlight incremental search
       
   580 
       
   581 ;; Make old Emacs key binding like in Emacs 23.x.
       
   582 (when (< emacs-major-version 23)
       
   583   (global-set-key (kbd "M-s o") 'occur)
       
   584   )
       
   585 
       
   586 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   587 (message "grep, find")
       
   588 
       
   589 ;; -ls produce very noisy output:
       
   590 ;; (setq find-ls-option '("-ls" . ""))
       
   591 ;; So I use next expression, which work with GNU find, I replace %s with '0'
       
   592 ;; to avoid unnecessary sys calls and this make output aligned by column:
       
   593 (setq find-ls-option '("-printf ' -rw-rw-rw- 0 %AY-%Am-%Ad %AH:%AM %p\n'" . ""))
       
   594 
       
   595 ;; Do not set t because some grep do not has --color options.
       
   596 (setq grep-highlight-matches nil)
       
   597 (setq grep-use-null-device nil)
       
   598 
       
   599 (eval-after-load 'grep
       
   600   '(progn
       
   601      (add-to-list 'grep-find-ignored-directories "build" t)
       
   602      (add-to-list 'grep-find-ignored-directories "dist" t)
       
   603      (add-to-list 'grep-find-ignored-directories "lib" t)
       
   604      (add-to-list 'grep-find-ignored-directories "_build" t)
       
   605      (add-to-list 'grep-find-ignored-directories "_dist" t)
       
   606      (add-to-list 'grep-find-ignored-directories "_lib" t)
       
   607 
       
   608      (when (boundp 'grep-find-ignored-files)
       
   609        (add-to-list 'grep-find-ignored-files "*TAGS")
       
   610        (add-to-list 'grep-find-ignored-files "GPATH")
       
   611        )
       
   612      ))
       
   613 (global-set-key [f7] 'rgrep)
       
   614 (global-set-key [M-f7] 'rgrep)
       
   615 
       
   616 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   617 (message "highlighting")
       
   618 
       
   619 (setq font-lock-maximum-decoration t)
       
   620 (global-font-lock-mode 1)
       
   621 
       
   622 (global-hi-lock-mode 1)
       
   623 
       
   624 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   625 (message "highlight selected text")
       
   626 
       
   627 (delete-selection-mode 1)
       
   628 
       
   629 (when (<= emacs-major-version 23)
       
   630   ;; 1/-1, when the mark is active, the region is highlighted.
       
   631   (transient-mark-mode 1)
       
   632 
       
   633   ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
       
   634   (require 'pc-select)
       
   635   (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
       
   636   (setq pc-select-meta-moves-sexps t)
       
   637   (cond
       
   638    ((= emacs-major-version 21) (pc-selection-mode))
       
   639    ((>= emacs-major-version 22) (pc-selection-mode 1))
       
   640    )
       
   641   )
       
   642 
       
   643 (when (eq window-system 'x)
       
   644   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
       
   645   )
       
   646 
       
   647 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   648 (message "highlighting current line")
       
   649 
       
   650 (when window-system
       
   651   (custom-set-faces '(hl-line ((t (:inherit highlight :background "light yellow")))))
       
   652   (global-hl-line-mode 1)
       
   653   )
       
   654 
       
   655 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   656 (message "paren, braces")
       
   657 
       
   658 (show-paren-mode 1) ; Parenthesis matching via highlighting.
       
   659 (setq show-paren-style (quote parenthesis))
       
   660 
       
   661 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   662 (message "keyboard, mouse")
       
   663 
       
   664 ;; cyrillic-jis-russian  for 567 is :,.
       
   665 ;; cyrillic-jcuken  for SHIFT 567 is :,.
       
   666 ;; russian-computer for SHIFT 567 is %^&
       
   667 (if (>= emacs-major-version 22)
       
   668     (setq default-input-method 'russian-computer)
       
   669   (setq default-input-method 'cyrillic-jcuken))
       
   670 ;; (pc-bindings-mode) ; Myself define keybinding, see
       
   671 
   776 
   672 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   777 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   673 (message "completion")
   778 (message "completion")
   674 
   779 
   675 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   780 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
   676 ;; Completion controled by 'completion-styles' variable.
   781 ;; Completion controled by 'completion-styles' variable.
   677 
       
   678 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   679 (message "mouse")
       
   680 
       
   681 ;; Scroll Bar gets dragged by mouse butn 1
       
   682 (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
       
   683 ;; Paste at point NOT at cursor
       
   684 (setq mouse-yank-at-point t)
       
   685 (when window-system
       
   686   (mouse-wheel-mode 1)
       
   687   )
       
   688 
       
   689 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   690 (message "key binding, short-keys")
       
   691 
       
   692 (global-set-key [home]    'beginning-of-line)
       
   693 (global-set-key [end]     'end-of-line)
       
   694 (global-set-key [C-home] 'beginning-of-buffer)
       
   695 (global-set-key [C-end]  'end-of-buffer)
       
   696 (global-set-key [C-delete]  'kill-word)
       
   697 (global-set-key [delete]     'delete-char)
       
   698 ;; (global-set-key [backspace]  'backward-delete-char-untabify) ; not work properly in *info* mode
       
   699 
       
   700 ;; setting some f[1-12] keys
       
   701 (global-set-key [f1]    'help)
       
   702 (global-set-key [f2]    'save-buffer)
       
   703 (global-set-key [f4]    'ispell-buffer)
       
   704 (global-set-key [S-f6]  'rename-buffer)
       
   705 (global-set-key [f8]    'kill-this-buffer)
       
   706 (global-set-key (kbd "C-x C-k") 'kill-this-buffer)
       
   707 (global-set-key [M-f4]  'save-buffers-kill-emacs)
       
   708 (global-set-key [f6]    'toggle-truncate-lines)
       
   709 
       
   710 ;; frames, windows manipulation, switch buffers
       
   711 (global-set-key [?\C-x right] 'next-buffer)
       
   712 (global-set-key [?\C-x left]  'previous-buffer)
       
   713 
       
   714 (global-set-key (kbd "\e\eg") 'goto-line)
       
   715 (global-set-key (kbd "\e\er") 'query-replace-regexp)
       
   716 
       
   717 ;; Disable suspend. It ugly.
       
   718 (when window-system
       
   719   (global-set-key (kbd "C-z") nil))
       
   720 (global-set-key (kbd "C-x C-z") nil)
       
   721 
       
   722 ;; (global-set-key [language-change] 'ignore)
       
   723 
       
   724 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   725 (message "coding system, charset, locale, lang")
       
   726 
       
   727 ;; Emacs 23.1 no longer need codepage-setup.
       
   728 (when (<= emacs-major-version 22)
       
   729   (codepage-setup 866)
       
   730   (codepage-setup 1251)
       
   731   )
       
   732 
       
   733 ;; Comment because prefer-coding-system will be ignored.
       
   734 ;; (setq-default coding-system-for-read  'cp1251-dos)
       
   735 ;; (setq-default coding-system-for-write 'cp1251-dos)
       
   736 
       
   737 ;; (setq locale-coding-system  'cp1251-dos)
       
   738 ;; (set-language-environment 'UTF-8)
       
   739 ;; (set-terminal-coding-system 'cp1251)
       
   740 ;; (set-keyboard-coding-system 'cp1251)
       
   741 
       
   742 (modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
       
   743 (cond
       
   744  ((equal window-system 'w32)          ; also (string-equal system-type "windows-nt")
       
   745   ;; (set-selection-coding-system 'utf-16-le-dos)
       
   746   (setq-default buffer-file-coding-system 'cp1251)
       
   747   (setq default-file-name-coding-system 'cp1251)
       
   748   (setq default-process-coding-system '(cp1251 . cp1251))
       
   749   )
       
   750  ((equal window-system 'x)
       
   751   (prefer-coding-system 'utf-8-unix)
       
   752   (setq selection-coding-system 'compound-text-with-extensions)
       
   753   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
       
   754   (modify-coding-system-alist 'process ".*" 'utf-8-unix)
       
   755   )
       
   756  ((eq system-type 'cygwin)
       
   757   (when (string-match "1251\\'" (getenv "LANG"))
       
   758     (prefer-coding-system 'cp1251-unix)
       
   759     (prefer-coding-system 'utf-8-unix)
       
   760     (modify-coding-system-alist 'process ".*" 'cp1251-unix)
       
   761     )
       
   762   )
       
   763  ((eq system-type 'darwin)
       
   764   nil
       
   765   )
       
   766  )
       
   767 
   782 
   768 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   783 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   769 (message "open file, ffap, dired")
   784 (message "open file, ffap, dired")
   770 
   785 
   771 (setq-default save-place t)
   786 (setq-default save-place t)
   892      ;; with SVG shared library.
   907      ;; with SVG shared library.
   893      (setq image-file-name-extensions (remove "svg" image-file-name-extensions))
   908      (setq image-file-name-extensions (remove "svg" image-file-name-extensions))
   894      ;; Re-initialize the image-file handler.
   909      ;; Re-initialize the image-file handler.
   895      (auto-image-file-mode t)
   910      (auto-image-file-mode t)
   896      ))
   911      ))
   897 
       
   898 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
   899 (message "minibuffer")
       
   900 
       
   901 (require 'icomplete) ; Interactive completion in minibuffer.
       
   902 (icomplete-mode 1)
       
   903 
       
   904 (mapc (lambda (ext) (add-to-list 'completion-ignored-extensions ext))
       
   905       '(
       
   906         ".class" "~" ".aux"
       
   907         ".o" ".obj" ".map" ".lib" ".lo" ".la" ".a" ".bin" ".exe"
       
   908         ;; Place dir at end to appear at the start of completion-ignored-extensions.
       
   909         "CVS/" ".hg/" ".svn/" ".git/" ".bzr/"
       
   910         ) )
       
   911 (setq read-file-name-completion-ignore-case t)
       
   912 
   912 
   913 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   913 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   914 (message "url")
   914 (message "url")
   915 
   915 
   916 ;; http://tools.ietf.org/html/rfc3986
   916 ;; http://tools.ietf.org/html/rfc3986