# HG changeset patch # User Oleksandr Gavenko # Date 1425679507 -7200 # Node ID 19c7b3be9b3a89b59c0d6864d1c01906ea9d60a8 # Parent 504c216e8d217287ec7adc49e500dccd04fc904e Define special macro to avoid warning about "assignment to free variable". diff -r 504c216e8d21 -r 19c7b3be9b3a .emacs-defs --- a/.emacs-defs Sun Mar 01 20:28:04 2015 +0200 +++ b/.emacs-defs Sat Mar 07 00:05:07 2015 +0200 @@ -37,3 +37,15 @@ (let ((default-directory my-usr-lisp-dir)) (normal-top-level-add-subdirs-to-load-path)))) +(defmacro my--eval-after-load (feature &rest forms) + `(,(if (or (not (boundp 'byte-compile-current-file)) + (not byte-compile-current-file) + (if (symbolp feature) + (require feature nil :no-error) + (load feature :no-message :no-error))) + 'progn + (message "my--eval-after-load: cannot find %s" feature) + 'with-no-warnings) + (eval-after-load ',feature + `(funcall (function ,(lambda () ,@forms)))))) + diff -r 504c216e8d21 -r 19c7b3be9b3a .emacs-my --- a/.emacs-my Sun Mar 01 20:28:04 2015 +0200 +++ b/.emacs-my Sat Mar 07 00:05:07 2015 +0200 @@ -12,6 +12,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "recentf") +(eval-and-compile + (require 'recentf)) + (setq recentf-save-file (concat user-emacs-directory ".recentf")) (when (eq system-type 'cygwin) (setq recentf-save-file (concat user-emacs-directory ".recentf-cygwin"))) @@ -25,7 +28,6 @@ "\\.png\\'")) (setq recentf-max-saved-items 10000) -(require 'recentf) (recentf-mode t) (global-set-key (kbd "\e\eq") 'recentf-open-files) @@ -450,7 +452,7 @@ (setq term-buffer-maximum-size (lsh 1 14)) -(eval-after-load 'term +(my--eval-after-load term '(progn (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")) @@ -639,7 +641,7 @@ (setq grep-highlight-matches nil) (setq grep-use-null-device nil) -(eval-after-load 'grep +(my--eval-after-load grep '(progn (add-to-list 'grep-find-ignored-directories "build" t) (add-to-list 'grep-find-ignored-directories "dist" t) @@ -950,7 +952,7 @@ (setq my-yas-root-directory "~/.emacs.d/my-yas") (setq yas/ignore-filenames-as-triggers t) -;; (eval-after-load 'yasnippet +;; (my--eval-after-load yasnippet ;; '(progn ;; (cond ;; ((listp yas/root-directory) (add-to-list 'yas/root-directory my-yas-root-directory)) @@ -1066,7 +1068,7 @@ (when (fboundp 'auto-image-file-mode) (auto-image-file-mode 1)) -(eval-after-load 'image-file +(my--eval-after-load image-file '(progn ;; Exclude .svg image from supported image list, as Emacs doesn't come ;; with SVG shared library. @@ -1232,7 +1234,7 @@ (add-hook 'rst-adjust-hook 'rst-toc-update) (unless window-system - (eval-after-load 'rst + (my--eval-after-load rst '(progn (custom-set-faces '(rst-level-1-face ((t (:background "yellow"))) t) @@ -1277,7 +1279,7 @@ ;%r (TeX-style-check TeX-print-style) ;%s master-file-name without extention ;%v yap command view line -;(eval-after-load "tex" +;(my--eval-after-load "tex" ; '(progn ; (add-to-list 'TeX-command-list ; (list "->PS landscape for pdf" @@ -1337,7 +1339,7 @@ ;; Add `my-fix-for-automake-info-lookup' entries to the end of doc-spec for ;; some modes. -(eval-after-load 'info-look +(my--eval-after-load info-look '(progn (mapc (lambda (mode) @@ -1589,7 +1591,7 @@ (require 'ecomplete) (setq message-mail-alias-type '(abbrev ecomplete)) -(eval-after-load 'message +(my--eval-after-load message '(progn (require 'mailabbrev) (define-key message-mode-map "\e\t" 'mail-abbrev-complete-alias) @@ -1670,9 +1672,9 @@ (let ( (gnus-interactive-exit nil) ) (gnus-group-exit) )) -(eval-after-load 'gnus '(add-hook 'kill-emacs-hook 'my-kill-gnus)) - -(eval-after-load 'gnus-art +(my--eval-after-load gnus '(add-hook 'kill-emacs-hook 'my-kill-gnus)) + +(my--eval-after-load gnus-art '(progn (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At")) )) @@ -1748,7 +1750,7 @@ (interactive) (browse-url (w3m-anchor))) -(eval-after-load 'w3m +(my--eval-after-load w3m '(progn (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) @@ -1759,7 +1761,7 @@ (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) -(eval-after-load 'gnus '(progn (gnus-demon-add-handler 'gnus-demon-scan-news 10 t))) +(my--eval-after-load gnus '(progn (gnus-demon-add-handler 'gnus-demon-scan-news 10 t))) ;; Show prefix and 'To' field instead 'From' for my mails. (setq gnus-summary-to-prefix "==> ") @@ -1873,7 +1875,7 @@ )) ;; Increase the score for followups to a sent article. -(eval-after-load 'gnus-score +(my--eval-after-load gnus-score '(progn ;; (add-hook 'message-sent-hook 'gnus-score-followup-article) (add-hook 'message-sent-hook 'gnus-score-followup-thread) @@ -1891,7 +1893,7 @@ "subject" subj 's (- gnus-score-interactive-default-score) (current-time-string))))) (gnus-summary-kill-same-subject unmark)) -(eval-after-load 'gnus-sum +(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 () @@ -1905,7 +1907,7 @@ (gnus-summary-mark-article (gnus-summary-article-number) gnus-del-mark)) (when (or (not (gnus-summary-search-forward)) (eq (gnus-summary-thread-level) 0)) (throw 'exit nil)) ))) -(eval-after-load 'gnus-sum +(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) @@ -1923,7 +1925,7 @@ (gnus-id-to-thread (mail-header-id (gnus-summary-article-header))))))) ;; Especially highlight my message and replays to me. -(eval-after-load 'gnus-sum +(my--eval-after-load gnus-sum '(progn (defface my-gnus-own-unread-face nil "Use this face to display own postings in Summary Buffer") @@ -1958,7 +1960,7 @@ ;; ("^comp" "comp.SCORE"))) ;; Make C-Up, C-Down more like across paragraph moving. -(eval-after-load 'gnus +(my--eval-after-load gnus '(progn (define-key gnus-summary-mode-map [(meta up)] '(lambda() (interactive) (scroll-other-window -1))) (define-key gnus-summary-mode-map [(meta down)] '(lambda() (interactive) (scroll-other-window 1))) @@ -2010,7 +2012,7 @@ jabber-alert-presence-message-function (lambda (who oldstatus newstatus statustext) nil) ) -(eval-after-load 'jabber +(my--eval-after-load jabber '(progn ;; Redefine standard binding for sending message form RET to C-RET. (define-key jabber-chat-mode-map (kbd "RET") 'newline) @@ -2111,7 +2113,7 @@ (setq erc-log-channels-directory "~/.emacs.d/.irc" erc-log-file-coding-system 'utf-8-unix) -(eval-after-load 'erc +(my--eval-after-load erc (lambda () (require 'erc-log) (mkdir erc-log-channels-directory t))) @@ -2168,7 +2170,7 @@ ;; (add-hook 'diff-mode-hook 'my-diff-auto-refine-mode-on) (when window-system - (eval-after-load 'diff-mode + (my--eval-after-load diff-mode '(progn (set-face-foreground 'diff-added-face "DarkGreen") (set-face-foreground 'diff-removed-face "DarkRed") @@ -2291,7 +2293,7 @@ ;; Show error in EN locale to easy search how fix problem in docs and Internet. (setq compilation-environment '("LANG=C")) -(eval-after-load 'compile +(my--eval-after-load compile '(progn ;; My funny error messages. (add-to-list 'compilation-error-regexp-alist '("^\\( +\\[csc\\] \\|\\)\\(.*\\)(\\([0-9]*\\),\\([0-9]*\\)):" 2 3 4)) @@ -2323,7 +2325,7 @@ ) (comint-send-string (get-buffer-process (current-buffer)) (concat string "\n")) ) -(eval-after-load 'compile +(my--eval-after-load compile '(progn (define-key compilation-mode-map [C-return] 'my-comint-send-string) )) @@ -2506,7 +2508,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "fvwm-mode") -(eval-after-load 'fvwm-mode +(my--eval-after-load fvwm-mode (setq fvwm-fvwmcommand-path (executable-find "FvwmCommand"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -2665,13 +2667,13 @@ (setq python-indent 4) -(eval-after-load 'python-mode +(my--eval-after-load python-mode '(when (and (boundp 'py-version) (equal py-version "5.1.0")) (setq-default py-which-shell py-python-command) ;; (py-toggle-shells 'cpython) )) -(eval-after-load 'python +(my--eval-after-load python '(define-key inferior-python-mode-map "\C-c\C-f" 'python-describe-symbol)) ;; Enable "M-/", "C-c g", "C-c d", "C-c f" shortcuts. @@ -2739,7 +2741,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "SML, Standard ML") -(eval-after-load 'sml +(my--eval-after-load sml '(progn (define-key sml-mode-map (kbd "C-c C-p") 'sml-send-function) )) @@ -2752,7 +2754,7 @@ (add-to-list 'auto-mode-alist '("\\.js$" . javascript-generic-mode)) ) -(eval-after-load 'js '(modify-syntax-entry ?$ "w" js-mode-syntax-table)) +(my--eval-after-load js '(modify-syntax-entry ?$ "w" js-mode-syntax-table)) (setq js-indent-level 4) ;; js-curly-indent-offset, js-expr-indent-offset, js-paren-indent-offset, js-square-indent-offset, js-switch-indent-offset @@ -2821,7 +2823,7 @@ ;; (package-install 'css-eldoc) -(eval-after-load 'css-mode +(my--eval-after-load css-mode (when (fboundp 'css-eldoc-enable) (css-eldoc-enable))) @@ -2901,12 +2903,12 @@ (add-to-list 'auto-mode-alist '("\.rng\\'" . nxml-mode)) (add-to-list 'auto-mode-alist '("\.xul\\'" . nxml-mode)) -(eval-after-load 'nxml-mode '(define-key nxml-mode-map [C-return] 'nxml-complete)) +(my--eval-after-load nxml-mode '(define-key nxml-mode-map [C-return] 'nxml-complete)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "relax ng, rng") -(eval-after-load 'rng-loc '(add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml")) +(my--eval-after-load rng-loc '(add-to-list 'rng-schema-locating-files "~/.emacs.d/rnc/schemas.xml")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "web-mode") @@ -2954,7 +2956,7 @@ ) (setq sgml-set-face t) ; for highlighting in sgml -(eval-after-load 'sgml-mode +(my--eval-after-load sgml-mode '(progn (unless (featurep 'psgml) (setq html-tag-alist @@ -3005,13 +3007,13 @@ ;; isar-display:show-consts t ) -(eval-after-load 'proof +(my--eval-after-load proof '(progn ;; (proof-maths-menu-toggle 1) ;; (unicode-tokens-mode 1) ;; (proof-imenu-toggle 1) )) -(eval-after-load 'isar +(my--eval-after-load isar '(progn (define-key isar-mode-map (kbd "C-c C-m") 'proof-goto-point) ))