merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 06 Oct 2011 17:03:32 +0300
changeset 721 3eb929c032f4
parent 719 694f7e388f2b (diff)
parent 720 e50b78c6a53d (current diff)
child 722 7d43d5ae86fe
child 723 ff912b026ad2
merged
.emacs-my
--- a/.emacs-autogen.sh	Thu Oct 06 16:41:35 2011 +0300
+++ b/.emacs-autogen.sh	Thu Oct 06 17:03:32 2011 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 if [ -z "$1" ]; then
   echo "Where config file?"
--- a/.emacs-my	Thu Oct 06 16:41:35 2011 +0300
+++ b/.emacs-my	Thu Oct 06 17:03:32 2011 +0300
@@ -1,4 +1,4 @@
-;; -*- mode: emacs-lisp; mode: outline-minor; coding: utf-8; fill-column: 78 -*-
+;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*-
 ;;
 ;; Written by Oleksandr Gavenko <gavenkoa@gmail.com>, 2008-2010.
 ;;
@@ -9,7 +9,7 @@
 ;;
 ;; For load order see README.
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "recentf")
 
 (require 'recentf)
@@ -20,14 +20,14 @@
 (setq recentf-max-saved-items 1000)
 (global-set-key (kbd "\e\eq")  'recentf-open-files)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "revert buffer")
 
 (global-set-key [f5]    'revert-buffer)
 (setq revert-without-query (quote (".*")))
 (setq auto-revert-interval 2)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "debugging")
 
 ;; Shut off message buffer by setting nil.
@@ -44,7 +44,7 @@
 ;; Also '-q' prevent loading your init file.
 (setq inhibit-default-init nil)         ; t/nil
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "user info")
 
 (setq user-full-name "Oleksandr Gavenko")
@@ -52,7 +52,7 @@
 (setq user-nick "gavenkoa")
 (setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address  ">"))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "my defun, defmacro, defvar")
 
 (defmacro my-filter (condfunc list)
@@ -66,6 +66,16 @@
            ,list)
      r))
 
+(defun my-fold (f x list)
+  "Recursively applies (F i j) to LIST starting with X.
+For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)."
+  (let ((li list) (x2 x))
+    (while li
+      (setq x2 (funcall f x2 (pop li)))
+      )
+    x2
+    ) )
+
 (unless (fboundp 'ignore-errors)
   (defmacro ignore-errors (&rest body)
     "Execute BODY; if an error occurs, return nil.
@@ -74,7 +84,7 @@
     `(condition-case nil (progn ,@body) (error nil)))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "mode groups")
 
 (defmacro my-defun-rename-symb-tree (name doc func)
@@ -155,7 +165,7 @@
   (my-mode2hook my-text-mode-list)
   "List of text mode hooks.")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "appearance")
 
 ;; To maximize frame on full screen, not work with Windows Emacs 21.4.
@@ -250,7 +260,7 @@
 (when (boundp 'confirm-kill-emacs)
   (setq confirm-kill-emacs 'y-or-n-p))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "silent runing")
 
 ;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
@@ -263,11 +273,25 @@
   "If t 'cmdproxy.exe' will be used as shell. Affect on M-x shell like
   commands. If nil, 'sh' will be used." )
 
+(defun follow-cygwin-symlink ()
+  "Follow new-style (and also UCS-16) Cygwin symlinks."
+  (save-excursion
+    (goto-char 0)
+    (when (looking-at "!<symlink>\xff\xfe")
+      (find-alternate-file
+       (substring
+        (decode-coding-string
+         (buffer-substring (match-end 0) (point-max))
+         'utf-16-le)
+        0 -1)                           ; -1 for stripping final \0.
+       ))))
+
 (when (eq system-type 'windows-nt)
   (ignore-errors
     (require 'cygwin-mount)
     (cygwin-mount-activate)
     )
+  (add-hook 'find-file-hooks 'follow-cygwin-symlink)
   ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
   ;; quoted by double '\' chars this cause failure.
   (defun shell-quote-argument (argument)
@@ -286,7 +310,7 @@
 (setq explicit-bash-args '("-i"))
 (setq explicit-sh-args '("-i"))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "whitespaces")
 
 (setq default-indicate-empty-lines t)
@@ -304,7 +328,7 @@
 ;; See also 'mode-require-final-newline'.
 (add-hook 'text-mode-hook (lambda () (setq require-final-newline nil)))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "gnu serv, server")
 
 ;; (load "~/emacs/bin/gnuserv/gnuserv.el")
@@ -319,7 +343,7 @@
     (server-start))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "standart/general settings")
 
 ;; Try to speed things up, especially in VM.
@@ -377,7 +401,11 @@
  x-gtk-show-hidden-files t
  )
 
-;;; ----------------------------------------------------------------
+(defun my-prevent-kill-buffer ()
+  (if (equal (buffer-name) "*scratch*") nil t))
+(add-to-list 'kill-buffer-query-functions 'my-prevent-kill-buffer)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "switching, creating, selecting buffers")
 
 (iswitchb-mode 1)
@@ -400,7 +428,7 @@
 ;; buffer-menu better then buffer-list, but ibuffer much better.
 (global-set-key "\C-x\C-b" 'ibuffer)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "scrolling")
 
 (defvar my-scroll-margin 4)
@@ -417,7 +445,7 @@
       ;; TODO its good invoke delete-dups for list, but delete-dups not exist in Emacs 21.4
       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "search, isearch, occur")
 
 (setq case-fold-search t)
@@ -431,7 +459,7 @@
   )
 (global-set-key [f7] 'occur)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "grep, find")
 
 ;; -ls produce very noisy output:
@@ -458,13 +486,13 @@
 
 (global-set-key [M-f7] 'rgrep)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "syntax highlighting")
 
 (setq font-lock-maximum-decoration t)
 (global-font-lock-mode 1)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "highlight selected text")
 
 ;; 1/-1, when the mark is active, the region is highlighted.
@@ -484,7 +512,7 @@
   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "highlighting current line")
 
 (when window-system
@@ -492,13 +520,13 @@
   (global-hl-line-mode 1)
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "paren, braces")
 
 (show-paren-mode 1) ; Parenthesis matching via highlighting.
 (setq show-paren-style (quote parenthesis))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "keyboard, mouse")
 
 ;; cyrillic-jis-russian  for 567 is :,.
@@ -509,13 +537,13 @@
   (setq default-input-method 'cyrillic-jcuken))
 ;; (pc-bindings-mode) ; Myself define keybinding, see
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "completion")
 
 ;; I remove partial-completion-mode because it depricated in Emacs 24.0.
 ;; Completion controled by 'completion-styles' variable.
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "mouse")
 
 ;; Scroll Bar gets dragged by mouse butn 1
@@ -526,7 +554,7 @@
   (mouse-wheel-mode 1)
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "key binding, short-keys")
 
 (global-set-key [home]    'beginning-of-line)
@@ -562,7 +590,7 @@
 
 ;; (global-set-key [language-change] 'ignore)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "coding system, charset, locale, lang")
 
 ;; Emacs 23.1 no longer need codepage-setup.
@@ -604,7 +632,7 @@
   )
  )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "open file, ffap, dired")
 
 (setq-default save-place t)
@@ -692,7 +720,7 @@
 
 (define-key dired-mode-map (kbd "`") 'my-dired-flag-tmp-files)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "ls-lisp, dired ls")
 
 ;; If non-nil - use 'insert-directory-program', which I dislike.
@@ -709,7 +737,7 @@
         "%Y-%m-%d %H:%M   "))
 (require 'ls-lisp)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "compression, archive")
 
 (require 'jka-compr) ; Automatic decompression, hooks for tar-mode.
@@ -720,7 +748,7 @@
 
 (add-to-list 'auto-mode-alist '("\\.\\(war\\|ear\\|sar\\|egg\\)\\'" . archive-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "image, png, svg")
 
 (when (fboundp 'auto-image-file-mode)
@@ -734,15 +762,7 @@
      (auto-image-file-mode t)
      ))
 
-;;; ----------------------------------------------------------------
-(message "convenient")
-
-(defun reglen()
-  "Show region length."
-  (interactive)
-  (message "%s" (- (region-end) (region-beginning))))
-
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "minibuffer")
 
 (require 'icomplete) ; Interactive completion in minibuffer.
@@ -757,13 +777,40 @@
         ) )
 (setq read-file-name-completion-ignore-case t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "music")
 (setq gnus-audio-au-player "winamp.exe"
       gnus-audio-directory "D:\\music"
       gnus-audio-wav-player "winamp.exe")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "url")
+
+;; http://tools.ietf.org/html/rfc3986
+;; http://en.wikipedia.org/wiki/Percent-encoding
+(defun my-percent-decode (str)
+  (decode-coding-string
+   (let* ( (s (split-string str "%")) )
+     (my-fold
+      'concat
+      (car s)
+      (mapcar
+       (lambda (x)
+         (concat (unibyte-string (string-to-number (substring x 0 2) 16)) (substring x 2)))
+       (cdr s))
+      )) 'utf-8))
+
+(defun my-percent-decode-region (arg beg end)
+  "Convert percent encoded string to native."
+  (interactive "P\nr")
+  (let ( (result (my-percent-decode (buffer-substring-no-properties beg end))) )
+    (if (not arg)
+        (message result)
+      (delete-region beg end)
+      (insert result))
+    ) )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "browser")
 
 (cond
@@ -780,7 +827,7 @@
   (browse-url (format "http://cygwin.com/cgi-bin2/package-grep.cgi?grep=%s" str))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "calendar")
 
 ;; (setq mark-holidays-in-calendar t)
@@ -790,12 +837,12 @@
 (setq calendar-week-start-day 1)
 (setq european-calendar-style t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "standard hooks")
 
 (add-hook 'write-file-hooks 'time-stamp)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "auto-fill")
 
 (setq-default fill-column 78)
@@ -811,7 +858,7 @@
 (add-hook 'html-mode-hook 'turn-on-auto-fill)
 (add-hook 'text-mode-hook 'turn-on-auto-fill)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "unknown")
 
 ;; mailcrypt gnus message sendmail bbdb pilot bibtex eiffel-mode emacs-w3m
@@ -819,7 +866,7 @@
 ;; chord-mode - edit guitar music
 ;; discography - variant of BibTeX mode for discographies
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "cacl, calculator")
 
 (setq-default calc-group-digits t)
@@ -856,12 +903,12 @@
         '(rst-level-6face ((t (:background "yellow"))) t)
         ) ) ) )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "TeX, LaTeX")
 
 (setq tex-run-command "initex")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "AUC TeX")
 
 ;(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar)
@@ -898,7 +945,7 @@
 ;           "texify --tex-opt=--src --run-viewer --clean %s.tex"
 ;           'TeX-run-command nil t))))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "reftex")
 
 ;; Reftex is included with Emacs 21.1.
@@ -910,7 +957,7 @@
 ;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
 ;; (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "PreviewLatex")
 
 ;(load "preview-latex.el" nil t t)
@@ -918,7 +965,7 @@
 ;(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
 ;(autoload 'LaTeX-preview-setup "preview")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "Info")
 
 ;; Because of Debian policy documentation covered by FDL license with invariant sections not allowed in packet
@@ -927,13 +974,13 @@
 (unless (getenv "INFOPATH")
   (setenv "INFOPATH" "~/usr/share/info:"))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "man, woman")
 
 (setq woman-use-own-frame nil)
 (setq woman-fill-frame t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "comint")
 
 ;; If non-nil, add a `/' to completed directories, ` ' to file names.
@@ -941,7 +988,7 @@
 ;; Non-nil means go to the end of the line before sending input.
 (setq comint-eol-on-send t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "spell, ispell, aspell")
 
 ;; Settings for spelling done in '.emacs-autogen'.
@@ -949,20 +996,20 @@
 ;(setq flyspell-default-dictionary "russianw")
 ;(setq flyspell-delay '1)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "dict, dictd, dictionary")
 
 (when (fboundp 'dict-c5-mode)
   (add-to-list 'auto-mode-alist '("\\.dict-c5$" . dict-c5-mode))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "remember-mode")
 
 (when (>= emacs-major-version 23)
   (require 'remember))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "org-mode, GTD, PIM, organize, todo")
 
 (when (>= emacs-major-version 22)
@@ -1032,7 +1079,7 @@
   ;;         ("DONE" . (:foreground "green" :weight bold))) )
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "TODO, XXX, FIXME highlight")
 ;; Show blanks and FIXME
 ;; http://www.emacswiki.org/cgi-bin/wiki/EightyColumnRule
@@ -1059,11 +1106,11 @@
      ))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "fortune")
 (setq fortune-file "~/XXX")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "mail, mh-e")
 
 (setq mail-signature t)
@@ -1072,7 +1119,7 @@
 
 ;; (setq mail-user-agent 'mh-e-user-agent)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "jabber")
 
 (autoload 'jabber-connect-all "jabber")
@@ -1141,7 +1188,7 @@
 
 (global-set-key (kbd "C-x C-j C-s") 'my-jabber-send)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "rcirc")
 
 ;; Turn on logging everything to a special buffer, for debugging.
@@ -1157,7 +1204,7 @@
 (setq rcirc-default-nick user-nick)
 (setq rcirc-default-user-full-name user-full-name)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "erc")
 
 ;; (add-to-list 'erc-modules 'notify)
@@ -1190,7 +1237,7 @@
 ;; Kill buffers for server messages after quitting the server
 ;; (setq erc-kill-server-buffer-on-quit t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "vc-mode, VCS, version control, cvs, svn, mercurial, hg, bazaar, bzr, git, fossil")
 
 ;; `-b' switch to ignore changes in whitespaces.
@@ -1229,20 +1276,20 @@
      (360 . "#0D80E0")))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "psvn")
 
 (setq svn-status-verbose t)
 (setq svn-status-hide-unmodified t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "DVC")
 
 (when (featurep 'dvc-emacs)
   (setq dvc-tips-enabled nil)
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "devel, prog, programming")
 
 (which-func-mode 1)
@@ -1268,7 +1315,7 @@
 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) ))
       (append my-devel-mode-hook-list my-text-mode-hook-list))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "diff, patch, ediff, emerge")
 
 (setq diff-switches "-u")
@@ -1276,7 +1323,14 @@
 (setq ediff-diff-options "")
 (setq ediff-custom-diff-options "-u")
 
-;;; ----------------------------------------------------------------
+(when window-system
+  (eval-after-load 'diff-mode
+    '(progn
+       (set-face-foreground 'diff-added-face "DarkGreen")
+       (set-face-foreground 'diff-removed-face "DarkRed")
+  )))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "indenting")
 
 (setq standard-indent 4)
@@ -1296,7 +1350,7 @@
     (setq tab-stop-list (cons i tab-stop-list))
     (setq i (- i 4))))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "compile")
 
 ;; Prompt for compilation command.
@@ -1328,18 +1382,19 @@
   "History list for `my-comint-send-string'."
   )
 (defun my-comint-send-string (string)
-  "Send string to comint buffers. Useful for *compilation* read-only buffer."
+  "Send string to comint buffers. Useful for *compilation* read-only buffer.
+Automaticaly append final newline."
   (interactive
    (list (read-input "Type string: " nil 'my-comint-send-hist-list))
    )
-  (comint-send-string (get-buffer-process (current-buffer)) string)
+  (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n"))
   )
 (eval-after-load 'compile
   '(progn
      (define-key compilation-mode-map [C-return] 'my-comint-send-string)
      ))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "TAGS, etags, ctags, GNU GLOBAL")
 
 ;; One of 'tags-table-list' or 'tags-file-name' control which TAGS files to
@@ -1355,7 +1410,7 @@
 (setq tags-add-tables t)
 (global-set-key "\M-\r" 'complete-tag)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "CEDET, semantic")
 
 ;; For debug use 'semantic-debug-idle-function' and 'semantic-debug-idle-work-function'.
@@ -1405,7 +1460,7 @@
   (global-set-key (kbd "C-c , c") 'semantic-ia-complete-symbol-menu)
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "imenu")
 
 (defun my-imenu-to-menubar ()
@@ -1417,17 +1472,17 @@
 (mapc (lambda (hook) (add-hook hook 'my-imenu-to-menubar))
       my-devel-mode-hook-list)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "windows inf files for driver installin")
 
 (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "makefile, make")
 
 (add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "asm, assembler")
 
 ;; (setq-default asm-comment-char 59)
@@ -1438,7 +1493,7 @@
 ;; (add-hook 'asm-mode-hook '(lambda () (local-unset-key ":")))
 ;; (add-hook 'asm-mode-hook '(lambda () (local-set-key ":" ":")))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "linker")
 
 (when (fboundp 'iar-linker-config-mode)
@@ -1448,7 +1503,7 @@
   (add-to-list 'auto-mode-alist '("\\.xcl\\'" . iar4-linker-config-mode))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "lisp, elisp")
 
 (setq list-command-history-max 256)
@@ -1474,20 +1529,23 @@
     )
    ))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "C, c-mode, C++, c++-mode")
 
 ;; Minor mode that highlights suspicious C and C++ constructions.
 (cwarn-mode 1)
 
 (setq c-echo-syntactic-information-p t)
-(add-hook 'c-mode-common-hook
- (lambda ()
-   ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
-   (c-toggle-auto-newline -1)
-   ;; Delete all preceding whitespace by DEL.
-   (c-toggle-hungry-state -1)
-   ))
+
+(defun my-c-mode-common-hook ()
+  ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
+  (c-toggle-auto-newline 1)
+  ;; Delete all preceding whitespace by DEL.
+  (c-toggle-hungry-state -1)
+  ;; Auto indent after typing colon according to `c-hanging-colons-alist'.
+  (c-toggle-electric-state 1)
+  )
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
 
 (defconst my-c-style
   '((c-tab-always-indent . t)
@@ -1513,6 +1571,7 @@
         ))
     (c-offsets-alist
      . (
+        (access-label . -)
         (arglist-intro . ++)
         (arglist-cont-nonempty . ++)
         (arglist-close . ++)
@@ -1533,22 +1592,28 @@
     (c-echo-syntactic-information-p . t))
   "My C Programming Style")
 
-(add-hook
- 'c-mode-common-hook
- '(lambda ()
-    (c-add-style "my" my-c-style t)
-    ;; If set 'c-default-style' before 'c-add-style'
-    ;; "Undefined style: my" error occured from 'c-get-style-variables'.
-    (setq c-default-style
-          '(
-            (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
-            (idl-mode . "my")
-            (awk-mode . "awk")
-            (other . "my")
-            ))
-    ))
+(defun my-c-mode-style-hook ()
+  (c-add-style "my" my-c-style t)
+  ;; If set 'c-default-style' before 'c-add-style'
+  ;; "Undefined style: my" error occured from 'c-get-style-variables'.
+  (setq c-default-style
+        '(
+          (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
+          (idl-mode . "my")
+          (awk-mode . "awk")
+          (other . "my")
+          ))
+  )
+(add-hook 'c-mode-common-hook 'my-c-mode-style-hook)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "python")
+
+(when (equal window-system 'w32)
+  (add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix))
+  )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "javascript, js")
 
 ;; (if (>= emacs-major-version 23)
@@ -1559,33 +1624,33 @@
 (setq auto-mode-alist (rassq-delete-all 'js-mode auto-mode-alist))
 (add-to-list 'auto-mode-alist '("\\.js$" . c++-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "bat file, batch")
 
 ;; loaded from 'generic-x.el'
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "nsis-mode")
 
 (when (fboundp 'nsis-mode)
   (add-to-list 'auto-mode-alist '("\\.\\(nsi\\|nsh\\)\\'" . nsis-mode))
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "csharp, c-sharp")
 
 (autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
 (add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "java")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "ECB")
 
 (setq ecb-tip-of-the-day nil)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "html")
 
 (defun html-charref-escape-region (start end)
@@ -1640,7 +1705,7 @@
     (html-charref-to-string (buffer-substring begin end))
     ))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "nxml")
 
 (setq nxml-sexp-element-flag t)
@@ -1651,7 +1716,7 @@
   '(add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml")
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "psgml")
 
 (setq my-html-template
@@ -1681,12 +1746,12 @@
                html-tag-alist)))
      )))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "sh, bash")
 
 (add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode))
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "printing")
 
 ;; Use Notepad to print plain text files to the default Windows printer
@@ -1703,12 +1768,12 @@
 ;(setq ps-printer-name nil)
 ;(setq ps-print-header nil)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "SQL")
 
 (setq sql-password "")
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "backuping")
 
 (setq
@@ -1721,7 +1786,7 @@
  kept-new-versions 3                           ; store last 3 version
  version-control t)                            ; use versioned backups
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "auto save")
 
 (setq auto-save-default t)
@@ -1731,14 +1796,14 @@
 ;; Note: if you kill unsaved file auto save file not deleted.
 (setq delete-auto-save-files t)
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Save and restore my buffers every time.
 (setq desktop-dirname "~/.emacs.d")
 (when (>= emacs-major-version 22)
   (desktop-save-mode 1)
   )
 
-;;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "User welcome msg")
 
 (add-hook 'emacs-startup-hook
@@ -1754,3 +1819,8 @@
 (setq default-directory "~/")
 
 ;;; End loading...
+
+;; Local variables:
+;; mode: outline-minor
+;; outline-regexp: "(message \""
+;; End:
--- a/Makefile	Thu Oct 06 16:41:35 2011 +0300
+++ b/Makefile	Thu Oct 06 17:03:32 2011 +0300
@@ -58,7 +58,6 @@
 		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
 	done
 	cp .emacs $(HOME)/.emacs
-	./.emacs-autogen.sh $(HOME)/.emacs-autogen
 	cp .emacs-my $(HOME)/.emacs-my
 	rm -f -r $(HOME)/.emacs.d/my-lisp
 	mkdir -p $(HOME)/.emacs.d/my-lisp
@@ -67,6 +66,7 @@
 	done
 	$(EMACS) --batch \
 		--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )'
+	./.emacs-autogen.sh $(HOME)/.emacs-autogen
 
 .PHONY: uninstall
 uninstall:
--- a/nsis-mode.el	Thu Oct 06 16:41:35 2011 +0300
+++ b/nsis-mode.el	Thu Oct 06 17:03:32 2011 +0300
@@ -19,6 +19,7 @@
 (defun nsis-mode-modify-syntax-entry ()
   (modify-syntax-entry ?_ "w")
   (modify-syntax-entry ?. "w")
+  (modify-syntax-entry ?$ ".")
   )
 
 (defun nsis-mode-set-comment-style ()
@@ -77,8 +78,9 @@
 (setq nsis-imenu-generic-expression
       '(
         ("Defines"  "^!define[[:blank:]]+\\([[:word:]]+\\)" 1)
-        ("Sections"  "^Section[[:blank:]]+\\(-?[[:word:]]+\\)" 1)
+        ("Sections"  "^Section[[:blank:]]+\"?\\(-?[[:word:] ]+\\)\"?" 1)
         ("Functions"  "^Function[[:blank:]]+\\([[:word:]]+\\)" 1)
+        ("Macros"  "^!macro[[:blank:]]+\\([[:word:]]+\\)" 1)
         ))
 
 (defun nsis-set-imenu-generic-expression ()