aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat-29.el8
-rw-r--r--compat-tests.el4
2 files changed, 12 insertions, 0 deletions
diff --git a/compat-29.el b/compat-29.el
index df39dc6..e75b5c8 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -169,6 +169,14 @@ This function does not move point. Also see `line-end-position'."
(let ((inhibit-field-text-motion t))
(line-end-position n)))
+;;;; Defined in image.c
+
+(compat-defun imagep (spec) ;; <compat-tests:imagep>
+ "Value is non-nil if SPEC is a valid image specification."
+ (and (eq (car-safe spec) 'image) (plistp (cdr spec))
+ (or (plist-get (cdr spec) :data) (plist-get (cdr spec) :file))
+ (image-type-available-p (plist-get (cdr spec) :type))))
+
;;;; Defined in subr.el
(compat-defun buffer-local-restore-state (states) ;; <compat-tests:buffer-local-set-state>
diff --git a/compat-tests.el b/compat-tests.el
index 7aad543..3b95fbb 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -306,6 +306,10 @@
(should-equal (pos-bol 0) 1)
(should-equal (pos-eol 0) 10)))
+(ert-deftest imagep ()
+ (should (imagep '(image :type xbm :file "file")))
+ (should (imagep '(image :type xbm :data [1 2 3 4]))))
+
(ert-deftest image-property ()
(let ((image (list 'image)))
;; Add properties.