Note: these macros are not very useful by themselves, but we will use them in later entries.
(defmacro require-maybe (feature &optional file)If you place the macros somewhere in the beginning of your .emacs, you can use them as follows (just some examples):
"*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))
;; change cursor color based on mode (insert/overwrite)and
(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 idle
(when-available 'set-fringe-mode ; emacs22+
(set-fringe-mode 2)) ; don't have too much space left of col1
For more information on installing modes (and other packages), see the installing packages-entry.
No comments:
Post a Comment