From afe50b7132cb9e5d5e3209ee91be0683963b072d Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 24 Jul 2022 20:09:12 +0800 Subject: [PATCH] Fix Emacs 26 compatibility * lisp/org-plot.el (org-plot/gnuplot): Do not use `if-let'. * lisp/ox-ascii.el (org-ascii--describe-links): * lisp/ox-md.el (org-md--headline-referred-p): Do not use `ignore-error'. * testing/org-test.el (org-test-at-time): Fallback to older definition of `decode-time' when it cannot accept 3 arguments. --- lisp/org-plot.el | 7 ++++--- lisp/ox-ascii.el | 7 ++++--- lisp/ox-md.el | 5 +++-- testing/org-test.el | 9 +++++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index bf84c99e0..4183b2af6 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -682,9 +682,10 @@ line directly before or after the table." (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; Dump table to datafile - (if-let ((dump-func (plist-get type :data-dump))) - (funcall dump-func table data-file num-cols params) - (org-plot/gnuplot-to-data table data-file params)) + (let ((dump-func (plist-get type :data-dump))) + (if dump-func + (funcall dump-func table data-file num-cols params) + (org-plot/gnuplot-to-data table data-file params))) ;; Check type of ind column (timestamp? text?) (when (plist-get params :check-ind-type) (let* ((ind (1- (plist-get params :ind))) diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 88a75a815..76a1a71fa 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -950,9 +950,10 @@ channel." (org-export-resolve-fuzzy-link link info) ;; Ignore broken links. On broken link, ;; `org-export-resolve-id-link' will throw an - ;; error and `ignore-error' will return nil. - (ignore-error 'org-link-broken - (org-export-resolve-id-link link info))))) + ;; error and we will return nil. + (condition-case nil + (org-export-resolve-id-link link info) + (org-link-broken nil))))) (when dest (concat (org-ascii--fill-string diff --git a/lisp/ox-md.el b/lisp/ox-md.el index 91b7ee657..3551e4184 100644 --- a/lisp/ox-md.el +++ b/lisp/ox-md.el @@ -195,8 +195,9 @@ of contents can refer to headlines." (lambda (link) (equal headline ;; Ignore broken links. - (ignore-error 'org-link-broken - (org-export-resolve-link link info)))) + (condition-case nil + (org-export-resolve-id-link link info) + (org-link-broken nil)))) info t)))) (defun org-md--headline-title (style level title &optional anchor tags) diff --git a/testing/org-test.el b/testing/org-test.el index 3565dd0cf..161b2f49c 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -470,8 +470,13 @@ TIME can be a non-nil Lisp time value, or a string specifying a date and time." (apply ,(symbol-function 'current-time-zone) (or time ,at) args))) ((symbol-function 'decode-time) - (lambda (&optional time zone form) (funcall ,(symbol-function 'decode-time) - (or time ,at) zone form))) + (lambda (&optional time zone form) + (condition-case nil + (funcall ,(symbol-function 'decode-time) + (or time ,at) zone form) + (wrong-number-of-arguments + (funcall ,(symbol-function 'decode-time) + (or time ,at)))))) ((symbol-function 'encode-time) (lambda (time &rest args) (apply ,(symbol-function 'encode-time) (or time ,at) args)))