From 4316fc76877bea60d89e32af0caf14d4da363f69 Mon Sep 17 00:00:00 2001 Message-Id: <4316fc76877bea60d89e32af0caf14d4da363f69.1682849409.git.yantar92@posteo.net> In-Reply-To: <3946dbb956afcd005cba0f1899acae5a74a109d4.1682849409.git.yantar92@posteo.net> References: <3946dbb956afcd005cba0f1899acae5a74a109d4.1682849409.git.yantar92@posteo.net> From: Ihor Radchenko Date: Tue, 18 Apr 2023 13:05:53 +0200 Subject: [PATCH v4 8/8] * lisp/org-compat.el: Throw error without compat in older Emacs Demand compat when using older Emacs. This is a better approach compared to (require 'compat nil 'noerror) because not erring on the `require' would generate a bunch of cryptic errors about functions not being defined from user perspective. --- lisp/org-compat.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index c40510c35..205fb30af 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -94,9 +94,10 @@ (defvar org-fold-core-style) ;;; compat.el -;; Do not throw an error when not available - assume latest Emacs -;; version (built-in Org). -(require 'compat nil 'noerror) +;; Use compat for older Emacs, supplying helpful error message if +;; compat is not available. +(when (version< emacs-version "29") + (org-require-package 'compat)) ;; Provide compatibility macros when we are a part of Emacs. ;; See https://elpa.gnu.org/packages/doc/compat.html#Usage -- 2.40.0