.emacs-my
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 02 Jun 2021 00:17:06 +0300
changeset 1730 795b3f2ecfbb
parent 1729 237c8f98ac43
child 1731 fec5d1fffe8c
permissions -rw-r--r--
Separated Cygwin & ansi colors settings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
     1
;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*-
6
d1c4515c3cfa Add copyright notice.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 5
diff changeset
     2
;;
302
e93ff9360a51 Point to README from config file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 299
diff changeset
     3
;; Config file for GNU Emacs.
83
d2eaf2ed6d1c Added basic jabber customization.
gavenkoa@gavenko.bifit.int
parents: 82
diff changeset
     4
;;
351
e30e4bd7e85e Small spell correction.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 348
diff changeset
     5
;; For load order see README.
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
     6
1683
40ff440156af cl-lib is pretty widespread now, no need for with-no-warnings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1682
diff changeset
     7
(require 'cl-lib)
1282
c4bc43d16082 Disable byte-compilation warnings:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1281
diff changeset
     8
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
     9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1600
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    10
(message "silent runing")
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    11
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    12
(setq inhibit-splash-screen t)
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    13
(setq inhibit-startup-message t)
1602
c1c4e95f4618 inhibit-startup-buffer-menu
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1601
diff changeset
    14
(setq inhibit-startup-buffer-menu t)
1600
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    15
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    16
(setq initial-scratch-message nil)
1601
85ff4f99ebd0 initial-major-mode is fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1600
diff changeset
    17
(setq initial-major-mode (quote fundamental-mode))
1600
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    18
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    19
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1694
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    20
(message "backuping")
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    21
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    22
;; Keep it above modes saving state into files or you'll see files like ".recentf~" in "~/.emacs.d".
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    23
(setq
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    24
 make-backup-files t
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    25
 ;; In other case (by renaming) you loose original file creation date.
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    26
 backup-by-copying t
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    27
 backup-directory-alist '(("." . "~/.emacs.d/.backup")) ; don't litter my fs tree
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    28
 delete-old-versions t                         ; delete excess backup versions silently
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    29
 kept-old-versions 1                           ; store first original version
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    30
 kept-new-versions 3                           ; store last 3 version
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    31
 version-control t)                            ; use versioned backups
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    32
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    33
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    34
(message "lockfile")
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    35
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    36
;; (info "(elisp) File Locks")
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    37
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    38
;; Disable stupid file locking. It breaks editing WSL files from Cygwin Emacs.
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    39
;; https://emacs.stackexchange.com/questions/61962/what-is-interlocking-about
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    40
;; https://cygwin.com/pipermail/cygwin/2020-November/246887.html
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    41
(setq create-lockfiles nil)
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    42
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    43
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    44
(message "auto save")
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    45
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    46
;; Disable auto saving, files "#name#" might trigger false rebuild if there is
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    47
;; some file watcher. Also those files looks like garbage in other tools/IDE.
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    48
(setq auto-save-default nil)
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    49
;; If nil autosave to a different file than the original.
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    50
(setq auto-save-visited-file-name nil)
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    51
(setq auto-save-interval 300)
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    52
;; Note: if you kill unsaved file auto save file not deleted.
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    53
(setq delete-auto-save-files t)
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    54
7145e9a4cf34 Moved setting for backups, auto saving, locking earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1693
diff changeset
    55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1600
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    56
(message "helper buffers")
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    57
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    58
(define-key global-map "\C-v" nil)
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    59
(define-key global-map "\C-vt" (lambda nil (interactive) (switch-to-buffer "*scratch*")))
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    60
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    61
(defvar my-work-file (expand-file-name "~/work.txt"))
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    62
(setq initial-buffer-choice my-work-file)
1603
23bc0ad590b9 I need to visit work file with UTF-8 support.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1602
diff changeset
    63
(define-key global-map "\C-vw" (lambda nil (interactive) (find-file my-work-file)))
1600
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    64
64b0c8d9821d Introduced key binding to open helper buffer baked by file (so will not be lost as with *scratch*).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1597
diff changeset
    65
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1620
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    66
(message "save-place")
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    67
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    68
;; `save-place-file' in ".emacs".
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    69
(save-place-mode 1) ; since v25.1
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    70
a20b6c6e82a3 Moved save-place to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1619
diff changeset
    71
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
611
49c993d41d3f Firstly enable 'recentf' to easy access to recently edited file when Emacs
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 610
diff changeset
    72
(message "recentf")
49c993d41d3f Firstly enable 'recentf' to easy access to recently edited file when Emacs
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 610
diff changeset
    73
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
    74
(eval-and-compile
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
    75
  (require 'recentf))
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
    76
1639
9b97a088274e Added comment how to reload recentf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1638
diff changeset
    77
;; (recentf-load-list)
1253
504c216e8d21 Move '.recentf' and '~/.irc' to '~/.emacs.d'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1240
diff changeset
    78
(setq recentf-save-file (concat user-emacs-directory ".recentf"))
1148
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    79
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    80
;; Prevent TRAMP to login on remote host when loading. Its take time and ask passwords!
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    81
(setq recentf-keep '(file-remote-p file-readable-p))
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    82
(setq recentf-exclude                   ; Use ``M-x recentf-cleanup`` to update recentf-list.
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    83
      '("/devel/[^/]*-\\(orig\\|tmp\\|xxx\\)"
1202
17ed3f571ca4 Add shortcut for recentf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1201
diff changeset
    84
        "/devel/my-\\(merge\\|pull\\)/"
1334
6e334301afb1 Update paths because I move my base development directory up one level.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1333
diff changeset
    85
        "/.cache/"
1202
17ed3f571ca4 Add shortcut for recentf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1201
diff changeset
    86
        "\\.png\\'"))
1329
a2f8f3f1f0ef Place related recentf settings together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1328
diff changeset
    87
1148
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    88
(setq recentf-max-saved-items 10000)
1329
a2f8f3f1f0ef Place related recentf settings together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1328
diff changeset
    89
(setq recentf-max-menu-items 40)
a2f8f3f1f0ef Place related recentf settings together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1328
diff changeset
    90
(setq recentf-show-file-shortcuts-flag nil)
1148
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
    91
1677
bfa894057550 Added note about recentf-auto-cleanup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1673
diff changeset
    92
;; Need to be defined before loading "recentf" because default value is
bfa894057550 Added note about recentf-auto-cleanup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1673
diff changeset
    93
;; "mode", meaning cleanup when turning the mode on.
bfa894057550 Added note about recentf-auto-cleanup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1673
diff changeset
    94
(setq recentf-auto-cleanup 600)
1682
32e95bb034b6 Disable population of `file-name-history', it causes calls to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    95
;; Disable population of `file-name-history', it causes calls to
32e95bb034b6 Disable population of `file-name-history', it causes calls to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    96
;;   abbreviate-file-name => file-name-case-insensitive-p => tramp-autoload-file-name-handler
32e95bb034b6 Disable population of `file-name-history', it causes calls to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    97
;; taking 41% of startup time.
32e95bb034b6 Disable population of `file-name-history', it causes calls to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    98
;; `ido-switch-buffer' doesn't depends on `file-name-history', nothing to lose.
32e95bb034b6 Disable population of `file-name-history', it causes calls to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    99
(setq recentf-initialize-file-name-history nil)
1677
bfa894057550 Added note about recentf-auto-cleanup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1673
diff changeset
   100
bfa894057550 Added note about recentf-auto-cleanup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1673
diff changeset
   101
(recentf-mode 1)
1148
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
   102
1202
17ed3f571ca4 Add shortcut for recentf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1201
diff changeset
   103
(global-set-key (kbd "\e\eq") 'recentf-open-files)
17ed3f571ca4 Add shortcut for recentf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1201
diff changeset
   104
(global-set-key [?\s-q] 'recentf-open-files)
611
49c993d41d3f Firstly enable 'recentf' to easy access to recently edited file when Emacs
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 610
diff changeset
   105
1148
9659883a1bec Add ``recentf-exclude`` to prevent opening unwanted files from temporary copy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1147
diff changeset
   106
;; (setq recentf-menu-filter 'recentf-arrange-by-dir) ; Too slow with dir widgets.
1153
516ab8f13ece Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   107
;; Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order!
516ab8f13ece Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1150
diff changeset
   108
(setq recentf-menu-filter nil)
1141
294e4bafc4a5 Set recentf-menu-filter as recentf-arrange-by-dir to avoid shown duplicate
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1140
diff changeset
   109
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   110
(defun my-recentf-clean-project (dir)
1208
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   111
  "Remove from recentf all files that belong to DIR directory."
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   112
  (interactive (list (read-directory-name "Exclude all paths")))
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   113
  (let ( recentf-exclude )
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   114
    (setq recentf-exclude (list (concat "^" (regexp-quote (expand-file-name dir)))))
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   115
    (recentf-cleanup) ))
e2ce4a60af3e my-recentf.clean-project
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1207
diff changeset
   116
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   117
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   118
(message "revert buffer, auto-revert")
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   119
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   120
(cl-eval-when (compile) (require 'autorevert))
658
b8a1ffa6408f Make revert buffer available more early.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 657
diff changeset
   121
b8a1ffa6408f Make revert buffer available more early.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 657
diff changeset
   122
(global-set-key [f5]    'revert-buffer)
1692
d627cd09b5e3 Simplified expression.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1691
diff changeset
   123
(setq revert-without-query '(".*"))
658
b8a1ffa6408f Make revert buffer available more early.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 657
diff changeset
   124
(setq auto-revert-interval 2)
b8a1ffa6408f Make revert buffer available more early.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 657
diff changeset
   125
1583
5811230692a3 Added docs about global-auto-revert-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1582
diff changeset
   126
;; (setq global-auto-revert-mode 1)
5811230692a3 Added docs about global-auto-revert-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1582
diff changeset
   127
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   128
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   129
(message "debugging")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   130
175
a505ab71060a Make comment shorter.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 174
diff changeset
   131
;; Shut off message buffer by setting nil.
252
330b4cdfaddf Increase log message count.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 251
diff changeset
   132
(setq message-log-max 512)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   133
1709
5946ac9f14c7 Docs: improved comment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1708
diff changeset
   134
;; Prevent Emacs from loading 'default.el', which is loaded after '.emacs'.
539
4e0728ed912a Document 'inhibit-default-init'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 538
diff changeset
   135
(setq inhibit-default-init nil)         ; t/nil
4e0728ed912a Document 'inhibit-default-init'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 538
diff changeset
   136
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   137
(defun my-eval-buffer ()
1416
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   138
  "Evaluate entire buffer with re-assigning values to `defvar' / `defcustom'.
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   139
Useful during package development."
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   140
  (interactive)
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   141
  (save-excursion
1417
920558cbf675 Fix: Warning: `beginning-of-buffer' is for interactive use only; use `(goto-char (point-min))' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1416
diff changeset
   142
    (goto-char (point-min))
1416
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   143
    (while (not (eobp))
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   144
      (eval-defun nil)
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   145
      (end-of-defun))))
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   146
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   147
(defun my-load-library (library)
1416
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   148
  "Evaluate entire library with re-assigning values to `defvar' / `defcustom'.
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   149
Useful during package development."
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   150
  (interactive
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   151
   (list (completing-read "Load library: "
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   152
                          (apply-partially 'locate-file-completion-table
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   153
                                           load-path
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   154
                                           '("" ".el")))))
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   155
  (with-temp-buffer
6f00eaa73a10 Functions to re-evaluate buffer/library with re-assigning `defvar` values.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1415
diff changeset
   156
    (insert-file-contents (locate-file library load-path '("" ".el")))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   157
    (my-eval-buffer)))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   158
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   159
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   160
(message "user info")
531
a6466b47121e Move user info to top.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 530
diff changeset
   161
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   162
(cl-eval-when (compile) (require 'info))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   163
1718
9d72f4424570 Removed mentioning of author and copyright from all files' headers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1717
diff changeset
   164
;; Following variables are loaded by (load my-lisp-auth t) from init.el:
9d72f4424570 Removed mentioning of author and copyright from all files' headers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1717
diff changeset
   165
;; user-full-name  user-mail-address  user-nick  user-home-page
774
ebfb1eb5cf56 Set following in ~/.emacs-auth.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 773
diff changeset
   166
1282
c4bc43d16082 Disable byte-compilation warnings:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1281
diff changeset
   167
(defvar user-nick (user-login-name)
c4bc43d16082 Disable byte-compilation warnings:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1281
diff changeset
   168
  "My nick name.")
930
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   169
;; auto-insert and copyright package use this to insert copyright owner. Gnus
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   170
;; uses this for Organization header.
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   171
(setenv "ORGANIZATION"
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   172
        (concat
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   173
         user-full-name
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   174
         " <" user-mail-address  ">"
ab0ce5cb09bf Add link to my home page in Organization mail header.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 929
diff changeset
   175
         (when (boundp 'user-home-page) (concat ", " user-home-page))))
531
a6466b47121e Move user info to top.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 530
diff changeset
   176
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   177
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1660
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   178
(message "autoload")
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   179
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   180
;; Ensure the help doesn't trigger autoloading.
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   181
(setq help-enable-autoload nil)
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   182
(setq help-enable-completion-autoload nil)
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   183
969cca2050e2 Ensure the help doesn't trigger autoloading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1656
diff changeset
   184
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
670
d10f2e70ff5e Redefine action to put 'html' tag in sgml-mode (more pretty look).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 669
diff changeset
   185
(message "my defun, defmacro, defvar")
d10f2e70ff5e Redefine action to put 'html' tag in sgml-mode (more pretty look).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 669
diff changeset
   186
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   187
(defmacro my-filter (pred list)
1017
7b1ae3e0c9e3 Omit condition from loop.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1016
diff changeset
   188
  "Construct list with elements from LIST which satisfy PRED."
1018
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   189
  (let ( (r (make-symbol "r_")) )
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   190
    `(let ( (,r (list nil)) )
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   191
       (mapc (lambda (item)
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   192
               (when (,pred item)
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   193
                 (nconc ,r (cons item nil))))
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   194
             ,list)
94b0ca71a583 Fix (info "(elisp) Surprising Local Vars").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1017
diff changeset
   195
       (cdr ,r))))
670
d10f2e70ff5e Redefine action to put 'html' tag in sgml-mode (more pretty look).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 669
diff changeset
   196
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   197
(defun my-fold (f x list)
716
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   198
  "Recursively applies (F i j) to LIST starting with X.
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   199
For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)."
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   200
  (let ((li list) (x2 x))
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   201
    (while li
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   202
      (setq x2 (funcall f x2 (pop li)))
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   203
      )
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   204
    x2
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   205
    ) )
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
   206
1631
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   207
(defun my-assoc-push (key value alist)
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   208
  "Add association if `key' is not in `alist' and replace all
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   209
accociation with single, if there is `key'."
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   210
  (when (not (symbolp alist)) (error "alist is not a symbol."))
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   211
  (set alist
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   212
       (cons (cons key value)
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   213
             (cl-remove key (symbol-value alist) :key #'car :test #'equal))))
f6eae5ebf7d9 Add association if `key' is not in `alist' and replace all accociation with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1630
diff changeset
   214
720
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   215
(unless (fboundp 'ignore-errors)
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   216
  (defmacro ignore-errors (&rest body)
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   217
    "Execute BODY; if an error occurs, return nil.
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   218
Otherwise, return result of last form in BODY."
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   219
    (declare (debug t) (indent 0))
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   220
    `(condition-case nil (progn ,@body) (error nil)))
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   221
  )
e50b78c6a53d Fix: ignore-errors does not defined under Emacs 22.2.1 (on Debian).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
   222
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   223
(defun my-lookup-key (key)
1016
6c3765dd9ed2 Search for KEY in all known keymaps.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
   224
  "Search for KEY in all known keymaps."
1468
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   225
  (let (result)
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   226
    (mapatoms (lambda (ob) (when (and (boundp ob)
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   227
                                 (keymapp (symbol-value ob))
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   228
                                 (functionp (lookup-key (symbol-value ob) key)))
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   229
                        (push ob result)))
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   230
              obarray)
0959998f028d Return list instead printing to *Message* buffer in my/lookup-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1467
diff changeset
   231
    (remove-if-not 'identity result) ))
1016
6c3765dd9ed2 Search for KEY in all known keymaps.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1015
diff changeset
   232
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   233
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   234
(message "lisp, elisp")
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   235
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   236
(cl-eval-when (compile) (require 'chistory))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   237
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   238
(setq list-command-history-max 256)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   239
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   240
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   241
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   242
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   243
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   244
(defun my-emacs-lisp-mode-hook ()
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   245
  (setq tab-width 8))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   246
(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   247
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   248
(defun my-elisp-find-tag ()
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   249
  (interactive)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   250
  (require 'etags)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   251
  (ring-insert find-tag-marker-ring (point-marker))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   252
  (unless (find-variable-at-point)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   253
    (find-function-at-point)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   254
    ))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   255
;; Goto elisp definition.
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   256
(define-key emacs-lisp-mode-map (kbd "M-.") 'my-elisp-find-tag)
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   257
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   258
(if (not (fboundp 'global-prettify-symbols-mode))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   259
    ;; http://www.emacswiki.org/emacs/PrettyLambda
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   260
    (font-lock-add-keywords
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   261
     'emacs-lisp-mode
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   262
     `(("(\\<\\(lambda\\)\\>"
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   263
        (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) )))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   264
  (global-prettify-symbols-mode 1))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   265
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   266
(defun my-dump-funcs ()
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   267
  "Dump all function calls in current buffer. Useful to explore
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   268
elisp API from somebody else files."
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   269
  (interactive)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   270
  (let* ( (cur-buffer (current-buffer)) (new-buffer (get-buffer-create (concat (buffer-name cur-buffer) "-funcs.el"))) symb )
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   271
    (while (search-forward-regexp "([[:alnum:]*]" nil t)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   272
      (setq symb (thing-at-point 'symbol))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   273
      (with-current-buffer new-buffer
1282
c4bc43d16082 Disable byte-compilation warnings:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1281
diff changeset
   274
        (insert symb)
1255
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   275
        (insert-char ?\n 1)))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   276
    (switch-to-buffer new-buffer)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   277
    (shell-command-on-region (point-min) (point-max) "sort -u" nil t)
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   278
    ))
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   279
abba187b8cab Move elisp tuning upper to get better support for debugging when init
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1254
diff changeset
   280
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   281
(message "mode groups")
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   282
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   283
(defmacro my-defun-rename-symb-tree (name doc func)
606
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   284
  "Travel by TREE and applies FUNC to each symbol."
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   285
  `(defun ,name (tree)
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   286
     ,doc
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   287
     (cond
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   288
      ((symbolp tree)
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   289
       (,func tree)
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   290
       )
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   291
      ((listp tree)
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   292
       (mapcar ',name tree)
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   293
       )
1257
a17e5b709fa7 Fix warning from checkdoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1256
diff changeset
   294
      (t (error "Only tree of symbols allowed"))
606
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   295
      )))
605
c228c0414e0b Generalize logic to rename symbols.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 604
diff changeset
   296
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   297
(my-defun-rename-symb-tree
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   298
 my-feature2mode
606
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   299
 "Convert TREE of features to TREE of modes for these features. Single symbol allowed."
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   300
 (lambda (symb) (intern (concat (symbol-name symb) "-mode"))))
605
c228c0414e0b Generalize logic to rename symbols.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 604
diff changeset
   301
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   302
(my-defun-rename-symb-tree
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   303
 my-mode2hook
606
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   304
 "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed."
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   305
 (lambda (symb) (intern (concat (symbol-name symb) "-hook")))
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   306
 )
605
c228c0414e0b Generalize logic to rename symbols.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 604
diff changeset
   307
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   308
(my-defun-rename-symb-tree
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   309
 my-mode2modemap
606
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   310
 "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed."
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   311
 (lambda (symb) (intern (concat (symbol-name symb) "-map")))
959d64f49788 Generalize code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 605
diff changeset
   312
 )
493
4f91b5ccab17 'my-modelist-to-hooklist' convert list of MODES to list of hooks for these
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 492
diff changeset
   313
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   314
(defvar my-prog-mode-list
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   315
  '(nsis-mode
1189
dd8bad2fe8ae show whitespaces in wesnoth-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1188
diff changeset
   316
    html-mode nxml-mode wesnoth-mode
737
fb4d18368c1f Add 'LilyPond-mode' to 'my-devel-mode-list' for enabling scroll-margin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 736
diff changeset
   317
    LilyPond-mode
866
b6b520b4e11e Add 'texinfo-mode' to 'my-devel-mode-list' for TODO highlighting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 865
diff changeset
   318
    texinfo-mode
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   319
    gadict-mode)
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   320
  "List of development modes.")
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   321
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   322
(defvar my-prog-hook-list
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   323
   (my-mode2hook my-prog-mode-list)
493
4f91b5ccab17 'my-modelist-to-hooklist' convert list of MODES to list of hooks for these
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 492
diff changeset
   324
  "List of development mode hooks.")
4f91b5ccab17 'my-modelist-to-hooklist' convert list of MODES to list of hooks for these
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 492
diff changeset
   325
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   326
(defvar my-text-mode-list
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   327
  '(text-mode
631
eb5ce5b0b208 Add 'html-mode' to devel mode list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 629
diff changeset
   328
    outline-mode
665
9761254a1260 Maintaining the table of contents up-to-date.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 664
diff changeset
   329
    rst-mode
723
ff912b026ad2 Move 'diff-mode' to 'my-text-mode-list' for trailing spaces highlighting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 721
diff changeset
   330
    diff-mode
1592
58938ef683aa Added magit-revision-mode to my-text-mode-list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1589
diff changeset
   331
    magit-revision-mode
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   332
    dict-c5-mode)
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   333
  "List of text modes.")
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   334
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   335
(defvar my-text-mode-hook-list
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   336
  (my-mode2hook my-text-mode-list)
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   337
  "List of text mode hooks.")
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   338
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   339
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1469
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   340
(message "MS Windows, w32, win32")
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   341
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   342
;; To remap CapsLock to ScrollLock:
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   343
;; Windows Registry Editor Version 5.00
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   344
;; [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
1470
787318562f0a I end with using Apps key as super.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1469
diff changeset
   345
;; ; CapsLock (3a,00) => LWin (5b,e0); LWin (5b,e0) => Apps (5d,e0)
787318562f0a I end with using Apps key as super.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1469
diff changeset
   346
;; "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,5b,e0,3a,00,5d,e0,5b,e0,00,00,00,00
787318562f0a I end with using Apps key as super.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1469
diff changeset
   347
(when (eq window-system 'w32)
787318562f0a I end with using Apps key as super.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1469
diff changeset
   348
  (setq w32-apps-modifier 'super))
1469
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   349
93700ab0e491 Use ScrollLock as super modifier in Windows. It is useful after remapping
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1468
diff changeset
   350
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   351
(message "appearance")
362
f4bd431ad549 By default start from user home directory (HOME point to it).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 361
diff changeset
   352
370
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   353
;; To maximize frame on full screen, not work with Windows Emacs 21.4.
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   354
;; And maked different height with Emacs 22.3 and 23.1.
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   355
;; (setq initial-frame-alist '((fullscreen . fullboth)))
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   356
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   357
(cl-eval-when (compile) (load-library "window"))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   358
550
d8092299457a (setq display-buffer-reuse-frames t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
   359
(setq display-buffer-reuse-frames t)
d8092299457a (setq display-buffer-reuse-frames t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 549
diff changeset
   360
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   361
(defun my-maximize ()
1183
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   362
  ;; Next code work with Emacs 21.4, 22.3, 23.1.
370
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   363
  (let (
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   364
        (px (display-pixel-width))
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   365
        (py (display-pixel-height))
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   366
        (fx (frame-char-width))
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   367
        (fy (frame-char-height))
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   368
        tx ty
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   369
        )
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   370
    ;; Next formulas discovered empiric on Windows host with default font.
373
bdf2522ad35c On Debian with font 7x13 right part of windows go out of display border.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 372
diff changeset
   371
    (setq tx (- (/ px fx) 7))
370
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   372
    (setq ty (- (/ py fy) 4))
625
78017f6d5b43 Indent initial frame to 2 pixel.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 624
diff changeset
   373
    (setq initial-frame-alist '((top . 2) (left . 2)))
370
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   374
    (add-to-list 'initial-frame-alist (cons 'width tx))
1183
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   375
    (add-to-list 'initial-frame-alist (cons 'height ty)) ))
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   376
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   377
(when window-system
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   378
  (if (fboundp 'toggle-frame-maximized)
6fdc4a4f4155 Use modern way to maximize frame.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1182
diff changeset
   379
      (toggle-frame-maximized)
1549
4ede173a315f Set new frame font same as in main. Maximize new frames.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1548
diff changeset
   380
    (my-maximize) )
4ede173a315f Set new frame font same as in main. Maximize new frames.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1548
diff changeset
   381
  (add-to-list 'default-frame-alist '(fullscreen . maximized)))
370
378a4dc8ea1c Maximize frame on full screen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 369
diff changeset
   382
151
0b6f4adf5096 Minor changes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 150
diff changeset
   383
(menu-bar-mode -1)
415
a325b9a15b8e Fix: 'scroll-bar-mode' and 'tooltip-mode' do not defined in Cygwin nox Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 412
diff changeset
   384
(when window-system
585
2431be336034 mouse-avoidance-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 584
diff changeset
   385
  (mouse-avoidance-mode 'animate)
502
64a475fa36e2 tool-bar-mode not available under Cygwin console Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   386
  (scroll-bar-mode 1)
64a475fa36e2 tool-bar-mode not available under Cygwin console Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 501
diff changeset
   387
  (tool-bar-mode -1)
1407
9ea890c729d8 Fix: Symbol's function definition is void: tooltip-mode on Solaris emacs-nox v24.3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1405
diff changeset
   388
  (tooltip-mode -1)
952
6ec8b1014d11 line-spacing and ediff-split-window-function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 951
diff changeset
   389
  (setq-default line-spacing nil)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   390
  (defun my-popup-menu ()
1003
8c1abe90331a Add doc strings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
   391
    "Menu from keyboard by emulating mouse event."
429
998f33a8ec6e Open menu by f10 like by C-Mouse-3 without mouse!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 428
diff changeset
   392
    (interactive)
490
d6c84d84af9b 'mouse-menu-bar-map' appear only in Emacs 23.x. To get work on any Emacs used
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 489
diff changeset
   393
    (mouse-popup-menubar
d6c84d84af9b 'mouse-menu-bar-map' appear only in Emacs 23.x. To get work on any Emacs used
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 489
diff changeset
   394
     (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name)))
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
   395
     nil) )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   396
  (global-set-key [f10] 'my-popup-menu)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   397
  (global-set-key [apps] 'my-popup-menu)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   398
  (global-set-key [menu] 'my-popup-menu) )
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   399
595
be6c27e4c776 Fix "Prefer horizontal windows splitting" for terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 594
diff changeset
   400
;; Prefer horizontal windows splitting.
612
1c59e45f5358 split-height-threshold/split-width-threshold can not be nil in Emacs 21.x/22.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 611
diff changeset
   401
(when (>= emacs-major-version 23)
1c59e45f5358 split-height-threshold/split-width-threshold can not be nil in Emacs 21.x/22.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 611
diff changeset
   402
  (setq split-height-threshold nil)
1c59e45f5358 split-height-threshold/split-width-threshold can not be nil in Emacs 21.x/22.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 611
diff changeset
   403
  (setq split-width-threshold nil)
1c59e45f5358 split-height-threshold/split-width-threshold can not be nil in Emacs 21.x/22.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 611
diff changeset
   404
  )
573
c28b88b60ed0 Prefer horizontal windows splitting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 524
diff changeset
   405
1147
490ac6d8ab55 Simplify title.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1146
diff changeset
   406
(setq frame-title-format '("EMACS " system-name ": %b"))
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
   407
(setq icon-title-format '("EMACS " system-name ": %b"))
338
ebf88f988c37 Move some appearance related switch together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 337
diff changeset
   408
933
8627e7b2c209 header-line-format
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 932
diff changeset
   409
;; Deprecated: `default-header-line-format', `default-mode-line-format'.
8627e7b2c209 header-line-format
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 932
diff changeset
   410
;; For `mode-line-format' default value was used.
8627e7b2c209 header-line-format
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 932
diff changeset
   411
(setq-default header-line-format nil)
363
17df92226b5a Set default-header-line-format.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 362
diff changeset
   412
1585
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   413
(setq-default left-fringe-width nil)
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   414
(setq-default right-fringe-width nil)
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   415
(setq-default left-margin-width nil)
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   416
(setq-default right-margin-width nil)
364
3d18cfe179cc Set default fringe and margin width.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 363
diff changeset
   417
882
58b84ad67327 default-truncate-lines is depricated since 23.2. Set
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 881
diff changeset
   418
(if (< emacs-major-version 24)
58b84ad67327 default-truncate-lines is depricated since 23.2. Set
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 881
diff changeset
   419
    (setq default-truncate-lines nil)
1585
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   420
  (setq-default truncate-lines nil))
882
58b84ad67327 default-truncate-lines is depricated since 23.2. Set
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 881
diff changeset
   421
(setq truncate-partial-width-windows nil)
366
223c01e1a084 Don't truncate long lines.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 365
diff changeset
   422
1530
b4f84f71f7ab Set large-file-warning-threshold greater then 10 MiB in order to open logs
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1529
diff changeset
   423
(setq large-file-warning-threshold (* 12 1000 1000)) ; Greater then 10 MiB in order to open logs without warnings.
b4f84f71f7ab Set large-file-warning-threshold greater then 10 MiB in order to open logs
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1529
diff changeset
   424
338
ebf88f988c37 Move some appearance related switch together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 337
diff changeset
   425
;; show column & line numbers in status bar
ebf88f988c37 Move some appearance related switch together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 337
diff changeset
   426
(setq column-number-mode t)
ebf88f988c37 Move some appearance related switch together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 337
diff changeset
   427
(setq line-number-mode t)
413
5b28a08bf61b Set size-indication-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 412
diff changeset
   428
(setq size-indication-mode t)
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
   429
(setq line-number-display-limit large-file-warning-threshold)
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
   430
(setq line-number-display-limit-width 200)
934
e8af987ef004 document linum-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 933
diff changeset
   431
;; (linum-mode 1)
1352
5d8228d51506 Document global-linum-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1351
diff changeset
   432
;; (global-linum-mode 1)
338
ebf88f988c37 Move some appearance related switch together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 337
diff changeset
   433
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   434
(when window-system
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   435
  (set-background-color "white")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   436
  (set-foreground-color "black")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   437
  (set-cursor-color "brown")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   438
  ;; (set-mouse-color "white")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   439
  (setq cursor-type 'box)           ; box, hollow, bar, hbar
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   440
  ;;(setq blink-matching-delay 0.01)
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   441
  (blink-cursor-mode 1)
686
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   442
  (setq use-file-dialog t)
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   443
  (setq use-dialog-box t)
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   444
  ;; (set-face-font 'default "7x14")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
   445
  )
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   446
218
1a48dde2dfa3 See what I am typing immediately (for keystroke in minibuffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   447
;; See what I am typing immediately (for keystroke in minibuffer).
1a48dde2dfa3 See what I am typing immediately (for keystroke in minibuffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   448
(setq echo-keystrokes 0.2)
1a48dde2dfa3 See what I am typing immediately (for keystroke in minibuffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   449
1541
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   450
(defun my-dpi ()
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   451
  (let* ((attrs (car (display-monitor-attributes-list)))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   452
         (size (assoc 'mm-size attrs))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   453
         (sizex (cadr size))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   454
         (res (cdr (assoc 'geometry attrs)))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   455
         (resx (- (caddr res) (car res)))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   456
         dpi)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   457
    (catch 'exit
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   458
      ;; in terminal
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   459
      (unless sizex
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   460
        (throw 'exit 10))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   461
      ;; on big screen
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   462
      (when (> sizex 1000)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   463
        (throw 'exit 10))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   464
      ;; DPI
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   465
      (* (/ (float resx) sizex) 25.4))))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   466
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   467
(defun my-preferred-font-size ()
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   468
  (let ( (dpi (my-dpi)) )
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   469
  (cond
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   470
    ((< dpi 110) 10)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   471
    ((< dpi 130) 11)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   472
    ((< dpi 160) 12)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   473
    (t 12))))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   474
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   475
(defvar my-preferred-font-size (my-preferred-font-size))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   476
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   477
(defvar my-regular-font
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   478
  (cond
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   479
   ((eq window-system 'x) (format "DejaVu Sans Mono-%d:weight=normal" my-preferred-font-size))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   480
   ((eq window-system 'w32) (format "Courier New-%d:antialias=none" my-preferred-font-size))))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   481
(defvar my-symbol-font
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   482
  (cond
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   483
   ((eq window-system 'x) (format "DejaVu Sans Mono-%d:weight=normal" my-preferred-font-size))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   484
   ((eq window-system 'w32) (format "DejaVu Sans Mono-%d:antialias=none" my-preferred-font-size))))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   485
1435
55307015efd0 Use Terminus font under X and fallback to misc-fixed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1434
diff changeset
   486
(cond
55307015efd0 Use Terminus font under X and fallback to misc-fixed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1434
diff changeset
   487
 ((eq window-system 'x)
1541
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   488
  (if (and (fboundp 'find-font) (find-font (font-spec :name my-regular-font)))
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   489
      (set-frame-font my-regular-font)
1439
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
   490
    (set-frame-font "7x14")))
1435
55307015efd0 Use Terminus font under X and fallback to misc-fixed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1434
diff changeset
   491
 ((eq window-system 'w32)
1541
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   492
  (set-frame-font my-regular-font)
1549
4ede173a315f Set new frame font same as in main. Maximize new frames.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1548
diff changeset
   493
  ;; (set-default-font my-regular-font)
4ede173a315f Set new frame font same as in main. Maximize new frames.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1548
diff changeset
   494
  (add-to-list 'default-frame-alist
4ede173a315f Set new frame font same as in main. Maximize new frames.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1548
diff changeset
   495
               (cons 'font my-regular-font))
1541
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   496
  (set-fontset-font nil 'cyrillic my-regular-font)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   497
  (set-fontset-font nil 'greek my-regular-font)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   498
  (set-fontset-font nil 'phonetic my-regular-font)
dca10cecc9e2 Set font size depending on DPI.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1540
diff changeset
   499
  (set-fontset-font nil 'symbol my-symbol-font)))
1089
7d9bd1fe3cb0 Set font for IPA and other fontset under Linux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1085
diff changeset
   500
686
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   501
(fset 'yes-or-no-p 'y-or-n-p)
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   502
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   503
(when (boundp 'confirm-kill-emacs)
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   504
  (setq confirm-kill-emacs 'y-or-n-p))
563751ecd385 Bind 'yes-or-no-p' to 'y-or-n-p'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 685
diff changeset
   505
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   506
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1360
a65e3eb1d96e Fix typo.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1356
diff changeset
   507
(message "date, time")
1354
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   508
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   509
(require 'time)
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   510
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   511
;; Also useful such format: (setq display-time-format " %H:%M %d-%m-%y ")
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   512
(setq display-time-24hr-format t)
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   513
(setq display-time-day-and-date nil)
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   514
(setq display-time-default-load-average nil)
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   515
(display-time)                          ; display-time-mode
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   516
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   517
;; For (display-time-world).
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   518
(setq display-time-world-time-format "%A %d %B %R %z %Z")
1618
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   519
(setq display-time-world-list
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   520
      '(("Europe/London" "London")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   521
        ("EET" "Eastern European")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   522
        ("Europe/Moscow" "Moscow")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   523
        ("Asia/Tel_Aviv" "Tel Aviv")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   524
        ("America/Chicago" "Chicago/US Central")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   525
        ("America/Los_Angeles" "Los Angeles")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   526
        ("America/New_York" "New York")
82cd26893672 Added interesting time zones for M-x display-time-world.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1617
diff changeset
   527
        ("Asia/Tokyo" "Tokyo")))
1354
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   528
1730
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   529
1354
57d416cf71fa display-time-world settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1352
diff changeset
   530
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1730
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   531
(message "term colors, ansi colors")
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   532
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   533
(ansi-color-for-comint-mode-on)
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   534
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   535
(defun my-ansi-color (&optional beg end)
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   536
  "Interpret ANSI color esacape sequence by colorifying cotent.
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   537
Operate on selected region on whole buffer."
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   538
  (interactive
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   539
   (if (use-region-p)
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   540
       (list (region-beginning) (region-end))
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   541
     (list (point-min) (point-max))))
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   542
  (ansi-color-apply-on-region beg end))
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   543
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   544
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   545
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   546
(message "shell, bash")
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
   547
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   548
(cl-eval-when (compile) (require 'shell))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   549
1730
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   550
(setq explicit-bash-args '("-i"))
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   551
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   552
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
   553
(message "Cygwin, MSYS")
676
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   554
709
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   555
(defun follow-cygwin-symlink ()
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   556
  "Follow new-style (and also UCS-16) Cygwin symlinks."
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   557
  (save-excursion
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   558
    (goto-char 0)
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   559
    (when (looking-at "!<symlink>\xff\xfe")
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   560
      (find-alternate-file
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   561
       (substring
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   562
        (decode-coding-string
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   563
         (buffer-substring (match-end 0) (point-max))
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   564
         'utf-16-le)
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   565
        0 -1)                           ; -1 for stripping final \0.
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   566
       ))))
2cb49be54b21 Follow new-style (and also UCS-16) Cygwin symlinks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
   567
1419
5ef1ab1064d4 Fix: Warning: reference to free variable `cygwin-mount-table--internal'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1418
diff changeset
   568
(defvar cygwin-mount-table--internal)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   569
(defun my-dos2cygwin-path (path)
731
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   570
  "Convert DOS path to Cygwin according to current mount table."
732
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
   571
  (interactive (list (read-directory-name "Enter DOS path: ")))
731
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   572
  (setq path (replace-regexp-in-string "\\\\" "/" (expand-file-name path)))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   573
  (let ( (table cygwin-mount-table--internal) item prefix )
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   574
    (while table
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   575
      (setq item (car table))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   576
      (setq prefix (concat "\\`" (regexp-quote (car item))))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   577
      (setq table (cdr table))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   578
      (when (string-match prefix path)
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   579
        (setq path (replace-regexp-in-string prefix (cdr item) path))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   580
        (setq table nil)
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   581
        ) )
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   582
    path
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   583
    ))
5b6105640c0e my-dos2cygwin-path
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 730
diff changeset
   584
1545
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   585
(defun my-shell-quote-argument (arg)
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   586
  (cond
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   587
   ((string-match "[<>&|* \"()[]" arg)
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   588
    (concat "'" arg "'"))
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   589
   ((string-match "'" arg)
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   590
    (concat "\"" arg "\""))
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   591
   (t
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   592
    arg)))
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   593
1403
a04175d20f08 I already activate "cygwin-mount".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1402
diff changeset
   594
;; Activate Cygwin for native Windows Emacs if available.
676
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   595
(when (eq system-type 'windows-nt)
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
   596
  (ignore-errors
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
   597
    (require 'cygwin-mount)
1403
a04175d20f08 I already activate "cygwin-mount".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1402
diff changeset
   598
    (cygwin-mount-activate))
733
67e6d0381996 Use 'find-file-hook' as 'find-file-hooks' marked as deprecated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 724
diff changeset
   599
  (add-hook 'find-file-hook 'follow-cygwin-symlink)
676
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   600
  ;; Workaround for Cygwin shell, when set 'CYGWIN=noglob'. By default 'shell-quote-argument'
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   601
  ;; quoted by double '\' chars this cause failure.
1545
d77b6bb30ea4 It doesn't help much but allows to run python process, otherwise
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1544
diff changeset
   602
  (advice-add #'shell-quote-argument :override #'my-shell-quote-argument)
676
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   603
  ;; Workaround for Cygwin when 'shell-file-name' is 'bash'.
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   604
  (setq null-device "/dev/null")
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   605
  ;; Use shell from Cygwin/MinGW.
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   606
  (setq shell-file-name "bash")
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   607
  (setenv "SHELL" "/bin/bash")
1532
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
   608
  ;; (modify-coding-system-alist 'process "bash" '(cp1251-unix . cp1251-unix))
676
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   609
  )
0accf646e451 Move code for shell setup to proper place. Remove unused code as I do not use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 675
diff changeset
   610
1402
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   611
(when (eq system-type 'windows-nt)
746
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   612
  ;; Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   613
  ;; 'gnutls-cli' run with '-s' opt and process wait for SIGALRM.
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   614
  ;; But build-in native Emacs 'kill' command can not send such Cygwin
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   615
  ;; specific sygnal. So 'starttls-negotiate-gnutls' function infinitely
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   616
  ;; wait for 'gnutls-cli' output.
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   617
  (defadvice signal-process (around cygwin (process sigcode))
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   618
    "Use 'kill.exe' instead build-in Emacs 'kill'."
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   619
    (if (eq sigcode 'SIGALRM)
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   620
        (shell-command
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   621
         (format "kill.exe -s SIGALRM %d"
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   622
                 (if (processp process) (process-id process) process)))
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   623
      ad-do-it
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   624
      ))
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   625
  (ad-activate 'signal-process)
748
a42f5a803c98 Do not convert output of 'gnutls-cli'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 747
diff changeset
   626
  (modify-coding-system-alist 'process "gnutls-cli" '(binary . binary))
746
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   627
  )
f7ce19afa666 Fix 'starttls.el' on native Windows Emacs with gnutls-cli from Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 745
diff changeset
   628
1402
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
   629
(when (eq system-type 'windows-nt)
858
81c925713d9c Add '.py' and '.sh' as allowed executable extension.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 857
diff changeset
   630
  (add-to-list 'exec-suffixes ".py")
81c925713d9c Add '.py' and '.sh' as allowed executable extension.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 857
diff changeset
   631
  (add-to-list 'exec-suffixes ".sh")
81c925713d9c Add '.py' and '.sh' as allowed executable extension.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 857
diff changeset
   632
  (defun executable-find (command) (locate-file command exec-path exec-suffixes))
81c925713d9c Add '.py' and '.sh' as allowed executable extension.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 857
diff changeset
   633
  )
81c925713d9c Add '.py' and '.sh' as allowed executable extension.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 857
diff changeset
   634
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   635
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
923
e2c69e1c4642 Define C-left/-right navigation in term raw mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 922
diff changeset
   636
(message "term")
e2c69e1c4642 Define C-left/-right navigation in term raw mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 922
diff changeset
   637
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   638
(cl-eval-when (compile) (require 'term))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   639
1454
b712a6dad4c2 Use bash in term-mode under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1453
diff changeset
   640
(when (eq system-type 'cygwin)
b712a6dad4c2 Use bash in term-mode under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1453
diff changeset
   641
  (setq explicit-shell-file-name "bash"))
b712a6dad4c2 Use bash in term-mode under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1453
diff changeset
   642
926
1ad4d40e5b5e Set term-buffer-maximum-size.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 925
diff changeset
   643
(setq term-buffer-maximum-size (lsh 1 14))
1ad4d40e5b5e Set term-buffer-maximum-size.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 925
diff changeset
   644
1314
54572ca2b27d term-scroll-show-maximum-output
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1312
diff changeset
   645
(setq term-scroll-show-maximum-output t)
54572ca2b27d term-scroll-show-maximum-output
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1312
diff changeset
   646
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
   647
(my--eval-after-load term
1696
01608a10b6d6 About term-paste.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1695
diff changeset
   648
  ;; (define-key term-raw-map [S-insert] 'term-paste) - defined inside mode!
1307
8d652d88c013 Enable file name completion in line-mode of term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1306
diff changeset
   649
  (define-key term-mode-map [?\t] #'term-dynamic-complete)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   650
  (defun my-term-send-delete-word-forward () (interactive) (term-send-raw-string "\ed"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   651
  (defun my-term-send-delete-word-backward () (interactive) (term-send-raw-string "\e\C-h"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   652
  (define-key term-raw-map [C-delete] 'my-term-send-delete-word-forward)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   653
  (define-key term-raw-map [C-backspace] 'my-term-send-delete-word-backward)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   654
  (defun my-term-send-forward-word () (interactive) (term-send-raw-string "\ef"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   655
  (defun my-term-send-backward-word () (interactive) (term-send-raw-string "\eb"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   656
  (define-key term-raw-map [C-left] 'my-term-send-backward-word)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   657
  (define-key term-raw-map [C-right] 'my-term-send-forward-word)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   658
  (defun my-term-send-m-right () (interactive) (term-send-raw-string "\e[1;3C"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   659
  (defun my-term-send-m-left () (interactive) (term-send-raw-string "\e[1;3D"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   660
  (define-key term-raw-map [M-right] 'my-term-send-m-right)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   661
  (define-key term-raw-map [M-left] 'my-term-send-m-left) )
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   662
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   663
(defun my-term-mode-hook ()
1062
c1cac6e85f9b Enable 'goto-address-mode' in 'term-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1061
diff changeset
   664
  (goto-address-mode 1))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   665
(add-hook 'term-mode-hook #'my-term-mode-hook)
1062
c1cac6e85f9b Enable 'goto-address-mode' in 'term-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1061
diff changeset
   666
1307
8d652d88c013 Enable file name completion in line-mode of term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1306
diff changeset
   667
(setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *")
8d652d88c013 Enable file name completion in line-mode of term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1306
diff changeset
   668
923
e2c69e1c4642 Define C-left/-right navigation in term raw mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 922
diff changeset
   669
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1104
0e876ae7ffe7 Show memory usage in proced.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
   670
(message "proced")
0e876ae7ffe7 Show memory usage in proced.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
   671
0e876ae7ffe7 Show memory usage in proced.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
   672
(setq-default proced-format 'medium)
0e876ae7ffe7 Show memory usage in proced.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
   673
0e876ae7ffe7 Show memory usage in proced.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1103
diff changeset
   674
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   675
(message "whitespaces")
361
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   676
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   677
(cl-eval-when (compile) (require 'whitespace))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   678
1585
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   679
(setq-default indicate-empty-lines t)
3d8b6068a940 Replaced default-FOO variables with (setq-default FOO ...) as they were deleted in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1584
diff changeset
   680
(setq-default indicate-buffer-boundaries 'left)
361
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   681
1634
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   682
;; Old trailing whitespace highlighter built-in into Emacs engine, until global-whitespace-mode is fixed.
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   683
(setq-default show-trailing-whitespace t)
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   684
(set-face-attribute 'trailing-whitespace nil :background "magenta")
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   685
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   686
;; whitespace-style "face" causes double quoted strings to be highlighted by font-lock-string-face.
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   687
;; https://emacs.stackexchange.com/questions/61770/whitespace-style-face-activats-highlighting-of-quoted-string-in-fundamental-mo
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   688
;; (setq whitespace-style '(face trailing tabs))
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   689
;; (setq whitespace-global-modes t)
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   690
;; (ignore-errors
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   691
;;   (require 'whitespace)
1c19f4e2ac19 Disabled global-whitespace-mode as it makes string quoted in double quote highlighted in fundamental-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1633
diff changeset
   692
;;   (global-whitespace-mode -1))
361
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   693
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   694
(setq next-line-add-newlines nil)
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   695
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   696
;; See also 'mode-require-final-newline'.
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   697
(add-hook 'text-mode-hook (lambda () (setq require-final-newline nil)))
9dbe92b8b329 Added indicate-buffer-boundaries.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 360
diff changeset
   698
1474
7a9acb530003 Use cycle-spacing as it convenient then M-\ key binding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1473
diff changeset
   699
(when (fboundp 'cycle-spacing)
7a9acb530003 Use cycle-spacing as it convenient then M-\ key binding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1473
diff changeset
   700
  (global-set-key (kbd "M-SPC") 'cycle-spacing))
7a9acb530003 Use cycle-spacing as it convenient then M-\ key binding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1473
diff changeset
   701
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   702
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
741
cd25b9526e76 'gnuserv' now dead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 740
diff changeset
   703
(message "server")
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 83
diff changeset
   704
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   705
(cl-eval-when (compile) (require 'server))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   706
1648
5da3c9313dc2 Use server-use-tcp for server activation for Cygwin as /tmp directory periodically is cleaned up.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1647
diff changeset
   707
(when (equal window-system 'w32)
5da3c9313dc2 Use server-use-tcp for server activation for Cygwin as /tmp directory periodically is cleaned up.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1647
diff changeset
   708
  ;; including cygwin here as socket in /tmp directory is a subject of cleanup...
5da3c9313dc2 Use server-use-tcp for server activation for Cygwin as /tmp directory periodically is cleaned up.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1647
diff changeset
   709
  (setq server-use-tcp t))
1453
7a4cc173d4d6 Enable server for Cygwin Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1452
diff changeset
   710
(when (and (>= emacs-major-version 22))
394
03d8b85ff815 Do not load server.el for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 393
diff changeset
   711
  (require 'server)
1405
fffa9d2a328f Fix: File error: Opening output file, no such file or directory, c:/Users/user/AppData/Roaming/.emacs.d/server/server
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1404
diff changeset
   712
  (when server-use-tcp
fffa9d2a328f Fix: File error: Opening output file, no such file or directory, c:/Users/user/AppData/Roaming/.emacs.d/server/server
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1404
diff changeset
   713
    (unless (file-directory-p server-auth-dir)
fffa9d2a328f Fix: File error: Opening output file, no such file or directory, c:/Users/user/AppData/Roaming/.emacs.d/server/server
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1404
diff changeset
   714
      (mkdir server-auth-dir)))
1203
2d151ab6761d Fix condition for applying server-ensure-safe-dir fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1196
diff changeset
   715
  (when (and (>= emacs-major-version 23) (equal window-system 'w32))
394
03d8b85ff815 Do not load server.el for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 393
diff changeset
   716
    (defun server-ensure-safe-dir (dir) "Noop" t)) ; Suppress error directory ~/.emacs.d/server is unsafe on windows.
662
81ca1335730a Fix condition as it stop server from loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 660
diff changeset
   717
  (when (or (= emacs-major-version 22) (not (eq (server-running-p server-name) t)))
1203
2d151ab6761d Fix condition for applying server-ensure-safe-dir fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1196
diff changeset
   718
    (server-start)) )
85
2bb7e6aceac9 Added target dist-tar.
gavenkoa@gavenko.bifit.int
parents: 83
diff changeset
   719
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   720
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1710
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   721
(message "file local variables/ dir local variables")
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   722
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   723
(setq enable-dir-local-variables t)
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   724
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   725
;; Prompt before evaluating potencially dangerous foreign elisp!
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   726
(setq enable-local-variables :safe)
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   727
(setq enable-local-eval :maybe)
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   728
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   729
;; See also `safe-local-eval-forms' & `safe-local-variable-values'.
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   730
03f26aaabbfa Moved settings for file local variable to a separate section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1709
diff changeset
   731
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   732
(message "standart/general settings")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   733
336
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   734
;; Try to speed things up, especially in VM.
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   735
(setq gc-cons-threshold 2000000)
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   736
408
78cf8a4feb66 Fix: default 'command-history' length too short (in Emacs 23.2 is 30).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   737
;; Default 'command-history' length too short (in Emacs 23.2 is 30).
78cf8a4feb66 Fix: default 'command-history' length too short (in Emacs 23.2 is 30).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   738
(setq history-length 200)
1486
cf1175a9cd7b I do not need duplicates in minibuffer history.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1482
diff changeset
   739
(setq history-delete-duplicates t)
408
78cf8a4feb66 Fix: default 'command-history' length too short (in Emacs 23.2 is 30).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 404
diff changeset
   740
336
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   741
;; Don't beep in my headphones!
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   742
(setq ring-bell-function '(lambda () "Empty ring-bell-function." nil))
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   743
(setq visible-bell t) ; With default ring-bell-function in text terminal
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   744
                      ; revert screen if press [end] or [home]
880
995e7f89c52d Set track-eol.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 879
diff changeset
   745
(setq track-eol nil)
336
a252995f7d6b Move general getting into one place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 335
diff changeset
   746
1372
cb4d1411a245 (setq enable-recursive-minibuffers t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1371
diff changeset
   747
(setq enable-recursive-minibuffers t)
867
2a689826c166 Set enable-recursive-minibuffers to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 866
diff changeset
   748
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   749
(setq kill-whole-line t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   750
879
a14d684e34f7 Don't set view-read-only to 't' because of bug with gettext.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 878
diff changeset
   751
;; Disable because of bug with gettext.el. See
a14d684e34f7 Don't set view-read-only to 't' because of bug with gettext.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 878
diff changeset
   752
;;   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287261
a14d684e34f7 Don't set view-read-only to 't' because of bug with gettext.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 878
diff changeset
   753
;; (setq view-read-only t)
102
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
   754
171
2f2aae1d394c Set read-quoted-char-radix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 169
diff changeset
   755
(setq read-quoted-char-radix 16)
2f2aae1d394c Set read-quoted-char-radix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 169
diff changeset
   756
1612
1bf9e4f1d289 Expression was simplified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1611
diff changeset
   757
;; https://emacs.stackexchange.com/questions/33117/showing-bytes-as-hexadecimal-escapes-rather-than-octal-escapes
1613
61ea45815411 Set display-raw-bytes-as-hex for Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1612
diff changeset
   758
(cond
61ea45815411 Set display-raw-bytes-as-hex for Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1612
diff changeset
   759
 ((>= emacs-major-version 26)
61ea45815411 Set display-raw-bytes-as-hex for Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1612
diff changeset
   760
  (setq display-raw-bytes-as-hex t))
61ea45815411 Set display-raw-bytes-as-hex for Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1612
diff changeset
   761
 ((and (>= emacs-major-version 22) (not (eq system-type 'darwin)))
613
1e7314bb84bc Fix loading error for Emacs 21.3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 612
diff changeset
   762
  (setq standard-display-table (make-display-table))
1e7314bb84bc Fix loading error for Emacs 21.3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 612
diff changeset
   763
  (let ( (i ?\x80) hex hi low )
1e7314bb84bc Fix loading error for Emacs 21.3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 612
diff changeset
   764
    (while (<= i ?\xff)
1e7314bb84bc Fix loading error for Emacs 21.3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 612
diff changeset
   765
      (aset standard-display-table (unibyte-char-to-multibyte i)
1612
1bf9e4f1d289 Expression was simplified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1611
diff changeset
   766
            (cl-map 'vector
1bf9e4f1d289 Expression was simplified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1611
diff changeset
   767
                    (lambda (c) (make-glyph-code c 'escape-glyph))
1bf9e4f1d289 Expression was simplified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1611
diff changeset
   768
                    (format "\\%02x" i)))
1613
61ea45815411 Set display-raw-bytes-as-hex for Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1612
diff changeset
   769
      (setq i (1+ i))))))
525
c8d4f5368b04 Show non printable characters in hex, not in octal.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 524
diff changeset
   770
1566
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   771
(defun my--get-char (name)
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   772
  "Get character by Unicode `name'."
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   773
  (cond
1627
1faf2d1a9cd6 Fixed typo in a condition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   774
   ((<= 26 emacs-major-version)
1595
0f4f0205ef3e No need for default value. It can hide bug.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1594
diff changeset
   775
    (gethash name (ucs-names)))
1627
1faf2d1a9cd6 Fixed typo in a condition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   776
   ((<= 23 emacs-major-version)
1566
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   777
    (cdr (assoc-string name (ucs-names))))
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   778
   (t (error "Emacs version is too old and lacks Unicode support..."))))
0e7f4d5153d1 Fixed (ucs-names) API change in Emacs v26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1565
diff changeset
   779
863
d48ba6196046 Add sign for euro and hryvnia.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 862
diff changeset
   780
(when (>= emacs-major-version 23)
1586
6aff838af671 Fixed: ‘ucs-insert’ is an obsolete function (as of 24.3), use ‘insert-char’ instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1585
diff changeset
   781
  (define-key global-map "\C-x8g" (lambda nil (interactive) (insert-char (my--get-char "HRYVNIA SIGN"))))
6aff838af671 Fixed: ‘ucs-insert’ is an obsolete function (as of 24.3), use ‘insert-char’ instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1585
diff changeset
   782
  (define-key global-map "\C-x8e" (lambda nil (interactive) (insert-char (my--get-char "EURO SIGN")))) )
863
d48ba6196046 Add sign for euro and hryvnia.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 862
diff changeset
   783
344
b7d0989d9472 generic-define-* before (require 'generic-x) allow load all useful extra modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 342
diff changeset
   784
;; generic-define-* before (require 'generic-x) allow load all useful extra modes.
1381
8e2779f23920 Fix Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   785
(defvar generic-define-mswindows-modes t)
8e2779f23920 Fix Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1380
diff changeset
   786
(defvar generic-define-unix-modes t)
1597
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   787
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   788
(setq generic-extras-enable-list
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   789
      '(apache-conf-generic-mode apache-log-generic-mode hosts-generic-mode java-manifest-generic-mode java-properties-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   790
        ;; javascript-generic-mode ansible-inventory-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   791
       show-tabs-generic-mode vrml-generic-mode bat-generic-mode inf-generic-mode ini-generic-mode rc-generic-mode reg-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   792
       rul-generic-mode alias-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   793
       etc-fstab-generic-mode etc-modules-conf-generic-mode etc-passwd-generic-mode etc-services-generic-mode etc-sudoers-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   794
       fvwm-generic-mode inetd-conf-generic-mode mailagent-rules-generic-mode mailrc-generic-mode named-boot-generic-mode named-database-generic-mode
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   795
       prototype-generic-mode resolve-conf-generic-mode samba-generic-mode x-resource-generic-mode xmodmap-generic-mode))
69fb0b318f3c Removed some generic modes that interfere with specialised: javascript-generic-mode ansible-inventory-generic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1596
diff changeset
   796
341
84db44766351 Remove bat-file-mode as it present in generic-x.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   797
(require 'generic-x)
84db44766351 Remove bat-file-mode as it present in generic-x.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 339
diff changeset
   798
345
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   799
;; The following commands are usually disabled by default. Enable them...
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   800
(put 'eval-expression  'disabled nil)
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   801
(put 'downcase-region  'disabled nil)
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   802
(put 'upcase-region    'disabled nil)
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   803
(put 'narrow-to-page   'disabled nil)
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   804
(put 'narrow-to-region 'disabled nil)
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   805
(put 'scroll-left      'disabled nil)
1371
e1c546660149 (put 'set-goal-column 'disabled nil)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1370
diff changeset
   806
(put 'set-goal-column  'disabled nil)
345
90b5ae643a6d Move code to proper place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 344
diff changeset
   807
432
650ccece6b01 use-dialog-box set to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 431
diff changeset
   808
(setq
650ccece6b01 use-dialog-box set to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 431
diff changeset
   809
 use-dialog-box t
650ccece6b01 use-dialog-box set to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 431
diff changeset
   810
 x-gtk-show-hidden-files t
650ccece6b01 use-dialog-box set to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 431
diff changeset
   811
 )
650ccece6b01 use-dialog-box set to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 431
diff changeset
   812
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   813
(defun my-prevent-kill-buffer ()
865
2a99ede322cd Prevent from closing 'NOTE.org' buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 864
diff changeset
   814
  (if (member (buffer-name) '("*scratch*" "NOTE.org")) nil t))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   815
(add-to-list 'kill-buffer-query-functions 'my-prevent-kill-buffer)
719
694f7e388f2b Add func 'my-prevent-kill-buffer' and prevent kill '*scratch*' buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 718
diff changeset
   816
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   817
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   818
(message "scrolling")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   819
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   820
(defvar my-scroll-margin 4)
339
4e131c57a0ef With scroll-step 3 when go down it scroll one line but if up - 3 so set
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 338
diff changeset
   821
127
0e82eedbaa82 Setup scrolling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 126
diff changeset
   822
(setq-default
1312
7c7a0f0e370e Fix spelling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1311
diff changeset
   823
 ;; Set to zero as this recommend documentation.
802
6168f8ab6479 Fix scrolling speed as I am use settings that documentation recommend avoid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   824
 scroll-step 0
6168f8ab6479 Fix scrolling speed as I am use settings that documentation recommend avoid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   825
 ;; If the value is greater than 100, redisplay will never recenter point, but
6168f8ab6479 Fix scrolling speed as I am use settings that documentation recommend avoid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   826
 ;; will always scroll just enough text to bring point into view
6168f8ab6479 Fix scrolling speed as I am use settings that documentation recommend avoid.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   827
 scroll-conservatively 1000
127
0e82eedbaa82 Setup scrolling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 126
diff changeset
   828
 scroll-preserve-screen-position t
0e82eedbaa82 Setup scrolling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 126
diff changeset
   829
 )
0e82eedbaa82 Setup scrolling.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 126
diff changeset
   830
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   831
(defvar my-scroll-margin-mode-list
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   832
  '(vc-dir-mode
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   833
    recentf-dialog-mode
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   834
    org-agenda-grid-mode           ; XXX for this item not worked!
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   835
    log-view-mode
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   836
    dired-mode
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   837
    compilation-mode
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   838
    conf-mode)
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   839
  "List of modes for enabling scroll margin.")
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   840
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   841
;; Set margin only for desired modes! Do not frustrate calendar any more.
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   842
(make-variable-buffer-local 'scroll-margin)
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   843
(defun my-set-scroll-margin () (setq scroll-margin my-scroll-margin))
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   844
(mapc (lambda (hook) (add-hook hook #'my-set-scroll-margin))
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   845
      (delete-dups (append my-text-mode-hook-list
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   846
                           my-prog-hook-list
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   847
                           (my-mode2hook my-scroll-margin-mode-list)
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
   848
                           '(prog-mode-hook))) )
333
14b07ca8335a Set margin only for desired modes! Do not frustrate calendar any more.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 332
diff changeset
   849
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   850
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
738
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   851
(message "chars, unicode")
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   852
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   853
(defun my-print-unicode (&optional start end)
738
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   854
  "Print UNICODE table."
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   855
  (interactive "nstart: \nnend: ")
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   856
  (switch-to-buffer (get-buffer-create "*UNICODE*"))
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   857
  (erase-buffer)
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   858
  (let ( (i start) )
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   859
    (while (<= i end)
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   860
      (insert (format "%s: U+%04x, %s\n" (char-to-string i) i (get-char-code-property i 'name)))
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   861
      (setq i (1+ i))
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   862
      )))
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   863
2a81232aa82f Add 'my-print-unicode' which print UNICODE table.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 737
diff changeset
   864
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   865
(message "search, isearch, occur")
254
51b47da56551 Highlight on search and repalce.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 253
diff changeset
   866
989
2967a171f889 Fix: case-fold-search become buffer local so set default value...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 988
diff changeset
   867
(setq-default case-fold-search t)
217
1c42ba3ac4ba Case insensitive search. Group search customization together.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   868
254
51b47da56551 Highlight on search and repalce.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 253
diff changeset
   869
(setq query-replace-highlight t)        ; highlight during query
51b47da56551 Highlight on search and repalce.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 253
diff changeset
   870
(setq search-highlight t)               ; highlight incremental search
51b47da56551 Highlight on search and repalce.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 253
diff changeset
   871
563
6d5387a4e95d Move code to proper place. Add 'f7' key binding for 'occur'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 562
diff changeset
   872
;; Make old Emacs key binding like in Emacs 23.x.
6d5387a4e95d Move code to proper place. Add 'f7' key binding for 'occur'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 562
diff changeset
   873
(when (< emacs-major-version 23)
6d5387a4e95d Move code to proper place. Add 'f7' key binding for 'occur'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 562
diff changeset
   874
  (global-set-key (kbd "M-s o") 'occur)
6d5387a4e95d Move code to proper place. Add 'f7' key binding for 'occur'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 562
diff changeset
   875
  )
6d5387a4e95d Move code to proper place. Add 'f7' key binding for 'occur'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 562
diff changeset
   876
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   877
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1478
e6f6dd580012 Enable ag if available for searching.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1477
diff changeset
   878
(message "grep, find, ack, ag")
526
9e613d7de6e1 Added exclude pattern to 'grep-find-ignored-directories'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 525
diff changeset
   879
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   880
(cl-eval-when (compile) (require 'find-dired))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
   881
542
22eb7a31b689 Speedup find-dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 541
diff changeset
   882
;; -ls produce very noisy output:
22eb7a31b689 Speedup find-dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 541
diff changeset
   883
;; (setq find-ls-option '("-ls" . ""))
22eb7a31b689 Speedup find-dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 541
diff changeset
   884
;; So I use next expression, which work with GNU find, I replace %s with '0'
22eb7a31b689 Speedup find-dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 541
diff changeset
   885
;; to avoid unnecessary sys calls and this make output aligned by column:
1298
f25b62528baa Show size in bytes by find-dired command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1296
diff changeset
   886
(setq find-ls-option '("-printf ' -rw-rw-rw- %9s %AY-%Am-%Ad %AH:%AM %p\n'" . ""))
542
22eb7a31b689 Speedup find-dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 541
diff changeset
   887
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
   888
(cl-eval-when (compile) (require 'grep))
1418
a824a9955b53 Fix: Warning: assignment to free variable `find-ls-option'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1417
diff changeset
   889
357
84c8c5f03fd4 Correct grep command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 356
diff changeset
   890
;; Do not set t because some grep do not has --color options.
84c8c5f03fd4 Correct grep command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 356
diff changeset
   891
(setq grep-highlight-matches nil)
84c8c5f03fd4 Correct grep command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 356
diff changeset
   892
(setq grep-use-null-device nil)
84c8c5f03fd4 Correct grep command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 356
diff changeset
   893
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
   894
(my--eval-after-load grep
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   895
  (add-to-list 'grep-find-ignored-directories "build" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   896
  (add-to-list 'grep-find-ignored-directories "dist" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   897
  (add-to-list 'grep-find-ignored-directories "lib" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   898
  (add-to-list 'grep-find-ignored-directories "_build" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   899
  (add-to-list 'grep-find-ignored-directories "_dist" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   900
  (add-to-list 'grep-find-ignored-directories "_lib" t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   901
  (when (boundp 'grep-find-ignored-files)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   902
    (add-to-list 'grep-find-ignored-files "*TAGS")
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   903
    (add-to-list 'grep-find-ignored-files "GPATH")) )
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
   904
356
fd1af7a494de Added key binding for rgrep.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 355
diff changeset
   905
(global-set-key [M-f7] 'rgrep)
fd1af7a494de Added key binding for rgrep.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 355
diff changeset
   906
1726
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
   907
(global-set-key [C-f7] 'my-ag)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   908
(global-set-key [S-f7] 'my-ag-default-directory)
1478
e6f6dd580012 Enable ag if available for searching.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1477
diff changeset
   909
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   910
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
861
f8f14aacfc9b Enable 'global-hi-lock-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 860
diff changeset
   911
(message "highlighting")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
   912
996
0eb9113dddaa Increase scrolling speed by defer consuming operation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995
diff changeset
   913
;; Increase scrolling speed by defer consuming operation.
1000
289782aa4afa I disable this due to bugs in Emacs (it doesn't highlight at all until you
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 999
diff changeset
   914
;; I disable this due to bugs in Emacs (it doesn't highlight at all until you
289782aa4afa I disable this due to bugs in Emacs (it doesn't highlight at all until you
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 999
diff changeset
   915
;; press any key).
289782aa4afa I disable this due to bugs in Emacs (it doesn't highlight at all until you
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 999
diff changeset
   916
;; (setq jit-lock-defer-time 0.01)
996
0eb9113dddaa Increase scrolling speed by defer consuming operation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995
diff changeset
   917
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   918
(setq font-lock-maximum-decoration t)
395
c7f6eb04626d Port to Emacs 32.2 (in 'global-font-lock-mode' error - Wrong number of arguments).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 391
diff changeset
   919
(global-font-lock-mode 1)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   920
1333
9927012ea835 Disable global-hi-lock-mode due to bug: 24.5; "(global-hi-lock-mode 1)" broke "C-x" key bindings inside "M-x term", especially for "emacs -nw" (Emacs inside Emacs).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1332
diff changeset
   921
;; http://debbugs.gnu.org/cgi/bugreport.cgi?archive=yes&bug=22620
9927012ea835 Disable global-hi-lock-mode due to bug: 24.5; "(global-hi-lock-mode 1)" broke "C-x" key bindings inside "M-x term", especially for "emacs -nw" (Emacs inside Emacs).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1332
diff changeset
   922
;; 24.5; "(global-hi-lock-mode 1)" broke "C-x" key bindings inside "M-x term", especially for "emacs -nw" (Emacs inside Emacs).
9927012ea835 Disable global-hi-lock-mode due to bug: 24.5; "(global-hi-lock-mode 1)" broke "C-x" key bindings inside "M-x term", especially for "emacs -nw" (Emacs inside Emacs).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1332
diff changeset
   923
; (global-hi-lock-mode -1)
861
f8f14aacfc9b Enable 'global-hi-lock-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 860
diff changeset
   924
1622
954b7c665c1a Added highlighting for special pattern to be less distracting. Two symbols are used as markers from each side to avoid most false positive matches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1621
diff changeset
   925
(when window-system
954b7c665c1a Added highlighting for special pattern to be less distracting. Two symbols are used as markers from each side to avoid most false positive matches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1621
diff changeset
   926
  (set-face-attribute 'shadow nil :foreground "gray60")) ;; tan, gray70
954b7c665c1a Added highlighting for special pattern to be less distracting. Two symbols are used as markers from each side to avoid most false positive matches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1621
diff changeset
   927
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   928
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   929
(message "highlight selected text")
64
54ef0d72488f More pretty with selecting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   930
776
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   931
(delete-selection-mode 1)
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   932
1429
f918516ffeb0 Fix: Warning: assignment to free variables `pc-select-selection-keys-only' and
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1428
diff changeset
   933
(defvar pc-select-selection-keys-only)
f918516ffeb0 Fix: Warning: assignment to free variables `pc-select-selection-keys-only' and
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1428
diff changeset
   934
(defvar pc-select-meta-moves-sexps)
776
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   935
(when (<= emacs-major-version 23)
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   936
  ;; 1/-1, when the mark is active, the region is highlighted.
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   937
  (transient-mark-mode 1)
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   938
  ;; Order of next items is important, (assignment must done before pc-selection-mode enabled).
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   939
  (require 'pc-select)
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   940
  (setq pc-select-selection-keys-only t)  ; To avoid some key bindings as F6, etc.
1e680ded54d1 'transient-mark-mode' and 'pc-selection-mode' are deprecated. Emacs 24 default
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 775
diff changeset
   941
  (setq pc-select-meta-moves-sexps t)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
   942
  (pc-selection-mode 1) )
64
54ef0d72488f More pretty with selecting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   943
1122
0e255897262a Set selection background color.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1121
diff changeset
   944
(when window-system
0e255897262a Set selection background color.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1121
diff changeset
   945
  (set-face-attribute 'region nil :background "light blue"))
0e255897262a Set selection background color.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1121
diff changeset
   946
146
506d2883199f kill/yank func also use/update CLIPBOARD selsction on X window.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 145
diff changeset
   947
(when (eq window-system 'x)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
   948
  (setq x-select-enable-clipboard t))
64
54ef0d72488f More pretty with selecting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 63
diff changeset
   949
1268
9fecb7abda89 Use er/expand-region if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1265
diff changeset
   950
(when (fboundp 'er/expand-region)
1724
35c96420cf54 Reserved s-= for my-calc-line (to avoid excessive typing of M-x my-calc-line). er/expand-region is now s-w to be near C-w/M-w.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1723
diff changeset
   951
  (global-set-key (kbd "s-w") 'er/expand-region))
1547
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   952
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   953
(defun my-mark-line ()
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   954
  "Mark current line."
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   955
  (forward-line 0)
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   956
  (set-mark (point))
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   957
  (forward-line 1)
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   958
  (exchange-point-and-mark))
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   959
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   960
(setq-default er/try-expand-list '(er/mark-word er/mark-symbol er/mark-inside-quotes er/mark-outside-quotes er/mark-inside-pairs er/mark-outside-pairs my-mark-line))
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   961
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   962
(my--eval-after-load text-mode-expansions
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   963
  (add-to-list 'expand-region-exclude-text-mode-expansions 'org-mode)
a4e4e54c257a Disable er in org/rst-mode. Expand to line with \n by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1546
diff changeset
   964
  (add-to-list 'expand-region-exclude-text-mode-expansions 'rst-mode))
1546
4939c41ef080 Expand region to word by default.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1545
diff changeset
   965
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   966
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   967
(message "highlighting current line")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
   968
1382
be41e9ce7713 Use hl-line even in terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1381
diff changeset
   969
(require 'hl-line)
be41e9ce7713 Use hl-line even in terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1381
diff changeset
   970
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   971
(defun my-hl-line-range-function ()
1277
ae5c2b9ab4bd Avoid overriding text background - highlight only after line end.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1276
diff changeset
   972
  (cons (line-end-position) (line-beginning-position 2)))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
   973
(setq hl-line-range-function #'my-hl-line-range-function)
1277
ae5c2b9ab4bd Avoid overriding text background - highlight only after line end.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1276
diff changeset
   974
1382
be41e9ce7713 Use hl-line even in terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1381
diff changeset
   975
(set-face-attribute 'hl-line nil :inherit nil :background "light yellow")
be41e9ce7713 Use hl-line even in terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1381
diff changeset
   976
(setq global-hl-line-sticky-flag t)
be41e9ce7713 Use hl-line even in terminals.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1381
diff changeset
   977
(global-hl-line-mode 1)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   978
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   979
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
   980
(message "paren, braces")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   981
1386
e9b455ea0327 Fix: Warning: `european-calendar-style' is an obsolete variable (as of 23.1); use `calendar-date-style' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
   982
(require 'paren)
e9b455ea0327 Fix: Warning: `european-calendar-style' is an obsolete variable (as of 23.1); use `calendar-date-style' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
   983
1654
984c15b493ab Highlight an entire expression instead of matching parenthesis.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1653
diff changeset
   984
(when window-system
1655
05502e8a049d Set more distinctive color for paren expression highlighting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1654
diff changeset
   985
  (face-spec-set 'show-paren-match '((t :background "wheat"))))
1654
984c15b493ab Highlight an entire expression instead of matching parenthesis.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1653
diff changeset
   986
;; parenthesis, expression, mixed
1728
746bcf68435f Show only the matching closing parenthesis, flashing entire expression is irritating.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1727
diff changeset
   987
(setq show-paren-style 'parenthesis)
1654
984c15b493ab Highlight an entire expression instead of matching parenthesis.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1653
diff changeset
   988
1656
0445e8ee4912 Fixed: show-paren-mode was disabled by large files because is it global mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
   989
;; show-paren-mode is global, to override have to be local variable.
0445e8ee4912 Fixed: show-paren-mode was disabled by large files because is it global mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
   990
(make-variable-buffer-local 'show-paren-mode)
0445e8ee4912 Fixed: show-paren-mode was disabled by large files because is it global mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
   991
(show-paren-mode 1)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   992
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
   993
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1430
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
   994
(message "input method")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
   995
1115
f67ef4132301 mouse-yank-at-point
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1114
diff changeset
   996
(setq mouse-yank-at-point t)
f67ef4132301 mouse-yank-at-point
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1114
diff changeset
   997
1080
8fad37c1d42f Refactoring input method selection.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   998
;; (pc-bindings-mode) ; I define own keybinding...
8fad37c1d42f Refactoring input method selection.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1076
diff changeset
   999
402
b1a9c8e0c22e As cyrillic-jcuken input metod fixed
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 398
diff changeset
  1000
;; cyrillic-jis-russian  for 567 is :,.
b1a9c8e0c22e As cyrillic-jcuken input metod fixed
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 398
diff changeset
  1001
;; cyrillic-jcuken  for SHIFT 567 is :,.
b1a9c8e0c22e As cyrillic-jcuken input metod fixed
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 398
diff changeset
  1002
;; russian-computer for SHIFT 567 is %^&
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1003
(setq default-input-method 'russian-computer)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1004
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1005
(defun my-toggle-input-method (&optional arg)
1081
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1006
  (interactive "P")
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1007
  (if (numberp arg)
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1008
      (cond
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1009
       ((eq arg 1)
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1010
        (activate-input-method nil))
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1011
       ((eq arg 2)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1012
        (activate-input-method 'russian-computer))
1081
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1013
       ((eq arg 3)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1014
        (activate-input-method 'ukrainian-computer))
1081
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1015
       ((eq arg 4)
1349
bb5f3306e2a8 Swap ipa and greek index.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1348
diff changeset
  1016
        (activate-input-method 'greek))
1317
0097c1ddafef Add quick access to TeX input method.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1316
diff changeset
  1017
       ((eq arg 5)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1018
        (activate-input-method 'ipa-x-sampa))
1348
93bcfa82cb34 Add Greek input method.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1347
diff changeset
  1019
       ((eq arg 6)
1553
760837fd2f5e Added switch to rfc1345 input method.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1552
diff changeset
  1020
        (activate-input-method 'TeX))
760837fd2f5e Added switch to rfc1345 input method.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1552
diff changeset
  1021
       ((eq arg 7)
760837fd2f5e Added switch to rfc1345 input method.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1552
diff changeset
  1022
        (activate-input-method 'rfc1345)) )
1081
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1023
    (toggle-input-method arg)) )
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1024
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1025
(global-set-key (kbd "C-\\") 'my-toggle-input-method)
1081
37ddc669849c Enhance selection of input methods by using numeric prefix for modeless
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1080
diff changeset
  1026
1430
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1027
;; I found this more quick method to allow `forward-word' across pronunciation
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1028
;; as a whole word.
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1029
(defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ))
1439
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1030
(when (boundp 'char-script-table)       ; Absent in Emacs 22.
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1031
  (mapc (lambda (ch)
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1032
          (aset char-script-table ch 'latin)
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1033
          (modify-syntax-entry ch "w"))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1034
        my-ipa-chars))
1430
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1035
;; Another option is to invent new category:
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1036
;;
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1037
;; (defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ))
1430
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1038
;; (define-category ?p "Phonetic")
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1039
;; (mapc (lambda (ch)
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1040
;;         (cond
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1041
;;          ((eq (aref char-script-table ch) 'phonetic)
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1042
;;           (modify-category-entry ch ?p)
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1043
;;           (modify-category-entry ch ?l nil t))
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1044
;;          ((eq (aref char-script-table ch) 'latin)   ; (aref char-script-table ?ˌ) is 'latin but (char-category-set ?ˌ) is ".j"
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1045
;;           (modify-category-entry ch ?l))))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1046
;;       my-ipa-chars)
1430
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1047
;; (add-to-list 'word-combining-categories '(?p . ?l))
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1048
;; (add-to-list 'word-combining-categories '(?l . ?p))
8380f91bc913 Make possible to move through English word pronunciation with single forward-word.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1429
diff changeset
  1049
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1050
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1051
(message "mouse")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1052
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1053
;; Scroll Bar gets dragged by mouse butn 1
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1054
(global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1055
;; Paste at point NOT at cursor
151
0b6f4adf5096 Minor changes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 150
diff changeset
  1056
(setq mouse-yank-at-point t)
439
a1910375f39e mouse-wheel-mode don't defined for Cygwin console Emacs 23.2.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 438
diff changeset
  1057
(when window-system
1402
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
  1058
  (mouse-wheel-mode 1))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1059
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1060
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1061
(message "key binding, short-keys")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1062
1291
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1063
(defun my--smart-beginning-of-line ()
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1064
  "Move point to `beginning-of-line'. If repeat command it cycle
1157
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1065
position between `back-to-indentation' and `beginning-of-line'."
1158
89f674f09ca3 If the string begins with ^' andshift-select-mode' is non-nil, Emacs first
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1157
diff changeset
  1066
  (interactive "^")
1291
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1067
  (if (and (eq last-command 'my--smart-beginning-of-line)
1157
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1068
           (= (line-beginning-position) (point)))
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1069
      (back-to-indentation)
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1070
    (beginning-of-line)))
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1071
1291
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1072
(defun my--smart-end-of-line ()
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1073
  "Move point to `end-of-line'. If repeat command it cycle
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1074
position between last non-whitespace and `end-of-line'."
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1075
  (interactive "^")
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1076
  (if (and (eq last-command 'my--smart-end-of-line)
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1077
           (= (line-end-position) (point)))
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1078
      (skip-syntax-backward " " (line-beginning-position))
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1079
    (end-of-line)))
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1080
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1081
(global-set-key [home]     'my--smart-beginning-of-line)
9cef82dd4c45 my--smart-end-of-line like my--smart-beginning-of-line.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1290
diff changeset
  1082
(global-set-key [end]      'my--smart-end-of-line)
1157
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1083
(global-set-key [C-home]   'beginning-of-buffer)
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1084
(global-set-key [C-end]    'end-of-buffer)
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1085
(global-set-key [C-delete] 'kill-word)
2036f6052212 my-smart-beginning-of-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1156
diff changeset
  1086
(global-set-key [delete]   'delete-char)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1087
;; (global-set-key [backspace]  'backward-delete-char-untabify) ; not work properly in *info* mode
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1088
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1089
(global-set-key [f2]    'save-buffer)
134
a071b60e4339 Set key binding to rename buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 125
diff changeset
  1090
(global-set-key [S-f6]  'rename-buffer)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1091
(global-set-key [M-f4]  'save-buffers-kill-emacs)
18
91626ebef652 Added hotkey for wrap long line.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 17
diff changeset
  1092
(global-set-key [f6]    'toggle-truncate-lines)
1019
cbc477acb47e Switch to other window by Super-TAB.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1018
diff changeset
  1093
(global-set-key [s-tab] 'other-window)
cbc477acb47e Switch to other window by Super-TAB.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1018
diff changeset
  1094
cbc477acb47e Switch to other window by Super-TAB.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1018
diff changeset
  1095
;; Disable suspend. It is ugly.
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1096
(when window-system
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1097
  (global-set-key (kbd "C-z") nil))
435
a34e8ddc9e12 Disable suspend by C-x C-z. It ugly.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 434
diff changeset
  1098
(global-set-key (kbd "C-x C-z") nil)
81
0ce6eaf6f26c Disable C-z, it ugly.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 80
diff changeset
  1099
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1100
;; (global-set-key [language-change] 'ignore)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1101
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1102
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1103
(message "coding system, charset, locale, lang")
80
bfc8c3d03527 Correct code to remove warning in *Messages* when loading .emacs-my.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
  1104
53
0d8616eedf8b Reformat.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 52
diff changeset
  1105
;; Comment because prefer-coding-system will be ignored.
0d8616eedf8b Reformat.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 52
diff changeset
  1106
;; (setq-default coding-system-for-read  'cp1251-dos)
0d8616eedf8b Reformat.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 52
diff changeset
  1107
;; (setq-default coding-system-for-write 'cp1251-dos)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1108
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1109
;; (setq locale-coding-system  'cp1251-dos)
583
a9e5bfad6dd5 Add note.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 582
diff changeset
  1110
;; (set-language-environment 'UTF-8)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1111
;; (set-terminal-coding-system 'cp1251)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1112
;; (set-keyboard-coding-system 'cp1251)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1113
4
46543c097be0 Transfer changer from .eamcs_unix, add case for w32 or other system.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 3
diff changeset
  1114
(modify-coding-system-alist 'file "\\.el" 'iso-2022-7bit)
192
8b4811c64ec4 Correct copy/paste coding in windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 191
diff changeset
  1115
(cond
106
0591d06cf752 Решил проблему copy/paste в X. Решил проблему поиска в UTF-8 буфере.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 102
diff changeset
  1116
 ((equal window-system 'w32)          ; also (string-equal system-type "windows-nt")
839
27fac2557f13 Don't set 'selection-coding-system' for Windows. This is no longer needed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 835
diff changeset
  1117
  ;; (set-selection-coding-system 'utf-16-le-dos)
1532
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  1118
  ;; (setq-default buffer-file-coding-system 'cp1251)
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  1119
  ;; (setq default-file-name-coding-system 'cp1251)
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  1120
  ;; (setq default-process-coding-system '(cp1251 . cp1251))
1542
29783921b4f7 Use UTF-8 on Windows fpr processes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1541
diff changeset
  1121
  (setq default-process-coding-system '(utf-8-dos . utf-8-unix))
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1122
  )
106
0591d06cf752 Решил проблему copy/paste в X. Решил проблему поиска в UTF-8 буфере.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 102
diff changeset
  1123
 ((equal window-system 'x)
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1124
  (prefer-coding-system 'utf-8-unix)
991
e8c74f4c5d9e Set 'selection-coding-system' to 'nil' to automatically select proper coding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 990
diff changeset
  1125
  (setq selection-coding-system nil)
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1126
  (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1127
  (modify-coding-system-alist 'process ".*" 'utf-8-unix)
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1128
  )
769
5ed69391dc95 Fix coding for Cygwin Emacs when LANG=ru_RU.cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 768
diff changeset
  1129
 ((eq system-type 'cygwin)
1196
fd26eef91bf6 Fix: if: Wrong type argument: stringp, nil.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1195
diff changeset
  1130
  (when (and (getenv "LANG") (string-match "1251\\'" (getenv "LANG")))
1532
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  1131
    ;; (prefer-coding-system 'cp1251-unix)
769
5ed69391dc95 Fix coding for Cygwin Emacs when LANG=ru_RU.cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 768
diff changeset
  1132
    (prefer-coding-system 'utf-8-unix)
1532
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  1133
    ;; (modify-coding-system-alist 'process ".*" 'cp1251-unix)
769
5ed69391dc95 Fix coding for Cygwin Emacs when LANG=ru_RU.cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 768
diff changeset
  1134
    )
5ed69391dc95 Fix coding for Cygwin Emacs when LANG=ru_RU.cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 768
diff changeset
  1135
  )
622
596406094fd1 Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1136
 ((eq system-type 'darwin)
623
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 621 622
diff changeset
  1137
  nil
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 621 622
diff changeset
  1138
  )
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1139
 )
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1140
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1141
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1653
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1142
(message "ibuffer")
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1143
1719
89c448a9fdbd Docs: about buffer-menu vs ibuffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1718
diff changeset
  1144
;; There is `buffer-menu' but `ibuffer' is much better.
1653
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1145
(global-set-key "\C-x\C-b" 'ibuffer)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1146
(global-set-key [s-insert] 'ibuffer)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1147
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1148
(setq ibuffer-expert t)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1149
(setq ibuffer-use-other-window nil)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1150
(setq ibuffer-default-shrink-to-minimum-size nil)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1151
(setq ibuffer-truncate-lines t)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1152
(setq ibuffer-default-sorting-mode 'recency)
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1153
c9e9a3912a95 (setq ibuffer-expert t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1652
diff changeset
  1154
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1155
(message "selecting/switching, creating/killing buffers, open file")
1555
1c42fc68bca9 Add recent files and bookmarks to ‘ivy-switch-buffer’.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1554
diff changeset
  1156
(message "ivy, ido, ffap")
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1157
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1158
;; (add-hook 'find-file-hook #'make-frame-visible)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1159
1200
a8fcda9c0aab Check if ido available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1199
diff changeset
  1160
(require 'ffap)
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  1161
(cl-eval-when (compile) (require 'ido nil t))
1558
a7bb0608855b Avoid warning "assignment to free variable" for /ido-mode during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1557
diff changeset
  1162
1330
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1163
;; Ido makes appropriate binding.
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1164
;(ffap-bindings)
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1165
;; C-u C-x C-f finds the file at point
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1166
;(setq ffap-require-prefix t)
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1167
;; browse urls at point via w3m
c0ac8ff63268 Add examples of ffap settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1329
diff changeset
  1168
;(setq ffap-url-fetcher 'w3m-browse-url)
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1169
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1170
(setq find-file-existing-other-name t)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1171
1555
1c42fc68bca9 Add recent files and bookmarks to ‘ivy-switch-buffer’.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1554
diff changeset
  1172
(setq ivy-use-virtual-buffers t)
1c42fc68bca9 Add recent files and bookmarks to ‘ivy-switch-buffer’.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1554
diff changeset
  1173
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1174
(setq ido-enable-flex-matching t)
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1175
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1176
(setq ido-use-filename-at-point 'guess)
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1177
(setq ido-use-url-at-point t)
1310
ca9bfec974ac Don't jump to unknown directory if file not found in current!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1309
diff changeset
  1178
(setq ido-auto-merge-work-directories-length -1)
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1179
(setq ido-enable-tramp-completion t)
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1180
(setq ido-use-virtual-buffers t)
1218
53eaec665fcf Increase ido limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
  1181
(setq ido-max-prospects 16)
53eaec665fcf Increase ido limits.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1215
diff changeset
  1182
(setq ido-max-work-directory-list 100)
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1183
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1184
(setq ido-create-new-buffer 'always)
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1185
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1186
(setq ido-file-extensions-order '(".java" ".c" ".py" ".xml" ".txt" ".el" ".ini" ".cfg" ".cnf" ".log"))
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1187
1229
52e0f3e3ca85 Use hippie-expand.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1227
diff changeset
  1188
(setq ido-ignore-buffers '("\\` "))
52e0f3e3ca85 Use hippie-expand.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1227
diff changeset
  1189
(setq ido-ignore-extensions nil)        ; From completion-ignored-extensions.
1191
2671cf871a38 ido-case-fold
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
  1190
(setq ido-case-fold t)
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1191
;; ido-ignore-directories
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1192
;; ido-ignore-files
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1193
1201
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1194
(unless
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1195
    (ignore-errors
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1196
      (require 'ido)
1438
57d7478f265d Document ido-everywhere synonym.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1437
diff changeset
  1197
      (ido-mode 1)                      ; (ido-everywhere 'both)
1201
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1198
      (global-set-key [?\s-d] #'ido-dired)
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1199
      (global-set-key [?\s-f] #'ido-find-file)
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1200
      t)
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1201
  (global-set-key [?\s-d] #'dired)
c300c3c9e973 Add key bindings for finding file that work in M-x term.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1200
diff changeset
  1202
  (global-set-key [?\s-f] #'find-file))
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1203
1628
6630261d42cd Fixe: fboundp cannot detect outoloaded functions, replay on package-installed-p instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1627
diff changeset
  1204
(when (package-installed-p 'ivy)
1626
f73d74be1316 Use ivy-switch-buffer if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
  1205
  (global-set-key (kbd "C-x b") #'ivy-switch-buffer))
f73d74be1316 Use ivy-switch-buffer if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1622
diff changeset
  1206
956
661dc3bfc076 Remove key bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 955
diff changeset
  1207
(global-set-key [?\C-x right] 'next-buffer)
661dc3bfc076 Remove key bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 955
diff changeset
  1208
(global-set-key [?\C-x left]  'previous-buffer)
1186
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1209
(global-set-key [s-right] 'next-buffer)
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1210
(global-set-key [s-left]  'previous-buffer)
1187
81ffdea5bfb1 Use Win key to make buffer deleting and switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1186
diff changeset
  1211
(defun my--kill-this-buffer-maybe-switch-to-next ()
1135
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1212
  "Kill current buffer. Switch to next buffer if previous command
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1213
was switching to next buffer or this command itself allowing
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1214
sequential closing of uninteresting buffers."
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1215
  (interactive)
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1216
  (let ( (cmd last-command) )
1182
616154dadd38 Replace kill-this-buffer with core functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1181
diff changeset
  1217
    (kill-buffer (current-buffer))
1135
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1218
    (when (memq cmd (list 'next-buffer this-command))
b6dcbd747884 Kill current buffer. Switch to next buffer if previous command was switching
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1133
diff changeset
  1219
      (next-buffer))))
1187
81ffdea5bfb1 Use Win key to make buffer deleting and switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1186
diff changeset
  1220
(global-set-key [?\C-x deletechar] 'my--kill-this-buffer-maybe-switch-to-next)
81ffdea5bfb1 Use Win key to make buffer deleting and switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1186
diff changeset
  1221
(global-set-key [s-delete] 'my--kill-this-buffer-maybe-switch-to-next)
1186
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1222
(defun my--backward-other-window ()
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1223
  (interactive)
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1224
  (other-window -1))
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1225
(global-set-key [?\C-x up] #'my--backward-other-window)
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1226
(global-set-key [?\C-x down] #'other-window)
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1227
(global-set-key [s-up] #'my--backward-other-window)
ff1145717171 Use Win key to make buffer switching faster and avoid key binding intersection with term-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1184
diff changeset
  1228
(global-set-key [s-down] #'other-window)
1544
2e84ca7e2578 Make function silent if file is modified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1543
diff changeset
  1229
1536
5854fc2dbece Added key binding to erase buffer conveniently.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1534
diff changeset
  1230
(defun my--erase-buffer ()
5854fc2dbece Added key binding to erase buffer conveniently.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1534
diff changeset
  1231
  (interactive)
1544
2e84ca7e2578 Make function silent if file is modified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1543
diff changeset
  1232
  (advice-add #'ask-user-about-supersession-threat :override #'identity)
1536
5854fc2dbece Added key binding to erase buffer conveniently.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1534
diff changeset
  1233
  (erase-buffer)
5854fc2dbece Added key binding to erase buffer conveniently.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1534
diff changeset
  1234
  (when (buffer-file-name)
1544
2e84ca7e2578 Make function silent if file is modified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1543
diff changeset
  1235
    (basic-save-buffer-1)
2e84ca7e2578 Make function silent if file is modified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1543
diff changeset
  1236
    (revert-buffer))
2e84ca7e2578 Make function silent if file is modified.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1543
diff changeset
  1237
  (advice-remove #'ask-user-about-supersession-threat #'identity))
1536
5854fc2dbece Added key binding to erase buffer conveniently.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1534
diff changeset
  1238
(global-set-key [s-backspace] #'my--erase-buffer)
956
661dc3bfc076 Remove key bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 955
diff changeset
  1239
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1240
(require 'uniquify)
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1241
(setq uniquify-buffer-name-style 'post-forward)
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1242
(setq uniquify-separator "|")
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1243
(setq uniquify-after-kill-buffer-p t)
1310
ca9bfec974ac Don't jump to unknown directory if file not found in current!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1309
diff changeset
  1244
(setq uniquify-strip-common-suffix t)
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1245
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1246
(setq read-buffer-completion-ignore-case t)
1127
dec4b1d47f61 Remove useless comment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1126
diff changeset
  1247
(setq read-file-name-completion-ignore-case t)
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1248
1445
b1f7af188fa2 icomplete mostly as powerful as smex. That's why I removed external dependency.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1444
diff changeset
  1249
(unless (featurep 'smex)
1444
d91ea2220a52 Give a try to smex.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1443
diff changeset
  1250
  (require 'icomplete)
d91ea2220a52 Give a try to smex.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1443
diff changeset
  1251
  (icomplete-mode 1))
1025
3d524b2cbbc1 Use icomplete for all completion-tables.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
  1252
(setq icomplete-with-completion-tables t)
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1253
1695
ffde995a5923 Added note about winner-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1694
diff changeset
  1254
;; It remembers stack of windows (not buffers) configurations and allows navigate with C-c LEFT / RIGHT.
ffde995a5923 Added note about winner-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1694
diff changeset
  1255
;; I don't find it useful as I always work only with 1 or 2 windows opened.
ffde995a5923 Added note about winner-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1694
diff changeset
  1256
;; (winner-mode 1)
ffde995a5923 Added note about winner-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1694
diff changeset
  1257
1306
b78bf2c141ab Use consistent style for internal names.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1305
diff changeset
  1258
(defun my--large-file-p ()
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1259
  "If buffer too large and my cause performance issue."
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1260
  (< large-file-warning-threshold (buffer-size)))
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1261
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1262
;; http://git.savannah.nongnu.org/cgit/so-long.git/tree/so-long.el is part of Emacs 27.1
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1263
;; https://emacs.stackexchange.com/questions/598/how-do-i-prevent-extremely-long-lines-making-emacs-slow
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1264
;; (make-variable-buffer-local 'mode-line-format)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1265
;; (setq mode-line-format (delq 'mode-line-position 'mode-line-format))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1266
(define-derived-mode my-large-file-mode fundamental-mode "LargeFile"
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1267
  "Fixes performance issues in Emacs for large files."
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1268
  ;; (setq buffer-read-only t)
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1269
  (setq bidi-display-reordering nil)
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1270
  (setq bidi-paragraph-direction 'left-to-right)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1271
  (font-lock-mode -1)
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1272
  (jit-lock-mode nil)
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1273
  (buffer-disable-undo)
1656
0445e8ee4912 Fixed: show-paren-mode was disabled by large files because is it global mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1655
diff changeset
  1274
  (setq-local show-paren-mode nil)
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1275
  (auto-revert-tail-mode -1)
1373
74a192647349 Fix: Warning: `make-variable-buffer-local' not called at toplevel.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1372
diff changeset
  1276
  (set (make-local-variable 'global-hl-line-mode) nil)
74a192647349 Fix: Warning: `make-variable-buffer-local' not called at toplevel.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1372
diff changeset
  1277
  (set (make-local-variable 'line-number-mode) nil)
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1278
  (set (make-local-variable 'column-number-mode) nil)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  1279
  (size-indication-mode -1))
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1280
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1281
(add-to-list 'magic-mode-alist (cons #'my--large-file-p #'my-large-file-mode))
1207
c658f0d30525 Fixes performance issues in Emacs for large files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1206
diff changeset
  1282
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1283
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1725
ce379e248565 Added binding for project-find-file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1724
diff changeset
  1284
(message "project")
ce379e248565 Added binding for project-find-file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1724
diff changeset
  1285
ce379e248565 Added binding for project-find-file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1724
diff changeset
  1286
(global-set-key (kbd "s-s") #'project-find-file)
1726
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
  1287
(global-set-key (kbd "<f7>") #'project-find-regexp)
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
  1288
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
  1289
(global-set-key (kbd "<f3>") #'fileloop-continue)
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
  1290
(global-set-key (kbd "S-<f3>") #'project-search)
ffd1272d96dc Defined key bindings to some project search/replace functions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1725
diff changeset
  1291
(global-set-key (kbd "C-<f3>") #'project-query-replace-regexp)
1725
ce379e248565 Added binding for project-find-file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1724
diff changeset
  1292
ce379e248565 Added binding for project-find-file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1724
diff changeset
  1293
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1425
f4aad8cbd103 Use shell glob instead regex for helm-locate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1424
diff changeset
  1294
(message "helm")
f4aad8cbd103 Use shell glob instead regex for helm-locate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1424
diff changeset
  1295
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  1296
(cl-eval-when (compile)
1428
75b892343aee Fix: Warning: assignment to free variable `helm-locate-command'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1427
diff changeset
  1297
  (require 'helm-locate nil t))
75b892343aee Fix: Warning: assignment to free variable `helm-locate-command'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1427
diff changeset
  1298
1425
f4aad8cbd103 Use shell glob instead regex for helm-locate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1424
diff changeset
  1299
(setq helm-locate-command "locate %s -e %s")
f4aad8cbd103 Use shell glob instead regex for helm-locate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1424
diff changeset
  1300
f4aad8cbd103 Use shell glob instead regex for helm-locate.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1424
diff changeset
  1301
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1455
d1849bd33ed5 company-dabbrev-downcase.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1454
diff changeset
  1302
(message "company")
d1849bd33ed5 company-dabbrev-downcase.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1454
diff changeset
  1303
1465
9def370d67f4 Align annotations to right.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1464
diff changeset
  1304
(setq company-tooltip-align-annotations t)
9def370d67f4 Align annotations to right.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1464
diff changeset
  1305
1456
d8a8d3b3ac48 company-dabbrev-other-buffers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1455
diff changeset
  1306
(setq company-dabbrev-other-buffers 'all) ; or `t' or `nil'
d8a8d3b3ac48 company-dabbrev-other-buffers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1455
diff changeset
  1307
;; (setq company-dabbrev-time-limit 0.1)
1455
d1849bd33ed5 company-dabbrev-downcase.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1454
diff changeset
  1308
(setq company-dabbrev-downcase nil)
1475
0cadf9373539 Avoid duplication in company prompt because of case.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1474
diff changeset
  1309
(setq company-dabbrev-ignore-case nil)
1455
d1849bd33ed5 company-dabbrev-downcase.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1454
diff changeset
  1310
1456
d8a8d3b3ac48 company-dabbrev-other-buffers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1455
diff changeset
  1311
;; (setq company-backends (delete 'company-dabbrev company-backends))
d8a8d3b3ac48 company-dabbrev-other-buffers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1455
diff changeset
  1312
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1313
(defun my-company-filter-out-numbers (lst)
1457
25fdf2cd36de Filter out completion started with numbers from company-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1456
diff changeset
  1314
  (cl-remove-if (lambda (str) (string-match-p "^[0-9]" str)) lst))
25fdf2cd36de Filter out completion started with numbers from company-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1456
diff changeset
  1315
25fdf2cd36de Filter out completion started with numbers from company-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1456
diff changeset
  1316
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1317
  (add-hook 'company-transformers #'my-company-filter-out-numbers))
1456
d8a8d3b3ac48 company-dabbrev-other-buffers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1455
diff changeset
  1318
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1319
(defun company-executable (command &optional arg &rest ignored)
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1320
  "Company completion for executable in PATH."
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1321
  (interactive (list 'interactive))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1322
  (cl-case command
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1323
    (interactive (company-begin-backend 'company-executable))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1324
    (prefix (thing-at-point 'filename))
1464
bc41ca628f69 Enable company-mode during Emacs startup. Echo full path to executable in echo-area.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1463
diff changeset
  1325
    (candidates (locate-file-completion-table exec-path exec-suffixes (thing-at-point 'filename) 'identity t))
bc41ca628f69 Enable company-mode during Emacs startup. Echo full path to executable in echo-area.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1463
diff changeset
  1326
    ;; (annotation (concat " " (locate-file arg exec-path exec-suffixes)))
bc41ca628f69 Enable company-mode during Emacs startup. Echo full path to executable in echo-area.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1463
diff changeset
  1327
    (meta (concat "Full path: " (locate-file arg exec-path exec-suffixes)))))
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1328
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1329
(defun my-company-text-setup ()
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1330
  (setq-local company-backends '((company-dabbrev company-files)))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1331
  (company-mode 1))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  1332
1455
d1849bd33ed5 company-dabbrev-downcase.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1454
diff changeset
  1333
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1288
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1334
(message "bookmark")
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1335
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1336
;; (require 'autobm)
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1337
(global-set-key (kbd "C-x r m") 'autobm)
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1338
1290
a3ec0437c4f1 set-mark-command-repeat-pop
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1289
diff changeset
  1339
(setq set-mark-command-repeat-pop 't)
a3ec0437c4f1 set-mark-command-repeat-pop
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1289
diff changeset
  1340
1288
6333a733046f Use new autobm mode!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1282
diff changeset
  1341
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1342
(message "completion")
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1343
1409
d9d85b71260c suggest-key-bindings
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1407
diff changeset
  1344
(setq suggest-key-bindings t)
d9d85b71260c suggest-key-bindings
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1407
diff changeset
  1345
953
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1346
;; I remove partial-completion-mode because it depricated in Emacs 24.0.
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1347
;; Completion controled by 'completion-styles' variable.
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1348
3ad3abeec5f9 Move related code to common place.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
  1349
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1142
7906db469af0 Switch to ido from iswitchb. Use ido key binding instead of ffap-bindings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1141
diff changeset
  1350
(message "dired")
598
9399292dae57 Enable 'ffap' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 597
diff changeset
  1351
9399292dae57 Enable 'ffap' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 597
diff changeset
  1352
(require 'dired)
241
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1353
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1354
(setq dired-dwim-target t)
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1355
;; dangerous
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1356
;; (setq
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1357
;;  dired-recursive-copies 'top
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1358
;;  dired-recursive-deletes 'top)
78cbd4c692ee Added dired settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 240
diff changeset
  1359
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1360
(defun my-dired-up-dir ()
463
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1361
  "'Reuse' buffer if enter to dir or open new buffer if enter to file."
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1362
  (interactive)
471
1d59b8a9d8a0 Fix bug: under Linux you can not go upper for '/dir' like dir (that lie
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 470
diff changeset
  1363
  ;; (dired-current-directory) always end with trailing '/' char.
1d59b8a9d8a0 Fix bug: under Linux you can not go upper for '/dir' like dir (that lie
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 470
diff changeset
  1364
  (let* ( (dir (dired-current-directory)) (i (- (length dir) 2)) upperdir )
463
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1365
    (while (and
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1366
            (>= i 0)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1367
            (not (equal (aref dir i) ?/)) )
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1368
      (setq i (- i 1))
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1369
      )
471
1d59b8a9d8a0 Fix bug: under Linux you can not go upper for '/dir' like dir (that lie
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 470
diff changeset
  1370
    (setq upperdir (substring dir 0 (+ i 1)))
1d59b8a9d8a0 Fix bug: under Linux you can not go upper for '/dir' like dir (that lie
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 470
diff changeset
  1371
    (when (file-directory-p upperdir)
1d59b8a9d8a0 Fix bug: under Linux you can not go upper for '/dir' like dir (that lie
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 470
diff changeset
  1372
      (find-alternate-file upperdir)
463
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1373
      (dired-goto-file dir)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1374
      )
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1375
    ))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1376
(define-key dired-mode-map (kbd "<backspace>") 'my-dired-up-dir)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1377
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1378
(defun my-dired-enter-to-dir ()
463
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1379
  "'Reuse' buffer if enter to dir or open new buffer if enter to file."
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1380
  (interactive)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1381
  (let ( (file (dired-get-file-for-visit)) )
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1382
    (if (file-directory-p file)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1383
        (find-alternate-file file)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1384
      (find-file file)
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1385
      )))
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1386
(define-key dired-mode-map (kbd "<return>")
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1387
  'my-dired-enter-to-dir)
463
adc3abb3c1fc Make Total Commmander like key binding for Enter and Backspace.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 462
diff changeset
  1388
697
d19881accc91 Make behaviour same as in GUI for dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 695
diff changeset
  1389
;; Make behaviour same as in GUI.
d19881accc91 Make behaviour same as in GUI for dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 695
diff changeset
  1390
(unless window-system
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1391
  (define-key dired-mode-map (kbd "DEL") 'my-dired-up-dir)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1392
  (define-key dired-mode-map (kbd "RET") 'my-dired-enter-to-dir))
697
d19881accc91 Make behaviour same as in GUI for dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 695
diff changeset
  1393
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1394
;; Enable 'a' command.
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  1395
(put 'dired-find-alternate-file 'disabled nil)
326
ded53e19d23a Enable 'a' command in dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 303
diff changeset
  1396
1308
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1397
(defvar my--file-name-tmp-refex
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1398
  (concat
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1399
   "\\(?:^#.*#"
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1400
   "\\|~"
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1401
   "\\|\\." (regexp-opt '("base" "local" "orig" "other" "rej" "diff" "log" "stackdump" "pyc" "pyo"))
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1402
   "\\|\\.log\\.[0-9]+"
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1403
   "\\)\\'")
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1404
  "Rule to detect temp/backup files.")
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1405
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1406
(defun my--file-name-tmp-p (file)
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1407
  (string-match my--file-name-tmp-refex
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1408
                (or (and (file-directory-p file) "") (file-name-nondirectory file))))
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1409
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1410
(defun my--dired-flag-tmp-files ()
469
a9adec4fbcbf Mark temporary files in dired by '`'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 468
diff changeset
  1411
  "Flag all temporary files for deletion."
a9adec4fbcbf Mark temporary files in dired by '`'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 468
diff changeset
  1412
  (interactive)
a9adec4fbcbf Mark temporary files in dired by '`'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 468
diff changeset
  1413
  (dired-mark-if
a9adec4fbcbf Mark temporary files in dired by '`'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 468
diff changeset
  1414
   (let ( (fn (dired-get-filename 'verbatim t)) )
1308
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1415
     (and fn (my--file-name-tmp-p fn)) )
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1416
   "backup file"))
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1417
9076a617eaae Mark .log.[0-9]+ files also as temporary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1307
diff changeset
  1418
(define-key dired-mode-map (kbd "`") 'my--dired-flag-tmp-files)
469
a9adec4fbcbf Mark temporary files in dired by '`'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 468
diff changeset
  1419
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1420
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1421
(message "ls-lisp, dired ls")
464
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1422
1651
5924c33ab4ad Just require ls-lisp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1650
diff changeset
  1423
(require 'ls-lisp)
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  1424
1652
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1425
;; If non-nil - use 'insert-directory-program', means directory sorting and
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1426
;; other options for `ls-lisp' do not have effect.
464
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1427
(setq ls-lisp-use-insert-directory-program nil)
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1428
(setq ls-lisp-ignore-case t)
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1429
(setq ls-lisp-dirs-first t)
519
bdc19bd3820f Ignore owners and groups under Cygwin (mostly because
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 517
diff changeset
  1430
(if (memq system-type '(windows-nt cygwin))
464
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1431
    (setq ls-lisp-verbosity nil)
1652
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1432
  (setq ls-lisp-verbosity '(links uid gid)))
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1433
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1434
;; On Cygwin use actual "ls" executable. List implementation fails with:
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1435
;;   ls-lisp-insert-directory: Getting attributes: Input/output error, lock
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1436
;; for some files, making it impossible to see directory contend in Dired even
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1437
;; if only some files are problmatic (accessing special files from WSL P9 file system).
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1438
(when (eq system-type 'cygwin)
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1439
  (setq my-ls-dir-switches '("-a" "-g" "--no-group" "--dired" "--group-directories-first"))
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1440
  (setq ls-lisp-use-insert-directory-program t)
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1441
  (setq list-directory-verbose-switches my-ls-dir-switches)
e72b61b36451 Turned off ls-list for Cygwin to make Dired work for dirs with special files from WSL P9 FS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1651
diff changeset
  1442
  (setq dired-listing-switches (mapconcat #'identity my-ls-dir-switches " ")))
464
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1443
;; Force use 'ls-lisp-format-time-list'.
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1444
(setq ls-lisp-use-localized-time-format t)
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1445
(setq ls-lisp-format-time-list
474
d1a3f9322927 Show seconds for file modification time in dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 473
diff changeset
  1446
      '("%Y-%m-%d %H:%M:%S"
d1a3f9322927 Show seconds for file modification time in dired.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 473
diff changeset
  1447
        "%Y-%m-%d %H:%M   "))
464
ae073d35f674 Always use 'ls-lisp' to emulate 'ls'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  1448
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1449
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1450
(message "compression, archive")
240
77b01720a256 Enable image if supported.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 239
diff changeset
  1451
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1452
(require 'jka-compr) ; Automatic decompression, hooks for tar-mode.
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1453
(when (fboundp 'auto-compression-mode)
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  1454
  (auto-compression-mode 1))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1455
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1456
(modify-coding-system-alist 'file "\\.\\(war\\|ear\\|sar\\|egg\\)\\'" 'no-conversion)
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1457
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1458
(add-to-list 'auto-mode-alist '("\\.\\(war\\|ear\\|sar\\|egg\\)\\'" . archive-mode))
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1459
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1460
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
619
d5b22e5edae1 Exclude .svg image from supported image list, as Emacs doesn't come with SVG
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 618
diff changeset
  1461
(message "image, png, svg")
240
77b01720a256 Enable image if supported.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 239
diff changeset
  1462
77b01720a256 Enable image if supported.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 239
diff changeset
  1463
(when (fboundp 'auto-image-file-mode)
77b01720a256 Enable image if supported.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 239
diff changeset
  1464
  (auto-image-file-mode 1))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  1465
(my--eval-after-load image-file
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1466
  ;; Exclude .svg image from supported image list, as Emacs doesn't come
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1467
  ;; with SVG shared library.
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1468
  (setq image-file-name-extensions (remove "svg" image-file-name-extensions))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1469
  ;; Re-initialize the image-file handler.
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1470
  (auto-image-file-mode t) )
240
77b01720a256 Enable image if supported.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 239
diff changeset
  1471
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1472
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
716
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1473
(message "url")
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1474
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1475
;; http://tools.ietf.org/html/rfc3986
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1476
;; http://en.wikipedia.org/wiki/Percent-encoding
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1477
(defun my-percent-decode (str)
716
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1478
  (decode-coding-string
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1479
   (let* ( (s (split-string str "%")) )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1480
     (my-fold
716
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1481
      'concat
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1482
      (car s)
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1483
      (mapcar
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1484
       (lambda (x)
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1485
         (concat (unibyte-string (string-to-number (substring x 0 2) 16)) (substring x 2)))
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1486
       (cdr s))
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1487
      )) 'utf-8))
a3f42d9dd281 my-percent-decode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 715
diff changeset
  1488
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1489
(defun my-percent-decode-region (beg end &optional arg)
717
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1490
  "Convert percent encoded string to native."
1014
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1491
  (interactive "r\nP")
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1492
  (let ( (result (my-percent-decode (buffer-substring-no-properties beg end))) )
717
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1493
    (if (not arg)
1014
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1494
        result
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1495
      (delete-region beg end)
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1496
      (insert result))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1497
    ) )
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1498
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1499
(defun my-percent-encode (str)
1014
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1500
  (apply 'concat
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1501
         (mapcar
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1502
          (lambda (ch) (if (or (and (<= ?a ch) (>= ?z ch))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1503
                          (and (<= ?A ch) (>= ?Z ch))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1504
                          (memq ch '(?- ?_ ?. ?~)))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1505
                      (char-to-string ch)
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1506
                    (format "%%%02X" ch)))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1507
          (encode-coding-string str 'utf-8) )))
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1508
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1509
(defun my-percent-encode-region (beg end &optional arg)
1014
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1510
  "Encode string to percent encoding."
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1511
  (interactive "r\nP")
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1512
  (let ( (result (my-percent-encode (buffer-substring-no-properties beg end))) )
1014
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1513
    (if (not arg)
82ae06b5d7c4 Add function: "Encode string to percent encoding."
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
  1514
        result
717
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1515
      (delete-region beg end)
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1516
      (insert result))
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1517
    ) )
b958f182d0d4 Convert percent encoded string to native.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 716
diff changeset
  1518
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1519
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1520
(message "browser")
98
5223817dad90 Use mozilla browser. Not tested for Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 97
diff changeset
  1521
1647
e3ecb49df5d4 Prefer to open URLs in Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1646
diff changeset
  1522
(defun my--browse-url-cygwin-firefox (url &optional _new-window)
e3ecb49df5d4 Prefer to open URLs in Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1646
diff changeset
  1523
  (call-process "cygstart" nil nil nil "firefox" url))
e3ecb49df5d4 Prefer to open URLs in Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1646
diff changeset
  1524
138
90fda97adcb1 Setup browse-url func for linux and windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
  1525
(cond
1647
e3ecb49df5d4 Prefer to open URLs in Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1646
diff changeset
  1526
 ((eq system-type 'cygwin)
e3ecb49df5d4 Prefer to open URLs in Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1646
diff changeset
  1527
  (setq browse-url-browser-function 'my--browse-url-cygwin-firefox))
138
90fda97adcb1 Setup browse-url func for linux and windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
  1528
 ((equal window-system 'w32)
90fda97adcb1 Setup browse-url func for linux and windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
  1529
  (setq browse-url-browser-function 'browse-url-default-windows-browser))
476
4d3b20be2562 Use Firefox to open URLs under Debian Linux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 475
diff changeset
  1530
 ((boundp 'debian-emacs-flavor)
4d3b20be2562 Use Firefox to open URLs under Debian Linux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 475
diff changeset
  1531
  (setq browse-url-browser-function 'browse-url-firefox))
138
90fda97adcb1 Setup browse-url func for linux and windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
  1532
 (t
90fda97adcb1 Setup browse-url func for linux and windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 120
diff changeset
  1533
  (setq browse-url-browser-function 'browse-url-mozilla)))
98
5223817dad90 Use mozilla browser. Not tested for Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 97
diff changeset
  1534
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1535
(defun my-cygwin-search (str)
677
154f402aa2dc my-cygwin-search
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 676
diff changeset
  1536
  "Search for Cygwin package on-line."
1366
f9989b9060aa Fix: Warning: `read-input' is an obsolete function (as of 22.1); use `read-string' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1365
diff changeset
  1537
  (interactive (list (read-string "Search for Cygwin package on-line: ")))
677
154f402aa2dc my-cygwin-search
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 676
diff changeset
  1538
  (browse-url (format "http://cygwin.com/cgi-bin2/package-grep.cgi?grep=%s" str))
154f402aa2dc my-cygwin-search
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 676
diff changeset
  1539
  )
154f402aa2dc my-cygwin-search
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 676
diff changeset
  1540
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1541
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1542
(message "ide, netbeans, idea")
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1543
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1544
(defun ide-netbeans-find-command ()
962
5d94d3736bbe Search for NetBeans executable in PATH, later in '/opt/netbeans*/bin/'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 961
diff changeset
  1545
  "Search for NetBeans executable in PATH, later in '/opt/netbeans*/bin/'."
961
d8f1ed2f2f9c Fix typo: command name. Add error checking code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 960
diff changeset
  1546
  (or
d8f1ed2f2f9c Fix typo: command name. Add error checking code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 960
diff changeset
  1547
   (executable-find "netbeans")
963
102845496d41 Fix: balance parents. Fix typo in func name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
  1548
   (car (last (sort (file-expand-wildcards "/opt/[Nn]etbeans*/bin/netbeans" t) 'equal))) ))
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1549
(defvar ide-netbeans-program (ide-netbeans-find-command)
960
272a40dfdbcd Add integration with NetBeans (netbeans-open-this-buffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
  1550
  "Command to run NetBeans.")
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1551
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1552
(defconst ide-netbeans-process-bufname "*ide-netbeans*"
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1553
  "Name used in `start-process'")
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1554
(defun ide-netbeans-open-file (file &optional line)
960
272a40dfdbcd Add integration with NetBeans (netbeans-open-this-buffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
  1555
  "Open FILE on LINE in NetBeans."
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1556
  (unless ide-netbeans-program
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1557
    (error "'ide-netbeans-program' is not set"))
1504
57c5763e0628 Add documentation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1503
diff changeset
  1558
  ;; https://www.jetbrains.com/help/idea/2016.3/opening-files-from-command-line.html
1505
4f43f768473f Use trick with changing working directory to avoid Cygwin path issues.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1504
diff changeset
  1559
  (let ( (default-directory (file-name-directory file)) (fname (file-name-nondirectory file)) )
4f43f768473f Use trick with changing working directory to avoid Cygwin path issues.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1504
diff changeset
  1560
    (if (integerp line)
4f43f768473f Use trick with changing working directory to avoid Cygwin path issues.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1504
diff changeset
  1561
        (start-process ide-netbeans-process-bufname nil ide-netbeans-program "--open" (format "%s:%d" fname line))
4f43f768473f Use trick with changing working directory to avoid Cygwin path issues.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1504
diff changeset
  1562
      (start-process ide-netbeans-process-bufname nil ide-netbeans-program "--open" fname))))
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1563
(defun ide-netbeans-open-this-buffer ()
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1564
  "Open current buffer in NetBeans."
960
272a40dfdbcd Add integration with NetBeans (netbeans-open-this-buffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
  1565
  (interactive)
1528
81091a6d400a Added key bindings to open file in external IDE. Unified code for error
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1527
diff changeset
  1566
  (unless (and (stringp (buffer-file-name)) (file-regular-p (buffer-file-name)))
986
6e74bf91f1df Add checks for: Buffer have no association with a file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 985
diff changeset
  1567
    (error "Buffer have no association with a file"))
1528
81091a6d400a Added key bindings to open file in external IDE. Unified code for error
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1527
diff changeset
  1568
  (ide-netbeans-open-file (buffer-file-name) (line-number-at-pos)))
960
272a40dfdbcd Add integration with NetBeans (netbeans-open-this-buffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
  1569
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1570
(defvar ide-idea-program nil
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1571
  "Idea executable or full path, like 'idea64.exe'")
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1572
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1573
(defconst ide-idea-process-bufname "*ide-idea*"
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1574
  "Name used in `start-process'")
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1575
(defun ide-idea-open-file (file &optional line)
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1576
  "Open FILE on LINE in Intellij Idea."
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1577
  (unless ide-idea-program
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1578
    (error "'ide-idea-program' is not set"))
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1579
  (let ( (default-directory (file-name-directory file)) (fname (file-name-nondirectory file)) )
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1580
    (if (integerp line)
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1581
        (start-process ide-idea-process-bufname nil ide-idea-program "--line" (int-to-string line) fname)
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1582
      (start-process ide-idea-process-bufname nil ide-idea-program fname))))
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1583
(defun ide-idea-open-this-buffer ()
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1584
  "Open current buffer in Intellij Idea."
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1585
  (interactive)
1529
37b616faabb8 Fixed parents and key binding syntax for ide-*.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1528
diff changeset
  1586
  (unless (and (stringp (buffer-file-name)) (file-regular-p (buffer-file-name)))
1503
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1587
    (error "Buffer have no association with a file"))
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1588
  (ide-idea-open-file (buffer-file-name) (line-number-at-pos)))
24fcc4c42be4 Open file in Intellij Idea. Common interface for IDE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1502
diff changeset
  1589
1529
37b616faabb8 Fixed parents and key binding syntax for ide-*.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1528
diff changeset
  1590
(define-key global-map [?\s-n] 'ide-netbeans-open-this-buffer)
37b616faabb8 Fixed parents and key binding syntax for ide-*.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1528
diff changeset
  1591
(define-key global-map [?\s-i] 'ide-idea-open-this-buffer)
1528
81091a6d400a Added key bindings to open file in external IDE. Unified code for error
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1527
diff changeset
  1592
960
272a40dfdbcd Add integration with NetBeans (netbeans-open-this-buffer).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
  1593
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1594
(message "calendar")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1595
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  1596
(cl-eval-when (compile) (require 'calendar))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  1597
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1598
;; (setq mark-holidays-in-calendar t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1599
;; (setq all-christian-calendar-holidays t)
1587
8770e2984f58 Fix: string-to-int was removed in v26.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1586
diff changeset
  1600
;; (setq calendar-date-display-form (quote ((format "%04s-%02d-%02d" year (string-to-number month) (string-to-number day)))))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1601
;; (setq calendar-time-display-form (quote (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))))
49
71cec5d9c60f Set week start with Monday.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 48
diff changeset
  1602
(setq calendar-week-start-day 1)
1386
e9b455ea0327 Fix: Warning: `european-calendar-style' is an obsolete variable (as of 23.1); use `calendar-date-style' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
  1603
(setq calendar-date-style 'iso)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1604
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1605
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1606
(message "standard hooks")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1607
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1608
(add-hook 'write-file-hooks 'time-stamp)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1609
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1610
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
735
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1611
(message "logging, logs")
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1612
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1613
(defun my-auto-revert-tail-mode-hook ()
1533
bf21c20118b4 .log.N files also should be treated as log files. Disable NRoff mode for such files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1532
diff changeset
  1614
  (when (string-match "/logs?/\\|\\.\\(?:log\\|out\\|log\\.[0-9]\\)\\'\\|/.xsession-errors\\'"
735
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1615
                      (buffer-file-name (current-buffer)))
1533
bf21c20118b4 .log.N files also should be treated as log files. Disable NRoff mode for such files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1532
diff changeset
  1616
    (fundamental-mode)
735
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1617
    (auto-revert-tail-mode 1)
1076
eed45b8a9e3a Highlight standard elements in log4* like log-files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1074
diff changeset
  1618
    (log4-hi-mode 1)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1619
    (setq scroll-margin my-scroll-margin)
735
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1620
    ))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1621
(add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook)
735
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1622
337d64d4f27b Enable auto-revert-tail-mode for log files from /var/log.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 734
diff changeset
  1623
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1624
(message "auto-fill")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1625
102
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  1626
(setq-default fill-column 78)
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  1627
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1628
(defvar my-fill-column 100
335
748c6e05fe87 Use common value for fill-column.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 334
diff changeset
  1629
  "I use greater value then 78 for comment in prog source.")
748c6e05fe87 Use common value for fill-column.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 334
diff changeset
  1630
148
7df64d2c9f3d Remove unused key binding. Added more docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 147
diff changeset
  1631
;; By default used American convention - sentence and with two spaces. Change
7df64d2c9f3d Remove unused key binding. Added more docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 147
diff changeset
  1632
;; it to one space. Has affect on filling and M-a, M-e commands.
102
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  1633
(setq sentence-end-double-space nil)
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  1634
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1635
;; Turn on auto-fill mode
1579
92b878231632 Do to turn on auto-fill mode. It is hard to disable it in derived modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1578
diff changeset
  1636
;; (add-hook 'html-mode-hook 'turn-on-auto-fill)
92b878231632 Do to turn on auto-fill mode. It is hard to disable it in derived modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1578
diff changeset
  1637
;; (add-hook 'text-mode-hook 'turn-on-auto-fill)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1638
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1639
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1640
(message "cacl, calculator")
367
58e70956523a Set cacl digit grouping.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 366
diff changeset
  1641
58e70956523a Set cacl digit grouping.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 366
diff changeset
  1642
(setq-default calc-group-digits t)
58e70956523a Set cacl digit grouping.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 366
diff changeset
  1643
(setq-default calc-group-char "'")
58e70956523a Set cacl digit grouping.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 366
diff changeset
  1644
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1645
(defun my-calc-region (arg beg end)
517
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1646
  "Calculate the region and display the result in the echo area.
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1647
With prefix ARG non-nil, insert the result at the end of region."
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1648
  (interactive "P\nr")
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1649
  (require 'calc)
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1650
  (let* ((expr (buffer-substring-no-properties beg end))
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1651
         (result (calc-eval expr)))
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1652
    (if (null arg)
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1653
        (message "%s = %s" expr result)
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1654
      (goto-char end)
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1655
      (save-excursion
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1656
        (insert result)))))
6889ad2dbd35 Add 'my-calc-eval-region' func.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 516
diff changeset
  1657
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1658
(defun my-calc-line (arg)
1730
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
  1659
  "Evaluate calc expression in the current line and display the
1729
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1660
result in the echo area by skipping everything after the final
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1661
'=' sign.
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1662
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1663
With prefix ARG non-nil or repeating command interactively,
1730
795b3f2ecfbb Separated Cygwin & ansi colors settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1729
diff changeset
  1664
insert the result at the end of line & add a space if necessary
1729
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1665
for delimiting clearing everything after '=' sign if it is here."
1289
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1666
  (interactive "P")
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1667
  (require 'calc)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1668
  (save-excursion
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1669
    (let (beg end expr result)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1670
      (beginning-of-line)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1671
      (setq beg (point))
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1672
      (end-of-line)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1673
      (search-backward "=" beg t)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1674
      (setq end (point))
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1675
      (setq expr (buffer-substring-no-properties beg end))
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1676
      (setq result (calc-eval expr))
1729
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1677
      (if (and (null arg) (not (eq 'my-calc-line last-command)))
1289
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1678
          (message "%s = %s" expr result)
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1679
        (end-of-line)
1729
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1680
        (setq end (point))
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1681
        (when (search-backward "=" beg t)
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1682
          (forward-char 1)
237c8f98ac43 Repeating my-calc-line interactive place result after "=" sign clearing any old text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1728
diff changeset
  1683
          (delete-region (point) end))
1289
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1684
        (unless (eq (char-before) ?\ )
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1685
          (insert ?\ ))
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1686
        (insert result)))))
85654fc21cf5 my-calc-line
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1288
diff changeset
  1687
1724
35c96420cf54 Reserved s-= for my-calc-line (to avoid excessive typing of M-x my-calc-line). er/expand-region is now s-w to be near C-w/M-w.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1723
diff changeset
  1688
(global-set-key (kbd "s-=") #'my-calc-line)
35c96420cf54 Reserved s-= for my-calc-line (to avoid excessive typing of M-x my-calc-line). er/expand-region is now s-w to be near C-w/M-w.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1723
diff changeset
  1689
1303
60e6b8174aee Fix sectioning comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1300
diff changeset
  1690
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
666
994de1974616 fix misspelling
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 665
diff changeset
  1691
(message "rst, reStructuredText")
665
9761254a1260 Maintaining the table of contents up-to-date.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 664
diff changeset
  1692
9761254a1260 Maintaining the table of contents up-to-date.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 664
diff changeset
  1693
;; Maintaining the table of contents up-to-date.
9761254a1260 Maintaining the table of contents up-to-date.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 664
diff changeset
  1694
(add-hook 'rst-adjust-hook 'rst-toc-update)
9761254a1260 Maintaining the table of contents up-to-date.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 664
diff changeset
  1695
1439
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1696
(if (coding-system-p 'prefer-utf-8-unix)
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1697
    (modify-coding-system-alist 'file "\\.rst\\'" 'prefer-utf-8-unix)
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  1698
  (modify-coding-system-alist 'file "\\.rst\\'" 'utf-8-unix))
1437
22f5b3cdf40f My .rst files in UTF-8.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1436
diff changeset
  1699
689
1b632e2151cc Fix rst-level-*-face for terminal.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 688
diff changeset
  1700
(unless window-system
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  1701
  (my--eval-after-load rst
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1702
    (custom-set-faces
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1703
     '(rst-level-1-face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1704
     '(rst-level-2-face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1705
     '(rst-level-3-face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1706
     '(rst-level-4-face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1707
     '(rst-level-5-face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1708
     '(rst-level-6face ((t (:background "yellow"))) t)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1709
     ) ) )
689
1b632e2151cc Fix rst-level-*-face for terminal.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 688
diff changeset
  1710
1472
c8da9757d036 Enable flyspell for rst-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1471
diff changeset
  1711
(when (featurep 'flyspell)
c8da9757d036 Enable flyspell for rst-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1471
diff changeset
  1712
  (add-hook 'rst-mode-hook #'flyspell-mode))
c8da9757d036 Enable flyspell for rst-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1471
diff changeset
  1713
1466
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  1714
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1715
  (add-hook 'rst-mode-hook #'my-company-text-setup))
1466
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  1716
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1717
;; (add-hook 'rst-mode-hook #'abbrev-mode)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1718
;; (remove-hook 'rst-mode-hook #'abbrev-mode)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  1719
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1720
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1570
30e7cac3143c Enable adoc-mode for .adoc files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
  1721
(message "adoc, asciidoc")
30e7cac3143c Enable adoc-mode for .adoc files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
  1722
1580
dfdbb8f1922c Enable adoc-mode by function presents, feature is not available from autoload file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1579
diff changeset
  1723
(when (fboundp 'adoc-mode)
1570
30e7cac3143c Enable adoc-mode for .adoc files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
  1724
  (add-to-list 'auto-mode-alist '("\\.adoc$" . adoc-mode)))
30e7cac3143c Enable adoc-mode for .adoc files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
  1725
30e7cac3143c Enable adoc-mode for .adoc files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1569
diff changeset
  1726
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1582
f7dd0f7cb900 Enable whitespace-mode for markdown-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
  1727
(message "md, markdown")
f7dd0f7cb900 Enable whitespace-mode for markdown-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
  1728
1705
3ed88879232f Activate outline-minor-mode for markdown-mode. And avoid whitespace-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
  1729
(my--eval-after-load markdown-mode
3ed88879232f Activate outline-minor-mode for markdown-mode. And avoid whitespace-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
  1730
  ;; (add-hook 'markdown-mode-hook #'whitespace-mode)
3ed88879232f Activate outline-minor-mode for markdown-mode. And avoid whitespace-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1704
diff changeset
  1731
  (add-hook 'markdown-mode-hook #'outline-minor-mode))
1582
f7dd0f7cb900 Enable whitespace-mode for markdown-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
  1732
f7dd0f7cb900 Enable whitespace-mode for markdown-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1581
diff changeset
  1733
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1734
(message "TeX, LaTeX")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1735
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1736
(setq tex-run-command "initex")
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1737
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1738
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1739
(message "AUC TeX")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1740
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1741
;(add-hook 'LaTeX-mode-hook 'LaTeX-install-toolbar)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1742
;; (setq TeX-parse-self t)             ; Enable parse on load.
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1743
;; (setq TeX-auto-save t)              ; Enable parse on save.
347
ae8ed6d33e90 Dont prompt for master file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 346
diff changeset
  1744
;; Query for master file. If you often use \include or \input, you should make AUCTEX aware of the
ae8ed6d33e90 Dont prompt for master file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 346
diff changeset
  1745
;; multi-file document structure.
ae8ed6d33e90 Dont prompt for master file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 346
diff changeset
  1746
(setq-default TeX-master nil)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1747
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1748
;(setq TeX-PDF-mode t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1749
;(setq TeX-interactive-mode t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1750
;(setq TeX-source-specials-mode 1)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1751
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1752
;;; some more menu entries in the command list:
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1753
;;; see tex-mik.el from package auctex: %v is defined in tex-mik.el
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1754
;;; other variables are defined in tex.el from auctex
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1755
;;; the meaning of some auctex-varibles:
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1756
        ;symbols defined in tex.el and tex-mik.el:
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1757
        ;%b name slave tex-file  %t name master tex-file
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1758
        ;%d dvi-file  %f ps-file
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1759
        ;%l "latex --src-specials"
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1760
        ;%n line number  %p printcommand  %q "lpq"
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1761
        ;%r (TeX-style-check TeX-print-style)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1762
        ;%s master-file-name without extention
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1763
        ;%v yap command view line
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1764
;; (my--eval-after-load tex
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1765
;;   (add-to-list 'TeX-command-list
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1766
;;                (list "->PS landscape for pdf"
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1767
;;                      "dvips %d -N0 -Ppdf -G0 -T 297mm,210mm -o %f "
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1768
;;                      'TeX-run-command nil t))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1769
;;   (add-to-list 'TeX-command-list
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1770
;;                (list "All Texify run-viewer"
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1771
;;                      "texify --tex-opt=--src --run-viewer --clean %s.tex"
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1772
;;                      'TeX-run-command nil t)))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1773
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1774
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1775
(message "reftex")
461
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  1776
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  1777
;; Reftex is included with Emacs 21.1.
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1778
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1779
;; (autoload 'reftex-mode     "reftex" "RefTeX Minor Mode" t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1780
;; (autoload 'turn-on-reftex  "reftex" "RefTeX Minor Mode" nil)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1781
;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1782
;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1783
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1784
;; (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1785
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1786
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1787
(message "PreviewLatex")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1788
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1789
;(load "preview-latex.el" nil t t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1790
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1791
;(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1792
;(autoload 'LaTeX-preview-setup "preview")
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1793
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1794
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1397
d4182b28cdc1 Including ~/usr/share/info in INFOPATH. Tweak for INFOPATH and cygwin-mount.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1396
diff changeset
  1795
(message "info")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1796
323
7a7dc2befa99 Because of Debian policy documentation covered by FDL license with invariant sections not allowed in packet
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 322
diff changeset
  1797
(unless (getenv "INFOPATH")
1402
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
  1798
  (if (eq system-type 'windows-nt)
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
  1799
      (setenv "INFOPATH" (concat (expand-file-name "~/usr/share/info") ":/usr/share/info:"))
b1a1c92a7f55 (eq window-system 'w32) ==> (eq system-type 'windows-nt) to correctly handle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1397
diff changeset
  1800
    (setenv "INFOPATH" (expand-file-name "~/usr/share/info:"))))
323
7a7dc2befa99 Because of Debian policy documentation covered by FDL license with invariant sections not allowed in packet
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 322
diff changeset
  1801
799
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1802
;; Assume that cygwin-mount already activated.
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1803
(when (featurep 'cygwin-mount)
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1804
  (setenv "INFOPATH" "/usr/share/info/:~/usr/share/info/:")
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1805
  ;; Redefine path-separator to UNIX to update Info-directory-list.
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1806
  (let ( (path-separator ":") )
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1807
    (require 'info)
1441
580e8a297afd Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1440
diff changeset
  1808
    (info-initialize) ))
799
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1809
972
eb7992880db9 Disable yas. Add info-lookup fix for automake manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 970
diff changeset
  1810
;; Info index nodes for automake under Debian.
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1811
(defvar my-fix-for-automake-info-lookup
1387
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1812
  '(("(automake-1.11)Macro Index" nil
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1813
     "^`" "['(]")
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1814
    ("(automake-1.11)Variable Index" nil
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1815
     "^`" "['(]")
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1816
    ("(automake-1.11)General Index" nil
3dec99863e5d Set valued via defvar instead of setq to avoid Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
  1817
     "^`" "['(]")))
972
eb7992880db9 Disable yas. Add info-lookup fix for automake manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 970
diff changeset
  1818
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1819
;; Add `my-fix-for-automake-info-lookup' entries to the end of doc-spec for
972
eb7992880db9 Disable yas. Add info-lookup fix for automake manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 970
diff changeset
  1820
;; some modes.
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  1821
(my--eval-after-load info-look
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1822
  (mapc
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1823
   (lambda (mode)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1824
     (let ( (doc-spec (info-lookup->doc-spec 'symbol mode)) )
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1825
       (mapc
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1826
        (lambda (doc-spec-item)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1827
          (setcdr (last doc-spec) (list doc-spec-item)))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1828
        my-fix-for-automake-info-lookup)))
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1829
   '(makefile-mode autoconf-mode))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1830
  (info-lookup-maybe-add-help
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1831
   :mode 'makefile-gmake-mode
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  1832
   :other-modes '(makefile-mode)))
972
eb7992880db9 Disable yas. Add info-lookup fix for automake manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 970
diff changeset
  1833
eb7992880db9 Disable yas. Add info-lookup fix for automake manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 970
diff changeset
  1834
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1835
(message "man, woman")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  1836
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  1837
(cl-eval-when (compile) (require 'woman))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  1838
799
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1839
(when (featurep 'cygwin-mount)
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1840
  (let ( (path (expand-file-name "~")) )
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1841
    (when (string-match "\\([c-z]\\):/" path)
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1842
      (setenv "MANPATH" (concat "/cygdrive/" (substring path 0 1) "/" (substring path 3) "/usr/share/man/:"))
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1843
      ) ))
c39f6e6fd191 Enable man and info page from Cygwin and from '~/usr/share'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 798
diff changeset
  1844
156
55aed5f25591 Added customisation for woman.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 143
diff changeset
  1845
(setq woman-use-own-frame nil)
55aed5f25591 Added customisation for woman.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 143
diff changeset
  1846
(setq woman-fill-frame t)
1534
a20f8f4abec7 Default sed filter failed with syntax error in native Emacs and Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1533
diff changeset
  1847
1632
9189d278b075 Replaced eval-after-load => with-eval-after-load for its easier syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1631
diff changeset
  1848
(with-eval-after-load 'man
1534
a20f8f4abec7 Default sed filter failed with syntax error in native Emacs and Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1533
diff changeset
  1849
  ;; Default sed filter failed with syntax error in native Emacs and Cygwin.
a20f8f4abec7 Default sed filter failed with syntax error in native Emacs and Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1533
diff changeset
  1850
  (when (eq system-type 'windows-nt)
a20f8f4abec7 Default sed filter failed with syntax error in native Emacs and Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1533
diff changeset
  1851
    (setq Man-filter-list nil)))
156
55aed5f25591 Added customisation for woman.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 143
diff changeset
  1852
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1853
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  1854
(message "comint")
434
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1855
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1856
;; If non-nil, add a `/' to completed directories, ` ' to file names.
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1857
(setq comint-completion-addsuffix t)
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1858
;; Non-nil means go to the end of the line before sending input.
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1859
(setq comint-eol-on-send t)
12acc6727bd9 Set comint-eol-on-send.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 433
diff changeset
  1860
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1861
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
775
a7253eb62dee Enable flyspell for Log-Edit buffer to decrease spell errors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 774
diff changeset
  1862
(message "spell, ispell, aspell, flyspell")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1863
387
7340a863ae23 Fix spelling settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 385
diff changeset
  1864
;; Settings for spelling done in '.emacs-autogen'.
775
a7253eb62dee Enable flyspell for Log-Edit buffer to decrease spell errors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 774
diff changeset
  1865
a7253eb62dee Enable flyspell for Log-Edit buffer to decrease spell errors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 774
diff changeset
  1866
(add-hook 'log-edit-mode-hook 'flyspell-mode)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1867
740
5dd70683a699 ispell-extra-args
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 739
diff changeset
  1868
;; (setq-default ispell-extra-args  '("--sug-mode=ultra"))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  1869
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1870
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1606
044155fc3ef9 Enabled new gadialog mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1605
diff changeset
  1871
(message "dict, dictd, dictionary, gadict, gaphrase, gadialog")
1361
f7fcbc47f739 Load gadict mode if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
  1872
1642
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1873
(defun my-gedict-enable-whitespace ()
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1874
  (setq show-trailing-whitespace nil)
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1875
  (setq-local whitespace-style '(face trailing))
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1876
  (whitespace-mode 1))
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1877
1361
f7fcbc47f739 Load gadict mode if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
  1878
(when (fboundp 'gadict-mode)
f7fcbc47f739 Load gadict mode if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1360
diff changeset
  1879
  (add-to-list 'auto-mode-alist '("\\.gadict$" . gadict-mode)) )
1642
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1880
(add-hook 'gadict-mode-hook 'my-gedict-enable-whitespace)
1404
a93ed2339d77 Enable whitespace-mode for gadict-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1403
diff changeset
  1881
1581
ad08a623a8c4 Activate gaphrase mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
  1882
(when (fboundp 'gaphrase-mode)
ad08a623a8c4 Activate gaphrase mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
  1883
  (add-to-list 'auto-mode-alist '("\\.gaphrase$" . gaphrase-mode)) )
1642
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1884
(add-hook 'gaphrase-mode-hook 'my-gedict-enable-whitespace)
1581
ad08a623a8c4 Activate gaphrase mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1580
diff changeset
  1885
1606
044155fc3ef9 Enabled new gadialog mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1605
diff changeset
  1886
(when (fboundp 'gadialog-mode)
044155fc3ef9 Enabled new gadialog mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1605
diff changeset
  1887
  (add-to-list 'auto-mode-alist '("\\.gadialog$" . gadialog-mode)) )
1642
4b2fba646dfd Enable whitespace-mode in gadict-mode with appropriate customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1640
diff changeset
  1888
(add-hook 'gadialog-mode-hook 'my-gedict-enable-whitespace)
1606
044155fc3ef9 Enabled new gadialog mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1605
diff changeset
  1889
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  1890
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
826
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1891
(message "figlet")
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1892
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1893
(defun my-figlet-region (&optional b e)
826
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1894
  (interactive "r")
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1895
  (shell-command-on-region b e "figlet" (current-buffer) t)
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1896
  (comment-region (mark) (point)))
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1897
869bc1369aca Add basic figlet function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 825
diff changeset
  1898
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
588
aa917b11ffef Initialize remember mode before org-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 587
diff changeset
  1899
(message "org-mode, GTD, PIM, organize, todo")
79
f80cd58e09cb Use buildin and installed version of org-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 78
diff changeset
  1900
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1901
(require 'org)
1697
1319d897155e Enabled org-tempo for shortcut to insert template #+BEGIN_SRC quickly.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1696
diff changeset
  1902
;; For "<s TAB". See `org-structure-template-alist'.
1319d897155e Enabled org-tempo for shortcut to insert template #+BEGIN_SRC quickly.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1696
diff changeset
  1903
(require 'org-tempo)
1698
9d07c2f3a944 Added example how to activate babel executors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1697
diff changeset
  1904
;; (require 'ob-shell)
9d07c2f3a944 Added example how to activate babel executors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1697
diff changeset
  1905
;; (require 'ob-python)
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1906
(require 'org-capture nil t)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1907
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  1908
(cl-eval-when (compile)
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1909
  (require 'org-agenda)
1376
52d43b70cc7c Exclusively use "org-capture". Although it is not available on Emacs 23 but I
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1375
diff changeset
  1910
  (require 'org-archive))
108
1559bb79bdd1 Enable org mode for >= emacs22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 107
diff changeset
  1911
295
5be44cff4683 Use utf-8 encoding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 289
diff changeset
  1912
;; XXX org-todo-keywords '((sequence "TODO" "START" "|" "DONE")) for org-version 4.67c
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1913
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
1717
3c60aeba5004 Moved definition of root for Org mode files to defs file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1711
diff changeset
  1914
(setq org-directory my-org-dir)
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1915
(setq
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1916
 org-agenda-ndays 31
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1917
 org-deadline-warning-days 7
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1918
 org-agenda-show-all-dates t
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1919
 org-agenda-format-date "%Y-%m-%d, %A %e %B"
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1920
 org-agenda-skip-deadline-if-done t
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1921
 org-agenda-skip-scheduled-if-done t
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1922
 org-agenda-start-on-weekday nil
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1923
 org-reverse-note-order t
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1924
 org-hide-leading-stars t
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1925
 org-tags-column 64
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1926
 org-archive-save-context-info '(time file olpath todo itags)
1564
c4ec990891d8 For convenience TAB always hide/show current leaf.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1560
diff changeset
  1927
 org-cycle-emulate-tab nil
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1928
 )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1929
(defvar my-org-agenda-todo-file (concat org-directory "/TODO.org"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1930
(defvar my-org-agenda-note-file (concat org-directory "/NOTE.org"))
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1931
(setq org-agenda-file-regexp "\\`[^.#].*[^_]\\.org\\'"
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1932
      org-agenda-files (list org-directory))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1933
;; (setq my-org-agenda-learning-file (concat org-directory "/LEARNING.org"))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1934
;; (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file ,my-org-agenda-learning-file))
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1935
(define-key global-map "\C-va" 'org-agenda)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1936
(define-key global-map "\C-ve" (lambda nil (interactive) (find-file my-org-agenda-note-file)))
1375
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1937
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1938
(setq org-todo-keywords '("|" "DONE"))
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1939
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1940
;; My tags for remember buffer.
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1941
(setq org-tag-alist
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1942
      '(
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1943
        ("ADMIN" . ?a)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1944
        ("BLOG" . ?b)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1945
        ("DEVEL" . ?d)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1946
        ("HOME" . ?h)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1947
        ("GET" . ?g)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1948
        ("LIFE" . ?l)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1949
        ("MAIL" . ?m)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1950
        ("JOB" . ?j)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1951
        ("QUESTION" . ?q)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1952
        ("PROJECT" . ?p)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1953
        ("READ" . ?r)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1954
        ("SEE" . ?s)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1955
        ))
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1956
;; With this variable tags duplicated in *Org Tags* menu. I use
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1957
;; `org-tag-alist' instead until bug fixed.
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1958
(setq org-tag-persistent-alist nil)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1959
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1960
(setq org-support-shift-select t)
5959fa99a6f7 Unconditionally enable Org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1374
diff changeset
  1961
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1962
(setq org-default-notes-file my-org-agenda-todo-file)
1376
52d43b70cc7c Exclusively use "org-capture". Although it is not available on Emacs 23 but I
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1375
diff changeset
  1963
(setq org-capture-templates
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1964
      '(("t" "Todo" entry (file my-org-agenda-todo-file) "* %?\n  SCHEDULED: %T")))
1376
52d43b70cc7c Exclusively use "org-capture". Although it is not available on Emacs 23 but I
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1375
diff changeset
  1965
(define-key global-map "\C-vr"
52d43b70cc7c Exclusively use "org-capture". Although it is not available on Emacs 23 but I
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1375
diff changeset
  1966
  (lambda () (interactive) (org-capture nil "t")))
48
5aa6729514f6 Add customize for org mode. Place todo higlight вместе с org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 47
diff changeset
  1967
1471
431c5408394c Enable company-mode for org-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1470
diff changeset
  1968
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1969
  (add-hook 'org-mode-hook #'my-company-text-setup))
1640
cbcc2ac8f3e3 Implemented mypasshide-mode for hiding passwords from my .org files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1639
diff changeset
  1970
(add-hook 'org-mode-hook #'mypasshide-mode)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1971
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1972
(defun my-org-archive-location (path)
1718
9d72f4424570 Removed mentioning of author and copyright from all files' headers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1717
diff changeset
  1973
  "For given PATH makes path for archive. Currently adds
9d72f4424570 Removed mentioning of author and copyright from all files' headers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1717
diff changeset
  1974
undescore before file extention. If file name doesn't match
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1975
`org-agenda-file-regexp' or have no extention return `nil'."
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1976
  (if (and (file-name-extension path)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1977
           (string-match org-agenda-file-regexp (file-name-nondirectory path)))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1978
      (concat (file-name-sans-extension path) "_." (file-name-extension path))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1979
    nil))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1980
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1981
(defun my-org-archive-file (path)
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1982
  "Move marked by `org-done-keywords' entries to archive file.
1635
d231b87af643 Grouped related code so paragraph selected text can be evaluated by eval-reegion!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1634
diff changeset
  1983
.
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1984
Archive file name constructed by `my-org-archive-location'."
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  1985
  (let ( (archive (my-org-archive-location path))
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1986
         entry-re entry-done-re
1112
1fc59cf19c28 Move marked by `org-done-keywords' entries to archive file defined by `my-org-archive-location'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
  1987
         entry-beg entry-end )
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1988
    (unless archive
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1989
      (error "'%s' looks like a non-org file..." path))
1112
1fc59cf19c28 Move marked by `org-done-keywords' entries to archive file defined by `my-org-archive-location'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
  1990
    (save-excursion
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1991
      (with-current-buffer (find-file-noselect path)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1992
        (org-set-regexps-and-options)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1993
        (setq entry-re "^\\* "
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1994
              entry-done-re (concat "^\\* *" (mapconcat 'regexp-quote org-done-keywords "\\|") " "))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1995
        (kill-new "")
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1996
        (goto-char (point-min))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1997
        (while (re-search-forward entry-done-re nil t)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1998
          (setq entry-beg (line-beginning-position))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  1999
          (if (re-search-forward entry-re nil t)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2000
              (beginning-of-line)
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2001
            (goto-char (point-max)))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2002
          (setq entry-end (point))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2003
          (let ( (last-command 'kill-region) )
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2004
            (kill-region entry-beg entry-end))
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2005
          )
1336
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2006
        (when (> (length (car kill-ring)) 0)
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2007
          (with-current-buffer (find-file-noselect archive)
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2008
            (goto-char (point-max))
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2009
            (insert ?\n)
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2010
            (yank)
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2011
            (save-buffer))
7c93663d44f3 Modify archive file only if archive entries found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1335
diff changeset
  2012
          (save-buffer) )))))
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2013
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2014
(defun my-org-archive (&optional prefix)
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2015
  "Move all entries marked by `org-done-keywords' to archive
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2016
files with name mangled by `my-org-archive-location'.
1635
d231b87af643 Grouped related code so paragraph selected text can be evaluated by eval-reegion!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1634
diff changeset
  2017
.
1433
a062de941d68 Fix docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1432
diff changeset
  2018
Without prefix work on current file. With prefix work on
a062de941d68 Fix docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1432
diff changeset
  2019
`org-agenda-files'."
1335
c8606339804e Use entire directory for org-mode file list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
  2020
  (interactive "P")
1686
bedbd1cd366d Fixed byte compilation warning: assignment to free variable "for".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1685
diff changeset
  2021
  (cl-loop for file in (if prefix (org-agenda-files) (list (buffer-file-name))) do
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2022
        (my-org-archive-file file)))
1112
1fc59cf19c28 Move marked by `org-done-keywords' entries to archive file defined by `my-org-archive-location'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1111
diff changeset
  2023
1351
52f76a250c23 Disable diary integration into org mode because I don't use diary and
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1350
diff changeset
  2024
(setq org-agenda-include-diary nil)
834
07219d4d737e (setq org-agenda-include-diary t)
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 830
diff changeset
  2025
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2026
(defun my-org-kill-by-tag (tag)
1032
2177746c28a0 Implement 'my-org-kill-by-tag'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
  2027
  "Put all entries that matches TAG from current org-file to `kill-ring'."
2177746c28a0 Implement 'my-org-kill-by-tag'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
  2028
  (interactive (list (completing-read "Enter tag: " (org-get-buffer-tags))))
1188
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2029
  (let ( rs (last-command 'kill-region) )
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2030
    (setq rs (org-scan-tags
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2031
              (lambda ()
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2032
                (org-mark-subtree)
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2033
                (list (point) (mark)))
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2034
              '(member tag tags-list) nil))
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2035
    (kill-new "")
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2036
    (dolist (r (reverse rs))            ; Kill from the end so upcoming regions still valid.
bdb5c65b3213 Fix: my-org-kill-by-tag miss some subtree as org-scan-tags assume that buffer unchanged during processing.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1187
diff changeset
  2037
      (apply #'kill-region r))))
1032
2177746c28a0 Implement 'my-org-kill-by-tag'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
  2038
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2039
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2040
(message "TODO, XXX, FIXME highlight")
48
5aa6729514f6 Add customize for org mode. Place todo higlight вместе с org mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 47
diff changeset
  2041
1637
9dc8c7db5541 Update codetags list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1636
diff changeset
  2042
(defvar my-todo-words '("TODO" "FIXME" "XXX" "HACK" "TBD" "BUG" "DELME" "EDITED"))
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2043
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2044
(defun my-todo (&optional mode)
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2045
  (interactive)
465
0a9cbfab10f4 Moved highlight pattern from hook to mode highlighting list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  2046
  (font-lock-add-keywords
0a9cbfab10f4 Moved highlight pattern from hook to mode highlighting list.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 463
diff changeset
  2047
   mode
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2048
   (list (list (concat "\\<" (regexp-opt my-todo-words) "\\>") 0 'font-lock-warning-face t))))
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2049
1643
ce2756ae43b2 Enabled highlighting of TODO keywords by text-mode-hook.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1642
diff changeset
  2050
(add-hook 'text-mode-hook 'my-todo)
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2051
(add-hook 'prog-mode-hook 'my-todo)
1636
fbef0a487803 Enable TODO highlighting in config-like modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1635
diff changeset
  2052
(add-hook 'conf-mode-hook 'my-todo)
fbef0a487803 Enable TODO highlighting in config-like modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1635
diff changeset
  2053
(add-hook 'yaml-mode-hook 'my-todo)
fbef0a487803 Enable TODO highlighting in config-like modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1635
diff changeset
  2054
(with-eval-after-load 'generic-x
fbef0a487803 Enable TODO highlighting in config-like modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1635
diff changeset
  2055
  (mapc (lambda (mode) (add-hook (intern (concat mode "-hook")) 'my-todo)) generic-mode-list))
284
bf5829d9bbf7 Another way to register TODO highlighting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 280
diff changeset
  2056
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2057
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2058
(message "mail, message")
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2059
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2060
(cl-eval-when (compile) (require 'message))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2061
780
afc4ee8b5dea Use message-user-agent as mail-user-agent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 779
diff changeset
  2062
(setq mail-user-agent 'message-user-agent)
afc4ee8b5dea Use message-user-agent as mail-user-agent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 779
diff changeset
  2063
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2064
(defun my-compose-mail ()
938
d063544b9199 Add Organization header for 'C-x m'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 937
diff changeset
  2065
  (interactive)
d063544b9199 Add Organization header for 'C-x m'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 937
diff changeset
  2066
  (compose-mail nil nil `(("Organization" . ,(getenv "ORGANIZATION")))))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2067
(global-set-key (kbd "C-x m") #'my-compose-mail)
938
d063544b9199 Add Organization header for 'C-x m'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 937
diff changeset
  2068
781
c0b65744479e Define own citation format. Also this fix of inclusion mail address of cited
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 780
diff changeset
  2069
(setq message-citation-line-format "On %Y-%m-%d, %N wrote:
c0b65744479e Define own citation format. Also this fix of inclusion mail address of cited
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 780
diff changeset
  2070
")
c0b65744479e Define own citation format. Also this fix of inclusion mail address of cited
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 780
diff changeset
  2071
(setq message-citation-line-function 'message-insert-formatted-citation-line)
660
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2072
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2073
(setq mail-signature t)
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2074
(setq mail-signature-file "~/.signature")
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2075
;; (add-hook 'mail-setup-hook 'fortune-to-signature)
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2076
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2077
;; (setq mail-from-style 'angles)
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2078
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2079
(setq mail-personal-alias-file "~/.mailrc")
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2080
;; Initialize from your mail aliases file...
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2081
(setq mail-aliases t)
1439
6fc6ce787711 Port to Emacs 22.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1438
diff changeset
  2082
(require 'ecomplete nil t)              ; Absent in Emacs 22.
783
f2d86933e2b5 Enable ecomplete in addition to abbrev for mail completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 782
diff changeset
  2083
(setq message-mail-alias-type '(abbrev ecomplete))
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2084
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2085
(my--eval-after-load message
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2086
  (require 'mailabbrev)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2087
  (define-key message-mode-map "\e\t" 'mail-abbrev-complete-alias))
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2088
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2089
(defun my-message-mode-hook ()
937
8f8987262795 Move code to proper place. Merge duplicate code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 936
diff changeset
  2090
  (setq fill-column 78)
8f8987262795 Move code to proper place. Merge duplicate code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 936
diff changeset
  2091
  (turn-on-auto-fill)
8f8987262795 Move code to proper place. Merge duplicate code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 936
diff changeset
  2092
  (flyspell-mode 1))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2093
(add-hook 'message-mode-hook 'my-message-mode-hook)
937
8f8987262795 Move code to proper place. Merge duplicate code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 936
diff changeset
  2094
1044
84d453ec622e Fix docs. Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1043
diff changeset
  2095
;; Mark all my messages by "common" string in "Message-Id" field to simplify
84d453ec622e Fix docs. Simplify code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1043
diff changeset
  2096
;; lookup for followups to me.
937
8f8987262795 Move code to proper place. Merge duplicate code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 936
diff changeset
  2097
(setq message-user-fqdn "gavenkoa.example.com")
784
982eee9d0366 Enable flyspell for message composing buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 783
diff changeset
  2098
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2099
;; Kill message buffer after mail send. You always can use C-c C-s to preserve it.
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2100
(setq message-kill-buffer-on-exit t)
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2101
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2102
(defconst my--message-safe-filename-regex "[[:alnum:]-_!.@]"
893
0e1febcbddb6 Escape file name with safe chars.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 892
diff changeset
  2103
  "Safe file names.")
0e1febcbddb6 Escape file name with safe chars.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 892
diff changeset
  2104
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2105
(defun my--message-refine-filename (filename)
893
0e1febcbddb6 Escape file name with safe chars.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 892
diff changeset
  2106
  (mapconcat
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2107
   (lambda (ch) (or (when (string-match my--message-safe-filename-regex (char-to-string ch)) (char-to-string ch)) "-"))
893
0e1febcbddb6 Escape file name with safe chars.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 892
diff changeset
  2108
   filename "") )
0e1febcbddb6 Escape file name with safe chars.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 892
diff changeset
  2109
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2110
(cl-eval-when (compile) (require 'gnus))
1420
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2111
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2112
(defun my--message-save ()
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2113
  "Store message in `gnus-article-save-directory' after
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2114
successful sending. It is possible that mail rejected and I lost
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2115
it completely, this func save it for me."
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2116
  (unless (eq major-mode 'message-mode)
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2117
    (error "Attempt to call my--message-save in non message-mode buffer"))
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2118
  (make-directory gnus-article-save-directory t)
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2119
  (let ( (buf (current-buffer))
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2120
         (field-to (my--message-refine-filename (or (message-fetch-field "Newsgroups") (message-fetch-field "To"))))
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2121
         (field-subject (my--message-refine-filename (message-fetch-field "Subject")))
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2122
         file )
1107
cc1303629cde Fix: save-current-buffer: Opening output file: file name too long.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1106
diff changeset
  2123
    (when (> (length field-to) 32)
cc1303629cde Fix: save-current-buffer: Opening output file: file name too long.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1106
diff changeset
  2124
      (setq field-to (substring field-to 0 32)))
cc1303629cde Fix: save-current-buffer: Opening output file: file name too long.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1106
diff changeset
  2125
    (when (> (length field-subject) 64)
cc1303629cde Fix: save-current-buffer: Opening output file: file name too long.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1106
diff changeset
  2126
      (setq field-subject (substring field-subject 0 64)))
1309
00f80b2988a2 Use "-" as hour/minute/second separator instead of ":" to avoid
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1308
diff changeset
  2127
    (setq file (concat gnus-article-save-directory "/" (format-time-string "%F_%H-%M-%S") "_" field-to "_" field-subject))
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2128
    (with-temp-file file
1388
444f477bf77f Fix: Warning: `... is for interactive use only; use `...' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1387
diff changeset
  2129
      (insert-buffer-substring buf)
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2130
      )) )
1415
26553c2093b1 Rename my public names to use "my/" prefix and my private function to use "my--" prefix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1414
diff changeset
  2131
(add-hook 'message-sent-hook 'my--message-save)
890
7558a3f8a3d9 Store message in `gnus-article-save-directory' after successful sending. It is
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 889
diff changeset
  2132
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2133
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
747
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2134
(message "smtp, smtpmail")
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2135
843
2adc2d3542a4 Use 'sendmail-send-it' for 'send-mail-function' under Debian as
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 842
diff changeset
  2136
(when (and (not (eq system-type 'gnu/linux)) (boundp 'smtpmail-smtp-server))
773
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2137
  (require 'smtpmail)
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2138
  (setq
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2139
   ;; If you use the default mail user agent.
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2140
   send-mail-function 'smtpmail-send-it
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2141
   ;; If you use Message or Gnus.
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2142
   message-send-mail-function 'smtpmail-send-it
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2143
   )
9308a0c91624 Load auth info if possible. Load smtpmail if user provide server to use.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 772
diff changeset
  2144
  )
747
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2145
;; (setq smtpmail-debug-verb t)
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2146
;; (setq smtpmail-debug-info t)
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2147
dd1d88804512 Use smtpmail mode for sending mail.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 746
diff changeset
  2148
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
779
df488c333452 Move message-mode settings to own section.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 778
diff changeset
  2149
(message "gnus, mh-e")
772
f0a62f45a356 Kill message buffer after mail send. You always can use C-c C-s to preserve it.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 771
diff changeset
  2150
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2151
(cl-eval-when (compile)
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2152
  (require 'gnus)
1420
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2153
  (require 'gnus-agent)
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2154
  (require 'gnus-start)
1420
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2155
  (require 'gnus-score)
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2156
  (require 'gnus-topic)
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2157
  (require 'gnus-spec)
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  2158
  (require 'spam))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2159
1327
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2160
;; (setq gnus-verbose 10)
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2161
757
789d7ac3d34f gnus-site-init-file
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 756
diff changeset
  2162
(setq gnus-site-init-file "~/.gnus.el")
789d7ac3d34f gnus-site-init-file
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 756
diff changeset
  2163
1054
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2164
(setq
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2165
 gnus-read-newsrc-file nil
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2166
 gnus-save-newsrc-file nil
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2167
 gnus-backup-startup-file t
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2168
 gnus-use-dribble-file t
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2169
 gnus-save-killed-list t
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2170
 )
144dcc473957 Set GNUS file reading settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  2171
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2172
(defun my-kill-gnus ()
841
68e40729a4f4 Kill Gnus when exiting Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
  2173
  "Kill Gnus when exiting Emacs."
68e40729a4f4 Kill Gnus when exiting Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
  2174
  (let ( (gnus-interactive-exit nil) )
68e40729a4f4 Kill Gnus when exiting Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
  2175
    (gnus-group-exit)
68e40729a4f4 Kill Gnus when exiting Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
  2176
    ))
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2177
(my--eval-after-load gnus
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2178
  (add-hook 'kill-emacs-hook 'my-kill-gnus))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2179
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2180
(my--eval-after-load gnus-art
1426
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2181
  (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:\\|^List-URL:\\|^Message-Id:")))
841
68e40729a4f4 Kill Gnus when exiting Emacs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 840
diff changeset
  2182
794
7f81d5acc2bc Store gnus specific files to '~/.gnus'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 793
diff changeset
  2183
;; Store gnus specific files to '~/.gnus'.
804
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2184
(setq
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2185
 gnus-directory "~/.gnus"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2186
 gnus-agent-directory "~/.gnus/agent/"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2187
 gnus-article-save-directory "~/.gnus/saved"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2188
 gnus-kill-files-directory "~/.gnus/scores"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2189
 gnus-cache-directory "~/.gnus/cache"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2190
 mail-source-directory "~/.gnus/mail"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2191
 message-directory "~/.gnus/mail"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2192
 message-auto-save-directory "~/.gnus/autosave"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2193
 ;; message-signature-directory
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2194
 mailcap-download-directory  "~/.gnus/mailcap"
1421
becf4559afc2 gnus-treat-date-user-defined no longer exist. Also it is unclear how
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1420
diff changeset
  2195
 ;; nnml-directory "~/.gnus/nnml-mail"
804
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2196
 spam-directory "~/.gnus/spam/"
c347ec94c201 Set "~/.gnus" prefix to all mail directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 803
diff changeset
  2197
 smime-certificate-directory "~/.gnus/certs/"
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  2198
 ;; nnfolder-directory "~/.gnus/archive"
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  2199
 ;; nnfolder-active-file "~/.gnus/archive/active"
975
75ac0063fd22 Fix indenting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 974
diff changeset
  2200
 )
798
c1f795e32b09 Spam settings (commented).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 797
diff changeset
  2201
806
eaabe3db15a5 Remove gnus-ignored-newsgroups to show all GMail folders.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 805
diff changeset
  2202
;; Remove gnus-ignored-newsgroups to show all GMail folders.
862
6b956999856b Fix "isearch-no-upper-case-p: Wrong type argument: stringp, nil" from gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 861
diff changeset
  2203
(setq gnus-ignored-newsgroups "some-non-existing")
798
c1f795e32b09 Spam settings (commented).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 797
diff changeset
  2204
1327
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2205
(my--eval-after-load gnus
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2206
  (require 'spam)
1331
69f9d5bdbddd Initialise stam module after loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1330
diff changeset
  2207
  (spam-initialize)
1327
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2208
  (setq gnus-spam-process-newsgroups
dd9d74485fb6 Show List-URL: mail header. Enable spam reporting for Gnus.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1326
diff changeset
  2209
        '(("^gmane\\." ((spam spam-use-gmane))))))
794
7f81d5acc2bc Store gnus specific files to '~/.gnus'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 793
diff changeset
  2210
739
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2211
(setq
819
38b7c81853e8 Mark that I am not 'gnus-novice-user' to avoid conformation when delete mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 818
diff changeset
  2212
 gnus-novice-user nil
739
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2213
 gnus-expert-user nil
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2214
 gnus-interactive-catchup t
1573
808d904b7de2 Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1572
diff changeset
  2215
 gnus-interactive-exit t)
739
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2216
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2217
(setq
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2218
 gnus-read-active-file nil
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2219
 gnus-check-new-newsgroups nil
1573
808d904b7de2 Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1572
diff changeset
  2220
 gnus-check-bogus-newsgroups nil)
739
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2221
1058
fac5c0d3af6a Check for timeout in gnus article fetching.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1055
diff changeset
  2222
(setq nntp-connection-timeout 10)
fac5c0d3af6a Check for timeout in gnus article fetching.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1055
diff changeset
  2223
902
09f76020fc46 Increase gnus-large-newsgroup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 901
diff changeset
  2224
(setq gnus-large-newsgroup 800)
941
ea395da0c817 Increase gnus-large-ephemeral-newsgroup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 940
diff changeset
  2225
(setq gnus-large-ephemeral-newsgroup 600)
ea395da0c817 Increase gnus-large-ephemeral-newsgroup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 940
diff changeset
  2226
(setq gnus-group-listing-limit 1000)
902
09f76020fc46 Increase gnus-large-newsgroup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 901
diff changeset
  2227
912
a3b18cbc7293 Set gnus-summary-next-group-on-exit to nil as I like stay an group from which
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 911
diff changeset
  2228
(setq
a3b18cbc7293 Set gnus-summary-next-group-on-exit to nil as I like stay an group from which
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 911
diff changeset
  2229
 gnus-group-goto-unread t
1573
808d904b7de2 Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1572
diff changeset
  2230
 gnus-summary-next-group-on-exit nil)
912
a3b18cbc7293 Set gnus-summary-next-group-on-exit to nil as I like stay an group from which
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 911
diff changeset
  2231
922
b0636498a974 Shown read groups anyway.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 921
diff changeset
  2232
(setq
b0636498a974 Shown read groups anyway.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 921
diff changeset
  2233
 gnus-permanently-visible-groups ".*"
b0636498a974 Shown read groups anyway.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 921
diff changeset
  2234
 gnus-topic-display-empty-topics t)
913
cb42c2651d3f Add command to show all subscribed groups (ever read).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 912
diff changeset
  2235
829
093b6699e903 Some settings for Gnus caching (same as default values).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 826
diff changeset
  2236
;; (setq 'gnus-use-cache t)
093b6699e903 Some settings for Gnus caching (same as default values).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 826
diff changeset
  2237
(setq gnus-use-long-file-name t)
093b6699e903 Some settings for Gnus caching (same as default values).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 826
diff changeset
  2238
(setq gnus-cache-remove-articles '(read))
093b6699e903 Some settings for Gnus caching (same as default values).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 826
diff changeset
  2239
786
496791c4fe36 If you're spooling in overlapping mbox folders, you probably want
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 785
diff changeset
  2240
;; If you're spooling in overlapping mbox folders, you probably want to delete
496791c4fe36 If you're spooling in overlapping mbox folders, you probably want
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 785
diff changeset
  2241
;; all messages with duplicate message IDs.
496791c4fe36 If you're spooling in overlapping mbox folders, you probably want
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 785
diff changeset
  2242
(setq nnmail-treat-duplicates 'delete)
496791c4fe36 If you're spooling in overlapping mbox folders, you probably want
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 785
diff changeset
  2243
1316
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2244
;; To disable html part of a message:
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2245
;; (setq mm-discouraged-alternatives '("text/html" "text/richtext"))
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2246
;; I manage to open link in external browser and fix navigation command so pretty ok with HTML parts.
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2247
(setq mm-discouraged-alternatives '("text/richtext"))
1574
52e28dfd9aff gnus-buttonized-mime-types
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1573
diff changeset
  2248
(setq gnus-buttonized-mime-types '("text/html"))
52e28dfd9aff gnus-buttonized-mime-types
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1573
diff changeset
  2249
1645
25cc74027466 Switched to build-in GNUS HTML renderer as Emacs cannot find w3m in Cygwin even if the package is installed.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1643
diff changeset
  2250
(setq mm-text-html-renderer 'shr)
787
fc00f202c3e3 Do not use the html part of a message, use the text part if possible!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 786
diff changeset
  2251
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2252
(cl-eval-when (compile)
1316
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2253
  (ignore-errors
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2254
    ;; w3m-anchor is macros in newer Emacs, need definition during byte-compilation.
da311a1522a0 Disable Warning: FAIL: (file-error "Cannot open load file" "w3m-util")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1315
diff changeset
  2255
    (require 'w3m-util)))
1294
03ff957a2614 Fix: my-w3m-view-url: Invalid function: w3m-anchor
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1292
diff changeset
  2256
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2257
(defun my-w3m-view-url ()
1071
60f93286b9a1 Browse URLs in external browser in w3m.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1068
diff changeset
  2258
  (interactive)
60f93286b9a1 Browse URLs in external browser in w3m.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1068
diff changeset
  2259
  (browse-url (w3m-anchor)))
60f93286b9a1 Browse URLs in external browser in w3m.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1068
diff changeset
  2260
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2261
(my--eval-after-load w3m
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2262
  (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url)
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2263
  (define-key w3m-minor-mode-map (kbd "S-RET") #'w3m-safe-view-this-url)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2264
  (define-key w3m-minor-mode-map (kbd "<left>") #'backward-char)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2265
  (define-key w3m-minor-mode-map (kbd "<right>") #'forward-char)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2266
  (define-key w3m-minor-mode-map (kbd "<up>") #'previous-line)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2267
  (define-key w3m-minor-mode-map (kbd "<down>") #'next-line))
940
90485e256108 Add key bindings for natural movement by arrow keys and opening url in
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 939
diff changeset
  2268
797
886b872e46cc gnus-topic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 796
diff changeset
  2269
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
886b872e46cc gnus-topic-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 796
diff changeset
  2270
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2271
(my--eval-after-load gnus
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2272
  (gnus-demon-add-handler 'gnus-demon-scan-news 10 t))
898
5cf5a1df2fb8 Scan for news.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 897
diff changeset
  2273
929
dc590d8c6f7b Show prefix and 'To' field instead 'From' for my mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
  2274
;; Show prefix and 'To' field instead 'From' for my mails.
1328
a2ce26837465 Mark my article more visually.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1327
diff changeset
  2275
(setq gnus-summary-to-prefix (if window-system "▒ " "==> "))
a2ce26837465 Mark my article more visually.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1327
diff changeset
  2276
(setq gnus-summary-newsgroup-prefix (if window-system "▒ " "==> "))
929
dc590d8c6f7b Show prefix and 'To' field instead 'From' for my mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
  2277
(setq gnus-ignored-from-addresses (list (regexp-quote user-mail-address) (regexp-quote user-full-name)))
dc590d8c6f7b Show prefix and 'To' field instead 'From' for my mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
  2278
936
c5f9c7bc1661 Use ORGANIZATION env var in gnus-posting-styles.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 935
diff changeset
  2279
(setq gnus-posting-styles
c5f9c7bc1661 Use ORGANIZATION env var in gnus-posting-styles.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 935
diff changeset
  2280
      '((".*"
c5f9c7bc1661 Use ORGANIZATION env var in gnus-posting-styles.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 935
diff changeset
  2281
         (organization (getenv "ORGANIZATION"))
c5f9c7bc1661 Use ORGANIZATION env var in gnus-posting-styles.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 935
diff changeset
  2282
         (signature-file "~/.signature"))))
742
f59b924b1b7d Add signature to mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 741
diff changeset
  2283
1673
bd16419905c0 Delay evaluation of gnus-add-configuration to gnus start time. It takes 25% of my Emacs start time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1671
diff changeset
  2284
(my--eval-after-load gnus
bd16419905c0 Delay evaluation of gnus-add-configuration to gnus start time. It takes 25% of my Emacs start time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1671
diff changeset
  2285
  (gnus-add-configuration
bd16419905c0 Delay evaluation of gnus-add-configuration to gnus start time. It takes 25% of my Emacs start time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1671
diff changeset
  2286
   '(article (vertical 1.0 (summary .30 point) (article 1.0)))))
928
067307a8ab45 Change layout of summary buffer: add group window.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 927
diff changeset
  2287
932
5648b7498bc5 gnus-summary-display-arrow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 931
diff changeset
  2288
(setq gnus-summary-display-arrow t)
5648b7498bc5 gnus-summary-display-arrow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 931
diff changeset
  2289
897
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2290
;; `gnus-summary-line-format',
789
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2291
;; `gnus-server-line-format', `gnus-topic-line-format',
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2292
;; `gnus-group-mode-line-format', `gnus-summary-mode-line-format',
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2293
;; `gnus-article-mode-line-format', `gnus-server-mode-line-format',
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2294
;; `gnus-summary-pick-line-format'.
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2295
790
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2296
(when window-system
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2297
  (setq
931
de20db59231c Highlight root articles in Gnus summary buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 930
diff changeset
  2298
   gnus-sum-thread-tree-root "● "
1531
59d0e2ab77f1 Replace triangle symbol with alternatives that is worked with default Windows fonts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1530
diff changeset
  2299
   gnus-sum-thread-tree-false-root " © "
790
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2300
   gnus-sum-thread-tree-indent " "
1531
59d0e2ab77f1 Replace triangle symbol with alternatives that is worked with default Windows fonts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1530
diff changeset
  2301
   gnus-sum-thread-tree-single-indent "• "
59d0e2ab77f1 Replace triangle symbol with alternatives that is worked with default Windows fonts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1530
diff changeset
  2302
   gnus-sum-thread-tree-leaf-with-other "├○ "
59d0e2ab77f1 Replace triangle symbol with alternatives that is worked with default Windows fonts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1530
diff changeset
  2303
   gnus-sum-thread-tree-single-leaf "└○ "
790
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2304
   gnus-sum-thread-tree-vertical "│"
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2305
   ))
356d5ed1649c Customize gnus-sum-thread-tree.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 789
diff changeset
  2306
789
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2307
(setq gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M")))
791
134ec9507faf Show standard status in Gnus summary.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 790
diff changeset
  2308
(setq gnus-summary-line-format "%U%R%z %&user-date; %B %[%-22,22f%] %s\n")
789
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2309
(setq gnus-summary-mode-line-format "Gnus: %p %Z")
6daf35744ad3 Modify 'gnus-summary-line-format'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 788
diff changeset
  2310
744
d3fc2caa5498 Setup own time format (ISO 8601 + day of week) for GNUS article.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 743
diff changeset
  2311
(setq gnus-article-time-format "%Y-%m-%d %T%z %a")
782
03aa367920e6 Make date header setting in portable way as recommended in manual.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 781
diff changeset
  2312
(setq gnus-article-date-headers '(combined-lapsed user-defined))
744
d3fc2caa5498 Setup own time format (ISO 8601 + day of week) for GNUS article.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 743
diff changeset
  2313
897
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2314
;; Remember when I visit group last time.
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2315
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2316
1431
c78504ea530f Fix: Warning: reference to free variable `gnus-tmp-group'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1430
diff changeset
  2317
(defvar gnus-tmp-group)
897
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2318
(defun gnus-user-format-function-d (header)
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2319
  (let ((time (gnus-group-timestamp gnus-tmp-group)))
899
e723c4b0d48c Do not show very old timestamps.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 898
diff changeset
  2320
    (if (and time (time-less-p (time-subtract (current-time) time) (seconds-to-time (* 3600 24 7 30 2))))
897
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2321
        (format-time-string "%Y-%m-%d %H:%M" time)
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2322
      "")))
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2323
;; %d (or with user defined format %ud) shown when I visit group last time in
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2324
;; %*Group* buffer.
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2325
(setq gnus-group-line-format "%M%S%p%P%6y:%B%(%-50,50G%)%3O %ud\n")
1979b76d6f6b Remember when I visit group last time.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 896
diff changeset
  2326
944
664e6f4c3dc8 Document gnus-extra-headers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 942
diff changeset
  2327
;; gnus-visible-headers gnus-extra-headers
796
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2328
(setq
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2329
 gnus-sorted-header-list
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2330
 '(
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2331
   "^From:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2332
   "^Subject:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2333
   "^Summary:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2334
   "^Keywords:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2335
   "^Newsgroups:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2336
   "^Followup-To:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2337
   "^To:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2338
   "^Cc:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2339
   "^Organization:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2340
   "^Date:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2341
   "^User-Agent:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2342
   "^X-Mailer:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2343
   "^X-Newsreader:"
23e9f51428a9 gnus-sorted-header-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 795
diff changeset
  2344
   ))
795
627ed33d9488 gnus-visible-headers
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 794
diff changeset
  2345
755
6f903d3b2ec7 Adaptive score for GNUS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 754
diff changeset
  2346
(setq
6f903d3b2ec7 Adaptive score for GNUS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 754
diff changeset
  2347
 gnus-show-threads t
785
7956c2497dda gnus-thread-sort-by-date
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 784
diff changeset
  2348
 gnus-thread-sort-functions '(gnus-thread-sort-by-date gnus-thread-sort-by-total-score)
1048
9d671852b5c1 Some GNUS default settings...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1047
diff changeset
  2349
 gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
9d671852b5c1 Some GNUS default settings...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1047
diff changeset
  2350
 gnus-summary-gather-subject-limit 'fuzzy
9d671852b5c1 Some GNUS default settings...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1047
diff changeset
  2351
 gnus-thread-hide-killed t
9d671852b5c1 Some GNUS default settings...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1047
diff changeset
  2352
 gnus-thread-ignore-subject t
755
6f903d3b2ec7 Adaptive score for GNUS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 754
diff changeset
  2353
 )
788
b7b60066599e Split scoring setting from other.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 787
diff changeset
  2354
906
da962aa69458 Especially highlight my message and replays to me.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
  2355
;; gnus-summary-mark-below gnus-summary-default-score gnus-summary-default-high-score gnus-summary-default-low-score
da962aa69458 Especially highlight my message and replays to me.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
  2356
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2357
;; Scoring.
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2358
(setq
820
dc1331cd9729 Set gnus-use-scoring to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 819
diff changeset
  2359
 gnus-use-scoring t
dc1331cd9729 Set gnus-use-scoring to t.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 819
diff changeset
  2360
 gnus-save-score t
788
b7b60066599e Split scoring setting from other.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 787
diff changeset
  2361
 gnus-score-expiry-days 60
1039
b87d918d2523 I don't need lowering scores.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1038
diff changeset
  2362
 ;; gnus-decay-scores t
903
6b24df8816ff Set gnus-score-decay-constant.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 902
diff changeset
  2363
 gnus-score-decay-constant 3
788
b7b60066599e Split scoring setting from other.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 787
diff changeset
  2364
 )
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2365
1041
0b70ed39332f These variables are local to each summary buffer and usually set by the score
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1040
diff changeset
  2366
(setq gnus-score-interactive-default-score 100)
0b70ed39332f These variables are local to each summary buffer and usually set by the score
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1040
diff changeset
  2367
0b70ed39332f These variables are local to each summary buffer and usually set by the score
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1040
diff changeset
  2368
;; These variables are local to each summary buffer and usually set by the
0b70ed39332f These variables are local to each summary buffer and usually set by the score
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1040
diff changeset
  2369
;; score file: gnus-summary-mark-below, gnus-summary-expunge-below, gnus-thread-expunge-below
909
14efc19ada1c Do not use gnus-score-followup-article if we use gnus-score-followup-thread.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 908
diff changeset
  2370
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2371
(setq gnus-use-adaptive-scoring t)
945
79c13b7327fa I use 100 for replay to me and 200 for essential mails, and -50 for bad mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 944
diff changeset
  2372
;; I use 100 for replay to me and 200 for essential mails, and -50 for bad mails.
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2373
(setq gnus-default-adaptive-score-alist
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2374
      '(
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2375
        (gnus-unread-mark)
945
79c13b7327fa I use 100 for replay to me and 200 for essential mails, and -50 for bad mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 944
diff changeset
  2376
        (gnus-ticked-mark (followup 100))
79c13b7327fa I use 100 for replay to me and 200 for essential mails, and -50 for bad mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 944
diff changeset
  2377
        (gnus-dormant-mark (followup 100))
918
f7a88390ec90 Decrease score only if I delete articles, not when read.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 916
diff changeset
  2378
        ;; (gnus-read-mark (followup -50))
f7a88390ec90 Decrease score only if I delete articles, not when read.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 916
diff changeset
  2379
        ;; (gnus-catchup-mark (subject -50))
f7a88390ec90 Decrease score only if I delete articles, not when read.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 916
diff changeset
  2380
        (gnus-del-mark (followup -50))
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2381
        (gnus-killed-mark (followup -50))
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2382
        (gnus-kill-file-mark (from -9999))
945
79c13b7327fa I use 100 for replay to me and 200 for essential mails, and -50 for bad mails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 944
diff changeset
  2383
        ))
908
e3b3e9f4d759 New scoring rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 906
diff changeset
  2384
793
dee9b2482842 Increase the score for followups to a sent article.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 792
diff changeset
  2385
;; Increase the score for followups to a sent article.
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2386
(my--eval-after-load gnus-score
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2387
  ;; (add-hook 'message-sent-hook 'gnus-score-followup-article)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2388
  (add-hook 'message-sent-hook 'gnus-score-followup-thread))
755
6f903d3b2ec7 Adaptive score for GNUS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 754
diff changeset
  2389
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2390
(defvar my-gnus-summary-kill-same-subject-min-len 8
1047
a9fcc9b86225 Fix feature name. Limit minimal subject length for exclude...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1046
diff changeset
  2391
  "Minimal length of subject string to ignore this subject.")
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2392
(defun my-gnus-summary-kill-same-subject (&optional unmark)
1046
2ca7e7cfa6d9 Add negative scores for all articles with same subject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1044
diff changeset
  2393
  "Add negative scores for all articles with same subject."
2ca7e7cfa6d9 Add negative scores for all articles with same subject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1044
diff changeset
  2394
  (interactive "P")
2ca7e7cfa6d9 Add negative scores for all articles with same subject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1044
diff changeset
  2395
  (when (or (not (integerp unmark)) (< 0 unmark))
1047
a9fcc9b86225 Fix feature name. Limit minimal subject length for exclude...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1046
diff changeset
  2396
    (let ( (subj (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))) )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2397
      (when (<= (length subj) my-gnus-summary-kill-same-subject-min-len)
1047
a9fcc9b86225 Fix feature name. Limit minimal subject length for exclude...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1046
diff changeset
  2398
        (gnus-summary-score-entry
a9fcc9b86225 Fix feature name. Limit minimal subject length for exclude...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1046
diff changeset
  2399
         "subject" subj
a9fcc9b86225 Fix feature name. Limit minimal subject length for exclude...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1046
diff changeset
  2400
         's (- gnus-score-interactive-default-score) (current-time-string)))))
1046
2ca7e7cfa6d9 Add negative scores for all articles with same subject.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1044
diff changeset
  2401
  (gnus-summary-kill-same-subject unmark))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2402
(my--eval-after-load gnus-sum
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2403
  (define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2404
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2405
(defun my-gnus-mark-thread-as-read ()
1118
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2406
  "Mark unmarked articles in current thread as read and move to
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2407
next thread without selecting article."
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2408
  (interactive)
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2409
  (gnus-summary-top-thread)
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2410
  (catch 'exit
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2411
    (while t
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2412
      (when (eq (gnus-summary-article-mark (gnus-summary-article-number)) gnus-unread-mark)
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2413
        (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark))
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2414
      (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0))
ece4746ba12e Mark unmarked articles in current thread as read and move to
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1117
diff changeset
  2415
        (throw 'exit nil)) )))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2416
(my--eval-after-load gnus-sum
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2417
  (define-key gnus-summary-mode-map (kbd "H-k") #'my-gnus-mark-thread-as-read))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2418
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2419
(defun my-gnus-thread-score-function (&rest scores)
919
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2420
  "If any followup have positive score assign greater available
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2421
score to thread, else assign lesser available score."
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2422
  (let ( (max (apply 'max scores)) (min (apply 'min scores)) )
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2423
    (if (< 0 max) max min)))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2424
(setq gnus-thread-score-function #'my-gnus-thread-score-function)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2425
(defun my-gnus-thread-total-score ()
919
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2426
  "Helper to debug `gnus-thread-score-function' function."
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2427
  (interactive)
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2428
  (message
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2429
   (int-to-string
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2430
    (gnus-thread-total-score
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2431
     (gnus-id-to-thread (mail-header-id (gnus-summary-article-header)))))))
fcd73bc6b91c Own gnus-thread-score-function: If any followup have positive score assign
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
  2432
906
da962aa69458 Especially highlight my message and replays to me.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
  2433
;; Especially highlight my message and replays to me.
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2434
(my--eval-after-load gnus-sum
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2435
  (defface my-gnus-own-unread-face nil
1424
9cc3eb1e06a8 Fix: Warning: defface for ... fails to specify containing group.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1423
diff changeset
  2436
    "Use this face to display own postings in Summary Buffer"
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2437
    :group 'my-gnus)
1617
c88a0c93dfbe Fixed Emacs 27.1 load issue: GNUS faces are now without -face suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1615
diff changeset
  2438
  (copy-face 'gnus-summary-high-unread 'my-gnus-own-unread-face)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2439
  (set-face-background 'my-gnus-own-unread-face "linen")
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2440
  (add-to-list 'gnus-summary-highlight
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2441
               '((and (> score 190) (eq mark gnus-unread-mark)) . my-gnus-own-unread-face))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2442
  (defface my-gnus-own-ancient-face nil
1424
9cc3eb1e06a8 Fix: Warning: defface for ... fails to specify containing group.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1423
diff changeset
  2443
    "Use this face to display own postings in Summary Buffer"
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2444
    :group 'my-gnus)
1617
c88a0c93dfbe Fixed Emacs 27.1 load issue: GNUS faces are now without -face suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1615
diff changeset
  2445
  (copy-face 'gnus-summary-high-ancient 'my-gnus-own-ancient-face)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2446
  (set-face-background 'my-gnus-own-ancient-face "linen")
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2447
  (add-to-list 'gnus-summary-highlight
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2448
               '((and (> score 190) (eq mark gnus-ancient-mark)) . my-gnus-own-ancient-face))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2449
  (defface my-gnus-own-ticked-face nil
1424
9cc3eb1e06a8 Fix: Warning: defface for ... fails to specify containing group.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1423
diff changeset
  2450
    "Use this face to display own postings in Summary Buffer"
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2451
    :group 'my-gnus)
1617
c88a0c93dfbe Fixed Emacs 27.1 load issue: GNUS faces are now without -face suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1615
diff changeset
  2452
  (copy-face 'gnus-summary-high-ticked 'my-gnus-own-ticked-face)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2453
  (set-face-background 'my-gnus-own-ticked-face "linen")
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2454
  (add-to-list 'gnus-summary-highlight
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2455
               '((and (> score 190) (or (eq mark gnus-dormant-mark) (eq mark gnus-ticked-mark))) . my-gnus-own-ticked-face))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2456
  (defface my-gnus-fup-face nil
1424
9cc3eb1e06a8 Fix: Warning: defface for ... fails to specify containing group.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1423
diff changeset
  2457
    "Use this face to display direct fups to my postings."
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2458
    :group 'my-gnus)
1617
c88a0c93dfbe Fixed Emacs 27.1 load issue: GNUS faces are now without -face suffix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1615
diff changeset
  2459
  (copy-face 'gnus-summary-high-unread 'my-gnus-fup-face)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2460
  (set-face-background 'my-gnus-fup-face "honeydew")
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2461
  (add-to-list 'gnus-summary-highlight
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2462
               '((and (<= 90 score) (<= score 110) (eq mark gnus-unread-mark)) . my-gnus-fup-face)) )
906
da962aa69458 Especially highlight my message and replays to me.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
  2463
807
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2464
;; (setq gnus-home-score-file
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2465
;;       ;; All groups that match the regexp `"\\.emacs"'
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2466
;;       '(("\\.emacs" "emacs.SCORE")
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2467
;;         ;; All the comp groups in one score file
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2468
;;         ("^comp" "comp.SCORE")))
63c56a8cf9f1 Remove duplication, move code above.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 806
diff changeset
  2469
911
ce5cb0a281ee Make C-Up, C-Down more like across paragraph moving.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
  2470
;; Make C-Up, C-Down more like across paragraph moving.
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2471
(my--eval-after-load gnus
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2472
  (define-key gnus-summary-mode-map [(meta up)] '(lambda() (interactive) (scroll-other-window -1)))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2473
  (define-key gnus-summary-mode-map [(meta down)] '(lambda() (interactive) (scroll-other-window 1)))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2474
  (define-key gnus-summary-mode-map [(control down)] 'gnus-summary-next-thread)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2475
  (define-key gnus-summary-mode-map [(control up)] 'gnus-summary-prev-thread))
911
ce5cb0a281ee Make C-Up, C-Down more like across paragraph moving.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
  2476
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2477
(defun my-gnus-search-web-by-message-id ()
1426
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2478
  "Search for article archive by Message-Id in Google."
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2479
  (interactive)
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2480
  (let ( (msgid (message-fetch-field "Message-Id")) (subj (message-fetch-field "Subject")) )
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2481
    (setq msgid (replace-regexp-in-string "[<>]" "" msgid))
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2482
    (setq subj (replace-regexp-in-string "[\"#]" " " subj))
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2483
    (browse-url (format "https://www.google.com.ua/search?q=%s" (url-encode-url (format "%s OR \"%s\"" msgid subj))))
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2484
    (browse-url (format "http://mid.mail-archive.com/%s" (url-encode-url msgid)))))
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2485
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2486
(my--eval-after-load gnus-art
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2487
  (define-key gnus-article-mode-map [(control return)] #'my-gnus-search-web-by-message-id))
1426
7dfa8e98a13d Show Message-Id in Gnus Article buffer. Search for Message-Id in Web.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1425
diff changeset
  2488
785
7956c2497dda gnus-thread-sort-by-date
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 784
diff changeset
  2489
;; (setq imap-log t)
7956c2497dda gnus-thread-sort-by-date
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 784
diff changeset
  2490
660
7abcc3f39fe9 Set basic mail settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 658
diff changeset
  2491
;; (setq mail-user-agent 'mh-e-user-agent)
83
d2eaf2ed6d1c Added basic jabber customization.
gavenkoa@gavenko.bifit.int
parents: 82
diff changeset
  2492
900
85a05f7d8bed Set gnus-signature-face to grey.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 899
diff changeset
  2493
(custom-set-faces
85a05f7d8bed Set gnus-signature-face to grey.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 899
diff changeset
  2494
 '(gnus-summary-cancelled ((t (:foreground "plum" :background nil))))
85a05f7d8bed Set gnus-signature-face to grey.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 899
diff changeset
  2495
 '(gnus-signature-face ((t (:foreground "grey"))))
85a05f7d8bed Set gnus-signature-face to grey.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 899
diff changeset
  2496
 )
739
65e6b1b497fb Add some GNUS settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 738
diff changeset
  2497
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2498
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2499
(message "jabber")
83
d2eaf2ed6d1c Added basic jabber customization.
gavenkoa@gavenko.bifit.int
parents: 82
diff changeset
  2500
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2501
(cl-eval-when (compile) (require 'jabber nil t))
1384
a952b43af57f Suppress another: Warning: assignment to free variable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
  2502
1273
738244fdc669 Keep jabber conversation history in 'user-emacs-directory'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1269
diff changeset
  2503
(setq jabber-history-dir (concat user-emacs-directory ".jabber"))
738244fdc669 Keep jabber conversation history in 'user-emacs-directory'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1269
diff changeset
  2504
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2505
(autoload 'jabber-connect-all "jabber")
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2506
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2507
(setq
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2508
 jabber-history-enabled t
1116
a34c8bbd5c3a jabber-history-muc-enabled
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1115
diff changeset
  2509
 jabber-history-muc-enabled t
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2510
 jabber-use-global-history nil
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2511
 jabber-backlog-number 40
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2512
 jabber-backlog-days 30
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2513
 jabber-alert-presence-message-function (lambda (who oldstatus newstatus statustext) nil)
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2514
 )
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2515
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2516
(my--eval-after-load jabber
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2517
  ;; Redefine standard binding for sending message form RET to C-RET.
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2518
  (define-key jabber-chat-mode-map (kbd "RET") 'newline)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2519
  (define-key jabber-chat-mode-map [C-return] 'jabber-chat-buffer-send)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2520
  ;; fsm used in emacs jabber
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2521
  (when (featurep 'fsm)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2522
    (setq fsm-debug nil))               ; Disable *fsm-debug* buffer.
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2523
  ;; Handle Emacs exit.
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2524
  (add-hook 'kill-emacs-hook 'jabber-disconnect))
83
d2eaf2ed6d1c Added basic jabber customization.
gavenkoa@gavenko.bifit.int
parents: 82
diff changeset
  2525
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2526
(defvar my-chat-prompt "[%t] %n>\n")
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2527
(setq
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2528
 jabber-chat-foreign-prompt-format my-chat-prompt
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2529
 jabber-chat-local-prompt-format my-chat-prompt
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2530
 jabber-groupchat-prompt-format my-chat-prompt
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2531
 jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n")
214
f4234e15d891 Fix prompt format (prompt and text stay on two line, not one).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 211
diff changeset
  2532
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2533
(let ( (mgs-list '("Я тутачки, а где Вы меня ожидали?"
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2534
                   "Software Development == Church Development. Step 1. Build it. Step 2. Pray."
680
285d2ffb35ff Update jabber motd.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 677
diff changeset
  2535
                   "Great books aren't written – they're rewritten."
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2536
                   "А любит Б, Б любит С, что делать A? Найти другую Б!")) )
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2537
  (random t)
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2538
  (setq jabber-default-show (nth (random (length mgs-list)) mgs-list))
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2539
  (setq jabber-default-status (nth (random (length mgs-list)) mgs-list))
182
8a8bf4f3e7c2 Correctly set fsm var.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 181
diff changeset
  2540
  )
83
d2eaf2ed6d1c Added basic jabber customization.
gavenkoa@gavenko.bifit.int
parents: 82
diff changeset
  2541
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2542
(defvar my-jabber-users nil
533
15b63e0cc424 Document some settings from .emacs-pre/-post.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 532
diff changeset
  2543
  "Assoc list of jabber user group. Keys are strings, values are lists of JIDs.")
516
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2544
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2545
(defun my-jabber-send (group)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2546
  "GROUP is keys from `my-jabber-users'"
516
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2547
  (interactive
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2548
   (list (completing-read "Select group: " my-jabber-users))
516
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2549
   )
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2550
  (let (
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2551
        (msg (if (use-region-p)
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2552
                 (buffer-substring (region-beginning) (region-end))
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2553
               (buffer-string)))
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2554
        (jc (jabber-read-account))
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2555
        )
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2556
    (deactivate-mark)
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2557
    (mapc
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2558
     (lambda (user)
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2559
       (jabber-send-message jc user "" msg "normal")
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2560
       )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2561
     (cdr (assoc group my-jabber-users))
516
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2562
     )
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2563
    )
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2564
  )
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2565
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2566
(global-set-key (kbd "C-x C-j C-s") 'my-jabber-send)
516
efa00a6ef34e Allow send message to multiply users.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 515
diff changeset
  2567
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2568
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2569
(message "erc")
239
408ebfd38be3 Set default erc encoding to utf-8 because on Windows I have default coding - cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 238
diff changeset
  2570
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2571
(cl-eval-when (compile)
1384
a952b43af57f Suppress another: Warning: assignment to free variable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
  2572
  (require 'erc)
a952b43af57f Suppress another: Warning: assignment to free variable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
  2573
  (require 'erc-log))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2574
639
3e66a9605c4f erc-notify-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 638
diff changeset
  2575
;; (add-to-list 'erc-modules 'notify)
3e66a9605c4f erc-notify-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 638
diff changeset
  2576
;; (setq erc-notify-list '(""))
3e66a9605c4f erc-notify-list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 638
diff changeset
  2577
377
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2578
;; Take off noise message.
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2579
(setq erc-track-exclude-types '("JOIN" "PART" "QUIT" "NICK" "MODE"))
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2580
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2581
(setq erc-current-nick-highlight-type 'nick-or-keyword)
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2582
(setq erc-track-use-faces t)
3e8792ee03cc Take off noise message from erc in notify.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 376
diff changeset
  2583
239
408ebfd38be3 Set default erc encoding to utf-8 because on Windows I have default coding - cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 238
diff changeset
  2584
(setq erc-server-coding-system 'utf-8)
877
b4412d7ff8a1 Set encoding for '#debian-russian'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 876
diff changeset
  2585
(setq erc-encoding-coding-alist
b4412d7ff8a1 Set encoding for '#debian-russian'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 876
diff changeset
  2586
      '(
b4412d7ff8a1 Set encoding for '#debian-russian'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 876
diff changeset
  2587
        ("^icq-" . cp1251)
b4412d7ff8a1 Set encoding for '#debian-russian'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 876
diff changeset
  2588
        ("#debian-russian" . koi8-r)
b4412d7ff8a1 Set encoding for '#debian-russian'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 876
diff changeset
  2589
        ))
634
97785d982806 erc-encoding-coding-alist, erc-autojoin-channels-alist
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 632
diff changeset
  2590
942
b08e5d2da63f Disable erc-autojoin-channels.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 941
diff changeset
  2591
;; (setq erc-autojoin-channels-alist '(("freenode.net" "#emacs")))
239
408ebfd38be3 Set default erc encoding to utf-8 because on Windows I have default coding - cp1251.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 238
diff changeset
  2592
637
f4806bc22860 Enable reconnect facility for ERC.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 636
diff changeset
  2593
(setq
f4806bc22860 Enable reconnect facility for ERC.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 636
diff changeset
  2594
 erc-server-auto-reconnect t
f4806bc22860 Enable reconnect facility for ERC.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 636
diff changeset
  2595
 erc-server-reconnect-timeout 60
1193
4f46f97a10e9 erc-log
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1192
diff changeset
  2596
 erc-server-reconnect-attempts 2)
4f46f97a10e9 erc-log
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1192
diff changeset
  2597
4f46f97a10e9 erc-log
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1192
diff changeset
  2598
(setq
1253
504c216e8d21 Move '.recentf' and '~/.irc' to '~/.emacs.d'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1240
diff changeset
  2599
 erc-log-channels-directory "~/.emacs.d/.irc"
1193
4f46f97a10e9 erc-log
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1192
diff changeset
  2600
 erc-log-file-coding-system 'utf-8-unix)
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2601
(my--eval-after-load erc
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2602
  (require 'erc-log)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2603
  (mkdir erc-log-channels-directory t))
637
f4806bc22860 Enable reconnect facility for ERC.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 636
diff changeset
  2604
636
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2605
;; Kill buffers for channels after /part
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2606
;; (setq erc-kill-buffer-on-part t)
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2607
;; Kill buffers for private queries after quitting the server
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2608
;; (setq erc-kill-queries-on-quit t)
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2609
;; Kill buffers for server messages after quitting the server
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2610
;; (setq erc-kill-server-buffer-on-quit t)
1c47e3a86feb Add commented settings for remember.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 635
diff changeset
  2611
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2612
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2613
(message "devel, programming")
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2614
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2615
(which-func-mode 1)
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2616
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2617
(add-to-list 'auto-mode-alist '("\\.cu$" . c-mode))
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2618
1306
b78bf2c141ab Use consistent style for internal names.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1305
diff changeset
  2619
(defun my--c++-header-file-p ()
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2620
  "Return non-nil, if in a C++ header."
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2621
  (and (string-match "\\.h$"
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2622
                     (or (buffer-file-name)
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2623
                         (buffer-name)))
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2624
       (save-excursion
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2625
         (re-search-forward "\\_<class\\_>" nil t))))
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2626
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  2627
(add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode))
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2628
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2629
(setq-default comment-style (quote indent))
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2630
(setq-default comment-column 44)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2631
(setq-default comment-fill-column my-fill-column)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2632
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2633
(setq-default fill-column my-fill-column)
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2634
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2635
(add-hook 'prog-mode-hook #'hs-minor-mode)
1234
7c3de38a446c hs-minor-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1233
diff changeset
  2636
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2637
(defun my-company-prog-mode-setup ()
1466
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  2638
  (setq-local company-dabbrev-code-other-buffers 'code)
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  2639
  (setq-local company-backends '((company-capf company-dabbrev-code company-files)))
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  2640
  (company-mode 1))
6814b46a6619 Rearrange code. Enable company mode for RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1465
diff changeset
  2641
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2642
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2643
  (add-hook 'prog-mode-hook #'my-company-prog-mode-setup))
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2644
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2645
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2646
(message "diff, patch, ediff, emerge")
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2647
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2648
(cl-eval-when (compile) (require 'ediff))
1384
a952b43af57f Suppress another: Warning: assignment to free variable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
  2649
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2650
(setq diff-switches "-u")
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2651
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2652
(setq ediff-diff-options "")
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2653
(setq ediff-custom-diff-options "-u")
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2654
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2655
(setq ediff-split-window-function 'split-window-vertically)
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2656
992
8523f94a9aa9 Disable: sometimes it take a long time to process large hunks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 991
diff changeset
  2657
;; Disable: sometimes it take a long time to process large hunks.
8523f94a9aa9 Disable: sometimes it take a long time to process large hunks.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 991
diff changeset
  2658
;; Use C-c C-b on hunk by own.
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2659
;; (defun my-diff-auto-refine-mode-on () (diff-auto-refine-mode 1))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2660
;; (add-hook 'diff-mode-hook 'my-diff-auto-refine-mode-on)
976
9378739883bb Enable diff-auto-refine-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 975
diff changeset
  2661
1630
8e99c0b3b772 Disabled hunk refinement during font-lock, introduced in v27.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
  2662
;; Since 27.1 it is enabled during font-lock. Need to disable explicitly.
8e99c0b3b772 Disabled hunk refinement during font-lock, introduced in v27.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
  2663
(setq diff-refine nil)
1633
d31f7473a4b1 Eliminated lags when navigating diff file cause by visiting files behind the
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
  2664
;; https://emacs.stackexchange.com/questions/61760/lags-when-navigating-vc-root-diff-buffer/
d31f7473a4b1 Eliminated lags when navigating diff file cause by visiting files behind the
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1632
diff changeset
  2665
(setq diff-font-lock-syntax 'hunk-only)
1630
8e99c0b3b772 Disabled hunk refinement during font-lock, introduced in v27.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1629
diff changeset
  2666
1565
0160e2f997ee Ported to Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1564
diff changeset
  2667
(when (and window-system (< emacs-major-version 26))
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2668
  (my--eval-after-load diff-mode
1565
0160e2f997ee Ported to Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1564
diff changeset
  2669
    (set-face-foreground 'diff-added "DarkGreen")
0160e2f997ee Ported to Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1564
diff changeset
  2670
    (set-face-foreground 'diff-removed "DarkRed")
0160e2f997ee Ported to Emacs 26.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1564
diff changeset
  2671
    (set-face-background 'diff-refine-changed "LightBlue1")))
974
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2672
a044269d57e0 Reorder sections.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 973
diff changeset
  2673
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
648
6486ccef8fd1 `-b' switch to ignore changes in whitespaces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 647
diff changeset
  2674
(message "vc-mode, VCS, version control, cvs, svn, mercurial, hg, bazaar, bzr, git, fossil")
6486ccef8fd1 `-b' switch to ignore changes in whitespaces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 647
diff changeset
  2675
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2676
(cl-eval-when (compile)
1593
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2677
  (require 'vc)
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2678
  (require 'vc-hooks)
1385
5f96b8d649ba Even on Windows I prefer UTF-8 fro SVN/CVS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
  2679
  (require 'vc-annotate)
5f96b8d649ba Even on Windows I prefer UTF-8 fro SVN/CVS.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
  2680
  (require 'vc-svn))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2681
1593
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2682
(defun my-vc-show-rev (rev)
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2683
  "Show diff for REV."
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2684
  (interactive "sRevision: ")
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2685
  (let ((backend (vc-responsible-backend default-directory)))
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2686
    (when backend
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2687
      (let ((rev-from (vc-call-backend backend 'previous-revision nil rev)))
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2688
        (when rev-from
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2689
          (vc-diff-internal t (list backend nil) rev-from rev))))))
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2690
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2691
(global-set-key (kbd "C-x v R") 'my-vc-show-rev)
8f9430c7d2f7 Show diff for REV.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1592
diff changeset
  2692
648
6486ccef8fd1 `-b' switch to ignore changes in whitespaces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 647
diff changeset
  2693
;; `-b' switch to ignore changes in whitespaces.
6486ccef8fd1 `-b' switch to ignore changes in whitespaces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 647
diff changeset
  2694
;; (setq vc-git-diff-switches "-b")
6486ccef8fd1 `-b' switch to ignore changes in whitespaces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 647
diff changeset
  2695
;; (setq vc-diff-switches "-b")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2696
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2697
(defun my-vc-root-diff (prefix)
1162
aadda3d1653c For Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1158
diff changeset
  2698
  "Same as `vc-root-diff' but for Hg with C-u show latest MQ patch and
aadda3d1653c For Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1158
diff changeset
  2699
with C-u C-u show MQ patch and local changes."
aadda3d1653c For Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1158
diff changeset
  2700
  (interactive "P")
1163
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2701
  (when (eq 'non-hg-mq
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2702
            (catch 'break
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2703
              (unless (and prefix (eq (vc-deduce-backend) 'Hg))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2704
                (throw 'break 'non-hg-mq))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2705
              (let* ( (rootdir (vc-call-backend 'Hg 'root default-directory)) (default-directory rootdir) )
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2706
                (unless (eq (vc-hg-command nil t rootdir "log" "-r" "qtip") 0)
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2707
                  (throw 'break 'non-hg-mq))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2708
                (cond
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2709
                 ((equal prefix '(4))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2710
                  (vc-diff-internal t (list 'Hg (list rootdir)) "qparent" "qtip"))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2711
                 ((equal prefix '(16))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2712
                  (vc-diff-internal t (list 'Hg (list rootdir)) "qparent" nil)) ))))
e7728b2522b2 Handle HG MQ from non-root directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1162
diff changeset
  2713
    (call-interactively 'vc-root-diff nil) ))
1162
aadda3d1653c For Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1158
diff changeset
  2714
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2715
(global-set-key (kbd "C-x v D") 'my-vc-root-diff)
1162
aadda3d1653c For Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1158
diff changeset
  2716
1552
da98a7d4c704 Increase context in patches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1550
diff changeset
  2717
(setq vc-hg-diff-switches (list "-U" "7"))
1701
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  2718
;; More context (7 lines) and better rename detection (30% similarity).
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  2719
(setq vc-git-diff-switches (list "-U7" "-M3"))
1552
da98a7d4c704 Increase context in patches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1550
diff changeset
  2720
1576
9169f962cc47 vc-git-print-log-follow is for v26.1
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1574
diff changeset
  2721
(setq vc-git-print-log-follow t)
9169f962cc47 vc-git-print-log-follow is for v26.1
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1574
diff changeset
  2722
615
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2723
(when window-system
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2724
  (setq
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2725
   vc-annotate-very-old-color "#0b5b20"
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2726
   vc-annotate-background "white"
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2727
   vc-annotate-color-map
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2728
   '(
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2729
     (20 .  "#EE0000")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2730
     (40 .  "#E0800D")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2731
     (60 .  "#D3001A")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2732
     (80 .  "#C68027")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2733
     (100 . "#B90034")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2734
     (120 . "#AB8042")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2735
     (140 . "#9E004F")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2736
     (160 . "#91805C")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2737
     (180 . "#840069")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2738
     (200 . "#778077")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2739
     (220 . "#690084")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2740
     (240 . "#5C8091")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2741
     (260 . "#4F009E")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2742
     (280 . "#4280AB")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2743
     (300 . "#3400B9")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2744
     (320 . "#2780C6")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2745
     (340 . "#1A00D3")
22cf0c9014d9 Replace '(if COND (progn BODY...))' by '(when COND BODY...)'. Remove
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 614
diff changeset
  2746
     (360 . "#0D80E0")))
19
a8e7a6e94341 Теперь белый фон для annotated.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 18
diff changeset
  2747
  )
a8e7a6e94341 Теперь белый фон для annotated.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 18
diff changeset
  2748
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2749
(defun my-log-edit-mode-hook ()
767
47c2dbdb69dd Set fill-column for "Log-Edit" buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 766
diff changeset
  2750
  (setq fill-column 78)
47c2dbdb69dd Set fill-column for "Log-Edit" buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 766
diff changeset
  2751
  )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2752
(add-hook 'log-edit-mode-hook 'my-log-edit-mode-hook t)
767
47c2dbdb69dd Set fill-column for "Log-Edit" buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 766
diff changeset
  2753
1632
9189d278b075 Replaced eval-after-load => with-eval-after-load for its easier syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1631
diff changeset
  2754
(with-eval-after-load 'log-edit
9189d278b075 Replaced eval-after-load => with-eval-after-load for its easier syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1631
diff changeset
  2755
  (remove-hook 'log-edit-hook 'log-edit-insert-message-template))
1356
850b597650f6 Remove those nasty "Summary: " from commit messages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1355
diff changeset
  2756
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2757
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1605
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2758
(message "magit")
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2759
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2760
(when (eq window-system 'w32)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2761
  (setq magit-refresh-status-buffer nil))
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2762
1605
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2763
(with-eval-after-load 'magit-mode
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2764
  (setq magit-log-margin '(t "%F %H:%M" magit-log-margin-width t 18))
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2765
  (define-key magit-mode-map [s-tab] nil))
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2766
1629
e92139c96b4d Disabled magit-diff-refine-hunk. No only it is slow in Cygwin it is also fails on some hunks...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1628
diff changeset
  2767
;; No only it is slow in Cygwin it is also fails on some hunks...
e92139c96b4d Disabled magit-diff-refine-hunk. No only it is slow in Cygwin it is also fails on some hunks...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1628
diff changeset
  2768
(setq magit-diff-refine-hunk nil)
1605
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2769
1607
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2770
(with-eval-after-load 'magit-branch
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2771
  (remove-hook 'find-file-hook 'magit-edit-branch*description-check-buffers))
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2772
(with-eval-after-load 'magit-autorevert
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2773
  (remove-hook 'find-file-hook 'magit-auto-revert-mode-check-buffers)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2774
  (remove-hook 'after-change-major-mode-hook 'magit-auto-revert-mode-enable-in-buffers))
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2775
(with-eval-after-load 'git-commit
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2776
  (remove-hook 'find-file-hook 'git-commit-setup-check-buffer)
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2777
  (remove-hook 'after-change-major-mode-hook 'git-commit-setup-font-lock-in-buffer))
dd180a2be151 Improved handling of long lines. Added docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1606
diff changeset
  2778
1605
bbb4f7c881ff Grouped magit and vc modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1604
diff changeset
  2779
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2780
(message "indenting")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2781
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2782
(cl-eval-when (compile) (require 'cc-mode))
1671
a6d55703383c Suppressed warning: assignment to free variable "c-basic-offset".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1660
diff changeset
  2783
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2784
(setq standard-indent 4)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2785
(setq c-basic-offset 4)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2786
1181
64523c0fddb0 Disable electric-indent-mode new in v24.4.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1180
diff changeset
  2787
(when (fboundp 'electric-indent-mode)
64523c0fddb0 Disable electric-indent-mode new in v24.4.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1180
diff changeset
  2788
  (electric-indent-mode -1))
64523c0fddb0 Disable electric-indent-mode new in v24.4.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1180
diff changeset
  2789
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2790
;; TAB (tab settings)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2791
(setq-default tab-width 4)
253
7cb6ff8a9a75 Translate comment to English.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 252
diff changeset
  2792
(setq-default indent-tabs-mode nil)     ; spaces instead of tabs by default
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2793
(setq tab-always-indent t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2794
(setq c-tab-always-indent t)
188
e36736f245fd Start tab-stop-list with zero.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 162
diff changeset
  2795
(let ( (line-width 400) i )
e36736f245fd Start tab-stop-list with zero.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 162
diff changeset
  2796
  (setq i (* (ceiling line-width 4) 4))
73
73e42aa11b3c Correct initial asigned with nil.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 72
diff changeset
  2797
  (setq tab-stop-list nil)
188
e36736f245fd Start tab-stop-list with zero.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 162
diff changeset
  2798
  (while (>= i 0)
e36736f245fd Start tab-stop-list with zero.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 162
diff changeset
  2799
    (setq tab-stop-list (cons i tab-stop-list))
e36736f245fd Start tab-stop-list with zero.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 162
diff changeset
  2800
    (setq i (- i 4))))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2801
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2802
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2803
(message "compile")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  2804
647
993160feda92 Add docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 646
diff changeset
  2805
;; Prompt for compilation command.
993160feda92 Add docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 646
diff changeset
  2806
(setq compilation-read-command 1)
894
d993e3e910ef Make 'mymake' as default compile command.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 893
diff changeset
  2807
(setq compile-command "mymake ")
638
5bfd6f2d1ae7 Use gmake on FreeBSD.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 637
diff changeset
  2808
(when (eq system-type 'berkeley-unix)
5bfd6f2d1ae7 Use gmake on FreeBSD.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 637
diff changeset
  2809
  (setq compile-command "gmake "))
646
6c2682a5d81e Add comment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 645
diff changeset
  2810
;; With '1' compilation window shall scroll down, with `first-error' stops scrolling at the first error.
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2811
(setq compilation-scroll-output 1)
684
f0604e71f261 compilation-ask-about-save
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 683
diff changeset
  2812
(setq compilation-ask-about-save t)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2813
577
d24848aec7d1 Show error in EN locale to easy search how fix problem in docs and Internet.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 564
diff changeset
  2814
;; Show error in EN locale to easy search how fix problem in docs and Internet.
1276
04e9ed4d22a1 LANG=C damage localised output.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1273
diff changeset
  2815
;; (setq compilation-environment '("LANG=C"))
577
d24848aec7d1 Show error in EN locale to easy search how fix problem in docs and Internet.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 564
diff changeset
  2816
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2817
(my--eval-after-load compile
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2818
  ;; My funny error messages.
1367
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2819
  (add-to-list 'compilation-error-regexp-alist-alist '(nant "^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4))
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2820
  (add-to-list 'compilation-error-regexp-alist 'nant)
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2821
  (add-to-list 'compilation-error-regexp-alist-alist '(msvc "^ *\\(.*\\)(\\([0-9]*\\)) +:" 1 2))
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2822
  (add-to-list 'compilation-error-regexp-alist 'msvc)
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2823
  (add-to-list 'compilation-error-regexp-alist-alist '(keil "^\"?\\([^\"]*\\)\"?,\\([0-9]*\\) .*\\[.*\\]: " 1 2))
4b9e39b257f0 Use named compilation-error-regexp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1366
diff changeset
  2824
  (add-to-list 'compilation-error-regexp-alist 'keil)
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2825
  (add-to-list 'compilation-error-regexp-alist-alist '(maven "\\[ERROR\\] \\(.*\\.java\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" 1 2 3))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2826
  (add-to-list 'compilation-error-regexp-alist 'maven)
1343
059cd8b7e3b3 Regex to parse asciidoc errors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1342
diff changeset
  2827
  (add-to-list 'compilation-error-regexp-alist-alist '(asciidoc "^asciidoc: \\(?:ERROR\\|WARNING\\): \\([^\n:]+\\): line \\([0-9]+\\):" 1 2))
059cd8b7e3b3 Regex to parse asciidoc errors.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1342
diff changeset
  2828
  (add-to-list 'compilation-error-regexp-alist 'asciidoc)
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2829
  (when (boundp 'compilation-mode-font-lock-keywords)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2830
    (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^[:blank:]]+\\)" . 1))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  2831
    (add-to-list 'compilation-mode-font-lock-keywords '("[[:blank:]]\\(/F[oe][^[:blank:]]+\\)" . 1))))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2832
1098
ac3d34a14b99 Colorize ANSI colour sequences in compilation buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1097
diff changeset
  2833
(ignore-errors
ac3d34a14b99 Colorize ANSI colour sequences in compilation buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1097
diff changeset
  2834
  (require 'ansi-color)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2835
  (defun my-colorize-compilation-buffer ()
1098
ac3d34a14b99 Colorize ANSI colour sequences in compilation buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1097
diff changeset
  2836
    (when (eq major-mode 'compilation-mode)
ac3d34a14b99 Colorize ANSI colour sequences in compilation buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1097
diff changeset
  2837
      (ansi-color-apply-on-region compilation-filter-start (point-max))))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2838
  (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2839
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2840
(defvar my-comint-send-hist-list nil
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2841
  "History list for `my-comint-send-string'."
672
ec015b06e121 my-comint-send-string
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 670
diff changeset
  2842
  )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2843
(defun my-comint-send-string (string)
704
474a9291a602 Automaticaly append final newline.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 703
diff changeset
  2844
  "Send string to comint buffers. Useful for *compilation* read-only buffer.
474a9291a602 Automaticaly append final newline.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 703
diff changeset
  2845
Automaticaly append final newline."
672
ec015b06e121 my-comint-send-string
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 670
diff changeset
  2846
  (interactive
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2847
   (list (read-string "Type string: " nil 'my-comint-send-hist-list))
672
ec015b06e121 my-comint-send-string
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 670
diff changeset
  2848
   )
704
474a9291a602 Automaticaly append final newline.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 703
diff changeset
  2849
  (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n"))
672
ec015b06e121 my-comint-send-string
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 670
diff changeset
  2850
  )
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2851
(my--eval-after-load compile
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2852
  (define-key compilation-mode-map [C-return] 'my-comint-send-string))
672
ec015b06e121 my-comint-send-string
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 670
diff changeset
  2853
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2854
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
951
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2855
(message "scons")
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2856
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2857
(add-to-list 'auto-mode-alist '("SConstruct\\'" . python-mode))
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2858
(add-to-list 'auto-mode-alist '("SConscript\\'" . python-mode))
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2859
1beeb0ad3272 Add scons settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 950
diff changeset
  2860
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1100
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2861
(message "gdb, gud")
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2862
;; Use C-x SPACE to set breakpoint in source file.
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2863
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2864
(cl-eval-when (compile) (require 'gdb-mi nil t))
1390
edcad6180e5e I don't use rcirc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1389
diff changeset
  2865
1100
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2866
(setq gdb-show-main t)                  ; See also (gdb-many-windows)
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2867
1571
5d67b50a7767 Set gud-pdb-command-name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1570
diff changeset
  2868
(setq gud-pdb-command-name "python3 -m pdb")
5d67b50a7767 Set gud-pdb-command-name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1570
diff changeset
  2869
1100
df3489a212a9 Show sources along with debugger.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1099
diff changeset
  2870
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2871
(message "completion, abbrev")
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2872
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2873
(setq completion-ignore-case t)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2874
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2875
(setq abbrev-file-name (concat user-emacs-directory ".abbrev"))
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2876
;; (quietly-read-abbrev-file)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2877
;; (setq default-abbrev-mode t)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2878
;; (setq save-abbrevs t)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2879
1229
52e0f3e3ca85 Use hippie-expand.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1227
diff changeset
  2880
(global-set-key (kbd "M-/") 'hippie-expand)
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2881
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  2882
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2883
(message "TAGS, etags, ctags, GNU GLOBAL")
421
44d516f2badd Enable automatic depth up search for TAGS file when 'etags-table' available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 420
diff changeset
  2884
529
1d38dfff2664 Add 'etags-select' and 'etags-table' customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 528
diff changeset
  2885
;; One of 'tags-table-list' or 'tags-file-name' control which TAGS files to
1d38dfff2664 Add 'etags-select' and 'etags-table' customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 528
diff changeset
  2886
;; use.
1d38dfff2664 Add 'etags-select' and 'etags-table' customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 528
diff changeset
  2887
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2888
(ignore-errors
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2889
  (require 'etags-table)
529
1d38dfff2664 Add 'etags-select' and 'etags-table' customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 528
diff changeset
  2890
  (setq etags-table-search-up-depth 8)
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2891
  (require 'etags-select)
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2892
  (global-set-key "\M-." 'etags-select-find-tag)
421
44d516f2badd Enable automatic depth up search for TAGS file when 'etags-table' available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 420
diff changeset
  2893
  )
44d516f2badd Enable automatic depth up search for TAGS file when 'etags-table' available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 420
diff changeset
  2894
675
7bef62461084 Try enable modes to avoid do this explicitly in '.emacs-pre'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 674
diff changeset
  2895
(setq tags-add-tables t)
1194
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2896
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2897
(defvar my-ido-tag-history nil
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2898
  "History of tags selected using `my-ido-complete-tag'.")
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2899
(defun my-ido-complete-tag (&optional substr)
1194
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2900
  "Find a tag using ido."
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2901
  (tags-completion-table)
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2902
  (let ( tag-names )
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2903
    (mapatoms (lambda (x) (push (symbol-name x) tag-names)) tags-completion-table)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2904
    (ido-completing-read "Tag: " tag-names nil t substr 'my-ido-tag-history)))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2905
(defun my-complete-tag (prefix point)
1194
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2906
  (interactive "P\nd")
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2907
  (if prefix
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2908
      (funcall #'complete-tag)
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2909
    (let ( (bounds (find-tag-default-bounds)) tag )
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2910
      (if (or (not bounds) (< point (car bounds)) (< (cdr bounds) point))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2911
          (setq tag (my-ido-complete-tag))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2912
        (setq tag (my-ido-complete-tag (buffer-substring (car bounds) (cdr bounds))))
1194
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2913
        (delete-region (car bounds) (cdr bounds)))
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2914
      (insert tag))))
14d42e7c9224 my-complete-tag with my-ido-complete-tag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1193
diff changeset
  2915
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2916
(global-set-key [M-return] #'my-complete-tag)
541
3d913b8531f4 Bound 'complete-tag' to M-RET.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 539
diff changeset
  2917
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2918
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2919
(message "imenu")
428
6e8b3a312262 Allow imenu function if manu-bar-mode disabled (becase in that case
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 427
diff changeset
  2920
1003
8c1abe90331a Add doc strings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
  2921
(require 'imenu)
8c1abe90331a Add doc strings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
  2922
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2923
(defun my-imenu-to-menubar ()
1003
8c1abe90331a Add doc strings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
  2924
  "Force imenu building when (menu-bar-mode -1)."
995
9d2f14f723c4 Fix condition to check support for imenu.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 994
diff changeset
  2925
  (when imenu-generic-expression
994
4bc77d7283ea Fix: File mode specification error: (error "The mode `nXML' does not support Imenu").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 993
diff changeset
  2926
    (imenu-add-menubar-index)
4bc77d7283ea Fix: File mode specification error: (error "The mode `nXML' does not support Imenu").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 993
diff changeset
  2927
    (run-hooks 'menu-bar-update-hook) ))
1589
ae79beae573a Enable TODO highlighting in all prod modes without listing all modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1588
diff changeset
  2928
(add-hook 'prog-mode-hook 'my-imenu-to-menubar)
652
243f52487da7 Always enable 'imenu'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 650
diff changeset
  2929
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2930
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2931
(message "windows inf files for driver installin")
303
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 288 302
diff changeset
  2932
288
5009c3f4afef Windows inf files for installing drivers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 285
diff changeset
  2933
(add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode))
5009c3f4afef Windows inf files for installing drivers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 285
diff changeset
  2934
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2935
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1101
500c2af9b6fb Set fvwm-fvwmcommand-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1100
diff changeset
  2936
(message "fvwm-mode")
500c2af9b6fb Set fvwm-fvwmcommand-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1100
diff changeset
  2937
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  2938
(my--eval-after-load fvwm-mode
1101
500c2af9b6fb Set fvwm-fvwmcommand-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1100
diff changeset
  2939
  (setq fvwm-fvwmcommand-path (executable-find "FvwmCommand")))
500c2af9b6fb Set fvwm-fvwmcommand-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1100
diff changeset
  2940
500c2af9b6fb Set fvwm-fvwmcommand-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1100
diff changeset
  2941
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2942
(message "makefile, make")
196
154d8ebf534b Added matches for makefile-gmake-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 192
diff changeset
  2943
762
a4787876e986 Down priority for Makefile pattern to allow match .diff/.rej first.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 761
diff changeset
  2944
(add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode) t)
196
154d8ebf534b Added matches for makefile-gmake-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 192
diff changeset
  2945
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2946
(defun my-makefile-setup ()
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2947
  (add-hook 'completion-at-point-functions 'comint-filename-completion nil t))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2948
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2949
(add-hook 'makefile-mode-hook #'my-makefile-setup)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2950
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2951
(defun my-makefile-company-setup ()
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2952
  "Limit search for symbols to Makefiles."
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2953
  (setq-local company-dabbrev-code-other-buffers t)
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2954
  (setq-local company-backends '((company-capf company-dabbrev-code company-files company-executable)))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2955
  (company-mode 1))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2956
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2957
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2958
  (add-hook 'makefile-mode-hook #'my-makefile-company-setup))
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  2959
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2960
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2961
(message "asm, assembler")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  2962
36
4261883ccdb6 Use C-style comment in asm files.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 35
diff changeset
  2963
;; (setq-default asm-comment-char 59)
4261883ccdb6 Use C-style comment in asm files.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 35
diff changeset
  2964
(add-hook 'asm-mode-hook '(lambda () (setq comment-start "/*") (setq comment-end "*/")) t)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2965
186
8c74e1ac4da1 Added association for IAR asm file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 185
diff changeset
  2966
(add-to-list 'auto-mode-alist '("\\.\\([sS]79\\|[sS]\\)\\'" . asm-mode))
8c74e1ac4da1 Added association for IAR asm file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 185
diff changeset
  2967
176
69d65b8a0a25 Added example for unset-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 175
diff changeset
  2968
;; (add-hook 'asm-mode-hook '(lambda () (local-unset-key ":")))
69d65b8a0a25 Added example for unset-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 175
diff changeset
  2969
;; (add-hook 'asm-mode-hook '(lambda () (local-set-key ":" ":")))
69d65b8a0a25 Added example for unset-key.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 175
diff changeset
  2970
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2971
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  2972
(message "linker")
272
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2973
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2974
(when (fboundp 'iar-linker-config-mode)
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2975
  (add-to-list 'auto-mode-alist '("\\.icf\\'" . iar-linker-config-mode))
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2976
  )
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2977
(when (fboundp 'iar4-linker-config-mode)
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2978
  (add-to-list 'auto-mode-alist '("\\.xcl\\'" . iar4-linker-config-mode))
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2979
  )
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  2980
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  2981
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1172
e13ab3bb9331 Minor mode that highlights suspicious C and C++ constructions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1167
diff changeset
  2982
(message "c-mode, cc-mode, c++-mode")
173
04b974b118c2 cc-mode customisations.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 172
diff changeset
  2983
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  2984
(cl-eval-when (compile) (require 'cc-mode))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  2985
645
f5a8fa2c4534 Minor mode that highlights suspicious C and C++ constructions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
  2986
;; Minor mode that highlights suspicious C and C++ constructions.
1172
e13ab3bb9331 Minor mode that highlights suspicious C and C++ constructions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1167
diff changeset
  2987
(global-cwarn-mode 1)
645
f5a8fa2c4534 Minor mode that highlights suspicious C and C++ constructions.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 644
diff changeset
  2988
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  2989
(setq c-echo-syntactic-information-p t)
710
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  2990
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2991
(defun my-c-mode-common-hook ()
710
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  2992
  ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
823
c1c5a6b3255a Enable 'electric' and disable 'auto-newline' in C-like modes. Previously I
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 818
diff changeset
  2993
  (c-toggle-auto-newline -1)
710
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  2994
  ;; Delete all preceding whitespace by DEL.
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  2995
  (c-toggle-hungry-state -1)
711
c124c5e589af Enable electric new-line. Document auto indent after typing colon.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 710
diff changeset
  2996
  ;; Auto indent after typing colon according to `c-hanging-colons-alist'.
c124c5e589af Enable electric new-line. Document auto indent after typing colon.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 710
diff changeset
  2997
  (c-toggle-electric-state 1)
710
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  2998
  )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  2999
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3000
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3001
(defconst my-c-style
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3002
  '((c-tab-always-indent . t)
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3003
    (c-comment-only-line-offset . 4)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3004
    (c-hanging-braces-alist
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3005
     . (
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3006
        (brace-list-open)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3007
        (substatement-open after)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3008
        ))
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3009
    (c-hanging-colons-alist
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3010
     . (
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3011
        (access-label after)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3012
        (case-label after)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3013
        (inher-intro)
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3014
        (label after)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3015
        (member-init-intro before)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3016
        ))
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3017
    (c-cleanup-list
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3018
     . (
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3019
        defun-close-semi
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3020
        empty-defun-braces
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3021
        scope-operator
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3022
        ))
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3023
    (c-offsets-alist
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3024
     . (
712
b54c2306b184 Set indent level for privdate/public keywords.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 711
diff changeset
  3025
        (access-label . -)
485
28f82b8f4f46 Set 'arglist-close' to same indent level as 'arglist-intro' and 'arglist-cont-nonempty'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 484
diff changeset
  3026
        (arglist-intro . ++)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3027
        (arglist-cont-nonempty . ++)
485
28f82b8f4f46 Set 'arglist-close' to same indent level as 'arglist-intro' and 'arglist-cont-nonempty'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 484
diff changeset
  3028
        (arglist-close . ++)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3029
        (block-open . 0)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3030
        (case-label . 0)
562
f277076ade00 Don't indent first LEFT CURLY BRACKET on new line of macros.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 561
diff changeset
  3031
        (cpp-define-intro . 0)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3032
        (comment-intro . 0)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3033
        (func-decl-cont . ++)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3034
        (inexpr-class . 0)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3035
        (inline-open . 0)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3036
        (knr-argdecl-intro . -)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3037
        (label . 0)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3038
        (statement-block-intro . +)
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3039
        (statement-cont . ++)
129
23d028bad418 More regular indent.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 128
diff changeset
  3040
        (substatement-open . 0)
445
17ffd2e22d12 Disable indent on extern C.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 444
diff changeset
  3041
        (inextern-lang . 0)
131
bd2400a18295 Practice alphabetical order.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 130
diff changeset
  3042
        ))
1174
1f2b829bd3e6 Certain syntactic errors are reported (like wrong indent).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1173
diff changeset
  3043
    ;; Certain syntactic errors are reported (like wrong indent).
1f2b829bd3e6 Certain syntactic errors are reported (like wrong indent).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1173
diff changeset
  3044
    (c-report-syntactic-errors . t)
1173
bf65579bd653 Echo syntactic information on TAB in message buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1172
diff changeset
  3045
    ;; Echo syntactic information on TAB in message buffer.
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3046
    (c-echo-syntactic-information-p . t))
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3047
  "My C Programming Style")
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3048
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3049
(defun my-c-mode-style-hook ()
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3050
  (c-add-style "my" my-c-style t)
710
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3051
  ;; If set 'c-default-style' before 'c-add-style'
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3052
  ;; "Undefined style: my" error occured from 'c-get-style-variables'.
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3053
  (setq c-default-style
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3054
        '(
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3055
          (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3056
          (idl-mode . "my")
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3057
          (awk-mode . "awk")
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3058
          (other . "my")
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3059
          ))
49635ebf70f1 Move some anonymous hooks to func definition.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 704
diff changeset
  3060
  )
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3061
(add-hook 'c-mode-common-hook 'my-c-mode-style-hook)
424
188eba7735eb If set 'c-default-style' before 'c-add-style'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 423
diff changeset
  3062
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3063
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1350
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3064
(message "python, python-mode")
703
970915b27f69 Don't send ^M to Python process under Windows as you get error
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
  3065
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3066
(cl-eval-when (compile)
1432
e099be0ee680 Fix: Warning: reference to free variable `python-indent'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1431
diff changeset
  3067
  (require 'python))
e099be0ee680 Fix: Warning: reference to free variable `python-indent'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1431
diff changeset
  3068
1543
438174f1f3f5 Prefer Python 3 for interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1542
diff changeset
  3069
(setq python-shell-interpreter "python3")
1700
4b7b0f90d97b Mentioned python-shell-interpreter-args.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1699
diff changeset
  3070
(setq python-shell-interpreter-args "-i")
1543
438174f1f3f5 Prefer Python 3 for interactive shell.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1542
diff changeset
  3071
1432
e099be0ee680 Fix: Warning: reference to free variable `python-indent'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1431
diff changeset
  3072
(setq python-indent-offset 4)
727
4d38b9e96670 Set 'python-indent' and 'python-continuation-offset'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 724
diff changeset
  3073
1727
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3074
;; (symbol-plist 'python-shell-process-environment)
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3075
(put 'python-shell-process-environment 'safe-local-variable 'listp)
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3076
(add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python"))
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3077
(add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python2"))
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3078
(add-to-list 'safe-local-variable-values '(python-shell-interpreter . "python3"))
371302065ef0 Marked some Python related variables / values as safe for being local.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1726
diff changeset
  3079
1706
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3080
(defun my-python/describe-at-point (symbol process prefix)
1707
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3081
  "Show full docs for symbol at point using Python's help() built-in.
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3082
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3083
With argument 1 uses Python's type() built-in.
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3084
With argument 2 uses Python's repr() built-in.
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3085
With argument 1 uses Python's dir() built-in.
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3086
With argument 1 uses Python's vars() built-in."
1702
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3087
  (interactive (list (python-info-current-symbol)
1706
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3088
                     (python-shell-get-process)
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3089
                     current-prefix-arg))
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3090
  (let ( (cmd
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3091
          (cond
1708
e6320b167b77 It is more informative to get help on symbol type than just type.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1707
diff changeset
  3092
           ((eq 1 prefix) (concat "help(type(" symbol "))\n"))
1707
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3093
           ((eq 2 prefix) (concat "repr(" symbol ")\n"))
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3094
           ((eq 3 prefix) (concat "print('\\n'.join(dir(" symbol ")))\n"))
84c30e639991 Unwrap Python's dir() list into multi line text.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1706
diff changeset
  3095
           ((eq 4 prefix) (concat "vars(" symbol ")\n"))
1706
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3096
           ((not prefix) (concat "help('" symbol "')\n"))
26b2fc3886f9 Added other types of introspection to my-python/describe-at-point.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1705
diff changeset
  3097
           (t (concat "dir(" symbol ")\n")))) )
1704
d5d0c845e7ad Shortened name for pydoc buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1703
diff changeset
  3098
    (switch-to-buffer (get-buffer-create (format "*pydoc: %s*" symbol)))
1702
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3099
    (fundamental-mode)
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3100
    (read-only-mode -1)
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3101
    (buffer-disable-undo)
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3102
    (erase-buffer)
1702
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3103
    (insert (python-shell-send-string-no-output cmd process))
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3104
    (setq-local delete-trailing-lines t)
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3105
    (delete-trailing-whitespace)
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3106
    (read-only-mode 1)
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3107
    (goto-char (point-min))))
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3108
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3109
(defun my-python/send-paragraph ()
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3110
  (interactive)
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3111
  (save-excursion
1703
003cda885eeb Fixed my-python/send-paragraph: part of region was remained highlighted after (mark-paragraph).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1702
diff changeset
  3112
    (let ( end )
003cda885eeb Fixed my-python/send-paragraph: part of region was remained highlighted after (mark-paragraph).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1702
diff changeset
  3113
      (forward-paragraph)
003cda885eeb Fixed my-python/send-paragraph: part of region was remained highlighted after (mark-paragraph).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1702
diff changeset
  3114
      (setq end (point))
003cda885eeb Fixed my-python/send-paragraph: part of region was remained highlighted after (mark-paragraph).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1702
diff changeset
  3115
      (backward-paragraph)
003cda885eeb Fixed my-python/send-paragraph: part of region was remained highlighted after (mark-paragraph).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1702
diff changeset
  3116
      (python-shell-send-region (point) end))))
1342
ca70c69cabe5 Added function and key binding to show docs through built-in "help" Python function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1341
diff changeset
  3117
1338
a49cca7037ba Add key binding for sending paragraph to python process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
  3118
;; For built-in python.el
a49cca7037ba Add key binding for sending paragraph to python process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
  3119
(my--eval-after-load python
1702
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3120
  ;; Shadows primitive built-in `python-describe-at-point'.
52368d6da1d4 Simplified code for displaying Python help. Shadow default C-c C-d key binding
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1701
diff changeset
  3121
  (define-key python-mode-map "\C-c\C-d" 'my-python/describe-at-point)
1338
a49cca7037ba Add key binding for sending paragraph to python process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
  3122
  (define-key python-mode-map [?\C-c ?\C-h] 'my-python/send-paragraph))
a49cca7037ba Add key binding for sending paragraph to python process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
  3123
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3124
(defgroup my-python nil
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3125
  "My Python extentions in Emacs."
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3126
  :group 'python)
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3127
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3128
(defvar my-python/pylint-command "pylint"
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3129
  "Command to run pylint executable.")
1701
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  3130
(defvar my-python/pylint-args "-f parseable --disable=C0301,C0325"
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3131
  "Arguments to pass to pylint executable.")
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3132
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3133
(defvar my-python/pep8-command "pep8"
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3134
  "Command to run pep8 executable.")
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3135
(defvar my-python/pep8-args ""
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3136
  "Arguments to pass to pep8 executable.")
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3137
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3138
(defvar my-python/pyflakes-command "pyflakes"
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3139
  "Command to run pyflakes executable.")
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3140
(defvar my-python/pyflakes-args ""
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3141
  "Arguments to pass to pyflakes executable.")
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3142
1450
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3143
(defvar my-python/pyflakes3-command "pyflakes3"
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3144
  "Command to run pyflakes3 executable.")
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3145
(defvar my-python/pyflakes3-args ""
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3146
  "Arguments to pass to pyflakes3 executable.")
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3147
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3148
(defvar my-python/checker-alist
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3149
  '((pylint . (my-python/pylint-command my-python/pylint-args))
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3150
    (pep8 . (my-python/pep8-command my-python/pep8-args))
1450
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3151
    (pyflakes . (my-python/pyflakes-command my-python/pyflakes-args))
44a6e8153899 Add pyflakes3.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1449
diff changeset
  3152
    (pyflakes3 . (my-python/pyflakes3-command my-python/pyflakes3-args)))
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3153
  "Known Python source code checkers.")
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3154
1701
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  3155
(defcustom my-python/default-checker
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  3156
  (cond
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  3157
   ((eq system-type 'cygwin) 'pylint)
c1ddee0b6366 Set better rename detection (30% similarity) for Git diff.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1700
diff changeset
  3158
   (t 'pyflakes))
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3159
  "Default Python source code checker. See `my-python/checker-alist' for full alist."
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3160
  :group 'my-python
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3161
  :type (cons 'choice (mapcar (lambda (e) (cons 'const e)) my-python/checker-alist)))
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3162
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3163
(defvar my-python/check-history nil)
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3164
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3165
(defun my-python/check (&optional checker)
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3166
  (interactive
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3167
   (list
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3168
    (completing-read "Select cheker: " (mapcar (lambda (e) (car e)) my-python/checker-alist) nil t (symbol-name my-python/default-checker) 'my-python/check-history)))
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3169
  (let ( entry )
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3170
    (unless (setq entry (cdr (assoc (intern-soft checker) my-python/checker-alist)))
1344
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3171
      (error "Unknown checker..."))
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3172
    (compilation-start (format "%s %s %s" (symbol-value (car entry)) (symbol-value (cadr entry)) (shell-quote-argument (buffer-file-name))))))
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3173
131e20ea7dad My Python checkers mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1343
diff changeset
  3174
(my--eval-after-load python
1412
04c1fdf1fdc9 Move defuns out of top level macro in order to simplify debugging. Follow
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1409
diff changeset
  3175
  (define-key python-mode-map [?\C-c ?\C-v] #'my-python/check))
1340
daa03efc12b9 Show full docs for symbol at point for Python mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1339
diff changeset
  3176
1338
a49cca7037ba Add key binding for sending paragraph to python process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1337
diff changeset
  3177
;; For 3rd party python-mode.el.
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3178
(my--eval-after-load python-mode
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3179
  (when (and (boundp 'py-version) (equal py-version "5.1.0"))
856
7757d0840a78 Fix bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=654398
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 843
diff changeset
  3180
    ;; (py-toggle-shells 'cpython)
1337
a0eadfd4cff0 Redefine and add some key binding for python-mode.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1336
diff changeset
  3181
    (setq-default py-which-shell py-python-command))
a0eadfd4cff0 Redefine and add some key binding for python-mode.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1336
diff changeset
  3182
  (when (boundp 'py-version)
a0eadfd4cff0 Redefine and add some key binding for python-mode.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1336
diff changeset
  3183
    (define-key python-mode-map [C-backspace] 'backward-kill-word)
a0eadfd4cff0 Redefine and add some key binding for python-mode.el.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1336
diff changeset
  3184
    (define-key python-mode-map [?\C-c ?p] 'py-execute-paragraph)
1339
d276e7a0d704 Seems that python-describe-symbol in python-mode.el and not in
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1338
diff changeset
  3185
    (define-key python-mode-map [?\C-c ?r] 'py-execute-region)
d276e7a0d704 Seems that python-describe-symbol in python-mode.el and not in
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1338
diff changeset
  3186
    (define-key inferior-python-mode-map "\C-c\C-f" 'python-describe-symbol)))
1023
3a49cbe13ae3 Fix 'eval-after-load' usage. Fix mode name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1022
diff changeset
  3187
957
15fc17674517 Enable "M-/", "C-c g", "C-c d", "C-c f" shortcuts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 956
diff changeset
  3188
;; Enable "M-/", "C-c g", "C-c d", "C-c f" shortcuts.
15fc17674517 Enable "M-/", "C-c g", "C-c d", "C-c f" shortcuts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 956
diff changeset
  3189
(setq ropemacs-enable-shortcuts t)
864
adacfc97125b Load 'pymacs' and 'ropemacs' automatically.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 863
diff changeset
  3190
(ignore-errors
1022
37071d001c49 Disable rope.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1021
diff changeset
  3191
  ;; (require 'pymacs)
37071d001c49 Disable rope.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1021
diff changeset
  3192
  ;; (pymacs-load "ropemacs" "rope-")
864
adacfc97125b Load 'pymacs' and 'ropemacs' automatically.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 863
diff changeset
  3193
  )
adacfc97125b Load 'pymacs' and 'ropemacs' automatically.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 863
diff changeset
  3194
;; Automatically save project python buffers before refactorings
adacfc97125b Load 'pymacs' and 'ropemacs' automatically.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 863
diff changeset
  3195
(setq ropemacs-confirm-saving 'nil)
adacfc97125b Load 'pymacs' and 'ropemacs' automatically.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 863
diff changeset
  3196
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3197
(defun my-python-add-to-path (path)
732
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3198
  (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3199
  (when (featurep 'cygwin-mount)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3200
    (setq path (my-dos2cygwin-path path)))
1024
4bb32327e98b Fix my-python-add-to-path to allow ~ in path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1023
diff changeset
  3201
  (python-send-string (format "import sys; sys.path.append(\"%s\")" (expand-file-name path))) )
732
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3202
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3203
(defun my-python-django-fix (path)
732
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3204
  "XXX not work on Cygwin + naive Emacs."
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3205
  (interactive (list (read-directory-name "Enter new path for PYTHONPATH: ")))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3206
  (when (featurep 'cygwin-mount)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3207
    (setq path (my-dos2cygwin-path path))
732
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3208
    )
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3209
  (let ((file (concat path "manage.py")))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3210
    (if (file-exists-p file)
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3211
        (python-send-string (format "import os; os.chdir(\"%s\"); execfile(\"%s\")" path file))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3212
      (error (format "file '%s' does not exist" file))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3213
      )))
139665dd6ada my-python-django-fix + my-python-add-to-path.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 731
diff changeset
  3214
1129
3458d2911643 Disable eldoc for Python in flavor of Semantic and perfomance reason.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1128
diff changeset
  3215
;; Disable in flavor of Semantic and perfomance reason.
3458d2911643 Disable eldoc for Python in flavor of Semantic and perfomance reason.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1128
diff changeset
  3216
;; (when (>= emacs-major-version 22)
1489
c0c3d88cd779 Windows doesn't have fonts for 'or'/'and' Python keywords.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1488
diff changeset
  3217
;;   (add-hook 'python-mode-hook 'turn-on-eldoc-mode)
c0c3d88cd779 Windows doesn't have fonts for 'or'/'and' Python keywords.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1488
diff changeset
  3218
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3219
(defun my-python-mode-hook ()
1722
c4feb289e3c2 tags-completion-at-point-function over python-completion-at-point as latter doesn't work for me in Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1719
diff changeset
  3220
  (setq completion-at-point-functions '(tags-completion-at-point-function python-completion-at-point))
1489
c0c3d88cd779 Windows doesn't have fonts for 'or'/'and' Python keywords.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1488
diff changeset
  3221
  (when (and (eq window-system 'w32) (fboundp 'prettify-symbols-mode))
c0c3d88cd779 Windows doesn't have fonts for 'or'/'and' Python keywords.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1488
diff changeset
  3222
    (prettify-symbols-mode -1)))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3223
(add-hook 'python-mode-hook 'my-python-mode-hook)
729
9c5cb48451ad Enable 'eldoc-mode' for 'python-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 728
diff changeset
  3224
1532
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  3225
;; (when (equal window-system 'w32)
e6ea63ccab39 Modern Windows can work with Unicode. No need for codepage.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1531
diff changeset
  3226
;;   (add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix)))
703
970915b27f69 Don't send ^M to Python process under Windows as you get error
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 699
diff changeset
  3227
1210
b149f50121ac requirements.txt is Python dependency description file probably.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1208
diff changeset
  3228
(add-to-list 'auto-mode-alist '("/requirements.txt\\'" . conf-mode))
b149f50121ac requirements.txt is Python dependency description file probably.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1208
diff changeset
  3229
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3230
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
884
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3231
(message "perl, cperl")
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3232
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3233
(cl-eval-when (compile) (require 'cperl-mode))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3234
884
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3235
;; Use cperl instead perl mode.
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3236
(mapc
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3237
 (lambda (pair)
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3238
   (if (eq (cdr pair) 'perl-mode)
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3239
       (setcdr pair 'cperl-mode)))
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3240
 (append auto-mode-alist interpreter-mode-alist))
885
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3241
;; Don't show all man page. I set man switches to "-a"...
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3242
(add-hook
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3243
 'cperl-mode-hook
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3244
 '(lambda ()
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3245
    (make-local-variable 'Man-switches)
fd8ec78ece0a Don't show all man page. I set man switches to "-a"...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 884
diff changeset
  3246
    (setq Man-switches nil)))
884
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3247
886
0867fc471c12 Expands for keywords such as foreach, while, etc...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 885
diff changeset
  3248
;; Expands for keywords such as foreach, while, etc...
0867fc471c12 Expands for keywords such as foreach, while, etc...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 885
diff changeset
  3249
(setq cperl-electric-keywords t)
0867fc471c12 Expands for keywords such as foreach, while, etc...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 885
diff changeset
  3250
888
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3251
(setq
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3252
 cperl-indent-level 2
889
7f24172c2c4b Fix indent level for closed parenthesis.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 888
diff changeset
  3253
 cperl-close-paren-offset -2
888
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3254
 cperl-continued-statement-offset 2
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3255
 cperl-indent-parens-as-block t
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3256
 cperl-tab-always-indent t)
37348d961bfb Set indentation rules for cperl.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
  3257
884
8c6ff01debc1 Use cperl instead perl mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 883
diff changeset
  3258
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1350
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3259
(message "r, ess-mode")
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3260
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3261
(setq ess-indent-offset 2)
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3262
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3263
(my--eval-after-load ess-inf
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3264
  (define-key inferior-ess-mode-map [home] 'comint-bol))
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3265
82ce5b4ae16e home key move after prompt in inferior-ess-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1349
diff changeset
  3266
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
873
900edc8d663e Define key binding to send paragraph to SML process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 872
diff changeset
  3267
(message "SML, Standard ML")
900edc8d663e Define key binding to send paragraph to SML process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 872
diff changeset
  3268
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3269
(my--eval-after-load sml
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3270
  (define-key sml-mode-map (kbd "C-c C-p") 'sml-send-function))
873
900edc8d663e Define key binding to send paragraph to SML process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 872
diff changeset
  3271
900edc8d663e Define key binding to send paragraph to SML process.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 872
diff changeset
  3272
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1615
6e1d795f7231 Enable typescript-mode for .tsx files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1614
diff changeset
  3273
(message "javascript, js, typescript")
508
79bcafd3d45f As old Emacs have on 'js-mode', use 'javascript-generic-mode'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 507
diff changeset
  3274
965
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3275
(if (>= emacs-major-version 23)
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3276
    (add-to-list 'auto-mode-alist '("\\.js$" . js-mode))
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3277
  (add-to-list 'auto-mode-alist '("\\.js$" . javascript-generic-mode))
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3278
  )
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3279
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3280
(my--eval-after-load js
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3281
  (modify-syntax-entry ?$ "w" js-mode-syntax-table))
1009
c6e2c636296f Treat '$' as word syntax for JS mode to simplify C-Left/Right movement for jQuery.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
  3282
1231
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3283
(setq js-indent-level 4)
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3284
;; js-curly-indent-offset, js-expr-indent-offset, js-paren-indent-offset, 	js-square-indent-offset, js-switch-indent-offset
1009
c6e2c636296f Treat '$' as word syntax for JS mode to simplify C-Left/Right movement for jQuery.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1001
diff changeset
  3285
965
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3286
;; BUG: all single char comments do not stop highlighting on end of line but
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3287
;; go to end of buffer. To fix use code:
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3288
;; (setq auto-mode-alist (rassq-delete-all 'js-mode auto-mode-alist))
72d443fe2b1d Disable workaround for:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
  3289
;; (add-to-list 'auto-mode-alist '("\\.js$" . c++-mode))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3290
1621
95a7aa1e3e60 Activate typescript mode with eval-after-load as feature isn't registerd during startup process so we cannot detect it earlier.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1620
diff changeset
  3291
(my--eval-after-load typescript-mode
1615
6e1d795f7231 Enable typescript-mode for .tsx files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1614
diff changeset
  3292
  (add-to-list 'auto-mode-alist '("\\.tsx?$" . typescript-mode)))
6e1d795f7231 Enable typescript-mode for .tsx files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1614
diff changeset
  3293
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3294
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1482
d74af7d75f19 Set indentation for json-mode. Require ag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1481
diff changeset
  3295
(message "json")
d74af7d75f19 Set indentation for json-mode. Require ag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1481
diff changeset
  3296
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3297
(defun my-json-mode-hook ()
1482
d74af7d75f19 Set indentation for json-mode. Require ag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1481
diff changeset
  3298
  (set (make-local-variable 'js-indent-level) 2))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3299
(add-hook 'json-mode-hook #'my-json-mode-hook)
1482
d74af7d75f19 Set indentation for json-mode. Require ag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1481
diff changeset
  3300
d74af7d75f19 Set indentation for json-mode. Require ag.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1481
diff changeset
  3301
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1649
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3302
(message "yaml, yml")
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3303
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3304
(my--eval-after-load yaml-mode
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3305
  (add-to-list 'auto-mode-alist '("\\.ya?ml\\.j2\\'" . yaml-mode)))
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3306
562ee79b1a31 Enable yaml-mode in Jinja templates.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1648
diff changeset
  3307
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3308
(message "bat file, batch")
272
f7fba93f4028 Enable file association for myself defined modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 266
diff changeset
  3309
461
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  3310
;; loaded from 'generic-x.el'
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  3311
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3312
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3313
(message "csharp, c-sharp")
204
4545865a64c3 Move bat file mode code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 203
diff changeset
  3314
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3315
(autoload 'csharp-mode "csharp-mode" "Major mode for editing C# code." t)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3316
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3317
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3318
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3319
(message "java")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  3320
1179
b2e1cb526649 Fix if subword-mode isn't defined.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1178
diff changeset
  3321
(when (fboundp 'subword-mode)
b2e1cb526649 Fix if subword-mode isn't defined.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1178
diff changeset
  3322
  (add-hook 'java-mode-hook #'subword-mode))
1178
2eeb9a3996b4 subword-mode for java-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1177
diff changeset
  3323
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3324
(add-hook 'java-mode-hook #'auto-revert-mode)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3325
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3326
(defun my-company-java-setup ()
1467
87b79df71e39 Adjust company mode to Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1466
diff changeset
  3327
  (setq-local company-dabbrev-code-other-buffers t)
87b79df71e39 Adjust company mode to Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1466
diff changeset
  3328
  (setq-local company-backends '((company-semantic company-capf company-dabbrev-code)))
87b79df71e39 Adjust company mode to Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1466
diff changeset
  3329
  (company-mode 1))
87b79df71e39 Adjust company mode to Java.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1466
diff changeset
  3330
(when (and (featurep 'semantic) (featurep 'company))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3331
  (add-hook 'java-mode-hook #'my-company-java-setup))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3332
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3333
(defvar my-java-exeption-dirs nil
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3334
  "List of dirs to look by `my-java-exeption'.")
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3335
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3336
(defun my-java-exeption ()
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3337
  "Look at current line if it like Java exaption and try find file using `my-java-exeption-dirs'"
1497
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3338
  (interactive)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3339
  (save-excursion
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3340
    (let ( path file line end )
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3341
      (forward-line 1)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3342
      (backward-char 1)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3343
      (setq end (point))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3344
      (forward-line 0)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3345
      (if (not (re-search-forward "^\\s-+at \\([a-zA-Z0-9.$]+\\)(\\([^.]+\\)\\.java:\\([1-9][0-9]*\\))" end t))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3346
          (message "Current line doesn't look like Java exeption or lack necessary information...")
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3347
        (setq file (match-string 2))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3348
        (setq line (match-string 3))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3349
        (setq path (match-string 1))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3350
        (setq path (replace-regexp-in-string (concat "\\." file ".*") "" path))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3351
        (setq path (replace-regexp-in-string "\\." "/" path))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3352
        (setq path (cl-some (lambda (dir)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3353
                              (let ((full-path (format "%s/%s/%s.java" dir path file)))
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3354
                                (when (file-exists-p full-path) full-path)))
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3355
                            my-java-exeption-dirs))
1497
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3356
        (if (not path)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3357
            (message "Can't find file %s.java" file)
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3358
          (find-file-other-window path)
1588
a2f88a6df8ab Fixed: ‘goto-line’ is for interactive use only; use ‘forward-line’ instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1587
diff changeset
  3359
          (forward-line (string-to-number line)))))))
1497
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3360
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3361
(my--eval-after-load log4-hi-mode
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3362
  (define-key log4-hi-mode-map [C-return] #'my-java-exeption))
1497
9a881de3da24 Define function to easy navigate to Java source file from Java exception.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1494
diff changeset
  3363
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3364
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1537
592689d6d222 Some symbols from default composition rules cause Emacs redisplay hang on Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1536
diff changeset
  3365
(message "cfengine")
592689d6d222 Some symbols from default composition rules cause Emacs redisplay hang on Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1536
diff changeset
  3366
1538
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3367
(add-to-list 'auto-mode-alist '("\\.cf\\'" . cfengine3-mode))
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3368
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3369
;; Problems with hunging on re-display when symbols is used on Windows can be solved by:
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3370
;;   (setq inhibit-compacting-font-caches t)
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3371
;; or choosing "DejaVu Sans Mono" font.
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3372
;; (my--eval-after-load cfengine3
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3373
;;   (defconst cfengine3--prettify-symbols-alist
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3374
;;     '(("->"  . ?→)
35dbe903d7e0 Problems with hunging on re-display when symbols is used on Windows can be solved by:
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1537
diff changeset
  3375
;;       ("=>"  . ?⇛))))
1537
592689d6d222 Some symbols from default composition rules cause Emacs redisplay hang on Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1536
diff changeset
  3376
592689d6d222 Some symbols from default composition rules cause Emacs redisplay hang on Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1536
diff changeset
  3377
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3378
(message "Pascal")
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3379
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3380
(cl-eval-when (compile) (require 'pascal))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3381
1220
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3382
(setq
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3383
 pascal-indent-level 4
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3384
 pascal-case-indent 2
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3385
 pascal-auto-newline t
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3386
 pascal-tab-always-indent t
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3387
 ;; pascal-toggle-completions t
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3388
 ;; pascal-auto-lineup nil
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3389
 pascal-auto-endcomments t)
90e3a3721051 abbrev-file-name, pascal-mode
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1218
diff changeset
  3390
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3391
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1227
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3392
(message "nsis-mode")
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3393
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3394
(when (fboundp 'nsis-mode)
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3395
  (add-to-list 'auto-mode-alist '("\\.\\(nsi\\|nsh\\)\\'" . nsis-mode))
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3396
  )
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3397
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3398
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3399
(message "wesnoth-mode")
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3400
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3401
(ignore-errors
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3402
  (require 'wesnoth-mode)
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3403
  (add-to-list 'auto-mode-alist '("wesnoth.*\\.cfg\\'" . wesnoth-mode)) )
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3404
1422
e601b08d4cbd Remove some "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
  3405
(defvar wesnoth-base-indent)
1227
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3406
(setq wesnoth-base-indent 2)
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3407
e2355b44d39d Enable wesnoth-mode if possible.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1221
diff changeset
  3408
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1231
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3409
(message "css")
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3410
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3411
(cl-eval-when (compile) (require 'css-mode))
1422
e601b08d4cbd Remove some "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1421
diff changeset
  3412
1231
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3413
(setq css-indent-offset 4)
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3414
1232
8c3600d2317d css-eldoc-enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1231
diff changeset
  3415
;; (package-install 'css-eldoc)
8c3600d2317d css-eldoc-enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1231
diff changeset
  3416
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3417
(my--eval-after-load css-mode
1233
ac43014e461d Delay loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1232
diff changeset
  3418
  (when (fboundp 'css-eldoc-enable)
ac43014e461d Delay loading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1232
diff changeset
  3419
    (css-eldoc-enable)))
1232
8c3600d2317d css-eldoc-enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1231
diff changeset
  3420
1231
a909406cc06c js-indent-level, css-indent-offset
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1230
diff changeset
  3421
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
958
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3422
(message "htmlize")
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3423
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3424
(cl-eval-when (compile) (require 'htmlize nil t))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3425
958
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3426
(setq
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3427
 htmlize-html-charset "utf-8"
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3428
 htmlize-output-type 'inline-css
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3429
 htmlize-html-major-mode 'html-mode
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3430
 htmlize-convert-nonascii-to-entities nil)
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3431
f93fa1c0f480 Add customisation for 'htmlize'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 957
diff changeset
  3432
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3433
(message "html")
104
e921a5d906ca Use highlighting on sgml modes!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 102
diff changeset
  3434
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3435
(defun my-html-charref-escape-region (start end)
628
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3436
  (interactive "r")
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3437
  (save-excursion
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3438
    (save-restriction
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3439
      (narrow-to-region start end)
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3440
      (goto-char (point-min))
1539
14739033d89f Prevent error that character not found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1538
diff changeset
  3441
      (while (search-forward "&" nil t) (replace-match "&amp;"))
628
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3442
      (goto-char (point-min))
1539
14739033d89f Prevent error that character not found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1538
diff changeset
  3443
      (while (search-forward "<" nil t) (replace-match "&lt;"))
628
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3444
      (goto-char (point-min))
1539
14739033d89f Prevent error that character not found.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1538
diff changeset
  3445
      (while (search-forward ">" nil t) (replace-match "&gt;"))
628
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3446
      )))
c00e41cc019e text2html
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 627
diff changeset
  3447
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3448
(defun my-html-charref-from-char (char)
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3449
  (format "&#%d;" char)
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3450
  )
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3451
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3452
(defun my-html-charref-from-string (string)
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3453
  (let ((res ""))
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3454
    (mapc
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3455
     (lambda (char) (setq res (concat res (my-html-charref-from-char char))))
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3456
     string)
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3457
    res
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3458
    ) )
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3459
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3460
(defun my-html-charref-escape-region2 (begin end &optional prefix)
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3461
  (interactive "r\nP")
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3462
  (if prefix
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3463
      (save-excursion
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3464
        (goto-char begin)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3465
        (insert (my-html-charref-from-string (delete-and-extract-region begin end))))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3466
    (my-html-charref-from-string (buffer-substring begin end))
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3467
    ))
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3468
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3469
(defun my-html-charref-to-string (html)
1449
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3470
  "Return string with replaced decimal/hex and string charrefs by
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3471
correcponding UTF-8 symbol."
1324
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3472
  (let (str)
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3473
    (with-temp-buffer
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3474
      (insert html)
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3475
      (goto-char (point-min))
1449
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3476
      (while (search-forward-regexp "&\\(?:#\\([[:digit:]]+\\)\\|#x\\([[:xdigit:]]+\\)\\|\\(lt\\|gt\\|amp\\|quot\\)\\);" nil t)
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3477
        (setq str (or (match-string 1) (match-string 2) (match-string 3)))
1324
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3478
        (cond
1449
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3479
         ((match-string 1)
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3480
          (when (> (string-to-number str 10) 0)
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3481
            (replace-match (string (string-to-number str 10)) t t)))
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3482
         ((match-string 2)
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3483
          (when (> (string-to-number str 16) 0)
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3484
            (replace-match (string (string-to-number str 16)) t t)))
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3485
         (t
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3486
          (cond
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3487
           ((equal str "lt")
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3488
            (replace-match "<" t t))
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3489
           ((equal str "gt")
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3490
            (replace-match ">" t t))
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3491
           ((equal str "quot")
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3492
            (replace-match "\"" t t))
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3493
           ((equal str "amp")
61455bf4fb87 Add handling of hex charrefs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1448
diff changeset
  3494
            (replace-match "&" t t)))) ))
1324
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3495
      (buffer-string))))
f6fc0d332bbc Add my-* prefix to html-charref-* functions. Add support for &lt; /
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1323
diff changeset
  3496
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3497
(defun my-html-charref-unescape-region (begin end &optional prefix)
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3498
  (interactive "r\nP")
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3499
  (if prefix
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3500
      (save-excursion
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3501
        (goto-char begin)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3502
        (insert (my-html-charref-to-string (delete-and-extract-region begin end))))
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3503
    (my-html-charref-to-string (buffer-substring begin end))
654
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3504
    ))
f08ea38190d6 html-charref package for converting string from/to HTML charref.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 653
diff changeset
  3505
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3506
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3507
(message "nxml")
520
7e8d77531ecf Make the complete element be treated as a single markup item.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 514
diff changeset
  3508
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3509
(cl-eval-when (compile) (require 'nxml-mode))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3510
520
7e8d77531ecf Make the complete element be treated as a single markup item.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 514
diff changeset
  3511
(setq nxml-sexp-element-flag t)
522
14a5ff978db7 Set indent for NXML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 521
diff changeset
  3512
(setq nxml-child-indent 2)
14a5ff978db7 Set indent for NXML.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 521
diff changeset
  3513
(setq nxml-attribute-indent 4)
104
e921a5d906ca Use highlighting on sgml modes!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 102
diff changeset
  3514
1568
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3515
(add-to-list 'auto-mode-alist '("\\.pom\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3516
(add-to-list 'auto-mode-alist '("\\.xsd\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3517
(add-to-list 'auto-mode-alist '("\\.rng\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3518
(add-to-list 'auto-mode-alist '("\\.xul\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3519
(add-to-list 'auto-mode-alist '("\\.xslt\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3520
(add-to-list 'auto-mode-alist '("\\.svg\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3521
(add-to-list 'auto-mode-alist '("\\.rss\\'" . nxml-mode))
c4b43eed6b3d Fixed regex quoting syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1567
diff changeset
  3522
(add-to-list 'auto-mode-alist '("\\.atom\\'" . nxml-mode))
997
28255ceefe52 Use .pom files as XML files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 993
diff changeset
  3523
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3524
(my--eval-after-load nxml-mode
1567
3a880076385d Fixed: ‘nxml-complete’ is an obsolete command (as of 26.1); use ‘completion-at-point’ instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1566
diff changeset
  3525
  (if (<= emacs-major-version 25)
3a880076385d Fixed: ‘nxml-complete’ is an obsolete command (as of 26.1); use ‘completion-at-point’ instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1566
diff changeset
  3526
      (define-key nxml-mode-map [C-return] 'nxml-complete)
1578
1fabb8953172 Simpler key binding to collapse XML documents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1577
diff changeset
  3527
    (define-key nxml-mode-map [C-return] 'completion-at-point))
1fabb8953172 Simpler key binding to collapse XML documents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1577
diff changeset
  3528
  (define-key nxml-mode-map [S-tab] 'hs-toggle-hiding))
994
4bc77d7283ea Fix: File mode specification error: (error "The mode `nXML' does not support Imenu").
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 993
diff changeset
  3529
1559
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3530
(defun my-nxml-pp ()
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3531
  "Pretty-print XML."
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3532
  (interactive)
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3533
  (goto-char (point-min))
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3534
  (while (re-search-forward ">[ \t\n\r]+<" nil t)
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3535
    (replace-match ">\n<"))
1560
10e5b207ec7d Fixed my-nxml-pp.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1559
diff changeset
  3536
  (goto-char (point-min))
1559
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3537
  (while (re-search-forward "><" nil t)
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3538
    (replace-match ">\n<"))
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3539
  (indent-region (point-min) (point-max))
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3540
  (goto-char (point-min)))
9f4456fcac0e Added pretty-print XML function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1558
diff changeset
  3541
1550
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3542
(defun my-nxml-where (&optional prefix)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3543
  "Display the hierarchy of XML elements the point is on as a path."
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3544
  (interactive "P")
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3545
  (let (path)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3546
    (save-excursion
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3547
      (save-restriction
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3548
        (widen)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3549
        (while (and (< (point-min) (point))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3550
                    (condition-case nil
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3551
                        (progn
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3552
                          (nxml-backward-up-element)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3553
                          t)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3554
                      (error nil)))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3555
          (setq path (cons (xmltok-start-tag-local-name) path)))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3556
        (setq path (mapconcat 'identity path "/"))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3557
        (when prefix
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3558
          (kill-new path))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3559
        (if (called-interactively-p t)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3560
            (message "%s" path)
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3561
          path)))))
e3a381f14ad1 Added function that copies xpath-like path in XML document.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1549
diff changeset
  3562
998
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995 997
diff changeset
  3563
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995 997
diff changeset
  3564
(message "relax ng, rng")
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995 997
diff changeset
  3565
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3566
(my--eval-after-load rng-loc
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3567
  (add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml"))
617
5e34660f1a23 Add path to local rnc schemas.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 616
diff changeset
  3568
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3569
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3570
(message "web-mode")
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3571
1558
a7bb0608855b Avoid warning "assignment to free variable" for /ido-mode during compilation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1557
diff changeset
  3572
(require 'web-mode nil t)
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3573
(cl-eval-when (compile) (require 'web-mode nil t))
1384
a952b43af57f Suppress another: Warning: assignment to free variable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
  3574
1067
493ae377ca5d Set web-mode offsets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1064
diff changeset
  3575
(setq web-mode-markup-indent-offset 2
493ae377ca5d Set web-mode offsets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1064
diff changeset
  3576
      web-mode-css-indent-offset 2
1074
fffe729d20a0 Update web-mode setting to new version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1073
diff changeset
  3577
      web-mode-code-indent-offset 2
fffe729d20a0 Update web-mode setting to new version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1073
diff changeset
  3578
      web-mode-script-padding 2
fffe729d20a0 Update web-mode setting to new version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1073
diff changeset
  3579
      web-mode-style-padding 2)
fffe729d20a0 Update web-mode setting to new version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1073
diff changeset
  3580
fffe729d20a0 Update web-mode setting to new version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1073
diff changeset
  3581
(setq web-mode-enable-comment-keywords t)
1067
493ae377ca5d Set web-mode offsets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1064
diff changeset
  3582
1554
42a48016fc5a Disable auto indenting on copy/paste in web-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1553
diff changeset
  3583
(setq web-mode-enable-auto-indentation nil)
42a48016fc5a Disable auto indenting on copy/paste in web-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1553
diff changeset
  3584
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3585
(ignore-errors (require 'web-mode))
1447
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3586
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3587
(when (featurep 'web-mode)
1447
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3588
  ;; Replace html-mode  with web-mode.
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3589
  (when (cl-some (lambda (spec) (eq (cdr spec) 'html-mode))
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3590
                 magic-fallback-mode-alist)
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3591
    (setq magic-fallback-mode-alist (copy-tree magic-fallback-mode-alist))
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3592
    (mapc (lambda (spec) (when (eq (cdr spec) 'html-mode) (setcdr spec 'web-mode)))
8cde360dda53 Replace html-mode with web-mode in ``magic-fallback-mode-alist``.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1445
diff changeset
  3593
          magic-fallback-mode-alist))
1128
33ab3ce7f973 Use original values of web-mode-engine-file-regexps. Enable PHP mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1127
diff changeset
  3594
  (setq web-mode-engine-file-regexps (delq (assoc "jsp" web-mode-engine-file-regexps) web-mode-engine-file-regexps))
33ab3ce7f973 Use original values of web-mode-engine-file-regexps. Enable PHP mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1127
diff changeset
  3595
  (mapc (lambda (i) (add-to-list 'web-mode-engine-file-regexps i))
33ab3ce7f973 Use original values of web-mode-engine-file-regexps. Enable PHP mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1127
diff changeset
  3596
          '(("jsp" . "\\.tagf?\\'")
33ab3ce7f973 Use original values of web-mode-engine-file-regexps. Enable PHP mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1127
diff changeset
  3597
            ("jsp" . "\\.jspf?\\'")))
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3598
  (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
1130
4aea0ddc3607 Use web-mode for PHP.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1125
diff changeset
  3599
  (add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
1027
53633ac1c134 Fix pattern for '.jspf' files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
  3600
  (add-to-list 'auto-mode-alist '("\\.jspf?\\'" . web-mode))
1028
939bec5b98f8 Add JSP tag file to web-modes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1027
diff changeset
  3601
  (add-to-list 'auto-mode-alist '("/WEB-INF/tags/.*\\.tagf?\\'" . web-mode))
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3602
  (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3603
  (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3604
  (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3605
  (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3606
  (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) )
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3607
1448
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3608
(face-spec-set 'web-mode-html-tag-face
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3609
               '((((class color) (min-colors 16)) :foreground "blue")
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3610
                 (((type tty) (class mono)) :inverse-video t)))
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3611
(face-spec-set 'web-mode-html-tag-custom-face
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3612
               '((((class color) (min-colors 16)) :foreground "red")
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3613
                 (((type tty) (class mono)) :inverse-video t)))
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3614
(face-spec-set 'web-mode-html-tag-custom-face
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3615
               '((((class color) (min-colors 16)) :foreground "red")
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3616
                 (((type tty) (class mono)) :inverse-video t)))
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3617
(face-spec-set 'web-mode-html-tag-bracket-face
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3618
               '((((background dark)) . (:foreground "white"))
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3619
                 (((background light)) . (:foreground "black"))))
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3620
(copy-face 'font-lock-variable-name-face 'web-mode-html-attr-name-face)
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3621
(copy-face 'web-mode-html-tag-bracket-face 'web-mode-html-attr-equal-face)
6e3c4ea65439 Redefine some web-mode faces.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1447
diff changeset
  3622
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3623
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3624
(message "sgml")
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3625
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3626
(cl-eval-when (compile) (require 'sgml-mode))
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3627
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3628
(setq sgml-basic-offset 4)
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3629
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3630
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3631
(message "psgml")
296
e502c69ab80a Make header name like tags, separated by comma and ended on period.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 295
diff changeset
  3632
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3633
(cl-eval-when (compile) (require 'psgml nil t))
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3634
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3635
(defvar my-html-template
698
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3636
      '("html"
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3637
        (nil
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3638
         "\n<head>" \n
1366
f9989b9060aa Fix: Warning: `read-input' is an obsolete function (as of 22.1); use `read-string' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1365
diff changeset
  3639
         "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" (read-string "Charset: ") "\">" \n
f9989b9060aa Fix: Warning: `read-input' is an obsolete function (as of 22.1); use `read-string' instead.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1365
diff changeset
  3640
         "<title>" (setq str (read-string "Title: ")) "</title>\n"
698
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3641
         "</head>\n"
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3642
         "<body>\n<h1>" str "</h1>"
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3643
         "\n<address>" \n
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3644
         "<a href=\"mailto:" user-mail-address "\">" (user-full-name) "</a>" \n
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3645
         "</address>" \n
2a081d4e2e7c FIX: 'html-tag-alist' is not defined in 'psgml' mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 691
diff changeset
  3646
         "</body>\n"
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3647
         )))
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3648
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3649
(my--eval-after-load sgml-mode
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3650
  (unless (featurep 'psgml)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3651
    (setq html-tag-alist
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3652
          (cons
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3653
           my-html-template
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3654
           (my-filter
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3655
            (lambda (item) (not (equal (car item) "html")))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3656
            html-tag-alist)))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3657
    (add-to-list 'html-tag-alist '("script" (\n) ("type" "text/javascript") ))
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3658
    (add-to-list 'html-tag-alist '("style" (\n) ("type" "text/css") )) ))
985
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3659
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3660
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3661
(message "jsp")
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3662
1420
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  3663
(defvar jsp-font-lock-syntactic-keywords
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  3664
  '(("\\(<\\)%--" (1 "< b"))
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  3665
    ("--%\\(>\\)" (1 "> b"))))
3327e11cea09 Fix many of "Warning: assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1419
diff changeset
  3666
985
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3667
(define-derived-mode jsp-mode html-mode "JSP"
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3668
  "JSP editing mode. Redefine HTML comment syntax to JSP."
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3669
  (setq comment-start "<%--")
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3670
  (setq comment-end "--%>")
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3671
  (setq comment-start-skip "<[!%]--[ \t]*")
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3672
  (setq comment-end-skip "[ \t]*--[% \t\n]*>")
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3673
  (setcdr (assoc 'font-lock-syntactic-keywords font-lock-defaults) 'jsp-font-lock-syntactic-keywords) )
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3674
1026
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3675
(unless (featurep 'web-mode)
ce279dbcf880 Use 'web-mode' if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
  3676
  (add-to-list 'auto-mode-alist '("\\.jspf?\\'" . jsp-mode)))
985
ad3c49e55848 Define own jsp-mode based on html-mode with JSP comment style.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 984
diff changeset
  3677
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3678
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1556
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3679
(message "emmet")
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3680
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3681
(cl-eval-when (compile) (require 'emmet-mode nil t))
1556
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3682
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3683
(when (featurep 'emmet-mode)
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3684
  (add-hook 'sgml-mode-hook 'emmet-mode))
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3685
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3686
(when (featurep 'web-mode)
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3687
  (add-hook 'web-mode-hook 'emmet-mode))
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3688
1557
89e2bb5c7333 Added emmet customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1556
diff changeset
  3689
(setq emmet-move-cursor-between-quotes t)
89e2bb5c7333 Added emmet customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1556
diff changeset
  3690
(setq emmet-move-cursor-after-expanding t)
89e2bb5c7333 Added emmet customization.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1556
diff changeset
  3691
1556
835b8743f9d3 Added emmet-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1555
diff changeset
  3692
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3693
(message "sh, bash")
438
740efbdc5777 Associate shell-script-mode for .cygport files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 437
diff changeset
  3694
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3695
(cl-eval-when (compile) (require 'sh-script))
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3696
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3697
(setq sh-basic-offset 2)
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3698
438
740efbdc5777 Associate shell-script-mode for .cygport files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 437
diff changeset
  3699
(add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode))
740efbdc5777 Associate shell-script-mode for .cygport files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 437
diff changeset
  3700
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3701
(defun my-sh-company-setup ()
1463
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  3702
  (setq-local company-backends '((company-capf company-files company-dabbrev-code)))
4c92e9fc2efd Add company completion for executable in PATH. Enable company for Makefile and progmodes.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1462
diff changeset
  3703
  (setq-local company-dabbrev-code-other-buffers t)
1460
d6606777ff0a Enable company mode for shell scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1459
diff changeset
  3704
  (company-mode 1))
d6606777ff0a Enable company mode for shell scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1459
diff changeset
  3705
d6606777ff0a Enable company mode for shell scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1459
diff changeset
  3706
(when (featurep 'company)
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3707
  (add-hook 'sh-mode-hook #'my-sh-company-setup))
1460
d6606777ff0a Enable company mode for shell scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1459
diff changeset
  3708
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3709
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
870
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3710
(message "pg, Proof General")
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3711
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3712
(cl-eval-when (compile) (require 'proof nil t))
1392
2979c26ce356 sgml-set-face is not defined anywhere. Fix some Warning: assignment to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1391
diff changeset
  3713
875
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3714
(setq proof-splash-enable nil)
870
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3715
;; (setq proof-toolbar-enable nil)
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3716
875
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3717
(setq
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3718
 isar-display:show-types t
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3719
 isar-display:show-sorts t
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3720
 isar-display:show-main-goal t
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3721
 isar-display:show-brackets t
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3722
 ;; Too many output, so commented:
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3723
 ;; isar-display:show-consts t
ad6675a2cc8e Disable shown consts in *goal* buffer.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 874
diff changeset
  3724
 )
871
209250a782ff Set isar-display:show-types and isar-display:show-brackets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 870
diff changeset
  3725
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3726
(my--eval-after-load proof
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3727
  ;; (proof-maths-menu-toggle 1)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3728
  ;; (unicode-tokens-mode 1)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3729
  ;; (proof-imenu-toggle 1)
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3730
  )
1254
19c7b3be9b3a Define special macro to avoid warning about "assignment to free variable".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1253
diff changeset
  3731
(my--eval-after-load isar
1278
8e47e801be9d Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1277
diff changeset
  3732
  (define-key isar-mode-map (kbd "C-c C-m") 'proof-goto-point))
870
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3733
faf5e15495dc Add Proof General settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 869
diff changeset
  3734
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3735
(message "printing")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3736
881
10910d09430c Set ps-paper-type.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 880
diff changeset
  3737
(setq ps-paper-type 'a4)
10910d09430c Set ps-paper-type.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 880
diff changeset
  3738
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3739
;; Use Notepad to print plain text files to the default Windows printer
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3740
;(setq lpr-command "notepad")
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3741
;(setq lpr-headers-switches '("/p"))    ; \ mis-use these
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3742
;(setq lpr-switches nil)                ; / two variables
9
96e0cbcd92ab Untabify.
Oleksander Gavenko <gavenko_a@3g.ua>
parents: 8
diff changeset
  3743
;(setq printer-name nil)        ; notepad takes the default
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3744
;(setq lpr-printer-switch "/P") ;; run notepad as batch printer
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3745
;;
295
5be44cff4683 Use utf-8 encoding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 289
diff changeset
  3746
461
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  3747
;; Printing to file.
295
5be44cff4683 Use utf-8 encoding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 289
diff changeset
  3748
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3749
;(setq printer-name "~/myprint.txt")
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3750
;(setq ps-printer-name nil)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3751
;(setq ps-print-header nil)
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3752
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3753
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3754
(message "SQL")
102
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  3755
1685
6a740def74e8 Fixed error 'eval-when is not defined' after switching to cl-lib.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1684
diff changeset
  3756
(cl-eval-when (compile) (require 'sql))
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3757
102
25585e240b4a Move customization from .emacs (custom-set-variables) to .emacs-my. Remove duplication.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 101
diff changeset
  3758
(setq sql-password "")
1051
1248821d9d0b Add plsql file extension to auto-mode-alist.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1050
diff changeset
  3759
(add-to-list 'auto-mode-alist '("\\.plsql\\'" . sql-mode))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3760
1110
6b18658edec8 Disable placeholders substitution in Oracle SQLi by Emacs itself.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1107
diff changeset
  3761
;; Disable placeholders substitution in Oracle SQLi by Emacs itself.
6b18658edec8 Disable placeholders substitution in Oracle SQLi by Emacs itself.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1107
diff changeset
  3762
;; This enable "define" and "&var" syntax.
6b18658edec8 Disable placeholders substitution in Oracle SQLi by Emacs itself.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1107
diff changeset
  3763
(setq sql-oracle-scan-on nil)
6b18658edec8 Disable placeholders substitution in Oracle SQLi by Emacs itself.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1107
diff changeset
  3764
1280
300a2718b555 Disable line wrapping for SQLi buffers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1279
diff changeset
  3765
(add-hook 'sql-interactive-mode-hook (lambda () (toggle-truncate-lines 1)))
300a2718b555 Disable line wrapping for SQLi buffers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1279
diff changeset
  3766
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3767
(defun my-sql-explain-paragraph ()
1323
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3768
  "Send the current paragraph to the SQL process with \"explain \" keyword.
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3769
Works at least for MySql/MariaDB."
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3770
  (interactive)
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3771
  (let ((start (save-excursion
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3772
                 (backward-paragraph)
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3773
                 (point)))
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3774
        (end (save-excursion
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3775
               (forward-paragraph)
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3776
               (point))))
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3777
    (sql-send-string (concat "explain " (buffer-substring-no-properties start end)))))
1326
7fc5b4f72144 Fix: Symbol's value as variable is void: sql-mode-map
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1325
diff changeset
  3778
7fc5b4f72144 Fix: Symbol's value as variable is void: sql-mode-map
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1325
diff changeset
  3779
(my--eval-after-load sql
1514
1ce5595fe5f1 Use 'my-' prefix instead 'my/' with nonstandard character.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1507
diff changeset
  3780
  (define-key sql-mode-map (kbd "C-c C-e") 'my-sql-explain-paragraph))
1323
08ca6cc08d2c Send the current paragraph to the SQL process with \"explain \" keyword.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1322
diff changeset
  3781
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3782
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1548
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3783
(message "hideshow")
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3784
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3785
(require 'hideshow)
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3786
1604
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3787
(defun my-selective-display-toggle ()
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3788
  "Better alternative to 'C-x $' using current column as threshold."
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3789
  (interactive)
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3790
  (set-selective-display
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3791
   (unless selective-display
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3792
     (1+ (current-column)))))
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3793
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3794
(defun my-hs-toggle ()
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3795
  (interactive)
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3796
  (if hs-minor-mode
1723
6533fa2834cf hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1722
diff changeset
  3797
      ;; hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
6533fa2834cf hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1722
diff changeset
  3798
      (hs-life-goes-on
6533fa2834cf hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1722
diff changeset
  3799
       (if (hs-already-hidden-p)
6533fa2834cf hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1722
diff changeset
  3800
           (hs-show-block)
6533fa2834cf hs-toggle-hiding has bug in v27.1. I eliminated "(event-end e)" from "hs-toggle-hiding" as workaround.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1722
diff changeset
  3801
         (hs-hide-block)))
1604
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3802
    (my-selective-display-toggle)))
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3803
72fa4385c7ba Fallback to selective-display if not in hs-minor-mode. Make corresponding key binding global.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1603
diff changeset
  3804
(define-key global-map (kbd "s--") #'my-hs-toggle)
1548
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3805
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3806
(add-to-list
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3807
 'hs-special-modes-alist
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3808
 '(nxml-mode
1596
caadc3835d6c Fix: removed quotation from sub-element inside quoted expression.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1595
diff changeset
  3809
   "<!--\\|<[^/>][^>]*>" "-->\\|</[^/>]+>" "<!--" nxml-forward-element nil))
1548
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3810
(add-hook 'nxml-mode-hook #'hs-minor-mode)
1594
cf7966919bd9 Fixed hs-special-modes-alist START regex to allow '/' in attr values (like base64 encoded data) and enabled proper nxml-forward-element balancing function.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1593
diff changeset
  3811
;; (setcdr (assoc 'nxml-mode hs-special-modes-alist) (list "<!--\\|<[^/>][^>]*>" "-->\\|</[^/>]+>" "<!--" #'nxml-forward-element nil))
1548
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3812
f7b46111fd5a Added hideshow mode for nxml.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1547
diff changeset
  3813
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1614
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3814
(message "prettyprint, pp")
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3815
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3816
(defun my-pp ()
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3817
  (interactive)
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3818
  (let ( (fname (buffer-file-name)) )
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3819
    (cond
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3820
     ((eq major-mode 'nxml-mode)
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3821
      (my-nxml-pp))
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3822
     ((string-match "\\.json\\'" fname)
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3823
       (json-pretty-print-buffer)))))
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3824
c858fc552ec5 my-pp based on context so I don't need to remember my-nxml-pp, json-pretty-print-buffer, etc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1613
diff changeset
  3825
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3826
(message "desktop")
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3827
657
e8416d2b2f6a Use c++-mode for JS files because of single char comment highlight but when
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 656
diff changeset
  3828
;; Save and restore my buffers every time.
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3829
(require 'desktop)
1374
313e428cf77c Add (eval-when 'compile ...) to reduce number of Warning: reference to free variable.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1373
diff changeset
  3830
766
31b6b63917df Use different 'recentf' and 'desktop' files and do not enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 764
diff changeset
  3831
(setq desktop-base-file-name ".emacs.desktop")
31b6b63917df Use different 'recentf' and 'desktop' files and do not enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 764
diff changeset
  3832
(setq desktop-base-lock-name ".emacs.desktop.lock")
1215
c7e52e93465a Move .emacs files to user-emacs-directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1210
diff changeset
  3833
(setq desktop-dirname user-emacs-directory)
766
31b6b63917df Use different 'recentf' and 'desktop' files and do not enable
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 764
diff changeset
  3834
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3835
(add-to-list 'desktop-path desktop-dirname)
1650
60f7bae01cdd Lazy loading of buffer significantly reduces startup time!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1649
diff changeset
  3836
; Lazy loading of buffer significantly reduces startup time!
60f7bae01cdd Lazy loading of buffer significantly reduces startup time!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1649
diff changeset
  3837
(setq desktop-restore-eager 1)
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3838
(setq desktop-restore-frames nil)
1688
0bab53c47567 Moved startup profiler settings to init.el and simplified activation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1687
diff changeset
  3839
(unless my-profiler-enabled
1679
5ee3a93090f0 Added option to disable activation of desktop-save-mode.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1678
diff changeset
  3840
  (desktop-save-mode 1))
1378
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3841
(setq
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3842
 desktop-globals-to-save
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3843
 (append
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3844
  '((file-name-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3845
    (compile-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3846
    (command-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3847
    (extended-command-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3848
    (shell-command-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3849
    (search-ring . 20)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3850
    (query-replace-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3851
    (regexp-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3852
    (grep-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3853
    (minibuffer-history . 100)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3854
    tags-file-name
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3855
    register-alist)
892deca62b56 Remove support for Emacs 21.x.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1377
diff changeset
  3856
  desktop-globals-to-save))
657
e8416d2b2f6a Use c++-mode for JS files because of single char comment highlight but when
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 656
diff changeset
  3857
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3858
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
545
24992bae7599 Use 'message' instead of comment to easy debug where error occurred.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 544
diff changeset
  3859
(message "User welcome msg")
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3860
250
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3861
(add-hook 'emacs-startup-hook
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3862
          (lambda ()
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3863
            (let ( (mgs-list '("Welcome to emacs, the thermonuclear editor."
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3864
                               "You enter to Out Space. Emacs on."
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3865
                               "Nice day for Emacsing!")) )
ef1c7269280f Show different messages on statup.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 249
diff changeset
  3866
              (message (nth (random (length mgs-list)) mgs-list)))))
0
aef1d0017234 Initial commit.
Oleksander Gavenko <gavenko_a@3g.ua>
parents:
diff changeset
  3867
548
1bfa0cf51c9c Set *Messages* buffer 'default-directory' to $HOME.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
  3868
(switch-to-buffer "*Messages*")
1bfa0cf51c9c Set *Messages* buffer 'default-directory' to $HOME.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 547
diff changeset
  3869
(setq default-directory "~/")
546
083974006b4a 'default-directory' for '*scratch*' buffer. This allow 'eval-buffer' on '.emacs-my'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 545
diff changeset
  3870
(switch-to-buffer "*scratch*")
083974006b4a 'default-directory' for '*scratch*' buffer. This allow 'eval-buffer' on '.emacs-my'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 545
diff changeset
  3871
(setq default-directory "~/")
083974006b4a 'default-directory' for '*scratch*' buffer. This allow 'eval-buffer' on '.emacs-my'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 545
diff changeset
  3872
461
1639d2540bbd Set outline-minor for file. Fix section to feet header outline pattern.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 460
diff changeset
  3873
;;; End loading...
718
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3874
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3875
;; Local variables:
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3876
;; mode: outline-minor
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3877
;; outline-regexp: "(message \""
19ab21ec7640 Define own outline-regex to easy view file structure.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 717
diff changeset
  3878
;; End: