From cee9b6abc687207e5e1b0243772627683b57c6b2 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 24 Dec 2023 12:18:52 +0100 Subject: [PATCH] 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. --- lisp/oc.el | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/lisp/oc.el b/lisp/oc.el index a74b32185..362ee2708 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.