67 |
67 |
68 ;; Prevent Emacs from loading 'default.el', which loaded after '.emacs'. |
68 ;; Prevent Emacs from loading 'default.el', which loaded after '.emacs'. |
69 ;; Also '-q' prevent loading your init file. |
69 ;; Also '-q' prevent loading your init file. |
70 (setq inhibit-default-init nil) ; t/nil |
70 (setq inhibit-default-init nil) ; t/nil |
71 |
71 |
72 (defun my/debug (mode) |
72 (defun my-debug (mode) |
73 "With prefix enable enter to debuger and show backtrace when |
73 "With prefix enable enter to debuger and show backtrace when |
74 problems occur, with double prefix enable debugging on event and |
74 problems occur, with double prefix enable debugging on event and |
75 signal, else disable breaking to debugger." |
75 signal, else disable breaking to debugger." |
76 (interactive "P") |
76 (interactive "P") |
77 (let ( (lvl1 (not (not mode))) (lvl2 (equal mode '(16))) ) |
77 (let ( (lvl1 (not (not mode))) (lvl2 (equal mode '(16))) ) |
83 (cond |
83 (cond |
84 (lvl2 (message "Debugging on quit/event/signal...")) |
84 (lvl2 (message "Debugging on quit/event/signal...")) |
85 (lvl1 (message "Debugging on quit...")) |
85 (lvl1 (message "Debugging on quit...")) |
86 (t (message "Debugging disabled..."))))) |
86 (t (message "Debugging disabled..."))))) |
87 |
87 |
88 (defun my/eval-buffer () |
88 (defun my-eval-buffer () |
89 "Evaluate entire buffer with re-assigning values to `defvar' / `defcustom'. |
89 "Evaluate entire buffer with re-assigning values to `defvar' / `defcustom'. |
90 Useful during package development." |
90 Useful during package development." |
91 (interactive) |
91 (interactive) |
92 (save-excursion |
92 (save-excursion |
93 (goto-char (point-min)) |
93 (goto-char (point-min)) |
94 (while (not (eobp)) |
94 (while (not (eobp)) |
95 (eval-defun nil) |
95 (eval-defun nil) |
96 (end-of-defun)))) |
96 (end-of-defun)))) |
97 |
97 |
98 (defun my/load-library (library) |
98 (defun my-load-library (library) |
99 "Evaluate entire library with re-assigning values to `defvar' / `defcustom'. |
99 "Evaluate entire library with re-assigning values to `defvar' / `defcustom'. |
100 Useful during package development." |
100 Useful during package development." |
101 (interactive |
101 (interactive |
102 (list (completing-read "Load library: " |
102 (list (completing-read "Load library: " |
103 (apply-partially 'locate-file-completion-table |
103 (apply-partially 'locate-file-completion-table |
104 load-path |
104 load-path |
105 '("" ".el"))))) |
105 '("" ".el"))))) |
106 (with-temp-buffer |
106 (with-temp-buffer |
107 (insert-file-contents (locate-file library load-path '("" ".el"))) |
107 (insert-file-contents (locate-file library load-path '("" ".el"))) |
108 (my/eval-buffer))) |
108 (my-eval-buffer))) |
109 |
109 |
110 (my/debug nil) |
110 (my-debug nil) |
111 |
111 |
112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
113 (message "user info") |
113 (message "user info") |
114 |
114 |
115 (eval-when 'compile (require 'info)) |
115 (eval-when 'compile (require 'info)) |
132 (when (boundp 'user-home-page) (concat ", " user-home-page)))) |
132 (when (boundp 'user-home-page) (concat ", " user-home-page)))) |
133 |
133 |
134 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
134 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
135 (message "my defun, defmacro, defvar") |
135 (message "my defun, defmacro, defvar") |
136 |
136 |
137 (defmacro my/filter (pred list) |
137 (defmacro my-filter (pred list) |
138 "Construct list with elements from LIST which satisfy PRED." |
138 "Construct list with elements from LIST which satisfy PRED." |
139 (let ( (r (make-symbol "r_")) ) |
139 (let ( (r (make-symbol "r_")) ) |
140 `(let ( (,r (list nil)) ) |
140 `(let ( (,r (list nil)) ) |
141 (mapc (lambda (item) |
141 (mapc (lambda (item) |
142 (when (,pred item) |
142 (when (,pred item) |
143 (nconc ,r (cons item nil)))) |
143 (nconc ,r (cons item nil)))) |
144 ,list) |
144 ,list) |
145 (cdr ,r)))) |
145 (cdr ,r)))) |
146 |
146 |
147 (defun my/fold (f x list) |
147 (defun my-fold (f x list) |
148 "Recursively applies (F i j) to LIST starting with X. |
148 "Recursively applies (F i j) to LIST starting with X. |
149 For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)." |
149 For example, (fold F X '(1 2 3)) computes (F (F (F X 1) 2) 3)." |
150 (let ((li list) (x2 x)) |
150 (let ((li list) (x2 x)) |
151 (while li |
151 (while li |
152 (setq x2 (funcall f x2 (pop li))) |
152 (setq x2 (funcall f x2 (pop li))) |
181 |
181 |
182 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) |
182 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) |
183 (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) |
183 (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) |
184 (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) |
184 (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) |
185 |
185 |
186 (defun my/emacs-lisp-mode-hook () |
186 (defun my-emacs-lisp-mode-hook () |
187 (setq tab-width 8)) |
187 (setq tab-width 8)) |
188 (add-hook 'emacs-lisp-mode-hook 'my/emacs-lisp-mode-hook) |
188 (add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook) |
189 |
189 |
190 (defun my/elisp-find-tag () |
190 (defun my-elisp-find-tag () |
191 (interactive) |
191 (interactive) |
192 (require 'etags) |
192 (require 'etags) |
193 (ring-insert find-tag-marker-ring (point-marker)) |
193 (ring-insert find-tag-marker-ring (point-marker)) |
194 (unless (find-variable-at-point) |
194 (unless (find-variable-at-point) |
195 (find-function-at-point) |
195 (find-function-at-point) |
196 )) |
196 )) |
197 ;; Goto elisp definition. |
197 ;; Goto elisp definition. |
198 (define-key emacs-lisp-mode-map (kbd "M-.") 'my/elisp-find-tag) |
198 (define-key emacs-lisp-mode-map (kbd "M-.") 'my-elisp-find-tag) |
199 |
199 |
200 (if (not (fboundp 'global-prettify-symbols-mode)) |
200 (if (not (fboundp 'global-prettify-symbols-mode)) |
201 ;; http://www.emacswiki.org/emacs/PrettyLambda |
201 ;; http://www.emacswiki.org/emacs/PrettyLambda |
202 (font-lock-add-keywords |
202 (font-lock-add-keywords |
203 'emacs-lisp-mode |
203 'emacs-lisp-mode |
204 `(("(\\<\\(lambda\\)\\>" |
204 `(("(\\<\\(lambda\\)\\>" |
205 (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) ))) |
205 (1 (progn (compose-region (match-beginning 1) (match-end 1) ,(make-char 'greek-iso8859-7 107)) font-lock-keyword-face)) ))) |
206 (global-prettify-symbols-mode 1)) |
206 (global-prettify-symbols-mode 1)) |
207 |
207 |
208 (defun my/dump-funcs () |
208 (defun my-dump-funcs () |
209 "Dump all function calls in current buffer. Useful to explore |
209 "Dump all function calls in current buffer. Useful to explore |
210 elisp API from somebody else files." |
210 elisp API from somebody else files." |
211 (interactive) |
211 (interactive) |
212 (let* ( (cur-buffer (current-buffer)) (new-buffer (get-buffer-create (concat (buffer-name cur-buffer) "-funcs.el"))) symb ) |
212 (let* ( (cur-buffer (current-buffer)) (new-buffer (get-buffer-create (concat (buffer-name cur-buffer) "-funcs.el"))) symb ) |
213 (while (search-forward-regexp "([[:alnum:]*]" nil t) |
213 (while (search-forward-regexp "([[:alnum:]*]" nil t) |
234 (mapcar ',name tree) |
234 (mapcar ',name tree) |
235 ) |
235 ) |
236 (t (error "Only tree of symbols allowed")) |
236 (t (error "Only tree of symbols allowed")) |
237 ))) |
237 ))) |
238 |
238 |
239 (my/defun-rename-symb-tree |
239 (my-defun-rename-symb-tree |
240 my/feature2mode |
240 my-feature2mode |
241 "Convert TREE of features to TREE of modes for these features. Single symbol allowed." |
241 "Convert TREE of features to TREE of modes for these features. Single symbol allowed." |
242 (lambda (symb) (intern (concat (symbol-name symb) "-mode")))) |
242 (lambda (symb) (intern (concat (symbol-name symb) "-mode")))) |
243 |
243 |
244 (my/defun-rename-symb-tree |
244 (my-defun-rename-symb-tree |
245 my/mode2hook |
245 my-mode2hook |
246 "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed." |
246 "Convert TREE of modes to TREE of hooks for these modes. Single symbol allowed." |
247 (lambda (symb) (intern (concat (symbol-name symb) "-hook"))) |
247 (lambda (symb) (intern (concat (symbol-name symb) "-hook"))) |
248 ) |
248 ) |
249 |
249 |
250 (my/defun-rename-symb-tree |
250 (my-defun-rename-symb-tree |
251 my/mode2modemap |
251 my-mode2modemap |
252 "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed." |
252 "Convert TREE of modes to TREE of keymaps for these modes. Single symbol allowed." |
253 (lambda (symb) (intern (concat (symbol-name symb) "-map"))) |
253 (lambda (symb) (intern (concat (symbol-name symb) "-map"))) |
254 ) |
254 ) |
255 |
255 |
256 (defvar my/devel-mode-list |
256 (defvar my-devel-mode-list |
257 '( |
257 '( |
258 sh-mode script-mode tcl-mode |
258 sh-mode script-mode tcl-mode |
259 c-mode c++-mode java-mode js-mode |
259 c-mode c++-mode java-mode js-mode |
260 python-mode perl-mode cperl-mode |
260 python-mode perl-mode cperl-mode |
261 lisp-mode |
261 lisp-mode |
285 compilation-mode |
285 compilation-mode |
286 conf-mode |
286 conf-mode |
287 ) |
287 ) |
288 "List of modes for enabling scroll margin.") |
288 "List of modes for enabling scroll margin.") |
289 |
289 |
290 (defvar my/scroll-margin-mode-hook-list |
290 (defvar my-scroll-margin-mode-hook-list |
291 (my/mode2hook my/scroll-margin-mode-list) |
291 (my-mode2hook my-scroll-margin-mode-list) |
292 "List of mode hooks for enabling scroll margin.") |
292 "List of mode hooks for enabling scroll margin.") |
293 |
293 |
294 (defvar my/text-mode-list |
294 (defvar my-text-mode-list |
295 '( |
295 '( |
296 text-mode |
296 text-mode |
297 outline-mode |
297 outline-mode |
298 rst-mode |
298 rst-mode |
299 diff-mode |
299 diff-mode |
300 dict-c5-mode |
300 dict-c5-mode |
301 ) |
301 ) |
302 "List of text modes.") |
302 "List of text modes.") |
303 |
303 |
304 (defvar my/text-mode-hook-list |
304 (defvar my-text-mode-hook-list |
305 (my/mode2hook my/text-mode-list) |
305 (my-mode2hook my-text-mode-list) |
306 "List of text mode hooks.") |
306 "List of text mode hooks.") |
307 |
307 |
308 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
308 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
309 (message "MS Windows, w32, win32") |
309 (message "MS Windows, w32, win32") |
310 |
310 |
363 (add-to-list 'initial-frame-alist (cons 'height ty)) )) |
363 (add-to-list 'initial-frame-alist (cons 'height ty)) )) |
364 |
364 |
365 (when window-system |
365 (when window-system |
366 (if (fboundp 'toggle-frame-maximized) |
366 (if (fboundp 'toggle-frame-maximized) |
367 (toggle-frame-maximized) |
367 (toggle-frame-maximized) |
368 (my/maximize) )) |
368 (my-maximize) )) |
369 |
369 |
370 (menu-bar-mode -1) |
370 (menu-bar-mode -1) |
371 (when window-system |
371 (when window-system |
372 (mouse-avoidance-mode 'animate) |
372 (mouse-avoidance-mode 'animate) |
373 (scroll-bar-mode 1) |
373 (scroll-bar-mode 1) |
374 (tool-bar-mode -1) |
374 (tool-bar-mode -1) |
375 (tooltip-mode -1) |
375 (tooltip-mode -1) |
376 (setq-default line-spacing nil) |
376 (setq-default line-spacing nil) |
377 (defun my/popup-menu () |
377 (defun my-popup-menu () |
378 "Menu from keyboard by emulating mouse event." |
378 "Menu from keyboard by emulating mouse event." |
379 (interactive) |
379 (interactive) |
380 (mouse-popup-menubar |
380 (mouse-popup-menubar |
381 (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name))) |
381 (list (list (/ (display-pixel-width) 2) 10) (get-buffer-window (buffer-name))) |
382 nil) ) |
382 nil) ) |
383 (global-set-key [f10] 'my/popup-menu) |
383 (global-set-key [f10] 'my-popup-menu) |
384 (global-set-key [apps] 'my/popup-menu) |
384 (global-set-key [apps] 'my-popup-menu) |
385 (global-set-key [menu] 'my/popup-menu) ) |
385 (global-set-key [menu] 'my-popup-menu) ) |
386 |
386 |
387 ;; Prefer horizontal windows splitting. |
387 ;; Prefer horizontal windows splitting. |
388 (when (>= emacs-major-version 23) |
388 (when (>= emacs-major-version 23) |
389 (setq split-height-threshold nil) |
389 (setq split-height-threshold nil) |
390 (setq split-width-threshold nil) |
390 (setq split-width-threshold nil) |
584 (setq term-scroll-show-maximum-output t) |
584 (setq term-scroll-show-maximum-output t) |
585 |
585 |
586 (my--eval-after-load term |
586 (my--eval-after-load term |
587 (define-key term-mode-map [?\t] #'term-dynamic-complete) |
587 (define-key term-mode-map [?\t] #'term-dynamic-complete) |
588 |
588 |
589 (defun my/term-send-delete-word-forward () (interactive) (term-send-raw-string "\ed")) |
589 (defun my-term-send-delete-word-forward () (interactive) (term-send-raw-string "\ed")) |
590 (defun my/term-send-delete-word-backward () (interactive) (term-send-raw-string "\e\C-h")) |
590 (defun my-term-send-delete-word-backward () (interactive) (term-send-raw-string "\e\C-h")) |
591 (define-key term-raw-map [C-delete] 'my/term-send-delete-word-forward) |
591 (define-key term-raw-map [C-delete] 'my-term-send-delete-word-forward) |
592 (define-key term-raw-map [C-backspace] 'my/term-send-delete-word-backward) |
592 (define-key term-raw-map [C-backspace] 'my-term-send-delete-word-backward) |
593 (defun my/term-send-forward-word () (interactive) (term-send-raw-string "\ef")) |
593 (defun my-term-send-forward-word () (interactive) (term-send-raw-string "\ef")) |
594 (defun my/term-send-backward-word () (interactive) (term-send-raw-string "\eb")) |
594 (defun my-term-send-backward-word () (interactive) (term-send-raw-string "\eb")) |
595 (define-key term-raw-map [C-left] 'my/term-send-backward-word) |
595 (define-key term-raw-map [C-left] 'my-term-send-backward-word) |
596 (define-key term-raw-map [C-right] 'my/term-send-forward-word) |
596 (define-key term-raw-map [C-right] 'my-term-send-forward-word) |
597 (defun my/term-send-m-right () (interactive) (term-send-raw-string "\e[1;3C")) |
597 (defun my-term-send-m-right () (interactive) (term-send-raw-string "\e[1;3C")) |
598 (defun my/term-send-m-left () (interactive) (term-send-raw-string "\e[1;3D")) |
598 (defun my-term-send-m-left () (interactive) (term-send-raw-string "\e[1;3D")) |
599 (define-key term-raw-map [M-right] 'my/term-send-m-right) |
599 (define-key term-raw-map [M-right] 'my-term-send-m-right) |
600 (define-key term-raw-map [M-left] 'my/term-send-m-left) ) |
600 (define-key term-raw-map [M-left] 'my-term-send-m-left) ) |
601 |
601 |
602 (defun my/term-mode-hook () |
602 (defun my-term-mode-hook () |
603 (goto-address-mode 1)) |
603 (goto-address-mode 1)) |
604 (add-hook 'term-mode-hook #'my/term-mode-hook) |
604 (add-hook 'term-mode-hook #'my-term-mode-hook) |
605 |
605 |
606 (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") |
606 (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") |
607 |
607 |
608 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
608 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
609 (message "proced") |
609 (message "proced") |
719 (setq |
719 (setq |
720 use-dialog-box t |
720 use-dialog-box t |
721 x-gtk-show-hidden-files t |
721 x-gtk-show-hidden-files t |
722 ) |
722 ) |
723 |
723 |
724 (defun my/prevent-kill-buffer () |
724 (defun my-prevent-kill-buffer () |
725 (if (member (buffer-name) '("*scratch*" "NOTE.org")) nil t)) |
725 (if (member (buffer-name) '("*scratch*" "NOTE.org")) nil t)) |
726 (add-to-list 'kill-buffer-query-functions 'my/prevent-kill-buffer) |
726 (add-to-list 'kill-buffer-query-functions 'my-prevent-kill-buffer) |
727 |
727 |
728 (define-key global-map "\C-v" nil) |
728 (define-key global-map "\C-v" nil) |
729 (define-key global-map "\C-vt" (lambda nil (interactive) (switch-to-buffer "*scratch*"))) |
729 (define-key global-map "\C-vt" (lambda nil (interactive) (switch-to-buffer "*scratch*"))) |
730 |
730 |
731 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
731 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
732 (message "scrolling") |
732 (message "scrolling") |
733 |
733 |
734 (defvar my/scroll-margin 4) |
734 (defvar my-scroll-margin 4) |
735 |
735 |
736 (setq-default |
736 (setq-default |
737 ;; Set to zero as this recommend documentation. |
737 ;; Set to zero as this recommend documentation. |
738 scroll-step 0 |
738 scroll-step 0 |
739 ;; If the value is greater than 100, redisplay will never recenter point, but |
739 ;; If the value is greater than 100, redisplay will never recenter point, but |
742 scroll-preserve-screen-position t |
742 scroll-preserve-screen-position t |
743 ) |
743 ) |
744 |
744 |
745 ;; Set margin only for desired modes! Do not frustrate calendar any more. |
745 ;; Set margin only for desired modes! Do not frustrate calendar any more. |
746 (make-variable-buffer-local 'scroll-margin) |
746 (make-variable-buffer-local 'scroll-margin) |
747 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my/scroll-margin)))) |
747 (mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin my-scroll-margin)))) |
748 (delete-dups (append my/text-mode-hook-list my/devel-mode-hook-list my/scroll-margin-mode-hook-list)) ) |
748 (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list my-scroll-margin-mode-hook-list)) ) |
749 |
749 |
750 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
750 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
751 (message "chars, unicode") |
751 (message "chars, unicode") |
752 |
752 |
753 (defun my/print-unicode (&optional start end) |
753 (defun my-print-unicode (&optional start end) |
754 "Print UNICODE table." |
754 "Print UNICODE table." |
755 (interactive "nstart: \nnend: ") |
755 (interactive "nstart: \nnend: ") |
756 (switch-to-buffer (get-buffer-create "*UNICODE*")) |
756 (switch-to-buffer (get-buffer-create "*UNICODE*")) |
757 (erase-buffer) |
757 (erase-buffer) |
758 (let ( (i start) ) |
758 (let ( (i start) ) |
897 (activate-input-method 'ipa-x-sampa)) |
897 (activate-input-method 'ipa-x-sampa)) |
898 ((eq arg 6) |
898 ((eq arg 6) |
899 (activate-input-method 'TeX)) ) |
899 (activate-input-method 'TeX)) ) |
900 (toggle-input-method arg)) ) |
900 (toggle-input-method arg)) ) |
901 |
901 |
902 (global-set-key (kbd "C-\\") 'my/toggle-input-method) |
902 (global-set-key (kbd "C-\\") 'my-toggle-input-method) |
903 |
903 |
904 ;; I found this more quick method to allow `forward-word' across pronunciation |
904 ;; I found this more quick method to allow `forward-word' across pronunciation |
905 ;; as a whole word. |
905 ;; as a whole word. |
906 (defconst my/ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) |
906 (defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) |
907 (when (boundp 'char-script-table) ; Absent in Emacs 22. |
907 (when (boundp 'char-script-table) ; Absent in Emacs 22. |
908 (mapc (lambda (ch) |
908 (mapc (lambda (ch) |
909 (aset char-script-table ch 'latin) |
909 (aset char-script-table ch 'latin) |
910 (modify-syntax-entry ch "w")) |
910 (modify-syntax-entry ch "w")) |
911 my/ipa-chars)) |
911 my-ipa-chars)) |
912 ;; Another option is to invent new category: |
912 ;; Another option is to invent new category: |
913 ;; |
913 ;; |
914 ;; (defconst my/ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) |
914 ;; (defconst my-ipa-chars (list ?ˈ ?ˌ ?ː ?ǁ ?ʲ ?θ ?ð ?ŋ ?ɡ ?ʒ ?ʃ ?ʧ ?ə ?ɜ ?ɛ ?ʌ ?ɒ ?ɔ ?ɑ ?æ ?ʊ ?ɪ)) |
915 ;; (define-category ?p "Phonetic") |
915 ;; (define-category ?p "Phonetic") |
916 ;; (mapc (lambda (ch) |
916 ;; (mapc (lambda (ch) |
917 ;; (cond |
917 ;; (cond |
918 ;; ((eq (aref char-script-table ch) 'phonetic) |
918 ;; ((eq (aref char-script-table ch) 'phonetic) |
919 ;; (modify-category-entry ch ?p) |
919 ;; (modify-category-entry ch ?p) |
920 ;; (modify-category-entry ch ?l nil t)) |
920 ;; (modify-category-entry ch ?l nil t)) |
921 ;; ((eq (aref char-script-table ch) 'latin) ; (aref char-script-table ?ˌ) is 'latin but (char-category-set ?ˌ) is ".j" |
921 ;; ((eq (aref char-script-table ch) 'latin) ; (aref char-script-table ?ˌ) is 'latin but (char-category-set ?ˌ) is ".j" |
922 ;; (modify-category-entry ch ?l)))) |
922 ;; (modify-category-entry ch ?l)))) |
923 ;; my/ipa-chars) |
923 ;; my-ipa-chars) |
924 ;; (add-to-list 'word-combining-categories '(?p . ?l)) |
924 ;; (add-to-list 'word-combining-categories '(?p . ?l)) |
925 ;; (add-to-list 'word-combining-categories '(?l . ?p)) |
925 ;; (add-to-list 'word-combining-categories '(?l . ?p)) |
926 |
926 |
927 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
927 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
928 (message "mouse") |
928 (message "mouse") |
1140 (setq company-dabbrev-downcase nil) |
1140 (setq company-dabbrev-downcase nil) |
1141 (setq company-dabbrev-ignore-case nil) |
1141 (setq company-dabbrev-ignore-case nil) |
1142 |
1142 |
1143 ;; (setq company-backends (delete 'company-dabbrev company-backends)) |
1143 ;; (setq company-backends (delete 'company-dabbrev company-backends)) |
1144 |
1144 |
1145 (defun my/company-filter-out-numbers (lst) |
1145 (defun my-company-filter-out-numbers (lst) |
1146 (cl-remove-if (lambda (str) (string-match-p "^[0-9]" str)) lst)) |
1146 (cl-remove-if (lambda (str) (string-match-p "^[0-9]" str)) lst)) |
1147 |
1147 |
1148 (when (featurep 'company) |
1148 (when (featurep 'company) |
1149 (add-hook 'company-transformers #'my/company-filter-out-numbers)) |
1149 (add-hook 'company-transformers #'my-company-filter-out-numbers)) |
1150 |
1150 |
1151 (defun company-executable (command &optional arg &rest ignored) |
1151 (defun company-executable (command &optional arg &rest ignored) |
1152 "Company completion for executable in PATH." |
1152 "Company completion for executable in PATH." |
1153 (interactive (list 'interactive)) |
1153 (interactive (list 'interactive)) |
1154 (cl-case command |
1154 (cl-case command |
1209 (when (file-directory-p upperdir) |
1209 (when (file-directory-p upperdir) |
1210 (find-alternate-file upperdir) |
1210 (find-alternate-file upperdir) |
1211 (dired-goto-file dir) |
1211 (dired-goto-file dir) |
1212 ) |
1212 ) |
1213 )) |
1213 )) |
1214 (define-key dired-mode-map (kbd "<backspace>") 'my/dired-up-dir) |
1214 (define-key dired-mode-map (kbd "<backspace>") 'my-dired-up-dir) |
1215 |
1215 |
1216 (defun my/dired-enter-to-dir () |
1216 (defun my-dired-enter-to-dir () |
1217 "'Reuse' buffer if enter to dir or open new buffer if enter to file." |
1217 "'Reuse' buffer if enter to dir or open new buffer if enter to file." |
1218 (interactive) |
1218 (interactive) |
1219 (let ( (file (dired-get-file-for-visit)) ) |
1219 (let ( (file (dired-get-file-for-visit)) ) |
1220 (if (file-directory-p file) |
1220 (if (file-directory-p file) |
1221 (find-alternate-file file) |
1221 (find-alternate-file file) |
1222 (find-file file) |
1222 (find-file file) |
1223 ))) |
1223 ))) |
1224 (define-key dired-mode-map (kbd "<return>") |
1224 (define-key dired-mode-map (kbd "<return>") |
1225 'my/dired-enter-to-dir) |
1225 'my-dired-enter-to-dir) |
1226 |
1226 |
1227 ;; Make behaviour same as in GUI. |
1227 ;; Make behaviour same as in GUI. |
1228 (unless window-system |
1228 (unless window-system |
1229 (define-key dired-mode-map (kbd "DEL") 'my/dired-up-dir) |
1229 (define-key dired-mode-map (kbd "DEL") 'my-dired-up-dir) |
1230 (define-key dired-mode-map (kbd "RET") 'my/dired-enter-to-dir)) |
1230 (define-key dired-mode-map (kbd "RET") 'my-dired-enter-to-dir)) |
1231 |
1231 |
1232 ;; Enable 'a' command. |
1232 ;; Enable 'a' command. |
1233 (put 'dired-find-alternate-file 'disabled nil) |
1233 (put 'dired-find-alternate-file 'disabled nil) |
1234 |
1234 |
1235 (defvar my--file-name-tmp-refex |
1235 (defvar my--file-name-tmp-refex |
1300 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1300 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1301 (message "url") |
1301 (message "url") |
1302 |
1302 |
1303 ;; http://tools.ietf.org/html/rfc3986 |
1303 ;; http://tools.ietf.org/html/rfc3986 |
1304 ;; http://en.wikipedia.org/wiki/Percent-encoding |
1304 ;; http://en.wikipedia.org/wiki/Percent-encoding |
1305 (defun my/percent-decode (str) |
1305 (defun my-percent-decode (str) |
1306 (decode-coding-string |
1306 (decode-coding-string |
1307 (let* ( (s (split-string str "%")) ) |
1307 (let* ( (s (split-string str "%")) ) |
1308 (my/fold |
1308 (my-fold |
1309 'concat |
1309 'concat |
1310 (car s) |
1310 (car s) |
1311 (mapcar |
1311 (mapcar |
1312 (lambda (x) |
1312 (lambda (x) |
1313 (concat (unibyte-string (string-to-number (substring x 0 2) 16)) (substring x 2))) |
1313 (concat (unibyte-string (string-to-number (substring x 0 2) 16)) (substring x 2))) |
1314 (cdr s)) |
1314 (cdr s)) |
1315 )) 'utf-8)) |
1315 )) 'utf-8)) |
1316 |
1316 |
1317 (defun my/percent-decode-region (beg end &optional arg) |
1317 (defun my-percent-decode-region (beg end &optional arg) |
1318 "Convert percent encoded string to native." |
1318 "Convert percent encoded string to native." |
1319 (interactive "r\nP") |
1319 (interactive "r\nP") |
1320 (let ( (result (my/percent-decode (buffer-substring-no-properties beg end))) ) |
1320 (let ( (result (my-percent-decode (buffer-substring-no-properties beg end))) ) |
1321 (if (not arg) |
1321 (if (not arg) |
1322 result |
1322 result |
1323 (delete-region beg end) |
1323 (delete-region beg end) |
1324 (insert result)) |
1324 (insert result)) |
1325 ) ) |
1325 ) ) |
1326 |
1326 |
1327 (defun my/percent-encode (str) |
1327 (defun my-percent-encode (str) |
1328 (apply 'concat |
1328 (apply 'concat |
1329 (mapcar |
1329 (mapcar |
1330 (lambda (ch) (if (or (and (<= ?a ch) (>= ?z ch)) |
1330 (lambda (ch) (if (or (and (<= ?a ch) (>= ?z ch)) |
1331 (and (<= ?A ch) (>= ?Z ch)) |
1331 (and (<= ?A ch) (>= ?Z ch)) |
1332 (memq ch '(?- ?_ ?. ?~))) |
1332 (memq ch '(?- ?_ ?. ?~))) |
1333 (char-to-string ch) |
1333 (char-to-string ch) |
1334 (format "%%%02X" ch))) |
1334 (format "%%%02X" ch))) |
1335 (encode-coding-string str 'utf-8) ))) |
1335 (encode-coding-string str 'utf-8) ))) |
1336 |
1336 |
1337 (defun my/percent-encode-region (beg end &optional arg) |
1337 (defun my-percent-encode-region (beg end &optional arg) |
1338 "Encode string to percent encoding." |
1338 "Encode string to percent encoding." |
1339 (interactive "r\nP") |
1339 (interactive "r\nP") |
1340 (let ( (result (my/percent-encode (buffer-substring-no-properties beg end))) ) |
1340 (let ( (result (my-percent-encode (buffer-substring-no-properties beg end))) ) |
1341 (if (not arg) |
1341 (if (not arg) |
1342 result |
1342 result |
1343 (delete-region beg end) |
1343 (delete-region beg end) |
1344 (insert result)) |
1344 (insert result)) |
1345 ) ) |
1345 ) ) |
1432 (add-hook 'write-file-hooks 'time-stamp) |
1432 (add-hook 'write-file-hooks 'time-stamp) |
1433 |
1433 |
1434 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1434 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1435 (message "logging, logs") |
1435 (message "logging, logs") |
1436 |
1436 |
1437 (defun my/auto-revert-tail-mode-hook () |
1437 (defun my-auto-revert-tail-mode-hook () |
1438 (when (string-match "/logs?/\\|\\.\\(?:log\\|out\\)\\'\\|/.xsession-errors\\'" |
1438 (when (string-match "/logs?/\\|\\.\\(?:log\\|out\\)\\'\\|/.xsession-errors\\'" |
1439 (buffer-file-name (current-buffer))) |
1439 (buffer-file-name (current-buffer))) |
1440 (auto-revert-tail-mode 1) |
1440 (auto-revert-tail-mode 1) |
1441 (log4-hi-mode 1) |
1441 (log4-hi-mode 1) |
1442 (setq scroll-margin my/scroll-margin) |
1442 (setq scroll-margin my-scroll-margin) |
1443 )) |
1443 )) |
1444 (add-hook 'find-file-hook 'my/auto-revert-tail-mode-hook) |
1444 (add-hook 'find-file-hook 'my-auto-revert-tail-mode-hook) |
1445 |
1445 |
1446 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1446 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1447 (message "auto-fill") |
1447 (message "auto-fill") |
1448 |
1448 |
1449 (setq-default fill-column 78) |
1449 (setq-default fill-column 78) |
1450 |
1450 |
1451 (defvar my/fill-column 100 |
1451 (defvar my-fill-column 100 |
1452 "I use greater value then 78 for comment in prog source.") |
1452 "I use greater value then 78 for comment in prog source.") |
1453 |
1453 |
1454 ;; By default used American convention - sentence and with two spaces. Change |
1454 ;; By default used American convention - sentence and with two spaces. Change |
1455 ;; it to one space. Has affect on filling and M-a, M-e commands. |
1455 ;; it to one space. Has affect on filling and M-a, M-e commands. |
1456 (setq sentence-end-double-space nil) |
1456 (setq sentence-end-double-space nil) |
1607 (let ( (path-separator ":") ) |
1607 (let ( (path-separator ":") ) |
1608 (require 'info) |
1608 (require 'info) |
1609 (info-initialize) )) |
1609 (info-initialize) )) |
1610 |
1610 |
1611 ;; Info index nodes for automake under Debian. |
1611 ;; Info index nodes for automake under Debian. |
1612 (defvar my/fix-for-automake-info-lookup |
1612 (defvar my-fix-for-automake-info-lookup |
1613 '(("(automake-1.11)Macro Index" nil |
1613 '(("(automake-1.11)Macro Index" nil |
1614 "^`" "['(]") |
1614 "^`" "['(]") |
1615 ("(automake-1.11)Variable Index" nil |
1615 ("(automake-1.11)Variable Index" nil |
1616 "^`" "['(]") |
1616 "^`" "['(]") |
1617 ("(automake-1.11)General Index" nil |
1617 ("(automake-1.11)General Index" nil |
1618 "^`" "['(]"))) |
1618 "^`" "['(]"))) |
1619 |
1619 |
1620 ;; Add `my/fix-for-automake-info-lookup' entries to the end of doc-spec for |
1620 ;; Add `my-fix-for-automake-info-lookup' entries to the end of doc-spec for |
1621 ;; some modes. |
1621 ;; some modes. |
1622 (my--eval-after-load info-look |
1622 (my--eval-after-load info-look |
1623 (mapc |
1623 (mapc |
1624 (lambda (mode) |
1624 (lambda (mode) |
1625 (let ( (doc-spec (info-lookup->doc-spec 'symbol mode)) ) |
1625 (let ( (doc-spec (info-lookup->doc-spec 'symbol mode)) ) |
1626 (mapc |
1626 (mapc |
1627 (lambda (doc-spec-item) |
1627 (lambda (doc-spec-item) |
1628 (setcdr (last doc-spec) (list doc-spec-item))) |
1628 (setcdr (last doc-spec) (list doc-spec-item))) |
1629 my/fix-for-automake-info-lookup))) |
1629 my-fix-for-automake-info-lookup))) |
1630 '(makefile-mode autoconf-mode)) |
1630 '(makefile-mode autoconf-mode)) |
1631 (info-lookup-maybe-add-help |
1631 (info-lookup-maybe-add-help |
1632 :mode 'makefile-gmake-mode |
1632 :mode 'makefile-gmake-mode |
1633 :other-modes '(makefile-mode))) |
1633 :other-modes '(makefile-mode))) |
1634 |
1634 |
1707 org-reverse-note-order t |
1707 org-reverse-note-order t |
1708 org-hide-leading-stars t |
1708 org-hide-leading-stars t |
1709 org-tags-column 64 |
1709 org-tags-column 64 |
1710 org-archive-save-context-info '(time file olpath todo itags) |
1710 org-archive-save-context-info '(time file olpath todo itags) |
1711 ) |
1711 ) |
1712 (defvar my/org-agenda-todo-file (concat org-directory "/TODO.org")) |
1712 (defvar my-org-agenda-todo-file (concat org-directory "/TODO.org")) |
1713 (defvar my/org-agenda-note-file (concat org-directory "/NOTE.org")) |
1713 (defvar my-org-agenda-note-file (concat org-directory "/NOTE.org")) |
1714 (setq org-agenda-file-regexp "\\`[^.#].*[^_]\\.org\\'" |
1714 (setq org-agenda-file-regexp "\\`[^.#].*[^_]\\.org\\'" |
1715 org-agenda-files (list org-directory)) |
1715 org-agenda-files (list org-directory)) |
1716 ;; (setq my/org-agenda-learning-file (concat org-directory "/LEARNING.org")) |
1716 ;; (setq my-org-agenda-learning-file (concat org-directory "/LEARNING.org")) |
1717 ;; (setq org-agenda-files `(,my/org-agenda-todo-file ,my/org-agenda-note-file ,my/org-agenda-learning-file)) |
1717 ;; (setq org-agenda-files `(,my-org-agenda-todo-file ,my-org-agenda-note-file ,my-org-agenda-learning-file)) |
1718 (define-key global-map "\C-va" 'org-agenda) |
1718 (define-key global-map "\C-va" 'org-agenda) |
1719 (define-key global-map "\C-ve" (lambda nil (interactive) (find-file my/org-agenda-note-file))) |
1719 (define-key global-map "\C-ve" (lambda nil (interactive) (find-file my-org-agenda-note-file))) |
1720 |
1720 |
1721 (setq org-todo-keywords '("|" "DONE")) |
1721 (setq org-todo-keywords '("|" "DONE")) |
1722 |
1722 |
1723 ;; My tags for remember buffer. |
1723 ;; My tags for remember buffer. |
1724 (setq org-tag-alist |
1724 (setq org-tag-alist |
1740 ;; `org-tag-alist' instead until bug fixed. |
1740 ;; `org-tag-alist' instead until bug fixed. |
1741 (setq org-tag-persistent-alist nil) |
1741 (setq org-tag-persistent-alist nil) |
1742 |
1742 |
1743 (setq org-support-shift-select t) |
1743 (setq org-support-shift-select t) |
1744 |
1744 |
1745 (setq org-default-notes-file my/org-agenda-todo-file) |
1745 (setq org-default-notes-file my-org-agenda-todo-file) |
1746 (setq org-capture-templates |
1746 (setq org-capture-templates |
1747 '(("t" "Todo" entry (file my/org-agenda-todo-file) "* %?\n SCHEDULED: %T"))) |
1747 '(("t" "Todo" entry (file my-org-agenda-todo-file) "* %?\n SCHEDULED: %T"))) |
1748 (define-key global-map "\C-vr" |
1748 (define-key global-map "\C-vr" |
1749 (lambda () (interactive) (org-capture nil "t"))) |
1749 (lambda () (interactive) (org-capture nil "t"))) |
1750 |
1750 |
1751 (when (featurep 'company) |
1751 (when (featurep 'company) |
1752 (add-hook 'org-mode-hook #'my/company-text-setup)) |
1752 (add-hook 'org-mode-hook #'my-company-text-setup)) |
1753 |
1753 |
1754 (defun my/org-archive-location (path) |
1754 (defun my-org-archive-location (path) |
1755 "For given PATH make path to archive. Currently add undescore |
1755 "For given PATH make path to archive. Currently add undescore |
1756 before file extention. If file name doesn't match |
1756 before file extention. If file name doesn't match |
1757 `org-agenda-file-regexp' or have no extention return `nil'." |
1757 `org-agenda-file-regexp' or have no extention return `nil'." |
1758 (if (and (file-name-extension path) |
1758 (if (and (file-name-extension path) |
1759 (string-match org-agenda-file-regexp (file-name-nondirectory path))) |
1759 (string-match org-agenda-file-regexp (file-name-nondirectory path))) |
1760 (concat (file-name-sans-extension path) "_." (file-name-extension path)) |
1760 (concat (file-name-sans-extension path) "_." (file-name-extension path)) |
1761 nil)) |
1761 nil)) |
1762 |
1762 |
1763 (defun my/org-archive-file (path) |
1763 (defun my-org-archive-file (path) |
1764 "Move marked by `org-done-keywords' entries to archive file. |
1764 "Move marked by `org-done-keywords' entries to archive file. |
1765 |
1765 |
1766 Archive file name constructed by `my/org-archive-location'." |
1766 Archive file name constructed by `my-org-archive-location'." |
1767 (let ( (archive (my/org-archive-location path)) |
1767 (let ( (archive (my-org-archive-location path)) |
1768 entry-re entry-done-re |
1768 entry-re entry-done-re |
1769 entry-beg entry-end ) |
1769 entry-beg entry-end ) |
1770 (unless archive |
1770 (unless archive |
1771 (error "'%s' looks like a non-org file..." path)) |
1771 (error "'%s' looks like a non-org file..." path)) |
1772 (save-excursion |
1772 (save-excursion |
1791 (insert ?\n) |
1791 (insert ?\n) |
1792 (yank) |
1792 (yank) |
1793 (save-buffer)) |
1793 (save-buffer)) |
1794 (save-buffer) ))))) |
1794 (save-buffer) ))))) |
1795 |
1795 |
1796 (defun my/org-archive (&optional prefix) |
1796 (defun my-org-archive (&optional prefix) |
1797 "Move all entries marked by `org-done-keywords' to archive |
1797 "Move all entries marked by `org-done-keywords' to archive |
1798 files with name mangled by `my/org-archive-location'. |
1798 files with name mangled by `my-org-archive-location'. |
1799 |
1799 |
1800 Without prefix work on current file. With prefix work on |
1800 Without prefix work on current file. With prefix work on |
1801 `org-agenda-files'." |
1801 `org-agenda-files'." |
1802 (interactive "P") |
1802 (interactive "P") |
1803 (loop for file in (if prefix (org-agenda-files) (list (buffer-file-name))) do |
1803 (loop for file in (if prefix (org-agenda-files) (list (buffer-file-name))) do |
1804 (my/org-archive-file file))) |
1804 (my-org-archive-file file))) |
1805 |
1805 |
1806 (setq org-agenda-include-diary nil) |
1806 (setq org-agenda-include-diary nil) |
1807 |
1807 |
1808 (defun my/org-kill-by-tag (tag) |
1808 (defun my-org-kill-by-tag (tag) |
1809 "Put all entries that matches TAG from current org-file to `kill-ring'." |
1809 "Put all entries that matches TAG from current org-file to `kill-ring'." |
1810 (interactive (list (completing-read "Enter tag: " (org-get-buffer-tags)))) |
1810 (interactive (list (completing-read "Enter tag: " (org-get-buffer-tags)))) |
1811 (let ( rs (last-command 'kill-region) ) |
1811 (let ( rs (last-command 'kill-region) ) |
1812 (setq rs (org-scan-tags |
1812 (setq rs (org-scan-tags |
1813 (lambda () |
1813 (lambda () |
1819 (apply #'kill-region r)))) |
1819 (apply #'kill-region r)))) |
1820 |
1820 |
1821 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1821 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1822 (message "TODO, XXX, FIXME highlight") |
1822 (message "TODO, XXX, FIXME highlight") |
1823 |
1823 |
1824 (dolist (mode (append my/devel-mode-list my/text-mode-list)) |
1824 (dolist (mode (append my-devel-mode-list my-text-mode-list)) |
1825 (font-lock-add-keywords |
1825 (font-lock-add-keywords |
1826 mode |
1826 mode |
1827 `( |
1827 `( |
1828 ( ,(concat "\\<\\(" (regexp-opt '("TODO" "FIX" "FIXME" "HACK" "XXX")) ":?\\)\\>") 1 'font-lock-warning-face t) |
1828 ( ,(concat "\\<\\(" (regexp-opt '("TODO" "FIX" "FIXME" "HACK" "XXX")) ":?\\)\\>") 1 'font-lock-warning-face t) |
1829 ;; 64 times, for highlight C-u C-u C-u <key> |
1829 ;; 64 times, for highlight C-u C-u C-u <key> |
1830 ;; ("\\([^[:space:]]\\)\\1\\{63\\}" 0 'my/contrasty-face t) |
1830 ;; ("\\([^[:space:]]\\)\\1\\{63\\}" 0 'my-contrasty-face t) |
1831 )) |
1831 )) |
1832 ) |
1832 ) |
1833 |
1833 |
1834 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1834 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1835 (message "mail, message") |
1835 (message "mail, message") |
1836 |
1836 |
1837 (eval-when 'compile (require 'message)) |
1837 (eval-when 'compile (require 'message)) |
1838 |
1838 |
1839 (setq mail-user-agent 'message-user-agent) |
1839 (setq mail-user-agent 'message-user-agent) |
1840 |
1840 |
1841 (defun my/compose-mail () |
1841 (defun my-compose-mail () |
1842 (interactive) |
1842 (interactive) |
1843 (compose-mail nil nil `(("Organization" . ,(getenv "ORGANIZATION"))))) |
1843 (compose-mail nil nil `(("Organization" . ,(getenv "ORGANIZATION"))))) |
1844 (global-set-key (kbd "C-x m") #'my/compose-mail) |
1844 (global-set-key (kbd "C-x m") #'my-compose-mail) |
1845 |
1845 |
1846 (setq message-citation-line-format "On %Y-%m-%d, %N wrote: |
1846 (setq message-citation-line-format "On %Y-%m-%d, %N wrote: |
1847 ") |
1847 ") |
1848 (setq message-citation-line-function 'message-insert-formatted-citation-line) |
1848 (setq message-citation-line-function 'message-insert-formatted-citation-line) |
1849 |
1849 |
1944 gnus-backup-startup-file t |
1944 gnus-backup-startup-file t |
1945 gnus-use-dribble-file t |
1945 gnus-use-dribble-file t |
1946 gnus-save-killed-list t |
1946 gnus-save-killed-list t |
1947 ) |
1947 ) |
1948 |
1948 |
1949 (defun my/kill-gnus () |
1949 (defun my-kill-gnus () |
1950 "Kill Gnus when exiting Emacs." |
1950 "Kill Gnus when exiting Emacs." |
1951 (let ( (gnus-interactive-exit nil) ) |
1951 (let ( (gnus-interactive-exit nil) ) |
1952 (gnus-group-exit) |
1952 (gnus-group-exit) |
1953 )) |
1953 )) |
1954 (my--eval-after-load gnus |
1954 (my--eval-after-load gnus |
1955 (add-hook 'kill-emacs-hook 'my/kill-gnus)) |
1955 (add-hook 'kill-emacs-hook 'my-kill-gnus)) |
1956 |
1956 |
1957 (my--eval-after-load gnus-art |
1957 (my--eval-after-load gnus-art |
1958 (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:\\|^List-URL:\\|^Message-Id:"))) |
1958 (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:\\|^List-URL:\\|^Message-Id:"))) |
1959 |
1959 |
1960 ;; Store gnus specific files to '~/.gnus'. |
1960 ;; Store gnus specific files to '~/.gnus'. |
2030 (eval-when-compile |
2030 (eval-when-compile |
2031 (ignore-errors |
2031 (ignore-errors |
2032 ;; w3m-anchor is macros in newer Emacs, need definition during byte-compilation. |
2032 ;; w3m-anchor is macros in newer Emacs, need definition during byte-compilation. |
2033 (require 'w3m-util))) |
2033 (require 'w3m-util))) |
2034 |
2034 |
2035 (defun my/w3m-view-url () |
2035 (defun my-w3m-view-url () |
2036 (interactive) |
2036 (interactive) |
2037 (browse-url (w3m-anchor))) |
2037 (browse-url (w3m-anchor))) |
2038 |
2038 |
2039 (my--eval-after-load w3m |
2039 (my--eval-after-load w3m |
2040 (define-key w3m-minor-mode-map (kbd "RET") #'my/w3m-view-url) |
2040 (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url) |
2041 (define-key w3m-minor-mode-map (kbd "S-RET") #'w3m-safe-view-this-url) |
2041 (define-key w3m-minor-mode-map (kbd "S-RET") #'w3m-safe-view-this-url) |
2042 (define-key w3m-minor-mode-map (kbd "<left>") #'backward-char) |
2042 (define-key w3m-minor-mode-map (kbd "<left>") #'backward-char) |
2043 (define-key w3m-minor-mode-map (kbd "<right>") #'forward-char) |
2043 (define-key w3m-minor-mode-map (kbd "<right>") #'forward-char) |
2044 (define-key w3m-minor-mode-map (kbd "<up>") #'previous-line) |
2044 (define-key w3m-minor-mode-map (kbd "<up>") #'previous-line) |
2045 (define-key w3m-minor-mode-map (kbd "<down>") #'next-line)) |
2045 (define-key w3m-minor-mode-map (kbd "<down>") #'next-line)) |
2162 ;; Increase the score for followups to a sent article. |
2162 ;; Increase the score for followups to a sent article. |
2163 (my--eval-after-load gnus-score |
2163 (my--eval-after-load gnus-score |
2164 ;; (add-hook 'message-sent-hook 'gnus-score-followup-article) |
2164 ;; (add-hook 'message-sent-hook 'gnus-score-followup-article) |
2165 (add-hook 'message-sent-hook 'gnus-score-followup-thread)) |
2165 (add-hook 'message-sent-hook 'gnus-score-followup-thread)) |
2166 |
2166 |
2167 (defvar my/gnus-summary-kill-same-subject-min-len 8 |
2167 (defvar my-gnus-summary-kill-same-subject-min-len 8 |
2168 "Minimal length of subject string to ignore this subject.") |
2168 "Minimal length of subject string to ignore this subject.") |
2169 (defun my/gnus-summary-kill-same-subject (&optional unmark) |
2169 (defun my-gnus-summary-kill-same-subject (&optional unmark) |
2170 "Add negative scores for all articles with same subject." |
2170 "Add negative scores for all articles with same subject." |
2171 (interactive "P") |
2171 (interactive "P") |
2172 (when (or (not (integerp unmark)) (< 0 unmark)) |
2172 (when (or (not (integerp unmark)) (< 0 unmark)) |
2173 (let ( (subj (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))) ) |
2173 (let ( (subj (gnus-simplify-subject-fuzzy (gnus-summary-article-subject))) ) |
2174 (when (<= (length subj) my/gnus-summary-kill-same-subject-min-len) |
2174 (when (<= (length subj) my-gnus-summary-kill-same-subject-min-len) |
2175 (gnus-summary-score-entry |
2175 (gnus-summary-score-entry |
2176 "subject" subj |
2176 "subject" subj |
2177 's (- gnus-score-interactive-default-score) (current-time-string))))) |
2177 's (- gnus-score-interactive-default-score) (current-time-string))))) |
2178 (gnus-summary-kill-same-subject unmark)) |
2178 (gnus-summary-kill-same-subject unmark)) |
2179 (my--eval-after-load gnus-sum |
2179 (my--eval-after-load gnus-sum |
2180 (define-key gnus-summary-mode-map (kbd "C-k") #'my/gnus-summary-kill-same-subject)) |
2180 (define-key gnus-summary-mode-map (kbd "C-k") #'my-gnus-summary-kill-same-subject)) |
2181 |
2181 |
2182 (defun my/gnus-mark-thread-as-read () |
2182 (defun my-gnus-mark-thread-as-read () |
2183 "Mark unmarked articles in current thread as read and move to |
2183 "Mark unmarked articles in current thread as read and move to |
2184 next thread without selecting article." |
2184 next thread without selecting article." |
2185 (interactive) |
2185 (interactive) |
2186 (gnus-summary-top-thread) |
2186 (gnus-summary-top-thread) |
2187 (catch 'exit |
2187 (catch 'exit |
2189 (when (eq (gnus-summary-article-mark (gnus-summary-article-number)) gnus-unread-mark) |
2189 (when (eq (gnus-summary-article-mark (gnus-summary-article-number)) gnus-unread-mark) |
2190 (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark)) |
2190 (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark)) |
2191 (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) |
2191 (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) |
2192 (throw 'exit nil)) ))) |
2192 (throw 'exit nil)) ))) |
2193 (my--eval-after-load gnus-sum |
2193 (my--eval-after-load gnus-sum |
2194 (define-key gnus-summary-mode-map (kbd "H-k") #'my/gnus-mark-thread-as-read)) |
2194 (define-key gnus-summary-mode-map (kbd "H-k") #'my-gnus-mark-thread-as-read)) |
2195 |
2195 |
2196 (defun my/gnus-thread-score-function (&rest scores) |
2196 (defun my-gnus-thread-score-function (&rest scores) |
2197 "If any followup have positive score assign greater available |
2197 "If any followup have positive score assign greater available |
2198 score to thread, else assign lesser available score." |
2198 score to thread, else assign lesser available score." |
2199 (let ( (max (apply 'max scores)) (min (apply 'min scores)) ) |
2199 (let ( (max (apply 'max scores)) (min (apply 'min scores)) ) |
2200 (if (< 0 max) max min))) |
2200 (if (< 0 max) max min))) |
2201 (setq gnus-thread-score-function #'my/gnus-thread-score-function) |
2201 (setq gnus-thread-score-function #'my-gnus-thread-score-function) |
2202 (defun my/gnus-thread-total-score () |
2202 (defun my-gnus-thread-total-score () |
2203 "Helper to debug `gnus-thread-score-function' function." |
2203 "Helper to debug `gnus-thread-score-function' function." |
2204 (interactive) |
2204 (interactive) |
2205 (message |
2205 (message |
2206 (int-to-string |
2206 (int-to-string |
2207 (gnus-thread-total-score |
2207 (gnus-thread-total-score |
2208 (gnus-id-to-thread (mail-header-id (gnus-summary-article-header))))))) |
2208 (gnus-id-to-thread (mail-header-id (gnus-summary-article-header))))))) |
2209 |
2209 |
2210 ;; Especially highlight my message and replays to me. |
2210 ;; Especially highlight my message and replays to me. |
2211 (my--eval-after-load gnus-sum |
2211 (my--eval-after-load gnus-sum |
2212 (defface my/gnus-own-unread-face nil |
2212 (defface my-gnus-own-unread-face nil |
2213 "Use this face to display own postings in Summary Buffer" |
2213 "Use this face to display own postings in Summary Buffer" |
2214 :group 'my/gnus) |
2214 :group 'my-gnus) |
2215 (copy-face 'gnus-summary-high-unread-face 'my/gnus-own-unread-face) |
2215 (copy-face 'gnus-summary-high-unread-face 'my-gnus-own-unread-face) |
2216 (set-face-background 'my/gnus-own-unread-face "linen") |
2216 (set-face-background 'my-gnus-own-unread-face "linen") |
2217 (add-to-list 'gnus-summary-highlight |
2217 (add-to-list 'gnus-summary-highlight |
2218 '((and (> score 190) (eq mark gnus-unread-mark)) . my/gnus-own-unread-face)) |
2218 '((and (> score 190) (eq mark gnus-unread-mark)) . my-gnus-own-unread-face)) |
2219 (defface my/gnus-own-ancient-face nil |
2219 (defface my-gnus-own-ancient-face nil |
2220 "Use this face to display own postings in Summary Buffer" |
2220 "Use this face to display own postings in Summary Buffer" |
2221 :group 'my/gnus) |
2221 :group 'my-gnus) |
2222 (copy-face 'gnus-summary-high-ancient-face 'my/gnus-own-ancient-face) |
2222 (copy-face 'gnus-summary-high-ancient-face 'my-gnus-own-ancient-face) |
2223 (set-face-background 'my/gnus-own-ancient-face "linen") |
2223 (set-face-background 'my-gnus-own-ancient-face "linen") |
2224 (add-to-list 'gnus-summary-highlight |
2224 (add-to-list 'gnus-summary-highlight |
2225 '((and (> score 190) (eq mark gnus-ancient-mark)) . my/gnus-own-ancient-face)) |
2225 '((and (> score 190) (eq mark gnus-ancient-mark)) . my-gnus-own-ancient-face)) |
2226 (defface my/gnus-own-ticked-face nil |
2226 (defface my-gnus-own-ticked-face nil |
2227 "Use this face to display own postings in Summary Buffer" |
2227 "Use this face to display own postings in Summary Buffer" |
2228 :group 'my/gnus) |
2228 :group 'my-gnus) |
2229 (copy-face 'gnus-summary-high-ticked-face 'my/gnus-own-ticked-face) |
2229 (copy-face 'gnus-summary-high-ticked-face 'my-gnus-own-ticked-face) |
2230 (set-face-background 'my/gnus-own-ticked-face "linen") |
2230 (set-face-background 'my-gnus-own-ticked-face "linen") |
2231 (add-to-list 'gnus-summary-highlight |
2231 (add-to-list 'gnus-summary-highlight |
2232 '((and (> score 190) (or (eq mark gnus-dormant-mark) (eq mark gnus-ticked-mark))) . my/gnus-own-ticked-face)) |
2232 '((and (> score 190) (or (eq mark gnus-dormant-mark) (eq mark gnus-ticked-mark))) . my-gnus-own-ticked-face)) |
2233 (defface my/gnus-fup-face nil |
2233 (defface my-gnus-fup-face nil |
2234 "Use this face to display direct fups to my postings." |
2234 "Use this face to display direct fups to my postings." |
2235 :group 'my/gnus) |
2235 :group 'my-gnus) |
2236 (copy-face 'gnus-summary-high-unread-face 'my/gnus-fup-face) |
2236 (copy-face 'gnus-summary-high-unread-face 'my-gnus-fup-face) |
2237 (set-face-background 'my/gnus-fup-face "honeydew") |
2237 (set-face-background 'my-gnus-fup-face "honeydew") |
2238 (add-to-list 'gnus-summary-highlight |
2238 (add-to-list 'gnus-summary-highlight |
2239 '((and (<= 90 score) (<= score 110) (eq mark gnus-unread-mark)) . my/gnus-fup-face)) ) |
2239 '((and (<= 90 score) (<= score 110) (eq mark gnus-unread-mark)) . my-gnus-fup-face)) ) |
2240 |
2240 |
2241 ;; (setq gnus-home-score-file |
2241 ;; (setq gnus-home-score-file |
2242 ;; ;; All groups that match the regexp `"\\.emacs"' |
2242 ;; ;; All groups that match the regexp `"\\.emacs"' |
2243 ;; '(("\\.emacs" "emacs.SCORE") |
2243 ;; '(("\\.emacs" "emacs.SCORE") |
2244 ;; ;; All the comp groups in one score file |
2244 ;; ;; All the comp groups in one score file |
2249 (define-key gnus-summary-mode-map [(meta up)] '(lambda() (interactive) (scroll-other-window -1))) |
2249 (define-key gnus-summary-mode-map [(meta up)] '(lambda() (interactive) (scroll-other-window -1))) |
2250 (define-key gnus-summary-mode-map [(meta down)] '(lambda() (interactive) (scroll-other-window 1))) |
2250 (define-key gnus-summary-mode-map [(meta down)] '(lambda() (interactive) (scroll-other-window 1))) |
2251 (define-key gnus-summary-mode-map [(control down)] 'gnus-summary-next-thread) |
2251 (define-key gnus-summary-mode-map [(control down)] 'gnus-summary-next-thread) |
2252 (define-key gnus-summary-mode-map [(control up)] 'gnus-summary-prev-thread)) |
2252 (define-key gnus-summary-mode-map [(control up)] 'gnus-summary-prev-thread)) |
2253 |
2253 |
2254 (defun my/gnus-search-web-by-message-id () |
2254 (defun my-gnus-search-web-by-message-id () |
2255 "Search for article archive by Message-Id in Google." |
2255 "Search for article archive by Message-Id in Google." |
2256 (interactive) |
2256 (interactive) |
2257 (let ( (msgid (message-fetch-field "Message-Id")) (subj (message-fetch-field "Subject")) ) |
2257 (let ( (msgid (message-fetch-field "Message-Id")) (subj (message-fetch-field "Subject")) ) |
2258 (setq msgid (replace-regexp-in-string "[<>]" "" msgid)) |
2258 (setq msgid (replace-regexp-in-string "[<>]" "" msgid)) |
2259 (setq subj (replace-regexp-in-string "[\"#]" " " subj)) |
2259 (setq subj (replace-regexp-in-string "[\"#]" " " subj)) |
2260 (browse-url (format "https://www.google.com.ua/search?q=%s" (url-encode-url (format "%s OR \"%s\"" msgid subj)))) |
2260 (browse-url (format "https://www.google.com.ua/search?q=%s" (url-encode-url (format "%s OR \"%s\"" msgid subj)))) |
2261 (browse-url (format "http://mid.mail-archive.com/%s" (url-encode-url msgid))))) |
2261 (browse-url (format "http://mid.mail-archive.com/%s" (url-encode-url msgid))))) |
2262 |
2262 |
2263 (my--eval-after-load gnus-art |
2263 (my--eval-after-load gnus-art |
2264 (define-key gnus-article-mode-map [(control return)] #'my/gnus-search-web-by-message-id)) |
2264 (define-key gnus-article-mode-map [(control return)] #'my-gnus-search-web-by-message-id)) |
2265 |
2265 |
2266 ;; (setq imap-log t) |
2266 ;; (setq imap-log t) |
2267 |
2267 |
2268 ;; (setq mail-user-agent 'mh-e-user-agent) |
2268 ;; (setq mail-user-agent 'mh-e-user-agent) |
2269 |
2269 |
2298 (when (featurep 'fsm) |
2298 (when (featurep 'fsm) |
2299 (setq fsm-debug nil)) ; Disable *fsm-debug* buffer. |
2299 (setq fsm-debug nil)) ; Disable *fsm-debug* buffer. |
2300 ;; Handle Emacs exit. |
2300 ;; Handle Emacs exit. |
2301 (add-hook 'kill-emacs-hook 'jabber-disconnect)) |
2301 (add-hook 'kill-emacs-hook 'jabber-disconnect)) |
2302 |
2302 |
2303 (defvar my/chat-prompt "[%t] %n>\n") |
2303 (defvar my-chat-prompt "[%t] %n>\n") |
2304 (setq |
2304 (setq |
2305 jabber-chat-foreign-prompt-format my/chat-prompt |
2305 jabber-chat-foreign-prompt-format my-chat-prompt |
2306 jabber-chat-local-prompt-format my/chat-prompt |
2306 jabber-chat-local-prompt-format my-chat-prompt |
2307 jabber-groupchat-prompt-format my/chat-prompt |
2307 jabber-groupchat-prompt-format my-chat-prompt |
2308 jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n") |
2308 jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n") |
2309 |
2309 |
2310 (let ( (mgs-list '("Я тутачки, а где Вы меня ожидали?" |
2310 (let ( (mgs-list '("Я тутачки, а где Вы меня ожидали?" |
2311 "Software Development == Church Development. Step 1. Build it. Step 2. Pray." |
2311 "Software Development == Church Development. Step 1. Build it. Step 2. Pray." |
2312 "Great books aren't written – they're rewritten." |
2312 "Great books aren't written – they're rewritten." |
2403 |
2403 |
2404 (add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode)) |
2404 (add-to-list 'magic-mode-alist '(my--c++-header-file-p . c++-mode)) |
2405 |
2405 |
2406 (setq-default comment-style (quote indent)) |
2406 (setq-default comment-style (quote indent)) |
2407 (setq-default comment-column 44) |
2407 (setq-default comment-column 44) |
2408 (setq-default comment-fill-column my/fill-column) |
2408 (setq-default comment-fill-column my-fill-column) |
2409 |
2409 |
2410 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my/fill-column)) )) |
2410 (mapc (lambda (hook) (add-hook hook (lambda () (setq fill-column my-fill-column)) )) |
2411 (append my/devel-mode-hook-list my/text-mode-hook-list)) |
2411 (append my-devel-mode-hook-list my-text-mode-hook-list)) |
2412 |
2412 |
2413 (mapc (lambda (mode) (add-hook (my/mode2hook mode) #'hs-minor-mode)) |
2413 (mapc (lambda (mode) (add-hook (my-mode2hook mode) #'hs-minor-mode)) |
2414 '(c-mode c++-mode java-mode js-mode lisp-mode emacs-lisp-mode)) |
2414 '(c-mode c++-mode java-mode js-mode lisp-mode emacs-lisp-mode)) |
2415 |
2415 |
2416 (defun my/company-prog-mode-setup () |
2416 (defun my-company-prog-mode-setup () |
2417 (setq-local company-dabbrev-code-other-buffers 'code) |
2417 (setq-local company-dabbrev-code-other-buffers 'code) |
2418 (setq-local company-backends '((company-capf company-dabbrev-code company-files))) |
2418 (setq-local company-backends '((company-capf company-dabbrev-code company-files))) |
2419 (company-mode 1)) |
2419 (company-mode 1)) |
2420 |
2420 |
2421 (when (featurep 'company) |
2421 (when (featurep 'company) |
2422 (add-hook 'prog-mode-hook #'my/company-prog-mode-setup)) |
2422 (add-hook 'prog-mode-hook #'my-company-prog-mode-setup)) |
2423 |
2423 |
2424 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2424 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2425 (message "diff, patch, ediff, emerge") |
2425 (message "diff, patch, ediff, emerge") |
2426 |
2426 |
2427 (eval-when 'compile (require 'ediff)) |
2427 (eval-when 'compile (require 'ediff)) |
2561 (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^[:blank:]]+\\)" . 1)) |
2561 (add-to-list 'compilation-mode-font-lock-keywords '("\\(/[Oo][Uu][Tt]:[^[:blank:]]+\\)" . 1)) |
2562 (add-to-list 'compilation-mode-font-lock-keywords '("[[:blank:]]\\(/F[oe][^[:blank:]]+\\)" . 1)))) |
2562 (add-to-list 'compilation-mode-font-lock-keywords '("[[:blank:]]\\(/F[oe][^[:blank:]]+\\)" . 1)))) |
2563 |
2563 |
2564 (ignore-errors |
2564 (ignore-errors |
2565 (require 'ansi-color) |
2565 (require 'ansi-color) |
2566 (defun my/colorize-compilation-buffer () |
2566 (defun my-colorize-compilation-buffer () |
2567 (when (eq major-mode 'compilation-mode) |
2567 (when (eq major-mode 'compilation-mode) |
2568 (ansi-color-apply-on-region compilation-filter-start (point-max)))) |
2568 (ansi-color-apply-on-region compilation-filter-start (point-max)))) |
2569 (add-hook 'compilation-filter-hook 'my/colorize-compilation-buffer)) |
2569 (add-hook 'compilation-filter-hook 'my-colorize-compilation-buffer)) |
2570 |
2570 |
2571 (defvar my/comint-send-hist-list nil |
2571 (defvar my-comint-send-hist-list nil |
2572 "History list for `my/comint-send-string'." |
2572 "History list for `my-comint-send-string'." |
2573 ) |
2573 ) |
2574 (defun my/comint-send-string (string) |
2574 (defun my-comint-send-string (string) |
2575 "Send string to comint buffers. Useful for *compilation* read-only buffer. |
2575 "Send string to comint buffers. Useful for *compilation* read-only buffer. |
2576 Automaticaly append final newline." |
2576 Automaticaly append final newline." |
2577 (interactive |
2577 (interactive |
2578 (list (read-string "Type string: " nil 'my/comint-send-hist-list)) |
2578 (list (read-string "Type string: " nil 'my-comint-send-hist-list)) |
2579 ) |
2579 ) |
2580 (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n")) |
2580 (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n")) |
2581 ) |
2581 ) |
2582 (my--eval-after-load compile |
2582 (my--eval-after-load compile |
2583 (define-key compilation-mode-map [C-return] 'my/comint-send-string)) |
2583 (define-key compilation-mode-map [C-return] 'my-comint-send-string)) |
2584 |
2584 |
2585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2586 (message "scons") |
2586 (message "scons") |
2587 |
2587 |
2588 (add-to-list 'auto-mode-alist '("SConstruct\\'" . python-mode)) |
2588 (add-to-list 'auto-mode-alist '("SConstruct\\'" . python-mode)) |
2621 (global-set-key "\M-." 'etags-select-find-tag) |
2621 (global-set-key "\M-." 'etags-select-find-tag) |
2622 ) |
2622 ) |
2623 |
2623 |
2624 (setq tags-add-tables t) |
2624 (setq tags-add-tables t) |
2625 |
2625 |
2626 (defvar my/ido-tag-history nil |
2626 (defvar my-ido-tag-history nil |
2627 "History of tags selected using `my/ido-complete-tag'.") |
2627 "History of tags selected using `my-ido-complete-tag'.") |
2628 (defun my/ido-complete-tag (&optional substr) |
2628 (defun my-ido-complete-tag (&optional substr) |
2629 "Find a tag using ido." |
2629 "Find a tag using ido." |
2630 (tags-completion-table) |
2630 (tags-completion-table) |
2631 (let ( tag-names ) |
2631 (let ( tag-names ) |
2632 (mapatoms (lambda (x) (push (symbol-name x) tag-names)) tags-completion-table) |
2632 (mapatoms (lambda (x) (push (symbol-name x) tag-names)) tags-completion-table) |
2633 (ido-completing-read "Tag: " tag-names nil t substr 'my/ido-tag-history))) |
2633 (ido-completing-read "Tag: " tag-names nil t substr 'my-ido-tag-history))) |
2634 (defun my/complete-tag (prefix point) |
2634 (defun my-complete-tag (prefix point) |
2635 (interactive "P\nd") |
2635 (interactive "P\nd") |
2636 (if prefix |
2636 (if prefix |
2637 (funcall #'complete-tag) |
2637 (funcall #'complete-tag) |
2638 (let ( (bounds (find-tag-default-bounds)) tag ) |
2638 (let ( (bounds (find-tag-default-bounds)) tag ) |
2639 (if (or (not bounds) (< point (car bounds)) (< (cdr bounds) point)) |
2639 (if (or (not bounds) (< point (car bounds)) (< (cdr bounds) point)) |
2640 (setq tag (my/ido-complete-tag)) |
2640 (setq tag (my-ido-complete-tag)) |
2641 (setq tag (my/ido-complete-tag (buffer-substring (car bounds) (cdr bounds)))) |
2641 (setq tag (my-ido-complete-tag (buffer-substring (car bounds) (cdr bounds)))) |
2642 (delete-region (car bounds) (cdr bounds))) |
2642 (delete-region (car bounds) (cdr bounds))) |
2643 (insert tag)))) |
2643 (insert tag)))) |
2644 |
2644 |
2645 (global-set-key [M-return] #'my/complete-tag) |
2645 (global-set-key [M-return] #'my-complete-tag) |
2646 |
2646 |
2647 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2647 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2648 (message "CEDET, semantic, SRecord") |
2648 (message "CEDET, semantic, SRecord") |
2649 |
2649 |
2650 ;; For debug use 'semantic-debug-idle-function' and 'semantic-debug-idle-work-function'. |
2650 ;; For debug use 'semantic-debug-idle-function' and 'semantic-debug-idle-work-function'. |
2731 ;; (add-to-list 'ede-locate-setup-options 'ede-locate-idutils) |
2731 ;; (add-to-list 'ede-locate-setup-options 'ede-locate-idutils) |
2732 ;; (add-to-list 'ede-locate-setup-options 'ede-locate-global) |
2732 ;; (add-to-list 'ede-locate-setup-options 'ede-locate-global) |
2733 |
2733 |
2734 ;; (ignore-errors (require 'cedet-idutils)) |
2734 ;; (ignore-errors (require 'cedet-idutils)) |
2735 |
2735 |
2736 (defun my/c-mode-cedet-hook () |
2736 (defun my-c-mode-cedet-hook () |
2737 ;; (local-set-key [C-return] 'semantic-complete-symbol) |
2737 ;; (local-set-key [C-return] 'semantic-complete-symbol) |
2738 ;; (local-set-key [C-return] 'semantic-complete-analyze-inline) |
2738 ;; (local-set-key [C-return] 'semantic-complete-analyze-inline) |
2739 ;; (local-set-key "." 'semantic-complete-self-insert) |
2739 ;; (local-set-key "." 'semantic-complete-self-insert) |
2740 ;; (local-set-key ">" 'semantic-complete-self-insert) |
2740 ;; (local-set-key ">" 'semantic-complete-self-insert) |
2741 ) |
2741 ) |
2742 (add-hook 'c-mode-common-hook 'my/c-mode-cedet-hook) |
2742 (add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook) |
2743 |
2743 |
2744 (ignore-errors |
2744 (ignore-errors |
2745 (require 'semantic/ia) |
2745 (require 'semantic/ia) |
2746 (define-key semantic-mode-map (kbd "C-c , .") 'semantic-ia-fast-jump) |
2746 (define-key semantic-mode-map (kbd "C-c , .") 'semantic-ia-fast-jump) |
2747 (define-key semantic-mode-map (kbd "C-c , d") 'semantic-ia-show-doc) |
2747 (define-key semantic-mode-map (kbd "C-c , d") 'semantic-ia-show-doc) |
2759 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2759 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2760 (message "imenu") |
2760 (message "imenu") |
2761 |
2761 |
2762 (require 'imenu) |
2762 (require 'imenu) |
2763 |
2763 |
2764 (defun my/imenu-to-menubar () |
2764 (defun my-imenu-to-menubar () |
2765 "Force imenu building when (menu-bar-mode -1)." |
2765 "Force imenu building when (menu-bar-mode -1)." |
2766 (when imenu-generic-expression |
2766 (when imenu-generic-expression |
2767 (imenu-add-menubar-index) |
2767 (imenu-add-menubar-index) |
2768 (run-hooks 'menu-bar-update-hook) )) |
2768 (run-hooks 'menu-bar-update-hook) )) |
2769 (mapc (lambda (hook) (add-hook hook 'my/imenu-to-menubar)) |
2769 (mapc (lambda (hook) (add-hook hook 'my-imenu-to-menubar)) |
2770 my/devel-mode-hook-list) |
2770 my-devel-mode-hook-list) |
2771 |
2771 |
2772 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2772 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2773 (message "windows inf files for driver installin") |
2773 (message "windows inf files for driver installin") |
2774 |
2774 |
2775 (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode)) |
2775 (add-to-list 'auto-mode-alist '("\\.inf\\'" . conf-mode)) |
2783 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2783 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2784 (message "makefile, make") |
2784 (message "makefile, make") |
2785 |
2785 |
2786 (add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode) t) |
2786 (add-to-list 'auto-mode-alist '("\\(Makefile\\|Makefile\\..+\\)\\'" . makefile-gmake-mode) t) |
2787 |
2787 |
2788 (defun my/makefile-setup () |
2788 (defun my-makefile-setup () |
2789 (add-hook 'completion-at-point-functions 'comint-filename-completion nil t)) |
2789 (add-hook 'completion-at-point-functions 'comint-filename-completion nil t)) |
2790 |
2790 |
2791 (add-hook 'makefile-mode-hook #'my/makefile-setup) |
2791 (add-hook 'makefile-mode-hook #'my-makefile-setup) |
2792 |
2792 |
2793 (defun my/makefile-company-setup () |
2793 (defun my-makefile-company-setup () |
2794 "Limit search for symbols to Makefiles." |
2794 "Limit search for symbols to Makefiles." |
2795 (setq-local company-dabbrev-code-other-buffers t) |
2795 (setq-local company-dabbrev-code-other-buffers t) |
2796 (setq-local company-backends '((company-capf company-dabbrev-code company-files company-executable))) |
2796 (setq-local company-backends '((company-capf company-dabbrev-code company-files company-executable))) |
2797 (company-mode 1)) |
2797 (company-mode 1)) |
2798 |
2798 |
2799 (when (featurep 'company) |
2799 (when (featurep 'company) |
2800 (add-hook 'makefile-mode-hook #'my/makefile-company-setup)) |
2800 (add-hook 'makefile-mode-hook #'my-makefile-company-setup)) |
2801 |
2801 |
2802 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2802 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2803 (message "asm, assembler") |
2803 (message "asm, assembler") |
2804 |
2804 |
2805 ;; (setq-default asm-comment-char 59) |
2805 ;; (setq-default asm-comment-char 59) |
2828 ;; Minor mode that highlights suspicious C and C++ constructions. |
2828 ;; Minor mode that highlights suspicious C and C++ constructions. |
2829 (global-cwarn-mode 1) |
2829 (global-cwarn-mode 1) |
2830 |
2830 |
2831 (setq c-echo-syntactic-information-p t) |
2831 (setq c-echo-syntactic-information-p t) |
2832 |
2832 |
2833 (defun my/c-mode-common-hook () |
2833 (defun my-c-mode-common-hook () |
2834 ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon. |
2834 ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon. |
2835 (c-toggle-auto-newline -1) |
2835 (c-toggle-auto-newline -1) |
2836 ;; Delete all preceding whitespace by DEL. |
2836 ;; Delete all preceding whitespace by DEL. |
2837 (c-toggle-hungry-state -1) |
2837 (c-toggle-hungry-state -1) |
2838 ;; Auto indent after typing colon according to `c-hanging-colons-alist'. |
2838 ;; Auto indent after typing colon according to `c-hanging-colons-alist'. |
2839 (c-toggle-electric-state 1) |
2839 (c-toggle-electric-state 1) |
2840 ) |
2840 ) |
2841 (add-hook 'c-mode-common-hook 'my/c-mode-common-hook) |
2841 (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) |
2842 |
2842 |
2843 (defconst my/c-style |
2843 (defconst my-c-style |
2844 '((c-tab-always-indent . t) |
2844 '((c-tab-always-indent . t) |
2845 (c-comment-only-line-offset . 4) |
2845 (c-comment-only-line-offset . 4) |
2846 (c-hanging-braces-alist |
2846 (c-hanging-braces-alist |
2847 . ( |
2847 . ( |
2848 (brace-list-open) |
2848 (brace-list-open) |
2886 (c-report-syntactic-errors . t) |
2886 (c-report-syntactic-errors . t) |
2887 ;; Echo syntactic information on TAB in message buffer. |
2887 ;; Echo syntactic information on TAB in message buffer. |
2888 (c-echo-syntactic-information-p . t)) |
2888 (c-echo-syntactic-information-p . t)) |
2889 "My C Programming Style") |
2889 "My C Programming Style") |
2890 |
2890 |
2891 (defun my/c-mode-style-hook () |
2891 (defun my-c-mode-style-hook () |
2892 (c-add-style "my" my/c-style t) |
2892 (c-add-style "my" my-c-style t) |
2893 ;; If set 'c-default-style' before 'c-add-style' |
2893 ;; If set 'c-default-style' before 'c-add-style' |
2894 ;; "Undefined style: my" error occured from 'c-get-style-variables'. |
2894 ;; "Undefined style: my" error occured from 'c-get-style-variables'. |
2895 (setq c-default-style |
2895 (setq c-default-style |
2896 '( |
2896 '( |
2897 (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") |
2897 (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my") |
2898 (idl-mode . "my") |
2898 (idl-mode . "my") |
2899 (awk-mode . "awk") |
2899 (awk-mode . "awk") |
2900 (other . "my") |
2900 (other . "my") |
2901 )) |
2901 )) |
2902 ) |
2902 ) |
2903 (add-hook 'c-mode-common-hook 'my/c-mode-style-hook) |
2903 (add-hook 'c-mode-common-hook 'my-c-mode-style-hook) |
2904 |
2904 |
2905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2906 (message "python, python-mode") |
2906 (message "python, python-mode") |
2907 |
2907 |
2908 (eval-when 'compile |
2908 (eval-when 'compile |
3088 ;; (pymacs-load "ropemacs" "rope-") |
3088 ;; (pymacs-load "ropemacs" "rope-") |
3089 ) |
3089 ) |
3090 ;; Automatically save project python buffers before refactorings |
3090 ;; Automatically save project python buffers before refactorings |
3091 (setq ropemacs-confirm-saving 'nil) |
3091 (setq ropemacs-confirm-saving 'nil) |
3092 |
3092 |
3093 (defun my/python-add-to-path (path) |
3093 (defun my-python-add-to-path (path) |
3094 (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) |
3094 (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) |
3095 (when (featurep 'cygwin-mount) |
3095 (when (featurep 'cygwin-mount) |
3096 (setq path (my/dos2cygwin-path path))) |
3096 (setq path (my-dos2cygwin-path path))) |
3097 (python-send-string (format "import sys; sys.path.append(\"%s\")" (expand-file-name path))) ) |
3097 (python-send-string (format "import sys; sys.path.append(\"%s\")" (expand-file-name path))) ) |
3098 |
3098 |
3099 (defun my/python-django-fix (path) |
3099 (defun my-python-django-fix (path) |
3100 "XXX not work on Cygwin + naive Emacs." |
3100 "XXX not work on Cygwin + naive Emacs." |
3101 (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) |
3101 (interactive (list (read-directory-name "Enter new path for PYTHONPATH: "))) |
3102 (when (featurep 'cygwin-mount) |
3102 (when (featurep 'cygwin-mount) |
3103 (setq path (my/dos2cygwin-path path)) |
3103 (setq path (my-dos2cygwin-path path)) |
3104 ) |
3104 ) |
3105 (let ((file (concat path "manage.py"))) |
3105 (let ((file (concat path "manage.py"))) |
3106 (if (file-exists-p file) |
3106 (if (file-exists-p file) |
3107 (python-send-string (format "import os; os.chdir(\"%s\"); execfile(\"%s\")" path file)) |
3107 (python-send-string (format "import os; os.chdir(\"%s\"); execfile(\"%s\")" path file)) |
3108 (error (format "file '%s' does not exist" file)) |
3108 (error (format "file '%s' does not exist" file)) |
3110 |
3110 |
3111 ;; Disable in flavor of Semantic and perfomance reason. |
3111 ;; Disable in flavor of Semantic and perfomance reason. |
3112 ;; (when (>= emacs-major-version 22) |
3112 ;; (when (>= emacs-major-version 22) |
3113 ;; (add-hook 'python-mode-hook 'turn-on-eldoc-mode) |
3113 ;; (add-hook 'python-mode-hook 'turn-on-eldoc-mode) |
3114 |
3114 |
3115 (defun my/python-mode-hook () |
3115 (defun my-python-mode-hook () |
3116 (when (and (eq window-system 'w32) (fboundp 'prettify-symbols-mode)) |
3116 (when (and (eq window-system 'w32) (fboundp 'prettify-symbols-mode)) |
3117 (prettify-symbols-mode -1))) |
3117 (prettify-symbols-mode -1))) |
3118 (add-hook 'python-mode-hook 'my/python-mode-hook) |
3118 (add-hook 'python-mode-hook 'my-python-mode-hook) |
3119 |
3119 |
3120 (when (equal window-system 'w32) |
3120 (when (equal window-system 'w32) |
3121 (add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix))) |
3121 (add-to-list 'process-coding-system-alist '("python" cp1251-unix . cp1251-unix))) |
3122 |
3122 |
3123 (add-to-list 'auto-mode-alist '("/requirements.txt\\'" . conf-mode)) |
3123 (add-to-list 'auto-mode-alist '("/requirements.txt\\'" . conf-mode)) |
3207 (when (fboundp 'subword-mode) |
3207 (when (fboundp 'subword-mode) |
3208 (add-hook 'java-mode-hook #'subword-mode)) |
3208 (add-hook 'java-mode-hook #'subword-mode)) |
3209 |
3209 |
3210 (add-hook 'java-mode-hook #'auto-revert-mode) |
3210 (add-hook 'java-mode-hook #'auto-revert-mode) |
3211 |
3211 |
3212 (defun my/company-java-setup () |
3212 (defun my-company-java-setup () |
3213 (setq-local company-dabbrev-code-other-buffers t) |
3213 (setq-local company-dabbrev-code-other-buffers t) |
3214 (setq-local company-backends '((company-semantic company-capf company-dabbrev-code))) |
3214 (setq-local company-backends '((company-semantic company-capf company-dabbrev-code))) |
3215 (company-mode 1)) |
3215 (company-mode 1)) |
3216 (when (and (featurep 'semantic) (featurep 'company)) |
3216 (when (and (featurep 'semantic) (featurep 'company)) |
3217 (add-hook 'java-mode-hook #'my/company-java-setup)) |
3217 (add-hook 'java-mode-hook #'my-company-java-setup)) |
3218 |
3218 |
3219 (defvar my/java-exeption-dirs nil |
3219 (defvar my-java-exeption-dirs nil |
3220 "List of dirs to look by `my/java-exeption'.") |
3220 "List of dirs to look by `my-java-exeption'.") |
3221 |
3221 |
3222 (defun my/java-exeption () |
3222 (defun my-java-exeption () |
3223 "Look at current line if it like Java exaption and try find file using `my/java-exeption-dirs'" |
3223 "Look at current line if it like Java exaption and try find file using `my-java-exeption-dirs'" |
3224 (interactive) |
3224 (interactive) |
3225 (save-excursion |
3225 (save-excursion |
3226 (let ( path file line end ) |
3226 (let ( path file line end ) |
3227 (forward-line 1) |
3227 (forward-line 1) |
3228 (backward-char 1) |
3228 (backward-char 1) |
3236 (setq path (replace-regexp-in-string (concat "\\." file ".*") "" path)) |
3236 (setq path (replace-regexp-in-string (concat "\\." file ".*") "" path)) |
3237 (setq path (replace-regexp-in-string "\\." "/" path)) |
3237 (setq path (replace-regexp-in-string "\\." "/" path)) |
3238 (setq path (cl-some (lambda (dir) |
3238 (setq path (cl-some (lambda (dir) |
3239 (let ((full-path (format "%s/%s/%s.java" dir path file))) |
3239 (let ((full-path (format "%s/%s/%s.java" dir path file))) |
3240 (when (file-exists-p full-path) full-path))) |
3240 (when (file-exists-p full-path) full-path))) |
3241 my/java-exeption-dirs)) |
3241 my-java-exeption-dirs)) |
3242 (if (not path) |
3242 (if (not path) |
3243 (message "Can't find file %s.java" file) |
3243 (message "Can't find file %s.java" file) |
3244 (find-file-other-window path) |
3244 (find-file-other-window path) |
3245 (goto-line (string-to-int line))))))) |
3245 (goto-line (string-to-int line))))))) |
3246 |
3246 |
3247 (my--eval-after-load log4-hi-mode |
3247 (my--eval-after-load log4-hi-mode |
3248 (define-key log4-hi-mode-map [C-return] #'my/java-exeption)) |
3248 (define-key log4-hi-mode-map [C-return] #'my-java-exeption)) |
3249 |
3249 |
3250 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3250 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3251 (message "Pascal") |
3251 (message "Pascal") |
3252 |
3252 |
3253 (eval-when 'compile (require 'pascal)) |
3253 (eval-when 'compile (require 'pascal)) |
3316 (while (search-forward "<") (replace-match "<")) |
3316 (while (search-forward "<") (replace-match "<")) |
3317 (goto-char (point-min)) |
3317 (goto-char (point-min)) |
3318 (while (search-forward ">") (replace-match ">")) |
3318 (while (search-forward ">") (replace-match ">")) |
3319 ))) |
3319 ))) |
3320 |
3320 |
3321 (defun my/html-charref-from-char (char) |
3321 (defun my-html-charref-from-char (char) |
3322 (format "&#%d;" char) |
3322 (format "&#%d;" char) |
3323 ) |
3323 ) |
3324 |
3324 |
3325 (defun my/html-charref-from-string (string) |
3325 (defun my-html-charref-from-string (string) |
3326 (let ((res "")) |
3326 (let ((res "")) |
3327 (mapc |
3327 (mapc |
3328 (lambda (char) (setq res (concat res (my/html-charref-from-char char)))) |
3328 (lambda (char) (setq res (concat res (my-html-charref-from-char char)))) |
3329 string) |
3329 string) |
3330 res |
3330 res |
3331 ) ) |
3331 ) ) |
3332 |
3332 |
3333 (defun my/html-charref-escape-region2 (begin end &optional prefix) |
3333 (defun my-html-charref-escape-region2 (begin end &optional prefix) |
3334 (interactive "r\nP") |
3334 (interactive "r\nP") |
3335 (if prefix |
3335 (if prefix |
3336 (save-excursion |
3336 (save-excursion |
3337 (goto-char begin) |
3337 (goto-char begin) |
3338 (insert (my/html-charref-from-string (delete-and-extract-region begin end)))) |
3338 (insert (my-html-charref-from-string (delete-and-extract-region begin end)))) |
3339 (my/html-charref-from-string (buffer-substring begin end)) |
3339 (my-html-charref-from-string (buffer-substring begin end)) |
3340 )) |
3340 )) |
3341 |
3341 |
3342 (defun my/html-charref-to-string (html) |
3342 (defun my-html-charref-to-string (html) |
3343 "Return string with replaced decimal/hex and string charrefs by |
3343 "Return string with replaced decimal/hex and string charrefs by |
3344 correcponding UTF-8 symbol." |
3344 correcponding UTF-8 symbol." |
3345 (let (str) |
3345 (let (str) |
3346 (with-temp-buffer |
3346 (with-temp-buffer |
3347 (insert html) |
3347 (insert html) |
3516 |
3516 |
3517 (setq sh-basic-offset 2) |
3517 (setq sh-basic-offset 2) |
3518 |
3518 |
3519 (add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode)) |
3519 (add-to-list 'auto-mode-alist '("\\.cygport\\'" . shell-script-mode)) |
3520 |
3520 |
3521 (defun my/sh-company-setup () |
3521 (defun my-sh-company-setup () |
3522 (setq-local company-backends '((company-capf company-files company-dabbrev-code))) |
3522 (setq-local company-backends '((company-capf company-files company-dabbrev-code))) |
3523 (setq-local company-dabbrev-code-other-buffers t) |
3523 (setq-local company-dabbrev-code-other-buffers t) |
3524 (company-mode 1)) |
3524 (company-mode 1)) |
3525 |
3525 |
3526 (when (featurep 'company) |
3526 (when (featurep 'company) |
3527 (add-hook 'sh-mode-hook #'my/sh-company-setup)) |
3527 (add-hook 'sh-mode-hook #'my-sh-company-setup)) |
3528 |
3528 |
3529 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3529 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3530 (message "pg, Proof General") |
3530 (message "pg, Proof General") |
3531 |
3531 |
3532 (eval-when 'compile (require 'proof nil t)) |
3532 (eval-when 'compile (require 'proof nil t)) |