From 3b0f44592f857b1e849f2190ef92835a7ea6b84f Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Mon, 24 Jun 2019 22:27:14 +0100 Subject: Add compatibility hacks to support org-mode 8 We do not really need to support org-mode 8 but as it is the default install it makes it easier to test from a clean emacs. --- org-drill.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/org-drill.el b/org-drill.el index c808ebb..d6ac8cf 100644 --- a/org-drill.el +++ b/org-drill.el @@ -65,8 +65,6 @@ :tag "Org-Drill" :group 'org-link) - - (defcustom org-drill-question-tag "drill" "Tag which topics must possess in order to be identified as review topics @@ -649,7 +647,6 @@ random number to another language.") :documentation "An org-drill session object carries data about the current state of a particular org-drill session." ) - (defvar org-drill-current-session nil) (defvar org-drill-last-session nil) @@ -706,6 +703,22 @@ regardless of whether the test was successful.") (put 'org-drill-right-cloze-delimiter 'safe-local-variable 'stringp) +;;; Org compatability hacks +(defvar org-drill-org-8-p (string-prefix-p "8" org-version)) +(when org-drill-org-8-p + (advice-add 'org-get-tags :around #'org-drill-get-tags-advice)) + +(defun org-drill-get-tags-advice (orig-fun &rest args) + ;; the two arg call obsoletes get-local-tags + (if (= 2 (length args)) + ;; and we don't want any byte compile errors + (if (fboundp 'org-get-local-tags) (org-get-local-tags)) + (funcall orig-fun))) + +(when org-drill-org-8-p + (defun org-toggle-latex-fragment (&rest args) + (apply 'org-prefix-latex-fragment args))) + ;;;; Utilities ================================================================ -- cgit v1.2.3