branch: elpa/casual
commit 0aea7c76b9ea20f087e02b631e936038c5151159
Author: Charles Choi <[email protected]>
Commit: Charles Choi <[email protected]>

    Update to support Org mode 9.8
    
    - Change to use org-link-preview if available.
---
 lisp/Makefile-org.make   | 1 +
 lisp/casual-org-utils.el | 5 +++++
 tests/test-casual-org.el | 9 ++++++---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lisp/Makefile-org.make b/lisp/Makefile-org.make
index cd53a0caff..a1b21f5c84 100644
--- a/lisp/Makefile-org.make
+++ b/lisp/Makefile-org.make
@@ -26,6 +26,7 @@ PACKAGE_PATHS=                                        \
 -L $(EMACS_ELPA_DIR)/seq-current               \
 -L $(EMACS_ELPA_DIR)/transient-current         \
 -L $(EMACS_ELPA_DIR)/cond-let-current          \
+-L $(EMACS_ELPA_DIR)/org-current               \
 -L $(CASUAL_LIB_LISP_DIR)
 
 include Makefile--rules.make
diff --git a/lisp/casual-org-utils.el b/lisp/casual-org-utils.el
index afe7749cd8..44fa6277d4 100644
--- a/lisp/casual-org-utils.el
+++ b/lisp/casual-org-utils.el
@@ -942,6 +942,11 @@ See `casual-org-table--range' for more on RANGE object."
    ["Display"
     :if casual-org-mode-p
     ("M-i" "Toggle Images" org-toggle-inline-images
+     :if (lambda () (and (display-graphic-p)
+                    (not (fboundp 'org-link-preview))))
+     :transient nil)
+    ("M-i" "Toggle Images" org-link-preview
+     :if (lambda () (and (display-graphic-p) (fboundp 'org-link-preview)))
      :transient nil)
     ("M" "Show Markup" visible-mode
      :description (lambda () (casual-lib-checkbox-label visible-mode "Show 
Markup"))
diff --git a/tests/test-casual-org.el b/tests/test-casual-org.el
index edf0eecaff..db1020faea 100644
--- a/tests/test-casual-org.el
+++ b/tests/test-casual-org.el
@@ -270,7 +270,8 @@
   (casualt-org-setup)
   (search-forward "* Casual Org Test File" nil t)
 
-  (cl-letf ((casualt-mock #'org-insert-link)
+  (cl-letf (((symbol-function #'display-graphic-p) (lambda (&optional display) 
t))
+            (casualt-mock #'org-insert-link)
             (casualt-mock #'org-insert-last-stored-link)
             (casualt-mock #'org-cite-insert)
             (casualt-mock #'org-timestamp)
@@ -278,7 +279,7 @@
             (casualt-mock #'org-clock-in)
             (casualt-mock #'org-clock-out)
             (casualt-mock #'org-clock-report)
-            (casualt-mock #'org-toggle-inline-images)
+            (casualt-mock #'org-link-preview)
             (casualt-mock #'visible-mode)
             (casualt-mock #'prettify-symbols-mode)
             (casualt-mock #'visual-line-mode)
@@ -292,7 +293,7 @@
              (:binding "M-c" :command org-clock-in)
              ;; (:binding "M-c" :command org-clock-out) ; TODO test
              ;; (:binding "R" :command org-clock-report) ; TODO test
-             (:binding "M-i" :command org-toggle-inline-images)
+             (:binding "M-i" :command org-link-preview)
              (:binding "M" :command visible-mode)
              (:binding "P" :command prettify-symbols-mode)
              (:binding "V" :command visual-line-mode)
@@ -301,6 +302,8 @@
       (casualt-suffix-testcase-runner test-vectors
                                       #'casual-org-tmenu
                                       '(lambda () (random 5000)))))
+
+
   (casualt-org-breakdown))
 
 (ert-deftest test-casual-org-tmenu-navigation ()

Reply via email to