optional require in .emacs

In my .emacs I was loading the subversion plugin.

(require 'psvn)

Unfortunately on systems that don’t have the subversion plugin Emacs would barf on this line and stop loading the rest of the .emacs file.

Fortunately someone else had asked a similar question, alternative to (require …), on gnu.emacs.help.

Based on that thread I updated my .emacs with this code.

(condition-case nil
  (require 'psvn)
  (error (message "Subversion plugin unavailable, skipping load ...")))

Leave a Reply

Your email address will not be published. Required fields are marked *