Next: , Previous: , Up: Customisation  


Q3.0.5: How to check if a lisp function is defined?

Use the following elisp:

(fboundp 'foo)

It’s almost always a mistake to test emacs-version or any similar variables.

Instead, use feature-tests, such as featurep, boundp, fboundp, or even simple behavioral tests, eg.:

(defvar foo-old-losing-code-p
  (condition-case nil (progn (losing-code t) nil)
    (wrong-number-of-arguments t)))

There is an incredible amount of broken code out there which could work much better more often in more places if it did the above instead of trying to divine its environment from the value of one variable.