1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

Revert "lisp/oc.el (org-cite-parse-elements): Use org-mode buffer for parsing"

This reverts commit 36f61a9c8b.

Because of complex dependencies, it is not easy to properly "require"
`org-element-with-buffer-copy' in oc.el.  So, reverting for now.
This commit is contained in:
Ihor Radchenko 2023-12-24 12:18:52 +01:00
parent a64b779cbe
commit cee9b6abc6
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -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.