emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Undo eats buffer [9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)]
@ 2023-10-26 12:01 Ken Mankoff
  2023-10-26 12:10 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Mankoff @ 2023-10-26 12:01 UTC (permalink / raw)
  To: emacs-orgmode


I'm running into a bug where if I (undo) after evaluating an Org Babel emacs-jupyter code block, several hundred lines of the Org buffer below are erased. Unfortunately I am having trouble creating an MWE that demonstrates this, but I hope the org-element-cache warning below may still be helpful.

The bug occurs when the emacs-jupyter (Python) block produces are error, and results look like the following, and then I eval (undo):

#+RESULTS:
:RESULTS:
: some text here
# [goto error]
#+begin_example
  lots of text here
#+end_example
:END:

I've tried (setq org-element-use-cache nil) but that does not seem to help. Any suggestions how to work around this, or help the emacs-jupyter effort address this if it is their domain, will be much appreciated.

Thanks,

   -k.



Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
Warning (org-element-cache): org-element--cache: Unregistered buffer modifications detected (57640 != 55418). Resetting.
If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).
The buffer is: misc.org
 Current command: nil
 Backtrace:
"  backtrace-to-string(nil)
  org-element--cache-sync(#<buffer misc.org> 37660)
  org-element-at-point()
  (progn (org-element-at-point))
  (unwind-protect (progn (org-element-at-point)) (set-match-data save-match-data-internal 'evaporate))
  (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data save-match-data-internal 'evaporate)))
  (let ((element (let ((save-match-data-internal (match-data))) (unwind-protect (progn (org-element-at-point)) (set-match-data save-match-data-internal 'evaporate))))) (and (eq (org-element-type element) 'src-block) (>= (line-beginning-position) (let* ((parray (and t (let* ... ...)))) (if parray (let* ((val ...)) (if (eq val ...) 'nil (let ... val))) (let* ((val ...)) (cond (... ...) (... ...) (t ...)))))) (<= (line-end-position) (save-excursion (save-restriction (widen) (goto-char (let* (...) (if parray ... ...))) (skip-chars-backward \" \\11\\n\") (line-end-position)))) (org-element--property :language element nil nil)))
  org-eldoc-get-src-lang()
  (let ((lang (org-eldoc-get-src-lang))) (cond ((string= lang \"org\") nil) ((or (string= lang \"emacs-lisp\") (string= lang \"elisp\")) (cond ((and (boundp 'eldoc-documentation-functions) (fboundp 'elisp-eldoc-var-docstring) (fboundp 'elisp-eldoc-funcall)) (let ((eldoc-documentation-functions ...)) (eldoc-print-current-symbol-info))) ((fboundp 'elisp-eldoc-documentation-function) (elisp-eldoc-documentation-function)) (t (let (eldoc-documentation-function) (eldoc-print-current-symbol-info))))) ((or (string= lang \"c\") (string= lang \"C\")) (if (require 'c-eldoc nil t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang \"css\") (if (require 'css-eldoc nil t) (progn (css-eldoc-function)))) ((string= lang \"php\") (if (require 'php-eldoc nil t) (progn (php-eldoc-function)))) ((or (string= lang \"go\") (string= lang \"golang\")) (if (require 'go-eldoc nil t) (progn (go-eldoc--documentation-function)))) (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)) (callback (car args))) (if (functionp doc-fun) (progn (if (functionp callback) (funcall doc-fun callback) (funcall doc-fun))))))))
  (or (org-eldoc-get-breadcrumb) (org-eldoc-get-src-header) (let ((lang (org-eldoc-get-src-lang))) (cond ((string= lang \"org\") nil) ((or (string= lang \"emacs-lisp\") (string= lang \"elisp\")) (cond ((and (boundp ...) (fboundp ...) (fboundp ...)) (let (...) (eldoc-print-current-symbol-info))) ((fboundp 'elisp-eldoc-documentation-function) (elisp-eldoc-documentation-function)) (t (let (eldoc-documentation-function) (eldoc-print-current-symbol-info))))) ((or (string= lang \"c\") (string= lang \"C\")) (if (require 'c-eldoc nil t) (progn (c-eldoc-print-current-symbol-info)))) ((string= lang \"css\") (if (require 'css-eldoc nil t) (progn (css-eldoc-function)))) ((string= lang \"php\") (if (require 'php-eldoc nil t) (progn (php-eldoc-function)))) ((or (string= lang \"go\") (string= lang \"golang\")) (if (require 'go-eldoc nil t) (progn (go-eldoc--documentation-function)))) (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang)) (callback (car args))) (if (functionp doc-fun) (progn (if ... ... ...))))))))
  org-eldoc-documentation-function(#f(compiled-function (string &rest plist) #<bytecode 0x2cb3448e18d688a>))
  run-hook-with-args-until-success(org-eldoc-documentation-function #f(compiled-function (string &rest plist) #<bytecode 0x2cb3448e18d688a>))
  eldoc-documentation-default()
  eldoc--invoke-strategy(nil)
  eldoc-print-current-symbol-info()
  #f(compiled-function () #<bytecode -0x1d368e501f6fdae>)()
  apply(#f(compiled-function () #<bytecode -0x1d368e501f6fdae>) nil)
  timer-event-handler([t 0 0 500000 nil #f(compiled-function () #<bytecode -0x1d368e501f6fdae>) nil idle 0 nil])
" Disable showing Disable logging



Emacs  : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)
 of 2022-05-30
Package: Org mode version 9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] Undo eats buffer [9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)]
  2023-10-26 12:01 [BUG] Undo eats buffer [9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)] Ken Mankoff
@ 2023-10-26 12:10 ` Ihor Radchenko
  2023-10-26 15:11   ` Ken Mankoff
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2023-10-26 12:10 UTC (permalink / raw)
  To: Ken Mankoff; +Cc: emacs-orgmode

Ken Mankoff <mankoff@gmail.com> writes:

> I'm running into a bug where if I (undo) after evaluating an Org Babel emacs-jupyter code block, several hundred lines of the Org buffer below are erased. Unfortunately I am having trouble creating an MWE that demonstrates this, but I hope the org-element-cache warning below may still be helpful.
> ...
> ------------------------------------------------------------------------
> Warning (org-element-cache): org-element--cache: Unregistered buffer modifications detected (57640 != 55418). Resetting.

This is most likely a problem with emacs-jupyter. It does something that
bypasses `after-change-functions', which is not allowed in Org mode.

> I've tried (setq org-element-use-cache nil) but that does not seem to help. Any suggestions how to work around this, or help the emacs-jupyter effort address this if it is their domain, will be much appreciated.

If disabling cache causes a problem, it is yet another problem (not the
warning you see from org-element). From my vague memory, emacs-jupyter
has non-standard treatment of code block results, so I again suspect
that the problem is with emacs-jupyter.

Have you tried reporting your problem to emacs-jupyter devs? There might
be a better chance that they can fix or suggest something.

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

* Re: [BUG] Undo eats buffer [9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)]
  2023-10-26 12:10 ` Ihor Radchenko
@ 2023-10-26 15:11   ` Ken Mankoff
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Mankoff @ 2023-10-26 15:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hi Ihor,

On 2023-10-26 at 05:10 -07, Ihor Radchenko <yantar92@posteo.net>
wrote...
> Have you tried reporting your problem to emacs-jupyter devs? There
> might be a better chance that they can fix or suggest something.

There is an open issue on that GitHub repository but someone thought it might be org-cache related, which is why I posted here. Thank you for your suggestions, I will report back there and see if it helps us make progress.

  -k.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-26 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-26 12:01 [BUG] Undo eats buffer [9.7-pre (release_9.6.10-888-g098f08 @ /home/kdm/local/src/org-mode/lisp/)] Ken Mankoff
2023-10-26 12:10 ` Ihor Radchenko
2023-10-26 15:11   ` Ken Mankoff

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).