branch: externals/org
commit 5fb78efdaa7bd00a63d660889c3b96b008a3c6c6
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-element-at-point: Add a fix for imaginary bug with buffer not being
preserved
* lisp/org-element.el (org-element-at-point): Make 100% sure that we
do not change buffer when displaying warnings. I am not sure if this
is happening, but judging from logs it looks like the cache reset is
not being triggered, potentially because buffer is not an Org buffer.
Reported-by: Jason Terk <[email protected]>
Link:
https://orgmode.org/list/CAKcq1cjD6GgvT+SNOza2Cxuxxf9-Ra8eMq-5h3gHNrrpc17G=w...@mail.gmail.com
---
lisp/org-element.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index f25007fbba..f6f6904de8 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -8535,14 +8535,21 @@ This function may modify the match data."
(condition-case-unless-debug err
(org-element--parse-to epom)
(error
- (org-element--cache-warn
- "Org parser error in %s::%S. Resetting.\n The
error was: %S\n Backtrace:\n%S\n Please report this to Org mode mailing list
(M-x org-submit-bug-report)."
- (buffer-name (current-buffer))
- epom
- err
- (when (and (fboundp 'backtrace-get-frames)
- (fboundp 'backtrace-to-string))
- (backtrace-to-string (backtrace-get-frames
'backtrace))))
+ ;; I am not sure if this is needed, but
+ ;; I see in one report that the cache
+ ;; is not being reset, so warning somehow
+ ;; changing current buffer is the only
+ ;; explanation I get. It does not hurt
+ ;; anyway.
+ (save-current-buffer
+ (org-element--cache-warn
+ "Org parser error in %s::%S. Resetting.\n The
error was: %S\n Backtrace:\n%S\n Please report this to Org mode mailing list
(M-x org-submit-bug-report)."
+ (buffer-name (current-buffer))
+ epom
+ err
+ (when (and (fboundp 'backtrace-get-frames)
+ (fboundp 'backtrace-to-string))
+ (backtrace-to-string (backtrace-get-frames
'backtrace)))))
(org-element-cache-reset)
(org-element--parse-to epom)))))
(when (and (org-element--cache-active-p)