[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org f1359546ad 5/9: org-element-at-point: Throw an erro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org f1359546ad 5/9: org-element-at-point: Throw an error when not in org-mode |
Date: |
Fri, 18 Aug 2023 06:58:29 -0400 (EDT) |
branch: externals/org
commit f1359546ad7dee9698b75ca25ad453e6f054bd06
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-element-at-point: Throw an error when not in org-mode
* lisp/org-element.el (org-element-at-point): Explicitly throw an
error when not in org-mode buffer. The parser expects certain
buffer-local constants and may fail otherwise. It is better to
indicate the problem explicitly instead of dealing with cryptic
generic errors.
(org-element-plain-list-interpreter):
* testing/lisp/test-ox.el (test-org-export/expand-include/links): Make
sure that we never invoke parser in non-Org buffers.
---
lisp/org-element.el | 4 ++++
testing/lisp/test-ox.el | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 69a62a2f5c..58693d4e33 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -1780,6 +1780,7 @@ Assume point is at the beginning of the list."
"Interpret plain-list element as Org syntax.
CONTENTS is the contents of the element."
(with-temp-buffer
+ (org-mode)
(insert contents)
(goto-char (point-min))
(org-list-repair)
@@ -8031,6 +8032,9 @@ This function may modify the match data."
(if (org-element-type epom t) epom
(setq epom (or epom (point)))
(org-with-point-at epom
+ (unless (derived-mode-p 'org-mode)
+ (error "`org-element-at-point' cannot be used in non-Org buffer %S
(%s)"
+ (current-buffer) major-mode))
;; Allow re-parsing when the command can benefit from it.
(when (and cached-only
(memq this-command org-element--cache-non-modifying-commands))
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 87c6db8af0..4ba0ba0325 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -1498,6 +1498,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1520,6 +1521,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1542,6 +1544,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1564,6 +1567,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1586,6 +1590,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1608,6 +1613,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
@@ -1628,6 +1634,7 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline
footnote]
(let ((buffer (find-file-noselect includer t)))
(unwind-protect
(with-current-buffer buffer
+ (org-mode)
(org-export-expand-include-keyword)
(org-trim (buffer-string)))
(when (buffer-live-p buffer)
- [elpa] externals/org updated (d0c7cd48eb -> 83fd03fb6d), ELPA Syncer, 2023/08/18
- [elpa] externals/org 83fd03fb6d 9/9: org-attach: Fix when called from agenda, ELPA Syncer, 2023/08/18
- [elpa] externals/org 3ec0933122 4/9: Fix Emacs 27 test failure, ELPA Syncer, 2023/08/18
- [elpa] externals/org 3b49db8755 1/9: Revert "Prefer `string-search' when matching exact strings", ELPA Syncer, 2023/08/18
- [elpa] externals/org 9e40208547 2/9: test-org-agenda/todo-selector: Remove stray `message' call, ELPA Syncer, 2023/08/18
- [elpa] externals/org 2eb4fd8900 6/9: lisp/ox-latex.el: Add the `:literal' attribute to verse block., ELPA Syncer, 2023/08/18
- [elpa] externals/org b3660cf135 7/9: * testing/lisp/test-org-attach-git.el: Avoid using global git config, ELPA Syncer, 2023/08/18
- [elpa] externals/org f1359546ad 5/9: org-element-at-point: Throw an error when not in org-mode,
ELPA Syncer <=
- [elpa] externals/org 79aa149143 8/9: org-babel-map-executable: Describe header arg in the docstring, ELPA Syncer, 2023/08/18
- [elpa] externals/org 933d282881 3/9: Fix Emacs 27 false-positive warnings, ELPA Syncer, 2023/08/18