summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Radchenko <yantar92@posteo.net>2023-12-24 12:18:52 +0100
committerIhor Radchenko <yantar92@posteo.net>2023-12-24 12:18:52 +0100
commitcee9b6abc687207e5e1b0243772627683b57c6b2 (patch)
treeca5da055b4ae2c97def37e7c245459411f3bd329
parenta64b779cbef8fdedcdd030ac781f92886a700e0c (diff)
downloadorg-mode-cee9b6abc.tar.gz
Revert "lisp/oc.el (org-cite-parse-elements): Use org-mode buffer for parsing"
This reverts commit 36f61a9c8b8d15335f5cb2cd7a627ad5d7103956. Because of complex dependencies, it is not easy to properly "require" `org-element-with-buffer-copy' in oc.el. So, reverting for now.
-rw-r--r--lisp/oc.el25
1 files changed, 8 insertions, 17 deletions
diff --git a/lisp/oc.el b/lisp/oc.el
index a74b321..362ee27 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -1162,23 +1162,14 @@ the same object, call `org-cite-adjust-note' first."
The return value is suitable as a replacement for a
\"print_bibliography\" keyword. As a consequence, the function
raises an error if S contains a headline."
- (org-element-with-buffer-copy
- :to-buffer (org-get-buffer-create " *Org parse*" t)
- :drop-contents t
- :drop-visibility t
- :drop-narrowing t
- :drop-locals t
- ;; Transferring local variables may put the temporary buffer
- ;; into a read-only state. Make sure we can insert STRING.
- (let ((inhibit-read-only t)) (erase-buffer) (insert s))
- ;; Prevent "Buffer *temp* modified; kill anyway?".
- (restore-buffer-modified-p nil)
- (pcase (org-element-contents (org-element-parse-buffer))
- ('nil nil)
- (`(,(and section (guard (org-element-type-p section 'section))))
- (org-element-contents section))
- (_
- (error "Headlines cannot replace a keyword")))))
+ (with-temp-buffer
+ (insert s)
+ (pcase (org-element-contents (org-element-parse-buffer))
+ ('nil nil)
+ (`(,(and section (guard (org-element-type-p section 'section))))
+ (org-element-contents section))
+ (_
+ (error "Headlines cannot replace a keyword")))))
(defun org-cite-parse-objects (s &optional affix)
"Parse string S as a secondary string.