On Fri, Aug 21, 2020 at 08:16:41PM +0100, phillip.lord@russet.org.uk
wrote:
On 2020-08-18 18:20, phillip.lord@russet.org.uk wrote:
As a starter for 10, this is a file that tests features. The idea
would be
to include it in the main (not test) lisp hierarchy, probably with a
single
autoloaded command "feature-test" or something which would run ert
with an
appropriate selector. This would make it available for use in any
Emacs
distribution without having to include any files only found in the
repo.
Feel free to ignore me, but I feel it may be more widely useful to
provide a list of all features and mark whether they're available or
not rather than run a test that reports unavailable features as
errors.
Something like this, but better:
(defun insert-feature (description test)
(indent-to 2)
(insert (if test "✔" "✖"))
(indent-to 5)
(insert description)
(insert "\n"))
(defun list-features ()
(interactive)
(switch-to-buffer (get-buffer-create "*Available Features*"))
(erase-buffer)
(insert-feature "JSON" (progn (require 'json) (fboundp
'json-serialize)))
(insert-feature "GNUTLS" (gnutls-available-p))
(insert-feature "pbm" (image-type-available-p 'pbm))
(insert-feature "xpm" (image-type-available-p 'xpm))
(insert-feature "bmp" (image-type-available-p 'bmp))
(insert-feature "gif" (image-type-available-p 'gif))
(insert-feature "png" (image-type-available-p 'png))
(insert-feature "xpm" (image-type-available-p 'xpm))
(insert-feature "jpeg" (image-type-available-p 'jpeg))
(insert-feature "tiff" (image-type-available-p 'tiff))
(insert-feature "svg" (image-type-available-p 'svg))
(insert-feature "native images" (image-type-available-p
'native-image)))
Unless of course the idea is to automate it, I suppose, in which case
this will be of no use...