瀏覽代碼

org-compat: Define proper-list-p

* lisp/org-compat.el (proper-list-p): New function for compatibility
with Emacsen before 27.1.

This is a follow-up to the backport of Emacs's 2fde6275b.
Kyle Meyer 6 年之前
父節點
當前提交
da31714c10
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      lisp/org-compat.el

+ 9 - 0
lisp/org-compat.el

@@ -598,6 +598,15 @@ attention to case differences."
            (eq t (compare-strings suffix nil nil
                                   string start-pos nil ignore-case))))))
 
+(unless (fboundp 'proper-list-p)
+  ;; `proper-list-p' was added in Emacs 27.1.  The function below is
+  ;; taken from Emacs subr.el 200195e824b^.
+  (defun proper-list-p (object)
+    "Return OBJECT's length if it is a proper list, nil otherwise.
+A proper list is neither circular nor dotted (i.e., its last cdr
+is nil)."
+    (and (listp object) (ignore-errors (length object)))))
+
 
 ;;; Integration with and fixes for other packages