summaryrefslogtreecommitdiffstats
path: root/.emacs.d/init.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r--.emacs.d/init.el22
1 files changed, 10 insertions, 12 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index d94791a..1e3138c 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -37,24 +37,22 @@
(autoload 'xmodmap-mode "xmodmap-mode" nil t)
;;;; Macros
+
+;; http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load/
(defmacro stante-after (feature &rest forms)
"After FEATURE is loaded, evaluate FORMS.
FEATURE may be an unquoted feature symbol or a file name, see
`eval-after-load'."
(declare (indent 1) (debug t))
- ;; Byte compile the body. If the feature is not available, ignore
- ;; warnings. Taken from
- ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-11/msg01262.html
- (let ((loaded (if (symbolp feature)
- (require feature nil :no-error)
- (load feature :no-error :no-message))))
- `(,(if loaded
- 'progn
- (message "stante-after: cannot find %s" feature)
- 'with-no-warnings)
- (eval-after-load ',feature
- `(funcall (function ,(lambda () ,@forms)))))))
+ `(,(if (or (not byte-compile-current-file)
+ (if (symbolp feature)
+ (require feature nil :noerror)
+ (load feature :no-message :no-error)))
+ `progn
+ (message "stante-after: cannot find %s" feature)
+ 'with-no-warnings)
+ (with-eval-after-load ',feature ,@forms)))
(defmacro oni:add-hooks (hook &rest functions)
"Add to HOOK each function in FUNCTIONS."