[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org-transclusion d9ed34a 1/2: (fix) add-all not to stop
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org-transclusion d9ed34a 1/2: (fix) add-all not to stop with error in one trasclusion |
Date: |
Thu, 23 Dec 2021 16:57:24 -0500 (EST) |
branch: externals/org-transclusion
commit d9ed34aa75f20db88f455150f5ea859beaa55e9a
Author: Noboru Ota <me@nobiot.com>
Commit: Noboru Ota <me@nobiot.com>
(fix) add-all not to stop with error in one trasclusion
`add-all` should not stop at one error and keep looping all #+transclude.
To do this, with-demoted-error is used for `add-all`. No change to single
`add` function.
`check-add` also outputs point and line of the location when error.
---
org-transclusion.el | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/org-transclusion.el b/org-transclusion.el
index 5569397..3db6104 100644
--- a/org-transclusion.el
+++ b/org-transclusion.el
@@ -486,7 +486,8 @@ the rest of the buffer unchanged."
(unless (or (org-transclusion-within-transclusion-p)
(plist-get (org-transclusion-keyword-string-to-plist)
:disable-auto))
- (org-transclusion-add))))
+ ;; Demoted-errors so that one error does not stop the whole process
+ (with-demoted-errors (org-transclusion-add)))))
(goto-char marker)
(move-marker marker nil) ; point nowhere for GC
t)))
@@ -1297,16 +1298,19 @@ Error if transclusion is not allowed.
Currently the following cases are prevented:
Case 1. Element at point is NOT #+transclude:
+ Element is in a block - e.g. example
Case 2. #+transclude inside another transclusion"
(cond
;; Case 1. Element at point is NOT #+transclude:
((let ((elm (org-element-at-point)))
- (not (and (string= "keyword" (org-element-type elm))
- (string= "TRANSCLUDE" (org-element-property :key elm)))))
- (user-error "Not at a transclude keyword"))
+ (not (and (string= "keyword" (org-element-type elm))
+ (string= "TRANSCLUDE" (org-element-property :key elm)))))
+ (user-error (format "Not at a transclude keyword at point %d, line %d"
+ (point) (org-current-line))))
;; Case 2. #+transclude inside another transclusion
((org-transclusion-within-transclusion-p)
- (user-error "Cannot transclude in another transclusion"))
+ (user-error (format "Cannot transclude in another transclusion at point
%d, line %d")
+ (point) (org-current-line)))
(t
t)))