~bzg/dev

3 2

[PATCH org-contrib] lisp/org-collector.el: add error handling in

Details
Message ID
<62193f18-f8eb-4493-ae81-8ac5241c77ff@cas.cat>
DKIM signature
pass
Download raw message
See attached the proposed patch
Details
Message ID
<455cc4ef-cfc8-49c0-b4bd-96f4ead7c0d8@cas.cat>
In-Reply-To
<62193f18-f8eb-4493-ae81-8ac5241c77ff@cas.cat> (view parent)
DKIM signature
pass
Download raw message
Oh, looks like attachments are ignored, then, adding it now:

When a property is considered an emacs lisp expression right now it
just blindly fails with (invalid-read-syntax #) that comes from the
org-babel-read function

The proposed change informs the user what property is failing
---
  lisp/org-collector.el | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org-collector.el b/lisp/org-collector.el
index 76ba7fb..cdc92ae 100644
--- a/lisp/org-collector.el
+++ b/lisp/org-collector.el
@@ -189,7 +189,11 @@ variables and values specified in props"
              (mapcar (lambda (pair)
                    (let ((inhibit-lisp-eval (or (string= (car pair) "ITEM")
                                 (string-match-p org-ts-regexp-inactive 
(cdr pair)))))
-                (cons (car pair) (org-babel-read (cdr pair) 
inhibit-lisp-eval))))
+                (condition-case err
+                    (cons (car pair) (org-babel-read (cdr pair) 
inhibit-lisp-eval))
+                  (error
+                   (error
+                    (print (format "Error processing lisp on property: 
%S, error: %S. Remember anything that starts with a (, ', ` or [ is 
considered an elisp expression" pair err)))))))
                  props))
            header-props)))
      ;; collect all property names
-- 
2.39.2
Details
Message ID
<ea91046c-3413-4cf8-b0c9-bf71e7dedfdc@cas.cat>
In-Reply-To
<455cc4ef-cfc8-49c0-b4bd-96f4ead7c0d8@cas.cat> (view parent)
DKIM signature
pass
Download raw message
the commit title, I meant/proposed:

lisp/org-collector.el: add error handling in props
Details
Message ID
<87cyrh9g7i.fsf@localhost>
In-Reply-To
<62193f18-f8eb-4493-ae81-8ac5241c77ff@cas.cat> (view parent)
DKIM signature
pass
Download raw message
Pedro <pedro@cas.cat> writes:

> See attached the proposed patch
> From cbdc9dca826599adb91950c82c13f2676fbea94d Mon Sep 17 00:00:00 2001
> From: pedro <git2021@cas.cat>
> Date: Mon, 25 Mar 2024 22:34:34 +0100
> Subject: [PATCH org-contrib] lisp/org-collector.el: add error handling in
>  props

Applied, onto master.
Thanks!

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
Reply to thread Export thread (mbox)