[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] trunk r113822: Add a test for decompressing gzipped da

From: Stephen J. Turnbull
Subject: Re: [Emacs-diffs] trunk r113822: Add a test for decompressing gzipped data
Date: Tue, 13 Aug 2013 13:24:47 +0900

Juanma Barranquero writes:

 > In other words, portable elisp code should really do
 > (and (fboundp 'zlib-available-p) (zlib-available-p))
 > to check for zlib support. Perhaps it would be worth to encapsulate
 > that check into (yet another) predicate...

XEmacs has an if-fboundp macro which does the above, but it's ugly.
I prefer extending the #'featurep mechanism to optionally do such
checks.  Eg,

;;; There's Fprovide(symbol) and Fput(Fintern("symbol"),
;;;                                   Fintern("availability-predicate"),
;;;                                   availability_predicate_DEFUN_symbol))
;;; conditionally compiled on --with-symbol in the startup code.
(defun feature-available-p (symbol)
  (and (featurep symbol)
       ;; I'm a ba-a-ad boy.
       (funcall (get symbol 'availability-predicate (lambda ())))))

Contributed to XEmacs under my agreement with the FSF.  Ie, now
copyright 2013 FSF.  There may be better ways of spelling all this, of

reply via email to

[Prev in Thread] Current Thread [Next in Thread]