(defmacro require-maybe (feature &optional file) "*Try to require FEATURE, but don't signal an error if `require' fails." `(require ,feature ,file 'noerror)) (defmacro when-available (func foo) "*Do something if FUNCTION is available." `(when (fboundp ,func) ,foo))If you place the macros somewhere in the beginning of your .emacs, you can use them as follows (just some examples):
;; change cursor color based on mode (insert/overwrite) (when (require-maybe 'cursor-chg) ; Load this library (change-cursor-mode 1) ; On for overwrite/read-only/input mode (toggle-cursor-type-when-idle 1)) ; On when idleand
(when-available 'set-fringe-mode ; emacs22+ (set-fringe-mode 2)) ; don't have too much space left of col1For more information on installing modes (and other packages), see the installing packages-entry.