emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: "Colin Baxter 😺" <m43cap@yandex.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-persist warning when archiving
Date: Tue, 26 Oct 2021 19:23:54 +0800	[thread overview]
Message-ID: <87cznsuj05.fsf@localhost> (raw)
In-Reply-To: <87sfworvq8.fsf@yandex.com>

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

Colin Baxter 😺 <m43cap@yandex.com> writes:

>     > Hello, Whenever I archive a DONE item via 'C-c C-x C-a' I get the
>     > warning:
>
>     > Warning (emacs): org-element--cache: Unregistered buffer
>     > modifications detected. Resetting.
>
>     > The archiving is successful, but I keep getting the warning and
>     > therefore wonder if there is some org-persist or cache setting
>     > that needs to be adjusted.
>
> Thinking a little more about this, I have not yet had a chance of
> archiving an item in a new emacs session. It may be that the warning
> is temporary to the first session and will disappear if and when I
> archive a DONE item in a new session.

This message always indicates some problem. However, I cannot reproduce
what you observe on my side. Did you try with emacs -Q? Also, you might
not be running the latest Org. I have extended this warning in recent
commits.

My crystal ball tells me that the attached patch might help. Can you try
it?

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-org-mode-Do-not-inhibit-after-change-function.patch --]
[-- Type: text/x-diff, Size: 2773 bytes --]

From da1e23bd1d8aaa673d034b288a6088868fe8abb7 Mon Sep 17 00:00:00 2001
Message-Id: <da1e23bd1d8aaa673d034b288a6088868fe8abb7.1635247299.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Tue, 26 Oct 2021 19:19:57 +0800
Subject: [PATCH] org.el/org-mode: Do not inhibit `after-change-functions' when
 loading

* lisp/org.el (org-mode): Let-bind `buffer-undo-list' instead of using
`org-unmodified'.  The latter suppresses org-element-cache handling of
buffer changes.
---
 lisp/org.el | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 69ff7a8d4..a20be7aac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4672,22 +4672,22 @@ (define-derived-mode org-mode outline-mode "Org"
 	     (= (point-min) (point-max)))
     (insert "#    -*- mode: org -*-\n\n"))
   (unless org-inhibit-startup
-    (org-unmodified
-     (when org-startup-with-beamer-mode (org-beamer-mode))
-     (when (or org-startup-align-all-tables org-startup-shrink-all-tables)
-       (org-table-map-tables
-	(cond ((and org-startup-align-all-tables
-		    org-startup-shrink-all-tables)
-	       (lambda () (org-table-align) (org-table-shrink)))
-	      (org-startup-align-all-tables #'org-table-align)
-	      (t #'org-table-shrink))
-	t))
-     (when org-startup-with-inline-images (org-display-inline-images))
-     (when org-startup-with-latex-preview (org-latex-preview '(16)))
-     (unless org-inhibit-startup-visibility-stuff (org-cycle-set-startup-visibility))
-     (when org-startup-truncated (setq truncate-lines t))
-     (when org-startup-numerated (require 'org-num) (org-num-mode 1))
-     (when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
+    (let ((buffer-undo-list t))
+      (when org-startup-with-beamer-mode (org-beamer-mode))
+      (when (or org-startup-align-all-tables org-startup-shrink-all-tables)
+        (org-table-map-tables
+	 (cond ((and org-startup-align-all-tables
+		     org-startup-shrink-all-tables)
+	        (lambda () (org-table-align) (org-table-shrink)))
+	       (org-startup-align-all-tables #'org-table-align)
+	       (t #'org-table-shrink))
+	 t))
+      (when org-startup-with-inline-images (org-display-inline-images))
+      (when org-startup-with-latex-preview (org-latex-preview '(16)))
+      (unless org-inhibit-startup-visibility-stuff (org-cycle-set-startup-visibility))
+      (when org-startup-truncated (setq truncate-lines t))
+      (when org-startup-numerated (require 'org-num) (org-num-mode 1))
+      (when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
 
   ;; Add a custom keymap for `visual-line-mode' so that activating
   ;; this minor mode does not override Org's keybindings.
-- 
2.32.0


  reply	other threads:[~2021-10-26 11:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26  9:09 org-persist warning when archiving Colin Baxter 😺
2021-10-26  9:17 ` Colin Baxter 😺
2021-10-26 11:23   ` Ihor Radchenko [this message]
2021-10-26 14:43     ` Colin Baxter 😺
2021-10-26 15:05       ` Ihor Radchenko
2021-10-26 17:47         ` Colin Baxter 😺
2021-10-27  6:45           ` Ihor Radchenko
2021-10-28  6:22             ` Colin Baxter 😺
2021-10-28 17:49               ` Colin Baxter 😺
2021-10-29  4:13                 ` Ihor Radchenko
2021-10-29 13:49                   ` Colin Baxter 😺
2021-10-29 14:28                     ` Ihor Radchenko
2021-10-29 16:51                       ` Colin Baxter 😺

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cznsuj05.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=m43cap@yandex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).