merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 20 Nov 2011 20:14:17 +0200
changeset 836 034e9cfcc17c
parent 732 139665dd6ada (current diff)
parent 834 07219d4d737e (diff)
child 837 02ecfa7fe15d
merged
.emacs-my
INSTALL
README
--- a/.emacs	Sun Oct 16 01:14:02 2011 +0300
+++ b/.emacs	Sun Nov 20 20:14:17 2011 +0200
@@ -8,17 +8,33 @@
 
 ;; ======================================================================
 ;; Load path.
+
+(defun my-find-subdirs (dir)
+  (if (file-directory-p dir)
+      (cons dir (apply 'append (mapcar 'my-find-subdirs (directory-files dir t "^[^.]")) ) )
+    ))
+(defun my-add-subdirs-to-load-path (dir)
+  (mapc
+   (lambda (d)
+     (add-to-list 'load-path d t)
+     (message "Load-path updated with: %s" d)
+     )
+   (my-find-subdirs dir)) )
+
 (defvar my-usr-el-dir
   (expand-file-name "~/usr/share/emacs/site-lisp")
   "Here live additional lisp packages.")
-(add-to-list 'load-path my-usr-el-dir t)
+(my-add-subdirs-to-load-path my-usr-el-dir)
+
 (defvar my-lisp-dir
   (expand-file-name "~/.emacs.d/my-lisp")
   "Here live my lisp packages.")
-(add-to-list 'load-path my-lisp-dir t)
+(my-add-subdirs-to-load-path my-lisp-dir)
 
 (defvar my-autoload (concat my-lisp-dir "/autoload-my.el")
   "Path to autoload for mode files.")
+(defvar my-auth (expand-file-name "~/.emacs-auth")
+  "Path to auth info for Emacs.")
 (defvar dot-emacs-autogen (expand-file-name "~/.emacs-autogen")
   "Path to automatically generated config file. It content depend on
   installation environment and it was overridden on install.")
@@ -31,6 +47,9 @@
 (if (file-exists-p dot-emacs-autogen)
     (load dot-emacs-autogen))
 
+(if (file-exists-p my-auth)
+    (load my-auth))
+
 ;; pre-load custom settings
 (if (file-exists-p dot-emacs-pre)
     (load dot-emacs-pre))
--- a/.emacs-my	Sun Oct 16 01:14:02 2011 +0300
+++ b/.emacs-my	Sun Nov 20 20:14:17 2011 +0200
@@ -12,6 +12,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "recentf")
 
+(setq recentf-save-file "~/.recentf")
+(when (eq system-type 'cygwin)
+  (setq recentf-save-file "~/.recentf-cygwin")
+  )
 (require 'recentf)
 ;; Prevent TRAMP to login on remote host when loading.
 ;; Its take time and ask passwords!
@@ -33,23 +37,33 @@
 ;; Shut off message buffer by setting nil.
 (setq message-log-max 512)
 
-;; Set the debug option to enable a backtrace when a problem occurs.
-(setq debug-on-error nil)               ; t/nil
-(setq debug-on-signal nil)
-
-;; Get trace when press C-g.
-(setq debug-on-quit nil)                ; t/nil
-
 ;; Prevent Emacs from loading 'default.el', which loaded after '.emacs'.
 ;; Also '-q' prevent loading your init file.
 (setq inhibit-default-init nil)         ; t/nil
 
+(defun my-debug (mode)
+  "With prefix enable debug backtrace when problems occur else disable."
+  (interactive "P")
+  (when mode
+    ;; (setq debug-on-signal t)
+    (setq mode t))
+  (setq debug-on-error mode)
+  ;; Get trace when press C-g.
+  (setq debug-on-quit mode)
+  )
+
+(my-debug nil)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "user info")
 
-(setq user-full-name "Oleksandr Gavenko")
-(setq user-mail-address "gavenkoa@gmail.com")
-(setq user-nick "gavenkoa")
+;; Set following in ~/.emacs-auth:
+;; (setq user-full-name "Oleksandr Gavenko")
+;; (setq user-mail-address "gavenkoa@gmail.com")
+;; (setq user-nick "gavenkoa")
+
+(unless (and (boundp 'user-nick) (stringp user-nick))
+  (setq user-nick (user-login-name)) )
 (setenv "ORGANIZATION" (concat user-full-name " <" user-mail-address  ">"))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -129,6 +143,7 @@
     nsis-mode
     bat-generic-mode
     html-mode
+    LilyPond-mode
     )
   "List of development modes.")
 
@@ -266,7 +281,7 @@
 ;; (setq inhibit-splash-screen t) ; nonexist on 21.4.1
 (setq inhibit-startup-message t)
 
-;; ----------------------------------------------------------------
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "shell, bash, Cygwin, MSYS")
 
 (defvar my-use-windows-shell nil
@@ -307,7 +322,7 @@
     (require 'cygwin-mount)
     (cygwin-mount-activate)
     )
-  (add-hook 'find-file-hooks 'follow-cygwin-symlink)
+  (add-hook 'find-file-hook '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)
@@ -321,6 +336,24 @@
   (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
   )
 
+(when (eq window-system 'w32)
+  ;; Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
+  ;; 'gnutls-cli' run with '-s' opt and process wait for SIGALRM.
+  ;; But build-in native Emacs 'kill' command can not send such Cygwin
+  ;; specific sygnal. So 'starttls-negotiate-gnutls' function infinitely
+  ;; wait for 'gnutls-cli' output.
+  (defadvice signal-process (around cygwin (process sigcode))
+    "Use 'kill.exe' instead build-in Emacs 'kill'."
+    (if (eq sigcode 'SIGALRM)
+        (shell-command
+         (format "kill.exe -s SIGALRM %d"
+                 (if (processp process) (process-id process) process)))
+      ad-do-it
+      ))
+  (ad-activate 'signal-process)
+  (modify-coding-system-alist 'process "gnutls-cli" '(binary . binary))
+  )
+
 (ansi-color-for-comint-mode-on)
 
 (setq explicit-bash-args '("-i"))
@@ -345,13 +378,9 @@
 (add-hook 'text-mode-hook (lambda () (setq require-final-newline nil)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(message "gnu serv, server")
+(message "server")
 
-;; (load "~/emacs/bin/gnuserv/gnuserv.el")
-;; (require 'gnuserv)
-;; (setq gnuserv-frame (selected-frame))
-
-(when (>= emacs-major-version 22)
+(when (and (>= emacs-major-version 22) (not (eq system-type 'cygwin)))
   (require 'server)
   (when (and (= emacs-major-version 23) (>= emacs-minor-version 1) (<= emacs-minor-version 2) (equal window-system 'w32))
     (defun server-ensure-safe-dir (dir) "Noop" t)) ; Suppress error directory ~/.emacs.d/server is unsafe on windows.
@@ -452,8 +481,11 @@
 (defvar my-scroll-margin 4)
 
 (setq-default
- scroll-step 1
- scroll-conservatively my-scroll-margin
+ ;; Set to zero as this recomment documentation.
+ scroll-step 0
+ ;; If the value is greater than 100, redisplay will never recenter point, but
+ ;; will always scroll just enough text to bring point into view
+ scroll-conservatively 1000
  scroll-preserve-screen-position t
  )
 
@@ -464,6 +496,20 @@
       (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list) )
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "chars, unicode")
+
+(defun my-print-unicode (&optional start end)
+  "Print UNICODE table."
+  (interactive "nstart: \nnend: ")
+  (switch-to-buffer (get-buffer-create "*UNICODE*"))
+  (erase-buffer)
+  (let ( (i start) )
+    (while (<= i end)
+      (insert (format "%s: U+%04x, %s\n" (char-to-string i) i (get-char-code-property i 'name)))
+      (setq i (1+ i))
+      )))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "search, isearch, occur")
 
 (setq case-fold-search t)
@@ -475,7 +521,6 @@
 (when (< emacs-major-version 23)
   (global-set-key (kbd "M-s o") 'occur)
   )
-(global-set-key [f7] 'occur)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "grep, find")
@@ -495,13 +540,16 @@
      (add-to-list 'grep-find-ignored-directories "build" t)
      (add-to-list 'grep-find-ignored-directories "dist" t)
      (add-to-list 'grep-find-ignored-directories "lib" t)
+     (add-to-list 'grep-find-ignored-directories "_build" t)
+     (add-to-list 'grep-find-ignored-directories "_dist" t)
+     (add-to-list 'grep-find-ignored-directories "_lib" t)
 
      (when (boundp 'grep-find-ignored-files)
        (add-to-list 'grep-find-ignored-files "*TAGS")
        (add-to-list 'grep-find-ignored-files "GPATH")
        )
      ))
-
+(global-set-key [f7] 'rgrep)
 (global-set-key [M-f7] 'rgrep)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -513,18 +561,21 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "highlight selected text")
 
-;; 1/-1, when the mark is active, the region is highlighted.
-(transient-mark-mode 1)
-(delete-selection-mode 1)               ; 1/-1
+(delete-selection-mode 1)
+
+(when (<= emacs-major-version 23)
+  ;; 1/-1, when the mark is active, the region is highlighted.
+  (transient-mark-mode 1)
 
-;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
-(require 'pc-select)
-(setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
-(setq pc-select-meta-moves-sexps t)
-(cond
- ((= emacs-major-version 21) (pc-selection-mode))
- ((>= emacs-major-version 22) (pc-selection-mode 1))
- )
+  ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
+  (require 'pc-select)
+  (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
+  (setq pc-select-meta-moves-sexps t)
+  (cond
+   ((= emacs-major-version 21) (pc-selection-mode))
+   ((>= emacs-major-version 22) (pc-selection-mode 1))
+   )
+  )
 
 (when (eq window-system 'x)
   (setq x-select-enable-clipboard t)    ; for Emacs 21.2.1 and newer
@@ -640,6 +691,13 @@
   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
   (modify-coding-system-alist 'process ".*" 'utf-8-unix)
   )
+ ((eq system-type 'cygwin)
+  (when (string-match "1251\\'" (getenv "LANG"))
+    (prefer-coding-system 'cp1251-unix)
+    (prefer-coding-system 'utf-8-unix)
+    (modify-coding-system-alist 'process ".*" 'cp1251-unix)
+    )
+  )
  ((eq system-type 'darwin)
   nil
   )
@@ -796,12 +854,6 @@
 (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
@@ -861,6 +913,16 @@
 (add-hook 'write-file-hooks 'time-stamp)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "logging, logs")
+
+(defun my-auto-revert-tail-mode-hook ()
+  (when (string-match "/var/log/\\|\\.log\\'"
+                      (buffer-file-name (current-buffer)))
+    (auto-revert-tail-mode 1)
+    ))
+(add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "auto-fill")
 
 (setq-default fill-column 78)
@@ -877,14 +939,6 @@
 (add-hook 'text-mode-hook 'turn-on-auto-fill)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(message "unknown")
-
-;; mailcrypt gnus message sendmail bbdb pilot bibtex eiffel-mode emacs-w3m
-;; eudc filladapt hugs-mode mpg123 php-mode ps-print
-;; chord-mode - edit guitar music
-;; discography - variant of BibTeX mode for discographies
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "cacl, calculator")
 
 (setq-default calc-group-digits t)
@@ -986,17 +1040,32 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "Info")
 
-;; Because of Debian policy documentation covered by FDL license with invariant sections not allowed in packet
-;; repository tree. So it must be installed manually. My usual configuration is install user local software
-;; into ~/usr DISTDIR.
 (unless (getenv "INFOPATH")
   (setenv "INFOPATH" "~/usr/share/info:"))
 
+;; Assume that cygwin-mount already activated.
+(when (featurep 'cygwin-mount)
+  (setenv "INFOPATH" "/usr/share/info/:~/usr/share/info/:")
+  ;; Redefine path-separator to UNIX to update Info-directory-list.
+  (let ( (path-separator ":") )
+    (require 'info)
+    (info-initialize)
+    ))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "man, woman")
 
+;; Assume that cygwin-mount already activated.
+(when (featurep 'cygwin-mount)
+  (let ( (path (expand-file-name "~")) )
+    (when (string-match "\\([c-z]\\):/" path)
+      (setenv "MANPATH" (concat "/cygdrive/" (substring path 0 1) "/" (substring path 3) "/usr/share/man/:"))
+      ) ))
+
 (setq woman-use-own-frame nil)
 (setq woman-fill-frame t)
+;; I prefer EN man pages.
+(setq manual-program "LANG=C man")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "comint")
@@ -1007,12 +1076,13 @@
 (setq comint-eol-on-send t)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(message "spell, ispell, aspell")
+(message "spell, ispell, aspell, flyspell")
 
 ;; Settings for spelling done in '.emacs-autogen'.
-;(add-hook 'text-mode-hook 'flyspell-mode)
-;(setq flyspell-default-dictionary "russianw")
-;(setq flyspell-delay '1)
+
+(add-hook 'log-edit-mode-hook 'flyspell-mode)
+
+;; (setq-default ispell-extra-args  '("--sug-mode=ultra"))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "dict, dictd, dictionary")
@@ -1022,6 +1092,23 @@
   )
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "figlet")
+
+(defun my-figlet-region (&optional b e)
+  (interactive "r")
+  (shell-command-on-region b e "figlet" (current-buffer) t)
+  (comment-region (mark) (point)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "jdone")
+
+(ignore-errors
+  (require 'jdone)
+  (jdone-setup-key-binding)
+  (jdone-integrate-hook)
+  )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "remember-mode")
 
 (when (>= emacs-major-version 23)
@@ -1056,11 +1143,6 @@
   (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file))
   (define-key global-map "\C-ca" 'org-agenda)
   (define-key global-map "\C-ce" (lambda nil (interactive) (find-file my-org-agenda-note-file)))
-  ;; I expect that these bindings work in all mode, Org mode use own, so redefine:
-  (define-key org-mode-map [C-S-right] 'forward-word-mark)
-  (define-key org-mode-map [C-S-left] 'backward-word-mark)
-  (define-key org-mode-map [S-up] 'previous-line-mark)
-  (define-key org-mode-map [S-down] 'next-line-mark)
 
   ;; My tags for remember buffer.
   (setq org-tag-persistent-alist
@@ -1097,6 +1179,8 @@
   ;;         ("DONE" . (:foreground "green" :weight bold))) )
   )
 
+(setq org-agenda-include-diary t)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "TODO, XXX, FIXME highlight")
 ;; Show blanks and FIXME
@@ -1129,14 +1213,235 @@
 (setq fortune-file "~/XXX")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(message "mail, mh-e")
+(message "mail, message")
+
+(setq mail-user-agent 'message-user-agent)
+
+(setq message-citation-line-format "On %Y-%m-%d, %N wrote:
+")
+(setq message-citation-line-function 'message-insert-formatted-citation-line)
 
 (setq mail-signature t)
 (setq mail-signature-file "~/.signature")
 ;; (add-hook 'mail-setup-hook 'fortune-to-signature)
 
+;; (setq mail-from-style 'angles)
+
+(setq mail-personal-alias-file "~/.mailrc")
+;; Initialize from your mail aliases file...
+(setq mail-aliases t)
+(require 'ecomplete)
+(setq message-mail-alias-type '(abbrev ecomplete))
+
+(eval-after-load 'message
+  '(progn
+     (require 'mailabbrev)
+     (define-key message-mode-map "\e\t" 'mail-abbrev-complete-alias)
+     ))
+
+(defun my-message-setup-routine ()
+  (flyspell-mode 1)
+  )
+(add-hook 'message-setup-hook 'my-message-setup-routine)
+
+;; Kill message buffer after mail send. You always can use C-c C-s to preserve it.
+(setq message-kill-buffer-on-exit t)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "smtp, smtpmail")
+
+(when (boundp 'smtpmail-smtp-server)
+  (require 'smtpmail)
+  (setq
+   ;; If you use the default mail user agent.
+   send-mail-function 'smtpmail-send-it
+   ;; If you use Message or Gnus.
+   message-send-mail-function 'smtpmail-send-it
+   )
+  )
+;; (setq smtpmail-debug-verb t)
+;; (setq smtpmail-debug-info t)
+
+(defun my-message-mode-hook ()
+  (setq fill-column 78)
+  (turn-on-auto-fill)
+  )
+(add-hook 'message-mode-hook 'my-message-mode-hook)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "gnus, mh-e")
+
+(setq gnus-site-init-file "~/.gnus.el")
+
+;; Store gnus specific files to '~/.gnus'.
+(setq
+ gnus-directory "~/.gnus"
+ gnus-agent-directory "~/.gnus/agent/"
+ gnus-article-save-directory "~/.gnus/saved"
+ gnus-kill-files-directory "~/.gnus/scores"
+ gnus-cache-directory "~/.gnus/cache"
+ mail-source-directory "~/.gnus/mail"
+ message-directory "~/.gnus/mail"
+ message-auto-save-directory "~/.gnus/autosave"
+ ;; message-signature-directory
+ mailcap-download-directory  "~/.gnus/mailcap"
+ nnml-directory "~/.gnus/nnml-mail"
+ spam-directory "~/.gnus/spam/"
+ smime-certificate-directory "~/.gnus/certs/"
+ nnfolder-directory "~/.gnus/archive"
+ nnfolder-active-file "~/.gnus/archive/active"
+)
+
+;; Remove gnus-ignored-newsgroups to show all GMail folders.
+(setq gnus-ignored-newsgroups nil)
+
+;; (require 'spam)
+;; (setq gnus-spam-process-newsgroups
+;;       '(("^gmane\\."
+;;          ((spam spam-use-gmane)))))
+
+(setq
+ gnus-novice-user nil
+ gnus-expert-user nil
+ gnus-interactive-catchup t
+ gnus-interactive-exit t
+ )
+
+(setq
+ gnus-read-active-file nil
+ gnus-check-new-newsgroups nil
+ gnus-check-bogus-newsgroups nil
+ )
+
+;; (setq 'gnus-use-cache t)
+(setq gnus-use-long-file-name t)
+(setq gnus-use-long-file-name t)
+(setq gnus-cache-remove-articles '(read))
+
+;; If you're spooling in overlapping mbox folders, you probably want to delete
+;; all messages with duplicate message IDs.
+(setq nnmail-treat-duplicates 'delete)
+
+;; Do not use the html part of a message, use the text part if possible!
+(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
+
+(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
+
+(setq
+ gnus-posting-styles
+ '(
+   (".*"
+    (organization "At home.")
+    (signature-file "~/.signature")
+    )
+   ))
+
+;; `gnus-group-line-format', `gnus-summary-line-format',
+;; `gnus-server-line-format', `gnus-topic-line-format',
+;; `gnus-group-mode-line-format', `gnus-summary-mode-line-format',
+;; `gnus-article-mode-line-format', `gnus-server-mode-line-format',
+;; `gnus-summary-pick-line-format'.
+
+(when window-system
+  (setq
+   gnus-sum-thread-tree-false-root ""
+   gnus-sum-thread-tree-indent " "
+   gnus-sum-thread-tree-leaf-with-other "├► "
+   gnus-sum-thread-tree-root ""
+   gnus-sum-thread-tree-single-leaf "└► "
+   gnus-sum-thread-tree-vertical "│"
+   ))
+
+(setq gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M")))
+(setq gnus-summary-line-format "%U%R%z %&user-date; %B %[%-22,22f%] %s\n")
+(setq gnus-summary-mode-line-format "Gnus: %p %Z")
+
+(setq gnus-article-time-format "%Y-%m-%d %T%z %a")
+(setq gnus-article-date-headers '(combined-lapsed user-defined))
+
+;; gnus-visible-headers
+(setq
+ gnus-sorted-header-list
+ '(
+   "^From:"
+   "^Subject:"
+   "^Summary:"
+   "^Keywords:"
+   "^Newsgroups:"
+   "^Followup-To:"
+   "^To:"
+   "^Cc:"
+   "^Organization:"
+   "^Date:"
+   "^User-Agent:"
+   "^X-Mailer:"
+   "^X-Newsreader:"
+   ))
+
+(setq
+ gnus-show-threads t
+ gnus-thread-sort-functions '(gnus-thread-sort-by-date gnus-thread-sort-by-total-score)
+ )
+
+;; Scoring, adaptive score.
+(setq
+ gnus-use-scoring t
+ gnus-save-score t
+ gnus-use-adaptive-scoring t
+ gnus-score-expiry-days 60
+ gnus-decay-scores t
+ gnus-default-adaptive-score-alist
+ '(
+   (gnus-unread-mark)
+   (gnus-ticked-mark (subject 5))
+   (gnus-dormant-mark (subject 5))
+   (gnus-del-mark (from -2) (subject -5))
+   (gnus-read-mark (from 2) (subject 1))
+   (gnus-killed-mark (subject -5))
+   (gnus-catchup-mark (subject -1))
+   (gnus-kill-file-mark (from -9999))
+   )
+ )
+;; Increase the score for followups to a sent article.
+(eval-after-load 'gnus-score
+  '(progn
+     (add-hook 'message-sent-hook 'gnus-score-followup-article)
+     (add-hook 'message-sent-hook 'gnus-score-followup-thread)
+     ))
+
+;; (setq gnus-home-score-file
+;;       ;; All groups that match the regexp `"\\.emacs"'
+;;       '(("\\.emacs" "emacs.SCORE")
+;;         ;; All the comp groups in one score file
+;;         ("^comp" "comp.SCORE")))
+
+;; (setq imap-log t)
+
 ;; (setq mail-user-agent 'mh-e-user-agent)
 
+(custom-set-faces '(gnus-summary-cancelled ((t (:foreground "plum" :background nil)))) )
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "bbdb")
+
+(setq
+ bbdb-offer-save 1
+ bbdb-use-pop-up t
+ bbdb-electric-p t
+ bbdb-popup-target-lines  1
+ )
+
+(setq bbdb-complete-name-full-completion t)
+(setq bbdb-completion-type 'primary-or-name)
+(setq bbdb-complete-name-allow-cycling t)
+
+(setq bbdb-file "~/.gnus/bbdb")
+
+;; (bbdb-initialize 'gnus 'message)
+;; (bbdb-insinuate-message)
+;; (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "jabber")
 
@@ -1294,6 +1599,11 @@
      (360 . "#0D80E0")))
   )
 
+(defun my-log-edit-mode-hook ()
+  (setq fill-column 78)
+  )
+(add-hook 'log-edit-mode-hook 'my-log-edit-mode-hook t)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "psvn")
 
@@ -1498,7 +1808,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "makefile, make")
 
-(add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode))
+(add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode) t)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (message "asm, assembler")
@@ -1557,7 +1867,7 @@
 
 (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)
+  (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'.
@@ -1788,6 +2098,8 @@
               (my-filter
                (lambda (item) (not (equal (car item) "html")))
                html-tag-alist)))
+       (add-to-list 'html-tag-alist '("script" (\n) ("type" "text/javascript") ))
+       (add-to-list 'html-tag-alist '("style" (\n) ("type" "text/css") ))
      )))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1842,7 +2154,14 @@
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Save and restore my buffers every time.
-(setq desktop-dirname "~/.emacs.d")
+
+(setq desktop-base-file-name ".emacs.desktop")
+(setq desktop-base-lock-name ".emacs.desktop.lock")
+(when (eq system-type 'cygwin)
+  (setq desktop-base-file-name ".emacs.desktop-cygwin")
+  (setq desktop-base-lock-name ".emacs.desktop-cygwin.lock")
+  )
+
 (when (>= emacs-major-version 22)
   (desktop-save-mode 1)
   )
--- a/INSTALL	Sun Oct 16 01:14:02 2011 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
--*- mode: outline; coding: utf-8 -*-
-
-Copyright (C) 2008-2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
-
-You can do anything with this file without any warranty.
-
-* Setup on Windows.
-
-** Setup HOME.
-
-Setup HOME environment variable. For example:
-
-  <win-drive-char>:\home
-
-** Setup MANPATH.
-
-To use woman with on Windows set MANPATH like this (note that path in
-Cygwin/MinGW style so you need use cygwin-mount.el):
-
-  MANPATH=:/cygdrive/d/home/usr/share/man:/usr/share/man:/usr/local/share/man
-
-for Cygwin or like this:
-
-  MANPATH=/e/home/usr/share/man:/e/bin/MinGW/man:/e/bin/gnuwin32/man
-
-for MinGW and other case.
-
-To get man paths on Cygwin see <cygwin-root>\usr\share\misc\man.conf.
-
-Also you can set woman-manpath variable.
-
-** Setup INFOPATH.
-
-To browse info file inside Emacs set INFOPATH like this for Cygwin:
-
-  INFOPATH=e:/opt/cygwin/usr/share/info;e:/home/usr/share/info;e:/bin/gnuwin32/info;e:/bin/gnuwin32/share/info:
-
-and like this for MinGW:
-
-  INFOPATH=e:/bin/gnutls/share/info;e:/bin/gnuwin32/info;e:/bin/gnuwin32/share/info;e:/bin/MinGW/info;e:/bin/MinGW/share/info;e:/bin/wget/info:
-
-Note that last colon symbol is essential for include also Emacs info to list.
-
-* GTD (org-mode).
-
-In home dir create .gtd subdir with todo.org file. Put simple content on top
-of them:
-
-  -*- coding: utf-8 -*-
-
-  #+STARTUP: overview
-  #+STARTUP: hidestars
-  #+ARCHIVE: %s_done::
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL.rst	Sun Nov 20 20:14:17 2011 +0200
@@ -0,0 +1,64 @@
+.. -*- coding: utf-8 -*-
+
+=======================================
+ 'dot-emacs' installation instruction.
+=======================================
+.. contents::
+
+Copyright (C) 2008-2011 by Oleksandr Gavenko <gavenkoa@gmail.com>
+
+You can do anything with this file without any warranty.
+
+Setup on Windows.
+=================
+
+Setup HOME.
+-----------
+
+Setup HOME environment variable. For example::
+
+  <win-drive-char>:\home
+
+Setup MANPATH.
+--------------
+
+To use woman with on Windows set MANPATH like this (note that path in
+Cygwin/MinGW style so you need use cygwin-mount.el)::
+
+  MANPATH=:/cygdrive/d/home/usr/share/man:/usr/share/man:/usr/local/share/man
+
+for Cygwin or like this::
+
+  MANPATH=/e/home/usr/share/man:/e/bin/MinGW/man:/e/bin/gnuwin32/man
+
+for MinGW and other case.
+
+To get man paths on Cygwin see <cygwin-root>\usr\share\misc\man.conf.
+
+Also you can set woman-manpath variable.
+
+Setup INFOPATH.
+---------------
+
+To browse info file inside Emacs set INFOPATH like this for Cygwin::
+
+  INFOPATH=e:/opt/cygwin/usr/share/info;e:/home/usr/share/info;e:/bin/gnuwin32/info;e:/bin/gnuwin32/share/info:
+
+and like this for MinGW::
+
+  INFOPATH=e:/bin/gnutls/share/info;e:/bin/gnuwin32/info;e:/bin/gnuwin32/share/info;e:/bin/MinGW/info;e:/bin/MinGW/share/info;e:/bin/wget/info:
+
+Note that last colon symbol is essential for include also Emacs info to list.
+
+GTD (org-mode).
+===============
+
+In home dir create .gtd subdir with todo.org file. Put simple content on top
+of them::
+
+  -*- coding: utf-8 -*-
+
+  #+STARTUP: overview
+  #+STARTUP: hidestars
+  #+ARCHIVE: %s_done::
+
--- a/Makefile	Sun Oct 16 01:14:02 2011 +0300
+++ b/Makefile	Sun Nov 20 20:14:17 2011 +0200
@@ -28,9 +28,15 @@
 
 host_os = unix
 ifneq '' '$(COMSPEC)'
-  host_os = windows
+  ifneq '' '$(WINDIR)'
+    # Probably under Windows.
+    host_os = windows
+  endif
 endif
 
+################################################################
+# Build tool definition/switches.
+
 EMACS = emacs
 # I prefer native Windows Emacs, so use it if available.
 ifeq 'windows' '$(host_os)'
@@ -39,14 +45,28 @@
   endif
 endif
 
+RST2HTML = rst2html
+ifeq '$(host_os)' 'windows'
+  RST2HTML = rst2html.py
+endif
+
+################################################################
+# Proj dirs/files.
+
+FILES_MODE_EL := $(wildcard *-mode.el)
+
+RST_FILES := $(wildcard *.rst)
+HTML_FILES := $(RST_FILES:.rst=.html)
+
 ################################################################
 # Targets.
 
-FILES_MODE_EL := $(wildcard *-mode.el)
-
 .PHONY: all
 all: install
 
+################################################################
+# Install/uninstall targets.
+
 .PHONY: install-all
 install-all: install
 	cp .emacs-pre $(HOME)/.emacs-pre
@@ -55,7 +75,7 @@
 .PHONY: install
 install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL)
 	for file in .emacs-pre .emacs-post; do \
-		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
+		[ -f $(HOME)/$$file ] || cp $$file $(HOME)/$$file; \
 	done
 	cp .emacs $(HOME)/.emacs
 	cp .emacs-my $(HOME)/.emacs-my
@@ -70,15 +90,28 @@
 
 .PHONY: uninstall
 uninstall:
-	@echo !!! Nothing done !!!
+	rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen
+	rm -f -r $(HOME)/.emacs.d/my-lisp
 
 .PHONY: tar
 tar:
 	tar cf dot-emacs.tar .emacs .emacs-my
 
+################################################################
+# Documentation targets.
+
+.PHONY: html
+html: $(HTML_FILES)
+
+$(HTML_FILES): %.html: %.rst
+	$(RST2HTML) --stylesheet=rst.css $*.rst $@
+
+################################################################
+# Clean targets.
+
 .PHONY: distclean
 distclean: clean
 
 .PHONY: clean
 clean:
-	rm -f dot-emacs.tar
+	rm -f dot-emacs.tar $(HTML_FILES)
--- a/README	Sun Oct 16 01:14:02 2011 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
--*- mode: outline; coding: utf-8 -*-
-
-Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
-
-You can do anything with this file without any warranty.
-
-* Config files structure.
-
-Main Emacs config file is '~/.emacs'. I decide don't store beside it all
-customisations. Instead it simply load files in such order:
-
-  '~/.emacs-autogen'
-                It content depend on installation environment. Automatically
-                generated.
-  '~/.emacs-pre'
-                For manually written customisation (usually for updating
-                load-path) which can affect on '.emacs-my'. Will not be
-                overridden on install.
-  '~/.emacs.d/my-lisp/autoload-my.el'
-                For defining autoload function for modes (instead loading all
-                mode files to save startup time). Automatically generated.
-  '~/.emacs-custom.el'
-                For storing customisations by Emacs itself. Some settings from
-                this file can effect on loaded elisp files from .emacs-my.
-                Will not be overridden on install.
-  '~/.emacs-my'
-                Here main customisations placed.
-  '~/.emacs-post'
-                For storing connection settings, passwords and enabling modes
-                added to load-path in ~/.emacs-pre. Will not be overridden on
-                install.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst	Sun Nov 20 20:14:17 2011 +0200
@@ -0,0 +1,38 @@
+.. -*- coding: utf-8 -*-
+
+=====================
+ 'dot-emacs' README.
+=====================
+.. contents::
+
+Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
+
+You can do anything with this file without any warranty.
+
+Config files structure.
+=======================
+
+Main Emacs config file is '~/.emacs'. I decide don't store beside it all
+customisations. Instead it simply load files in such order:
+
+  '~/.emacs-autogen'
+                It content depend on installation environment. Automatically
+                generated.
+  '~/.emacs-pre'
+                For manually written customisation (usually for updating
+                load-path) which can affect on '.emacs-my'. Will not be
+                overridden on install.
+  '~/.emacs.d/my-lisp/autoload-my.el'
+                For defining autoload function for modes (instead loading all
+                mode files to save startup time). Automatically generated.
+  '~/.emacs-custom.el'
+                For storing customisations by Emacs itself. Some settings from
+                this file can effect on loaded elisp files from .emacs-my.
+                Will not be overridden on install.
+  '~/.emacs-my'
+                Here main customisations placed.
+  '~/.emacs-post'
+                For storing connection settings, passwords and enabling modes
+                added to load-path in ~/.emacs-pre. Will not be overridden on
+                install.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rst.css	Sun Nov 20 20:14:17 2011 +0200
@@ -0,0 +1,19 @@
+body, frameset { background-color: ivory; }
+body { padding: 0 10% 0 10%; }
+a { text-decoration:none; }
+a:link { color: brown; }
+a:visited { color: IndianRed; }
+a:hover { background: bisque; border-radius: 10px; padding: 1px; }
+p { text-indent: 2em; }
+p:first-letter { font-weight: bold; }
+.literal-block {
+    margin: 0 0 0 4em;
+    padding: 5px;
+    border: 1px;
+    border-style: solid;
+    border-color: brown;
+    background-color: LightYellow;
+    overflow: auto;
+}
+table { border-collapse:collapse; margin-left:auto; margin-right:auto; }
+table, tr, td { padding: 3px; border: 1px dotted maroon; background-color: cornsilk; }