* org-element-cache error when storing footnotes using capture buffer
@ 2024-10-02 18:35 Akash Pal
2024-10-04 10:43 ` Akash
2024-10-13 10:20 ` Ihor Radchenko
0 siblings, 2 replies; 3+ messages in thread
From: Akash Pal @ 2024-10-02 18:35 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
Suppose we have the following document
```
#+title: test-file
* This is h1
** This is h1.2
We introduce some text here
Then we narrow to this heading and introduce a footnote
* Another heading here so that footnote capture works
#+begin_src
(org-element-property :buffer (org-element-at-point))
#+end_src
* Footnotes
```
When we narrow to h1.2 (subtree) so that * Footnotes is not visible - after
adding the footnote, when we check
(org-element-property :buffer (org-element-at-point)) at any headline level
or anywhere
It returns nil - inplace of the #<buffer> element it should return
This causes functions to fail that rely on this.
I am on Org mode version 9.8-pre (release_9.7.11-145-g28b631 -- the version
we get when we clone the git today (2024-10-03)
Thank you, let me know if you need any information in reproducing it.
[-- Attachment #2: Type: text/html, Size: 1123 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: org-element-cache error when storing footnotes using capture buffer
2024-10-02 18:35 org-element-cache error when storing footnotes using capture buffer Akash Pal
@ 2024-10-04 10:43 ` Akash
2024-10-13 10:20 ` Ihor Radchenko
1 sibling, 0 replies; 3+ messages in thread
From: Akash @ 2024-10-04 10:43 UTC (permalink / raw)
To: akashpaul21; +Cc: emacs-orgmode
Dear Maintainers,
I seem to have been able to solve this issue through some brute force debugging.
The problem emanates from when copying over the local variables, especially the `buffer-file-name' variable
The function definition `org-src--edit-element' contains a provision to make the said variable nil - but it is quickly reset during initialisation of the buffer just 1 line downstream. Moving the setq statement 4 lines below seems to solve the issue,
Herein I give the patch,
```
--- org-src.el 2024-10-04 15:54:11.357117268 +0530
+++ org-src-patched.el 2024-10-04 15:55:24.041730163 +0530
@@ -609,7 +609,6 @@
(let ((lf (eq type 'latex-fragment)))
(unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf)))
(set-buffer-modified-p nil)
- (setq buffer-file-name nil)
;; Initialize buffer.
(when (functionp initialize)
(let ((org-inhibit-startup t))
@@ -617,6 +616,7 @@
(funcall initialize)
(error (message "Initialization fails with: %S"
(error-message-string e))))))
+ (setq buffer-file-name nil)
;; Transmit buffer-local variables for exit function. It must
;; be done after initializing major mode, as this operation
;; may reset them otherwise.
```
The following in .init can also be done by users not willing to patch the source file `org-src.el'
;; HHHH---------------------------------------------------
(defun patch/org-src--edit-element (&rest args)
(setq-local buffer-file-name nil))
(advice-add 'org-src--edit-element
:after
#'patch/org-src--edit-element)
;; HHHH---------------------------------------------------
Thank you,
Akash P
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: org-element-cache error when storing footnotes using capture buffer
2024-10-02 18:35 org-element-cache error when storing footnotes using capture buffer Akash Pal
2024-10-04 10:43 ` Akash
@ 2024-10-13 10:20 ` Ihor Radchenko
1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2024-10-13 10:20 UTC (permalink / raw)
To: Akash Pal; +Cc: emacs-orgmode
Akash Pal <akashpaul21@gmail.com> writes:
> Suppose we have the following document
>
> ```
> #+title: test-file
>
> * This is h1
>
> ** This is h1.2
>
> We introduce some text here
>
> Then we narrow to this heading and introduce a footnote
> ...
> When we narrow to h1.2 (subtree) so that * Footnotes is not visible - after
> adding the footnote, when we check
>
> (org-element-property :buffer (org-element-at-point)) at any headline level
> or anywhere
> It returns nil - inplace of the #<buffer> element it should return
>
> This causes functions to fail that rely on this.
Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=90945e16aa
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-13 10:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02 18:35 org-element-cache error when storing footnotes using capture buffer Akash Pal
2024-10-04 10:43 ` Akash
2024-10-13 10:20 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.