# HG changeset patch # User Oleksandr Gavenko # Date 1490815636 -10800 # Node ID 1ce5595fe5f1b54e66be0321bfcf697816c4beeb # Parent 0da077ba84ab2a1d3250b09dc2dce9cd8bb1510a Use 'my-' prefix instead 'my/' with nonstandard character. diff -r 0da077ba84ab -r 1ce5595fe5f1 .emacs-my --- a/.emacs-my Sat Mar 25 11:59:34 2017 +0300 +++ b/.emacs-my Wed Mar 29 22:27:16 2017 +0300 @@ -43,7 +43,7 @@ ;; Don't sort ``recentf-list`` so ``recentf-open-files`` show files in historical order! (setq recentf-menu-filter nil) -(defun my/recentf-clean-project (dir) +(defun my-recentf-clean-project (dir) "Remove from recentf all files that belong to DIR directory." (interactive (list (read-directory-name "Exclude all paths"))) (let ( recentf-exclude ) @@ -69,7 +69,7 @@ ;; Also '-q' prevent loading your init file. (setq inhibit-default-init nil) ; t/nil -(defun my/debug (mode) +(defun my-debug (mode) "With prefix enable enter to debuger and show backtrace when problems occur, with double prefix enable debugging on event and signal, else disable breaking to debugger." @@ -85,7 +85,7 @@ (lvl1 (message "Debugging on quit...")) (t (message "Debugging disabled..."))))) -(defun my/eval-buffer () +(defun my-eval-buffer () "Evaluate entire buffer with re-assigning values to `defvar' / `defcustom'. Useful during package development." (interactive) @@ -95,7 +95,7 @@ (eval-defun nil) (end-of-defun)))) -(defun my/load-library (library) +(defun my-load-library (library) "Evaluate entire library with re-assigning values to `defvar' / `defcustom'. Useful during package development." (interactive @@ -105,9 +105,9 @@ '("" ".el"))))) (with-temp-buffer (insert-file-contents (locate-file library load-path '("" ".el"))) - (my/eval-buffer))) - -(my/debug nil) + (my-eval-buffer))) + +(my-debug nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "user info") @@ -134,7 +134,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "my defun, defmacro, defvar") -(defmacro my/filter (pred list) +(defmacro my-filter (pred list) "Construct list with elements from LIST which satisfy PRED." (let ( (r (make-symbol "r_")) ) `(let ( (,r (list nil)) ) @@ -144,7 +144,7 @@ ,list) (cdr ,r)))) -(defun my/fold (f x list) +(defun my-fold (f x list) "Recursively applies (F i j) to LIST starting with X. For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)." (let ((li list) (x2 x)) @@ -162,7 +162,7 @@ `(condition-case nil (progn ,@body) (error nil))) ) -(defun my/lookup-key (key) +(defun my-lookup-key (key) "Search for KEY in all known keymaps." (let (result) (mapatoms (lambda (ob) (when (and (boundp ob) @@ -183,11 +183,11 @@ (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) -(defun my/emacs-lisp-mode-hook () +(defun my-emacs-lisp-mode-hook () (setq tab-width 8)) -(add-hook 'emacs-lisp-mode-hook 'my/emacs-lisp-mode-hook) - -(defun my/elisp-find-tag () +(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook) + +(defun my-elisp-find-tag () (interactive) (require 'etags) (ring-insert find-tag-marker-ring (point-marker)) @@ -195,7 +195,7 @@ (find-function-at-point) )) ;; Goto elisp definition. -(define-key emacs-lisp-mode-map (kbd "M-.") 'my/elisp-find-tag) +(define-key emacs-lisp-mode-map (kbd "M-.") 'my-elisp-find-tag) (if (not (fboundp 'global-prettify-symbols-mode)) ;; http://www.emacswiki.org/emacs/PrettyLambda @@ -205,7 +205,7 @@ (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) ))) (global-prettify-symbols-mode 1)) -(defun my/dump-funcs () +(defun my-dump-funcs () "Dump all function calls in current buffer. Useful to explore elisp API from somebody else files." (interactive) @@ -222,7 +222,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "mode groups") -(defmacro my/defun-rename-symb-tree (name doc func) +(defmacro my-defun-rename-symb-tree (name doc func) "Travel by TREE and applies FUNC to each symbol." `(defun ,name (tree) ,doc @@ -236,24 +236,24 @@ (t (error "Only tree of symbols allowed")) ))) -(my/defun-rename-symb-tree - my/feature2mode +(my-defun-rename-symb-tree + my-feature2mode "Convert TREE of features to TREE of modes for these features. Single symbol allowed." (lambda (symb) (intern (concat (symbol-name symb) "-mode")))) -(my/defun-rename-symb-tree - my/mode2hook +(my-defun-rename-symb-tree + my-mode2hook "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed." (lambda (symb) (intern (concat (symbol-name symb) "-hook"))) ) -(my/defun-rename-symb-tree - my/mode2modemap +(my-defun-rename-symb-tree + my-mode2modemap "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed." (lambda (symb) (intern (concat (symbol-name symb) "-map"))) ) -(defvar my/devel-mode-list +(defvar my-devel-mode-list '( sh-mode script-mode tcl-mode c-mode c++-mode java-mode js-mode @@ -271,11 +271,11 @@ ) "List of development modes.") -(defvar my/devel-mode-hook-list - (my/mode2hook my/devel-mode-list) +(defvar my-devel-mode-hook-list + (my-mode2hook my-devel-mode-list) "List of development mode hooks.") -(defvar my/scroll-margin-mode-list +(defvar my-scroll-margin-mode-list '( vc-dir-mode recentf-dialog-mode @@ -287,11 +287,11 @@ ) "List of modes for enabling scroll margin.") -(defvar my/scroll-margin-mode-hook-list - (my/mode2hook my/scroll-margin-mode-list) +(defvar my-scroll-margin-mode-hook-list + (my-mode2hook my-scroll-margin-mode-list) "List of mode hooks for enabling scroll margin.") -(defvar my/text-mode-list +(defvar my-text-mode-list '( text-mode outline-mode @@ -301,8 +301,8 @@ ) "List of text modes.") -(defvar my/text-mode-hook-list - (my/mode2hook my/text-mode-list) +(defvar my-text-mode-hook-list + (my-mode2hook my-text-mode-list) "List of text mode hooks.") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -346,7 +346,7 @@ (setq display-buffer-reuse-frames t) -(defun my/maximize () +(defun my-maximize () ;; Next code work with Emacs 21.4, 22.3, 23.1. (let ( (px (display-pixel-width)) @@ -365,7 +365,7 @@ (when window-system (if (fboundp 'toggle-frame-maximized) (toggle-frame-maximized) - (my/maximize) )) + (my-maximize) )) (menu-bar-mode -1) (when window-system @@ -374,15 +374,15 @@ (tool-bar-mode -1) (tooltip-mode -1) (setq-default line-spacing nil) - (defun my/popup-menu () + (defun my-popup-menu () "Menu from keyboard by emulating mouse event." (interactive) (mouse-popup-menubar (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name))) nil) ) - (global-set-key [f10] 'my/popup-menu) - (global-set-key [apps] 'my/popup-menu) - (global-set-key [menu] 'my/popup-menu) ) + (global-set-key [f10] 'my-popup-menu) + (global-set-key [apps] 'my-popup-menu) + (global-set-key [menu] 'my-popup-menu) ) ;; Prefer horizontal windows splitting. (when (>= emacs-major-version 23) @@ -482,7 +482,7 @@ (eval-when 'compile (require 'shell)) -(defvar my/use-windows-shell nil +(defvar my-use-windows-shell nil "If t 'cmdproxy.exe' will be used as shell. Affect on \\[shell] like commands. If nil, 'sh' will be used." ) @@ -500,7 +500,7 @@ )))) (defvar cygwin-mount-table--internal) -(defun my/dos2cygwin-path (path) +(defun my-dos2cygwin-path (path) "Convert DOS path to Cygwin according to current mount table." (interactive (list (read-directory-name "Enter DOS path: "))) (setq path (replace-regexp-in-string "\\\\" "/" (expand-file-name path))) @@ -560,7 +560,7 @@ (ansi-color-for-comint-mode-on) -(defun my/ansi-color (&optional beg end) +(defun my-ansi-color (&optional beg end) "Interpret ANSI color esacape sequence by colorifying cotent. Operate on selected region on whole buffer." (interactive @@ -586,22 +586,22 @@ (my--eval-after-load term (define-key term-mode-map [?\t] #'term-dynamic-complete) - (defun my/term-send-delete-word-forward () (interactive) (term-send-raw-string "\ed")) - (defun my/term-send-delete-word-backward () (interactive) (term-send-raw-string "\e\C-h")) - (define-key term-raw-map [C-delete] 'my/term-send-delete-word-forward) - (define-key term-raw-map [C-backspace] 'my/term-send-delete-word-backward) - (defun my/term-send-forward-word () (interactive) (term-send-raw-string "\ef")) - (defun my/term-send-backward-word () (interactive) (term-send-raw-string "\eb")) - (define-key term-raw-map [C-left] 'my/term-send-backward-word) - (define-key term-raw-map [C-right] 'my/term-send-forward-word) - (defun my/term-send-m-right () (interactive) (term-send-raw-string "\e[1;3C")) - (defun my/term-send-m-left () (interactive) (term-send-raw-string "\e[1;3D")) - (define-key term-raw-map [M-right] 'my/term-send-m-right) - (define-key term-raw-map [M-left] 'my/term-send-m-left) ) - -(defun my/term-mode-hook () + (defun my-term-send-delete-word-forward () (interactive) (term-send-raw-string "\ed")) + (defun my-term-send-delete-word-backward () (interactive) (term-send-raw-string "\e\C-h")) + (define-key term-raw-map [C-delete] 'my-term-send-delete-word-forward) + (define-key term-raw-map [C-backspace] 'my-term-send-delete-word-backward) + (defun my-term-send-forward-word () (interactive) (term-send-raw-string "\ef")) + (defun my-term-send-backward-word () (interactive) (term-send-raw-string "\eb")) + (define-key term-raw-map [C-left] 'my-term-send-backward-word) + (define-key term-raw-map [C-right] 'my-term-send-forward-word) + (defun my-term-send-m-right () (interactive) (term-send-raw-string "\e[1;3C")) + (defun my-term-send-m-left () (interactive) (term-send-raw-string "\e[1;3D")) + (define-key term-raw-map [M-right] 'my-term-send-m-right) + (define-key term-raw-map [M-left] 'my-term-send-m-left) ) + +(defun my-term-mode-hook () (goto-address-mode 1)) -(add-hook 'term-mode-hook #'my/term-mode-hook) +(add-hook 'term-mode-hook #'my-term-mode-hook) (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") @@ -621,7 +621,7 @@ ;; (setq-default show-trailing-whitespace t) (setq whitespace-style '(face trailing tabs)) -(setq whitespace-global-modes (append my/devel-mode-list my/text-mode-list)) +(setq whitespace-global-modes (append my-devel-mode-list my-text-mode-list)) (ignore-errors (require 'whitespace) (global-whitespace-mode 1)) @@ -721,9 +721,9 @@ x-gtk-show-hidden-files t ) -(defun my/prevent-kill-buffer () +(defun my-prevent-kill-buffer () (if (member (buffer-name) '("*scratch*" "NOTE.org")) nil t)) -(add-to-list 'kill-buffer-query-functions 'my/prevent-kill-buffer) +(add-to-list 'kill-buffer-query-functions 'my-prevent-kill-buffer) (define-key global-map "\C-v" nil) (define-key global-map "\C-vt" (lambda nil (interactive) (switch-to-buffer "*scratch*"))) @@ -731,7 +731,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "scrolling") -(defvar my/scroll-margin 4) +(defvar my-scroll-margin 4) (setq-default ;; Set to zero as this recommend documentation. @@ -744,13 +744,13 @@ ;; Set margin only for desired modes! Do not frustrate calendar any more. (make-variable-buffer-local 'scroll-margin) -(mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my/scroll-margin)))) - (delete-dups (append my/text-mode-hook-list my/devel-mode-hook-list my/scroll-margin-mode-hook-list)) ) +(mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin)))) + (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list)) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "chars, unicode") -(defun my/print-unicode (&optional start end) +(defun my-print-unicode (&optional start end) "Print UNICODE table." (interactive "nstart: \nnend: ") (switch-to-buffer (get-buffer-create "*UNICODE*")) @@ -804,8 +804,8 @@ (global-set-key [M-f7] 'rgrep) -(global-set-key [f7] 'my/ag) -(global-set-key [S-f7] 'my/ag-default-directory) +(global-set-key [f7] 'my-ag) +(global-set-key [S-f7] 'my-ag-default-directory) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "highlighting") @@ -853,9 +853,9 @@ (require 'hl-line) -(defun my/hl-line-range-function () +(defun my-hl-line-range-function () (cons (line-end-position) (line-beginning-position 2))) -(setq hl-line-range-function #'my/hl-line-range-function) +(setq hl-line-range-function #'my-hl-line-range-function) (set-face-attribute 'hl-line nil :inherit nil :background "light yellow") (setq global-hl-line-sticky-flag t) @@ -881,7 +881,7 @@ ;; russian-computer for SHIFT 567 is %^& (setq default-input-method 'russian-computer) -(defun my/toggle-input-method (&optional arg) +(defun my-toggle-input-method (&optional arg) (interactive "P") (if (numberp arg) (cond @@ -899,19 +899,19 @@ (activate-input-method 'TeX)) ) (toggle-input-method arg)) ) -(global-set-key (kbd "C-\\") 'my/toggle-input-method) +(global-set-key (kbd "C-\\") 'my-toggle-input-method) ;; I found this more quick method to allow `forward-word' across pronunciation ;; as a whole word. -(defconst my/ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) +(defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) (when (boundp 'char-script-table) ; Absent in Emacs 22. (mapc (lambda (ch) (aset char-script-table ch 'latin) (modify-syntax-entry ch "w")) - my/ipa-chars)) + my-ipa-chars)) ;; Another option is to invent new category: ;; -;; (defconst my/ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) +;; (defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) ;; (define-category ?p "Phonetic") ;; (mapc (lambda (ch) ;; (cond @@ -920,7 +920,7 @@ ;; (modify-category-entry ch ?l nil t)) ;; ((eq (aref char-script-table ch) 'latin) ; (aref char-script-table ?ˌ) is 'latin but (char-category-set ?ˌ) is ".j" ;; (modify-category-entry ch ?l)))) -;; my/ipa-chars) +;; my-ipa-chars) ;; (add-to-list 'word-combining-categories '(?p . ?l)) ;; (add-to-list 'word-combining-categories '(?l . ?p)) @@ -1105,7 +1105,7 @@ "If buffer too large and my cause performance issue." (< large-file-warning-threshold (buffer-size))) -(define-derived-mode my/large-file-mode fundamental-mode "LargeFile" +(define-derived-mode my-large-file-mode fundamental-mode "LargeFile" "Fixes performance issues in Emacs for large files." ;; (setq buffer-read-only t) (setq bidi-display-reordering nil) @@ -1117,7 +1117,7 @@ (set (make-local-variable 'line-number-mode) nil) (set (make-local-variable 'column-number-mode) nil) ) -(add-to-list 'magic-mode-alist (cons #'my--large-file-p #'my/large-file-mode)) +(add-to-list 'magic-mode-alist (cons #'my--large-file-p #'my-large-file-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "helm") @@ -1142,11 +1142,11 @@ ;; (setq company-backends (delete 'company-dabbrev company-backends)) -(defun my/company-filter-out-numbers (lst) +(defun my-company-filter-out-numbers (lst) (cl-remove-if (lambda (str) (string-match-p "^[0-9]" str)) lst)) (when (featurep 'company) - (add-hook 'company-transformers #'my/company-filter-out-numbers)) + (add-hook 'company-transformers #'my-company-filter-out-numbers)) (defun company-executable (command &optional arg &rest ignored) "Company completion for executable in PATH." @@ -1158,7 +1158,7 @@ ;; (annotation (concat " " (locate-file arg exec-path exec-suffixes))) (meta (concat "Full path: " (locate-file arg exec-path exec-suffixes))))) -(defun my/company-text-setup () +(defun my-company-text-setup () (setq-local company-backends '((company-dabbrev company-files))) (company-mode 1)) @@ -1195,7 +1195,7 @@ ;; dired-recursive-copies 'top ;; dired-recursive-deletes 'top) -(defun my/dired-up-dir () +(defun my-dired-up-dir () "'Reuse' buffer if enter to dir or open new buffer if enter to file." (interactive) ;; (dired-current-directory) always end with trailing '/' char. @@ -1211,9 +1211,9 @@ (dired-goto-file dir) ) )) -(define-key dired-mode-map (kbd "") 'my/dired-up-dir) - -(defun my/dired-enter-to-dir () +(define-key dired-mode-map (kbd "") 'my-dired-up-dir) + +(defun my-dired-enter-to-dir () "'Reuse' buffer if enter to dir or open new buffer if enter to file." (interactive) (let ( (file (dired-get-file-for-visit)) ) @@ -1222,12 +1222,12 @@ (find-file file) ))) (define-key dired-mode-map (kbd "") - 'my/dired-enter-to-dir) + 'my-dired-enter-to-dir) ;; Make behaviour same as in GUI. (unless window-system - (define-key dired-mode-map (kbd "DEL") 'my/dired-up-dir) - (define-key dired-mode-map (kbd "RET") 'my/dired-enter-to-dir)) + (define-key dired-mode-map (kbd "DEL") 'my-dired-up-dir) + (define-key dired-mode-map (kbd "RET") 'my-dired-enter-to-dir)) ;; Enable 'a' command. (put 'dired-find-alternate-file 'disabled nil) @@ -1302,10 +1302,10 @@ ;; http://tools.ietf.org/html/rfc3986 ;; http://en.wikipedia.org/wiki/Percent-encoding -(defun my/percent-decode (str) +(defun my-percent-decode (str) (decode-coding-string (let* ( (s (split-string str "%")) ) - (my/fold + (my-fold 'concat (car s) (mapcar @@ -1314,17 +1314,17 @@ (cdr s)) )) 'utf-8)) -(defun my/percent-decode-region (beg end &optional arg) +(defun my-percent-decode-region (beg end &optional arg) "Convert percent encoded string to native." (interactive "r\nP") - (let ( (result (my/percent-decode (buffer-substring-no-properties beg end))) ) + (let ( (result (my-percent-decode (buffer-substring-no-properties beg end))) ) (if (not arg) result (delete-region beg end) (insert result)) ) ) -(defun my/percent-encode (str) +(defun my-percent-encode (str) (apply 'concat (mapcar (lambda (ch) (if (or (and (<= ?a ch) (>= ?z ch)) @@ -1334,10 +1334,10 @@ (format "%%%02X" ch))) (encode-coding-string str 'utf-8) ))) -(defun my/percent-encode-region (beg end &optional arg) +(defun my-percent-encode-region (beg end &optional arg) "Encode string to percent encoding." (interactive "r\nP") - (let ( (result (my/percent-encode (buffer-substring-no-properties beg end))) ) + (let ( (result (my-percent-encode (buffer-substring-no-properties beg end))) ) (if (not arg) result (delete-region beg end) @@ -1355,7 +1355,7 @@ (t (setq browse-url-browser-function 'browse-url-mozilla))) -(defun my/cygwin-search (str) +(defun my-cygwin-search (str) "Search for Cygwin package on-line." (interactive (list (read-string "Search for Cygwin package on-line: "))) (browse-url (format "http://cygwin.com/cgi-bin2/package-grep.cgi?grep=%s" str)) @@ -1434,21 +1434,21 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "logging, logs") -(defun my/auto-revert-tail-mode-hook () +(defun my-auto-revert-tail-mode-hook () (when (string-match "/logs?/\\|\\.\\(?:log\\|out\\)\\'\\|/.xsession-errors\\'" (buffer-file-name (current-buffer))) (auto-revert-tail-mode 1) (log4-hi-mode 1) - (setq scroll-margin my/scroll-margin) + (setq scroll-margin my-scroll-margin) )) -(add-hook 'find-file-hook 'my/auto-revert-tail-mode-hook) +(add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "auto-fill") (setq-default fill-column 78) -(defvar my/fill-column 100 +(defvar my-fill-column 100 "I use greater value then 78 for comment in prog source.") ;; By default used American convention - sentence and with two spaces. Change @@ -1465,7 +1465,7 @@ (setq-default calc-group-digits t) (setq-default calc-group-char "'") -(defun my/calc-region (arg beg end) +(defun my-calc-region (arg beg end) "Calculate the region and display the result in the echo area. With prefix ARG non-nil, insert the result at the end of region." (interactive "P\nr") @@ -1478,7 +1478,7 @@ (save-excursion (insert result))))) -(defun my/calc-line (arg) +(defun my-calc-line (arg) "Evaluate expression in current line and display the result in the echo area by skipping final '=' sign. With prefix ARG non-nil, insert the result at the end of line and space if @@ -1526,7 +1526,7 @@ (add-hook 'rst-mode-hook #'flyspell-mode)) (when (featurep 'company) - (add-hook 'rst-mode-hook #'my/company-text-setup)) + (add-hook 'rst-mode-hook #'my-company-text-setup)) ;; (add-hook 'rst-mode-hook #'abbrev-mode) ;; (remove-hook 'rst-mode-hook #'abbrev-mode) @@ -1609,7 +1609,7 @@ (info-initialize) )) ;; Info index nodes for automake under Debian. -(defvar my/fix-for-automake-info-lookup +(defvar my-fix-for-automake-info-lookup '(("(automake-1.11)Macro Index" nil "^`" "['(]") ("(automake-1.11)Variable Index" nil @@ -1617,7 +1617,7 @@ ("(automake-1.11)General Index" nil "^`" "['(]"))) -;; Add `my/fix-for-automake-info-lookup' entries to the end of doc-spec for +;; Add `my-fix-for-automake-info-lookup' entries to the end of doc-spec for ;; some modes. (my--eval-after-load info-look (mapc @@ -1626,7 +1626,7 @@ (mapc (lambda (doc-spec-item) (setcdr (last doc-spec) (list doc-spec-item))) - my/fix-for-automake-info-lookup))) + my-fix-for-automake-info-lookup))) '(makefile-mode autoconf-mode)) (info-lookup-maybe-add-help :mode 'makefile-gmake-mode @@ -1678,7 +1678,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "figlet") -(defun my/figlet-region (&optional b e) +(defun my-figlet-region (&optional b e) (interactive "r") (shell-command-on-region b e "figlet" (current-buffer) t) (comment-region (mark) (point))) @@ -1695,7 +1695,7 @@ ;; XXX org-todo-keywords '((sequence "TODO" "START" "|" "DONE")) for org-version 4.67c (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) -(setq org-directory "~/my/gtd") +(setq org-directory "~/my-gtd") (setq org-agenda-ndays 31 org-deadline-warning-days 7 @@ -1709,14 +1709,14 @@ org-tags-column 64 org-archive-save-context-info '(time file olpath todo itags) ) -(defvar my/org-agenda-todo-file (concat org-directory "/TODO.org")) -(defvar my/org-agenda-note-file (concat org-directory "/NOTE.org")) +(defvar my-org-agenda-todo-file (concat org-directory "/TODO.org")) +(defvar my-org-agenda-note-file (concat org-directory "/NOTE.org")) (setq org-agenda-file-regexp "\\`[^.#].*[^_]\\.org\\'" org-agenda-files (list org-directory)) -;; (setq my/org-agenda-learning-file (concat org-directory "/LEARNING.org")) -;; (setq org-agenda-files `(,my/org-agenda-todo-file ,my/org-agenda-note-file ,my/org-agenda-learning-file)) +;; (setq my-org-agenda-learning-file (concat org-directory "/LEARNING.org")) +;; (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file ,my-org-agenda-learning-file)) (define-key global-map "\C-va" 'org-agenda) -(define-key global-map "\C-ve" (lambda nil (interactive) (find-file my/org-agenda-note-file))) +(define-key global-map "\C-ve" (lambda nil (interactive) (find-file my-org-agenda-note-file))) (setq org-todo-keywords '("|" "DONE")) @@ -1742,16 +1742,16 @@ (setq org-support-shift-select t) -(setq org-default-notes-file my/org-agenda-todo-file) +(setq org-default-notes-file my-org-agenda-todo-file) (setq org-capture-templates - '(("t" "Todo" entry (file my/org-agenda-todo-file) "* %?\n SCHEDULED: %T"))) + '(("t" "Todo" entry (file my-org-agenda-todo-file) "* %?\n SCHEDULED: %T"))) (define-key global-map "\C-vr" (lambda () (interactive) (org-capture nil "t"))) (when (featurep 'company) - (add-hook 'org-mode-hook #'my/company-text-setup)) - -(defun my/org-archive-location (path) + (add-hook 'org-mode-hook #'my-company-text-setup)) + +(defun my-org-archive-location (path) "For given PATH make path to archive. Currently add undescore before file extention. If file name doesn't match `org-agenda-file-regexp' or have no extention return `nil'." @@ -1760,11 +1760,11 @@ (concat (file-name-sans-extension path) "_." (file-name-extension path)) nil)) -(defun my/org-archive-file (path) +(defun my-org-archive-file (path) "Move marked by `org-done-keywords' entries to archive file. -Archive file name constructed by `my/org-archive-location'." - (let ( (archive (my/org-archive-location path)) +Archive file name constructed by `my-org-archive-location'." + (let ( (archive (my-org-archive-location path)) entry-re entry-done-re entry-beg entry-end ) (unless archive @@ -1793,19 +1793,19 @@ (save-buffer)) (save-buffer) ))))) -(defun my/org-archive (&optional prefix) +(defun my-org-archive (&optional prefix) "Move all entries marked by `org-done-keywords' to archive -files with name mangled by `my/org-archive-location'. +files with name mangled by `my-org-archive-location'. Without prefix work on current file. With prefix work on `org-agenda-files'." (interactive "P") (loop for file in (if prefix (org-agenda-files) (list (buffer-file-name))) do - (my/org-archive-file file))) + (my-org-archive-file file))) (setq org-agenda-include-diary nil) -(defun my/org-kill-by-tag (tag) +(defun my-org-kill-by-tag (tag) "Put all entries that matches TAG from current org-file to `kill-ring'." (interactive (list (completing-read "Enter tag: " (org-get-buffer-tags)))) (let ( rs (last-command 'kill-region) ) @@ -1821,13 +1821,13 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "TODO, XXX, FIXME highlight") -(dolist (mode (append my/devel-mode-list my/text-mode-list)) +(dolist (mode (append my-devel-mode-list my-text-mode-list)) (font-lock-add-keywords mode `( ( ,(concat "\\<\\(" (regexp-opt '("TODO" "FIX" "FIXME" "HACK" "XXX")) ":?\\)\\>") 1 'font-lock-warning-face t) ;; 64 times, for highlight C-u C-u C-u - ;; ("\\([^[:space:]]\\)\\1\\{63\\}" 0 'my/contrasty-face t) + ;; ("\\([^[:space:]]\\)\\1\\{63\\}" 0 'my-contrasty-face t) )) ) @@ -1838,10 +1838,10 @@ (setq mail-user-agent 'message-user-agent) -(defun my/compose-mail () +(defun my-compose-mail () (interactive) (compose-mail nil nil `(("Organization" . ,(getenv "ORGANIZATION"))))) -(global-set-key (kbd "C-x m") #'my/compose-mail) +(global-set-key (kbd "C-x m") #'my-compose-mail) (setq message-citation-line-format "On %Y-%m-%d, %N wrote: ") @@ -1863,11 +1863,11 @@ (require 'mailabbrev) (define-key message-mode-map "\e\t" 'mail-abbrev-complete-alias)) -(defun my/message-mode-hook () +(defun my-message-mode-hook () (setq fill-column 78) (turn-on-auto-fill) (flyspell-mode 1)) -(add-hook 'message-mode-hook 'my/message-mode-hook) +(add-hook 'message-mode-hook 'my-message-mode-hook) ;; Mark all my messages by "common" string in "Message-Id" field to simplify ;; lookup for followups to me. @@ -1946,13 +1946,13 @@ gnus-save-killed-list t ) -(defun my/kill-gnus () +(defun my-kill-gnus () "Kill Gnus when exiting Emacs." (let ( (gnus-interactive-exit nil) ) (gnus-group-exit) )) (my--eval-after-load gnus - (add-hook 'kill-emacs-hook 'my/kill-gnus)) + (add-hook 'kill-emacs-hook 'my-kill-gnus)) (my--eval-after-load gnus-art (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:\\|^List-URL:\\|^Message-Id:"))) @@ -2032,12 +2032,12 @@ ;; w3m-anchor is macros in newer Emacs, need definition during byte-compilation. (require 'w3m-util))) -(defun my/w3m-view-url () +(defun my-w3m-view-url () (interactive) (browse-url (w3m-anchor))) (my--eval-after-load w3m - (define-key w3m-minor-mode-map (kbd "RET") #'my/w3m-view-url) + (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url) (define-key w3m-minor-mode-map (kbd "S-RET") #'w3m-safe-view-this-url) (define-key w3m-minor-mode-map (kbd "") #'backward-char) (define-key w3m-minor-mode-map (kbd "") #'forward-char) @@ -2164,22 +2164,22 @@ ;; (add-hook 'message-sent-hook 'gnus-score-followup-article) (add-hook 'message-sent-hook 'gnus-score-followup-thread)) -(defvar my/gnus-summary-kill-same-subject-min-len 8 +(defvar my-gnus-summary-kill-same-subject-min-len 8 "Minimal length of subject string to ignore this subject.") -(defun my/gnus-summary-kill-same-subject (&optional unmark) +(defun my-gnus-summary-kill-same-subject (&optional unmark) "Add negative scores for all articles with same subject." (interactive "P") (when (or (not (integerp unmark)) (< 0 unmark)) (let ( (subj (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))) ) - (when (<= (length subj) my/gnus-summary-kill-same-subject-min-len) + (when (<= (length subj) my-gnus-summary-kill-same-subject-min-len) (gnus-summary-score-entry "subject" subj 's (- gnus-score-interactive-default-score) (current-time-string))))) (gnus-summary-kill-same-subject unmark)) (my--eval-after-load gnus-sum - (define-key gnus-summary-mode-map (kbd "C-k") #'my/gnus-summary-kill-same-subject)) - -(defun my/gnus-mark-thread-as-read () + (define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject)) + +(defun my-gnus-mark-thread-as-read () "Mark unmarked articles in current thread as read and move to next thread without selecting article." (interactive) @@ -2191,15 +2191,15 @@ (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) (throw 'exit nil)) ))) (my--eval-after-load gnus-sum - (define-key gnus-summary-mode-map (kbd "H-k") #'my/gnus-mark-thread-as-read)) - -(defun my/gnus-thread-score-function (&rest scores) + (define-key gnus-summary-mode-map (kbd "H-k") #'my-gnus-mark-thread-as-read)) + +(defun my-gnus-thread-score-function (&rest scores) "If any followup have positive score assign greater available score to thread, else assign lesser available score." (let ( (max (apply 'max scores)) (min (apply 'min scores)) ) (if (< 0 max) max min))) -(setq gnus-thread-score-function #'my/gnus-thread-score-function) -(defun my/gnus-thread-total-score () +(setq gnus-thread-score-function #'my-gnus-thread-score-function) +(defun my-gnus-thread-total-score () "Helper to debug `gnus-thread-score-function' function." (interactive) (message @@ -2209,34 +2209,34 @@ ;; Especially highlight my message and replays to me. (my--eval-after-load gnus-sum - (defface my/gnus-own-unread-face nil + (defface my-gnus-own-unread-face nil "Use this face to display own postings in Summary Buffer" - :group 'my/gnus) - (copy-face 'gnus-summary-high-unread-face 'my/gnus-own-unread-face) - (set-face-background 'my/gnus-own-unread-face "linen") + :group 'my-gnus) + (copy-face 'gnus-summary-high-unread-face 'my-gnus-own-unread-face) + (set-face-background 'my-gnus-own-unread-face "linen") (add-to-list 'gnus-summary-highlight - '((and (> score 190) (eq mark gnus-unread-mark)) . my/gnus-own-unread-face)) - (defface my/gnus-own-ancient-face nil + '((and (> score 190) (eq mark gnus-unread-mark)) . my-gnus-own-unread-face)) + (defface my-gnus-own-ancient-face nil "Use this face to display own postings in Summary Buffer" - :group 'my/gnus) - (copy-face 'gnus-summary-high-ancient-face 'my/gnus-own-ancient-face) - (set-face-background 'my/gnus-own-ancient-face "linen") + :group 'my-gnus) + (copy-face 'gnus-summary-high-ancient-face 'my-gnus-own-ancient-face) + (set-face-background 'my-gnus-own-ancient-face "linen") (add-to-list 'gnus-summary-highlight - '((and (> score 190) (eq mark gnus-ancient-mark)) . my/gnus-own-ancient-face)) - (defface my/gnus-own-ticked-face nil + '((and (> score 190) (eq mark gnus-ancient-mark)) . my-gnus-own-ancient-face)) + (defface my-gnus-own-ticked-face nil "Use this face to display own postings in Summary Buffer" - :group 'my/gnus) - (copy-face 'gnus-summary-high-ticked-face 'my/gnus-own-ticked-face) - (set-face-background 'my/gnus-own-ticked-face "linen") + :group 'my-gnus) + (copy-face 'gnus-summary-high-ticked-face 'my-gnus-own-ticked-face) + (set-face-background 'my-gnus-own-ticked-face "linen") (add-to-list 'gnus-summary-highlight - '((and (> score 190) (or (eq mark gnus-dormant-mark) (eq mark gnus-ticked-mark))) . my/gnus-own-ticked-face)) - (defface my/gnus-fup-face nil + '((and (> score 190) (or (eq mark gnus-dormant-mark) (eq mark gnus-ticked-mark))) . my-gnus-own-ticked-face)) + (defface my-gnus-fup-face nil "Use this face to display direct fups to my postings." - :group 'my/gnus) - (copy-face 'gnus-summary-high-unread-face 'my/gnus-fup-face) - (set-face-background 'my/gnus-fup-face "honeydew") + :group 'my-gnus) + (copy-face 'gnus-summary-high-unread-face 'my-gnus-fup-face) + (set-face-background 'my-gnus-fup-face "honeydew") (add-to-list 'gnus-summary-highlight - '((and (<= 90 score) (<= score 110) (eq mark gnus-unread-mark)) . my/gnus-fup-face)) ) + '((and (<= 90 score) (<= score 110) (eq mark gnus-unread-mark)) . my-gnus-fup-face)) ) ;; (setq gnus-home-score-file ;; ;; All groups that match the regexp `"\\.emacs"' @@ -2251,7 +2251,7 @@ (define-key gnus-summary-mode-map [(control down)] 'gnus-summary-next-thread) (define-key gnus-summary-mode-map [(control up)] 'gnus-summary-prev-thread)) -(defun my/gnus-search-web-by-message-id () +(defun my-gnus-search-web-by-message-id () "Search for article archive by Message-Id in Google." (interactive) (let ( (msgid (message-fetch-field "Message-Id")) (subj (message-fetch-field "Subject")) ) @@ -2261,7 +2261,7 @@ (browse-url (format "http://mid.mail-archive.com/%s" (url-encode-url msgid))))) (my--eval-after-load gnus-art - (define-key gnus-article-mode-map [(control return)] #'my/gnus-search-web-by-message-id)) + (define-key gnus-article-mode-map [(control return)] #'my-gnus-search-web-by-message-id)) ;; (setq imap-log t) @@ -2300,11 +2300,11 @@ ;; Handle Emacs exit. (add-hook 'kill-emacs-hook 'jabber-disconnect)) -(defvar my/chat-prompt "[%t] %n>\n") +(defvar my-chat-prompt "[%t] %n>\n") (setq - jabber-chat-foreign-prompt-format my/chat-prompt - jabber-chat-local-prompt-format my/chat-prompt - jabber-groupchat-prompt-format my/chat-prompt + jabber-chat-foreign-prompt-format my-chat-prompt + jabber-chat-local-prompt-format my-chat-prompt + jabber-groupchat-prompt-format my-chat-prompt jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n") (let ( (mgs-list '("Я тутачки, а где Вы меня ожидали?" @@ -2316,13 +2316,13 @@ (setq jabber-default-status (nth (random (length mgs-list)) mgs-list)) ) -(defvar my/jabber-users nil +(defvar my-jabber-users nil "Assoc list of jabber user group. Keys are strings, values are lists of JIDs.") -(defun my/jabber-send (group) - "GROUP is keys from `my/jabber-users'" +(defun my-jabber-send (group) + "GROUP is keys from `my-jabber-users'" (interactive - (list (completing-read "Select group: " my/jabber-users)) + (list (completing-read "Select group: " my-jabber-users)) ) (let ( (msg (if (use-region-p) @@ -2335,12 +2335,12 @@ (lambda (user) (jabber-send-message jc user "" msg "normal") ) - (cdr (assoc group my/jabber-users)) + (cdr (assoc group my-jabber-users)) ) ) ) -(global-set-key (kbd "C-x C-j C-s") 'my/jabber-send) +(global-set-key (kbd "C-x C-j C-s") 'my-jabber-send) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "erc") @@ -2405,21 +2405,21 @@ (setq-default comment-style (quote indent)) (setq-default comment-column 44) -(setq-default comment-fill-column my/fill-column) - -(mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my/fill-column)) )) - (append my/devel-mode-hook-list my/text-mode-hook-list)) - -(mapc (lambda (mode) (add-hook (my/mode2hook mode) #'hs-minor-mode)) +(setq-default comment-fill-column my-fill-column) + +(mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) )) + (append my-devel-mode-hook-list my-text-mode-hook-list)) + +(mapc (lambda (mode) (add-hook (my-mode2hook mode) #'hs-minor-mode)) '(c-mode c++-mode java-mode js-mode lisp-mode emacs-lisp-mode)) -(defun my/company-prog-mode-setup () +(defun my-company-prog-mode-setup () (setq-local company-dabbrev-code-other-buffers 'code) (setq-local company-backends '((company-capf company-dabbrev-code company-files))) (company-mode 1)) (when (featurep 'company) - (add-hook 'prog-mode-hook #'my/company-prog-mode-setup)) + (add-hook 'prog-mode-hook #'my-company-prog-mode-setup)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "diff, patch, ediff, emerge") @@ -2435,8 +2435,8 @@ ;; Disable: sometimes it take a long time to process large hunks. ;; Use C-c C-b on hunk by own. -;; (defun my/diff-auto-refine-mode-on () (diff-auto-refine-mode 1)) -;; (add-hook 'diff-mode-hook 'my/diff-auto-refine-mode-on) +;; (defun my-diff-auto-refine-mode-on () (diff-auto-refine-mode 1)) +;; (add-hook 'diff-mode-hook 'my-diff-auto-refine-mode-on) (when window-system (my--eval-after-load diff-mode @@ -2455,7 +2455,7 @@ ;; (setq vc-git-diff-switches "-b") ;; (setq vc-diff-switches "-b") -(defun my/vc-root-diff (prefix) +(defun my-vc-root-diff (prefix) "Same as `vc-root-diff' but for Hg with C-u show latest MQ patch and with C-u C-u show MQ patch and local changes." (interactive "P") @@ -2473,7 +2473,7 @@ (vc-diff-internal t (list 'Hg (list rootdir)) "qparent" nil)) )))) (call-interactively 'vc-root-diff nil) )) -(global-set-key (kbd "C-x v D") 'my/vc-root-diff) +(global-set-key (kbd "C-x v D") 'my-vc-root-diff) (when window-system (setq @@ -2501,10 +2501,10 @@ (360 . "#0D80E0"))) ) -(defun my/log-edit-mode-hook () +(defun my-log-edit-mode-hook () (setq fill-column 78) ) -(add-hook 'log-edit-mode-hook 'my/log-edit-mode-hook t) +(add-hook 'log-edit-mode-hook 'my-log-edit-mode-hook t) (eval-after-load 'log-edit '(remove-hook 'log-edit-hook 'log-edit-insert-message-template)) @@ -2563,24 +2563,24 @@ (ignore-errors (require 'ansi-color) - (defun my/colorize-compilation-buffer () + (defun my-colorize-compilation-buffer () (when (eq major-mode 'compilation-mode) (ansi-color-apply-on-region compilation-filter-start (point-max)))) - (add-hook 'compilation-filter-hook 'my/colorize-compilation-buffer)) - -(defvar my/comint-send-hist-list nil - "History list for `my/comint-send-string'." + (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer)) + +(defvar my-comint-send-hist-list nil + "History list for `my-comint-send-string'." ) -(defun my/comint-send-string (string) +(defun my-comint-send-string (string) "Send string to comint buffers. Useful for *compilation* read-only buffer. Automaticaly append final newline." (interactive - (list (read-string "Type string: " nil 'my/comint-send-hist-list)) + (list (read-string "Type string: " nil 'my-comint-send-hist-list)) ) (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n")) ) (my--eval-after-load compile - (define-key compilation-mode-map [C-return] 'my/comint-send-string)) + (define-key compilation-mode-map [C-return] 'my-comint-send-string)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "scons") @@ -2623,26 +2623,26 @@ (setq tags-add-tables t) -(defvar my/ido-tag-history nil - "History of tags selected using `my/ido-complete-tag'.") -(defun my/ido-complete-tag (&optional substr) +(defvar my-ido-tag-history nil + "History of tags selected using `my-ido-complete-tag'.") +(defun my-ido-complete-tag (&optional substr) "Find a tag using ido." (tags-completion-table) (let ( tag-names ) (mapatoms (lambda (x) (push (symbol-name x) tag-names)) tags-completion-table) - (ido-completing-read "Tag: " tag-names nil t substr 'my/ido-tag-history))) -(defun my/complete-tag (prefix point) + (ido-completing-read "Tag: " tag-names nil t substr 'my-ido-tag-history))) +(defun my-complete-tag (prefix point) (interactive "P\nd") (if prefix (funcall #'complete-tag) (let ( (bounds (find-tag-default-bounds)) tag ) (if (or (not bounds) (< point (car bounds)) (< (cdr bounds) point)) - (setq tag (my/ido-complete-tag)) - (setq tag (my/ido-complete-tag (buffer-substring (car bounds) (cdr bounds)))) + (setq tag (my-ido-complete-tag)) + (setq tag (my-ido-complete-tag (buffer-substring (car bounds) (cdr bounds)))) (delete-region (car bounds) (cdr bounds))) (insert tag)))) -(global-set-key [M-return] #'my/complete-tag) +(global-set-key [M-return] #'my-complete-tag) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "CEDET, semantic, SRecord") @@ -2703,7 +2703,7 @@ (global-srecode-minor-mode 1) (add-hook 'prog-mode-hook 'srecode-minor-mode) - (defun my/srecode-reload-templates () + (defun my-srecode-reload-templates () "Reload all templates under `srecode-map-load-path'. Useful during template developing." (interactive) @@ -2733,13 +2733,13 @@ ;; (ignore-errors (require 'cedet-idutils)) - (defun my/c-mode-cedet-hook () + (defun my-c-mode-cedet-hook () ;; (local-set-key [C-return] 'semantic-complete-symbol) ;; (local-set-key [C-return] 'semantic-complete-analyze-inline) ;; (local-set-key "." 'semantic-complete-self-insert) ;; (local-set-key ">" 'semantic-complete-self-insert) ) - (add-hook 'c-mode-common-hook 'my/c-mode-cedet-hook) + (add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook) (ignore-errors (require 'semantic/ia) @@ -2761,13 +2761,13 @@ (require 'imenu) -(defun my/imenu-to-menubar () +(defun my-imenu-to-menubar () "Force imenu building when (menu-bar-mode -1)." (when imenu-generic-expression (imenu-add-menubar-index) (run-hooks 'menu-bar-update-hook) )) -(mapc (lambda (hook) (add-hook hook 'my/imenu-to-menubar)) - my/devel-mode-hook-list) +(mapc (lambda (hook) (add-hook hook 'my-imenu-to-menubar)) + my-devel-mode-hook-list) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "windows inf files for driver installin") @@ -2785,19 +2785,19 @@ (add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode) t) -(defun my/makefile-setup () +(defun my-makefile-setup () (add-hook 'completion-at-point-functions 'comint-filename-completion nil t)) -(add-hook 'makefile-mode-hook #'my/makefile-setup) - -(defun my/makefile-company-setup () +(add-hook 'makefile-mode-hook #'my-makefile-setup) + +(defun my-makefile-company-setup () "Limit search for symbols to Makefiles." (setq-local company-dabbrev-code-other-buffers t) (setq-local company-backends '((company-capf company-dabbrev-code company-files company-executable))) (company-mode 1)) (when (featurep 'company) - (add-hook 'makefile-mode-hook #'my/makefile-company-setup)) + (add-hook 'makefile-mode-hook #'my-makefile-company-setup)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "asm, assembler") @@ -2830,7 +2830,7 @@ (setq c-echo-syntactic-information-p t) -(defun my/c-mode-common-hook () +(defun my-c-mode-common-hook () ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon. (c-toggle-auto-newline -1) ;; Delete all preceding whitespace by DEL. @@ -2838,9 +2838,9 @@ ;; Auto indent after typing colon according to `c-hanging-colons-alist'. (c-toggle-electric-state 1) ) -(add-hook 'c-mode-common-hook 'my/c-mode-common-hook) - -(defconst my/c-style +(add-hook 'c-mode-common-hook 'my-c-mode-common-hook) + +(defconst my-c-style '((c-tab-always-indent . t) (c-comment-only-line-offset . 4) (c-hanging-braces-alist @@ -2888,8 +2888,8 @@ (c-echo-syntactic-information-p . t)) "My C Programming Style") -(defun my/c-mode-style-hook () - (c-add-style "my" my/c-style t) +(defun my-c-mode-style-hook () + (c-add-style "my" my-c-style t) ;; If set 'c-default-style' before 'c-add-style' ;; "Undefined style: my" error occured from 'c-get-style-variables'. (setq c-default-style @@ -2900,7 +2900,7 @@ (other . "my") )) ) -(add-hook 'c-mode-common-hook 'my/c-mode-style-hook) +(add-hook 'c-mode-common-hook 'my-c-mode-style-hook) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "python, python-mode") @@ -3020,7 +3020,7 @@ (define-key python-mode-map "\C-c\C-g" 'my-python/eldoc-at-point2) (define-key python-mode-map [?\C-c ?\C-h] 'my-python/send-paragraph)) -(defgroup my/python nil +(defgroup my-python nil "My Python extentions in Emacs." :group 'python) @@ -3053,7 +3053,7 @@ (defcustom my-python/default-checker 'pyflakes "Default Python source code checker. See `my-python/checker-alist' for full alist." - :group 'my/python + :group 'my-python :type (cons 'choice (mapcar (lambda (e) (cons 'const e)) my-python/checker-alist))) (defvar my-python/check-history nil) @@ -3090,17 +3090,17 @@ ;; Automatically save project python buffers before refactorings (setq ropemacs-confirm-saving 'nil) -(defun my/python-add-to-path (path) +(defun my-python-add-to-path (path) (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) (when (featurep 'cygwin-mount) - (setq path (my/dos2cygwin-path path))) + (setq path (my-dos2cygwin-path path))) (python-send-string (format "import sys; sys.path.append(\"%s\")" (expand-file-name path))) ) -(defun my/python-django-fix (path) +(defun my-python-django-fix (path) "XXX not work on Cygwin + naive Emacs." (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) (when (featurep 'cygwin-mount) - (setq path (my/dos2cygwin-path path)) + (setq path (my-dos2cygwin-path path)) ) (let ((file (concat path "manage.py"))) (if (file-exists-p file) @@ -3112,10 +3112,10 @@ ;; (when (>= emacs-major-version 22) ;; (add-hook 'python-mode-hook 'turn-on-eldoc-mode) -(defun my/python-mode-hook () +(defun my-python-mode-hook () (when (and (eq window-system 'w32) (fboundp 'prettify-symbols-mode)) (prettify-symbols-mode -1))) -(add-hook 'python-mode-hook 'my/python-mode-hook) +(add-hook 'python-mode-hook 'my-python-mode-hook) (when (equal window-system 'w32) (add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix))) @@ -3186,9 +3186,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "json") -(defun my/json-mode-hook () +(defun my-json-mode-hook () (set (make-local-variable 'js-indent-level) 2)) -(add-hook 'json-mode-hook #'my/json-mode-hook) +(add-hook 'json-mode-hook #'my-json-mode-hook) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "bat file, batch") @@ -3209,18 +3209,18 @@ (add-hook 'java-mode-hook #'auto-revert-mode) -(defun my/company-java-setup () +(defun my-company-java-setup () (setq-local company-dabbrev-code-other-buffers t) (setq-local company-backends '((company-semantic company-capf company-dabbrev-code))) (company-mode 1)) (when (and (featurep 'semantic) (featurep 'company)) - (add-hook 'java-mode-hook #'my/company-java-setup)) - -(defvar my/java-exeption-dirs nil - "List of dirs to look by `my/java-exeption'.") - -(defun my/java-exeption () - "Look at current line if it like Java exaption and try find file using `my/java-exeption-dirs'" + (add-hook 'java-mode-hook #'my-company-java-setup)) + +(defvar my-java-exeption-dirs nil + "List of dirs to look by `my-java-exeption'.") + +(defun my-java-exeption () + "Look at current line if it like Java exaption and try find file using `my-java-exeption-dirs'" (interactive) (save-excursion (let ( path file line end ) @@ -3238,14 +3238,14 @@ (setq path (cl-some (lambda (dir) (let ((full-path (format "%s/%s/%s.java" dir path file))) (when (file-exists-p full-path) full-path))) - my/java-exeption-dirs)) + my-java-exeption-dirs)) (if (not path) (message "Can't find file %s.java" file) (find-file-other-window path) (goto-line (string-to-int line))))))) (my--eval-after-load log4-hi-mode - (define-key log4-hi-mode-map [C-return] #'my/java-exeption)) + (define-key log4-hi-mode-map [C-return] #'my-java-exeption)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "Pascal") @@ -3305,7 +3305,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "html") -(defun my/html-charref-escape-region (start end) +(defun my-html-charref-escape-region (start end) (interactive "r") (save-excursion (save-restriction @@ -3318,28 +3318,28 @@ (while (search-forward ">") (replace-match ">")) ))) -(defun my/html-charref-from-char (char) +(defun my-html-charref-from-char (char) (format "&#%d;" char) ) -(defun my/html-charref-from-string (string) +(defun my-html-charref-from-string (string) (let ((res "")) (mapc - (lambda (char) (setq res (concat res (my/html-charref-from-char char)))) + (lambda (char) (setq res (concat res (my-html-charref-from-char char)))) string) res ) ) -(defun my/html-charref-escape-region2 (begin end &optional prefix) +(defun my-html-charref-escape-region2 (begin end &optional prefix) (interactive "r\nP") (if prefix (save-excursion (goto-char begin) - (insert (my/html-charref-from-string (delete-and-extract-region begin end)))) - (my/html-charref-from-string (buffer-substring begin end)) + (insert (my-html-charref-from-string (delete-and-extract-region begin end)))) + (my-html-charref-from-string (buffer-substring begin end)) )) -(defun my/html-charref-to-string (html) +(defun my-html-charref-to-string (html) "Return string with replaced decimal/hex and string charrefs by correcponding UTF-8 symbol." (let (str) @@ -3367,13 +3367,13 @@ (replace-match "&" t t)))) )) (buffer-string)))) -(defun my/html-charref-unescape-region (begin end &optional prefix) +(defun my-html-charref-unescape-region (begin end &optional prefix) (interactive "r\nP") (if prefix (save-excursion (goto-char begin) - (insert (my/html-charref-to-string (delete-and-extract-region begin end)))) - (my/html-charref-to-string (buffer-substring begin end)) + (insert (my-html-charref-to-string (delete-and-extract-region begin end)))) + (my-html-charref-to-string (buffer-substring begin end)) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -3466,7 +3466,7 @@ (eval-when 'compile (require 'psgml nil t)) -(defvar my/html-template +(defvar my-html-template '("html" (nil "\n" \n @@ -3484,8 +3484,8 @@ (unless (featurep 'psgml) (setq html-tag-alist (cons - my/html-template - (my/filter + my-html-template + (my-filter (lambda (item) (not (equal (car item) "html"))) html-tag-alist))) (add-to-list 'html-tag-alist '("script" (\n) ("type" "text/javascript") )) @@ -3518,13 +3518,13 @@ (add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode)) -(defun my/sh-company-setup () +(defun my-sh-company-setup () (setq-local company-backends '((company-capf company-files company-dabbrev-code))) (setq-local company-dabbrev-code-other-buffers t) (company-mode 1)) (when (featurep 'company) - (add-hook 'sh-mode-hook #'my/sh-company-setup)) + (add-hook 'sh-mode-hook #'my-sh-company-setup)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "pg, Proof General") @@ -3584,7 +3584,7 @@ (add-hook 'sql-interactive-mode-hook (lambda () (toggle-truncate-lines 1))) -(defun my/sql-explain-paragraph () +(defun my-sql-explain-paragraph () "Send the current paragraph to the SQL process with \"explain \" keyword. Works at least for MySql/MariaDB." (interactive) @@ -3597,7 +3597,7 @@ (sql-send-string (concat "explain " (buffer-substring-no-properties start end))))) (my--eval-after-load sql - (define-key sql-mode-map (kbd "C-c C-e") 'my/sql-explain-paragraph)) + (define-key sql-mode-map (kbd "C-c C-e") 'my-sql-explain-paragraph)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "backuping")