all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [org-save-all-org-buffers] Saving is not reliable?
@ 2020-12-07 16:22 Mikhail Skorzhisnkii
  2020-12-09  6:16 ` Kyle Meyer
  0 siblings, 1 reply; 6+ messages in thread
From: Mikhail Skorzhisnkii @ 2020-12-07 16:22 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/html, Size: 4663 bytes --]

[-- Attachment #2: Type: text/plain, Size: 2070 bytes --]

Hello forum,

I start noticing some time ago that saving org-mode buffers works
unreliably in my setup. Most of the time I am using function
`org-save-all-org-buffers' from core org. Unfortunately I don't have a
good reproduction scenarios of this bug. In fact I don't have
reproduction scenario at all. It just happens sometimes: I am sure I
saved all org buffers I had, then restart emacs and then I see that some
changes were not actually saved.

Possibly there is something wrong in my customisations. But without a
reproduction scenario, I don't see a way to prove it. However, after I
made a tiny change to the function, I stopped seeing these problems at
all. Here is the fix I have applied:

,----
| diff --git a/lisp/org.elf b/lisp/org.el
| index df3f377f6..448dc4a88 100644
| --- a/lisp/org.el
| +++ b/lisp/org.el
| @@ -15229,7 +15229,9 @@ The value is a list, with zero or more of the symbols `effort', `appt',
|    "Save all Org buffers without user confirmation."
|    (interactive)
|    (message "Saving all Org buffers...")
| -  (save-some-buffers t (lambda () (derived-mode-p 'org-mode)))
| +  (save-some-buffers t (lambda ()
| +                         (and (derived-mode-p 'org-mode)
| +                              (not (buffer-base-buffer)))))
|    (when (featurep 'org-id) (org-id-locations-save))
|    (message "Saving all Org buffers... done"))
`----

My theory was that `save-some-buffers' may work unreliably with indirect
buffers, so I've excluded them from the saving. Again, I have tried to
prove it by using indirect buffer and saving it instead of base buffer.
But it worked without a problem. So even if my theory is correct, bug
not reproducing every time. Nevertheless I am having this change already
for two weeks and I don't have reproduction of this bug. Previously I've
noticed loosing data every day or so.

I don't suggest to apply this patch, but may be someone have\had the
same problem or have a deeper insight how indirect buffers work and why
my fix may be a working solution?

      Kind regards,
      Mikhail Skorzhinskii

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

end of thread, other threads:[~2020-12-13 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-07 16:22 [org-save-all-org-buffers] Saving is not reliable? Mikhail Skorzhisnkii
2020-12-09  6:16 ` Kyle Meyer
2020-12-09 10:16   ` Mikhail Skorzhisnkii
2020-12-09 10:30     ` Eric S Fraga
2020-12-12 23:50       ` Samuel Wales
2020-12-13 15:08         ` Mikhail Skorzhisnkii

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.