~vm/vm/vmpc-prompt

« back to all changes in this revision

Viewing changes to lisp/vm-version.el

  • Committer: Robert Widhopf-Fenk
  • Date: 2008-03-13 20:21:26 UTC
  • Revision ID: hack@robf.de-20080313202126-bynf8qn37u5tsofv
Added new function `vm-load-features' which tries loading of features.

Display a warning message if they are not available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
171
171
      (image-type-available-p type)
172
172
    (or (featurep type) (eq type 'xbm))))
173
173
 
 
174
(defun vm-load-features (feature-list &optional silent)
 
175
  "Try to load those features listed in FEATURE_LIST.
 
176
If SILENT is t, do not display warnings for unloadable features.
 
177
Return the list of loaded features."
 
178
  (setq feature-list
 
179
        (mapcar (lambda (f)
 
180
                  (condition-case nil
 
181
                      (progn (require f)
 
182
                             f)
 
183
                    (error
 
184
                     (if (load (format "%s" f) t)
 
185
                         f
 
186
                       (when (not silent)
 
187
                         (message "WARNING: Could not load feature %S." f)
 
188
                         (sit-for 1)
 
189
                         (message "WARNING: Related functions may not work correctly!")
 
190
                         (sit-for 1))
 
191
                       nil))))
 
192
                feature-list))
 
193
  (delete nil feature-list))
 
194
 
174
195
(provide 'vm-version)
175
196
 
176
197
;;; vm-version.el ends here