emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-save-all-org-buffers reapplies startup visibility [9.5 (re


From: No Wayman
Subject: Re: [BUG] org-save-all-org-buffers reapplies startup visibility [9.5 (release_9.5 @ /usr/local/share/emacs/29.0.50/lisp/org/)]
Date: Tue, 05 Oct 2021 22:08:43 -0400
User-agent: mu4e 1.7.0; emacs 28.0.50

Confirmed with the following, simpler, test case:

Yodel[1] Report 2021-10-05 22:07:33
===================================

--8<---------------cut here---------------start------------->8---
(yodel
 :user-dir "org-save-all-org-buffers"
 :packages* org
 :formatter yodel-format-as-mailing-list-message
 :post*
 (yodel-file "./test.org"
   :with*
   "#+startup: overview
* A
** B"
   :then*
   (require 'org-element)
   (defun +org-visible nil
     (org-element-interpret-data
      (org-element-parse-buffer nil 'visible-only)))
   (message "%s
%s" "Before `org-save-all-org-buffers':"
(+org-visible))
   (set-buffer-modified-p t)
   (org-save-all-org-buffers)
   (message "%s
%s" "After `org-save-all-org-buffers':"
(+org-visible))))
--8<---------------cut here---------------end--------------->8---

STDOUT
======

Loading /tmp/org-save-all-org-buffers/straight-bootstrap-snippet.el (source)...
Before `org-save-all-org-buffers':

#+startup: overview
* A
** B

Saving all Org buffers...

Saving all Org buffers... done
After `org-save-all-org-buffers':

#+startup: overview
* A

Environment
===========

- emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
of 2021-09-29
- system type: gnu/linux

Packages
========

- org https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cc2490a7061955395c4f5a1a23a088044554a2f7

The behavior of `save-some-buffers' PRED argument changed recently:

https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=a9ad3d477441feefa3bf6107d58281cb64e0e78a

If the PRED returns a function, that function is called.
Since `derived-mode-p' returns the symbol `org-mode', Org is being reloaded in modified buffers. That's what is causing the visibility change. This could also have other undesirable behavior such as running the mode hook, resetting buffer-local variables, etc.

The attached patch ensures we're returning a boolean from the PRED function.
Tested with:

Yodel[1] Report 2021-10-05 22:07:33
===================================

--8<---------------cut here---------------start------------->8---
(yodel
 :user-dir "org-save-all-org-buffers.patch"
 :packages*
(org :host github :repo "progfolio/org-mode" :branch "fix/org-save-all-org-buffers")
 :formatter yodel-format-as-mailing-list-message
 :post*
 (yodel-file "./test.org"
   :with*
   "#+startup: overview
* A
** B"
   :then*
   (require 'org-element)
   (defun +org-visible nil
     (org-element-interpret-data
      (org-element-parse-buffer nil 'visible-only)))
   (message "%s
%s" "Before `org-save-all-org-buffers':"
(+org-visible))
   (set-buffer-modified-p t)
   (org-save-all-org-buffers)
   (message "%s
%s" "After `org-save-all-org-buffers':"
(+org-visible))))
--8<---------------cut here---------------end--------------->8---

STDOUT
======

Loading /tmp/org-save-all-org-buffers.patch/straight-bootstrap-snippet.el (source)...
Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror... Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Cloning org...
Cloning org...done
Building org...
Building org...done

Before `org-save-all-org-buffers':

#+startup: overview
* A
** B

Saving all Org buffers...

Saving all Org buffers... done
After `org-save-all-org-buffers':

#+startup: overview
* A
** B

Environment
===========

- emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars)
of 2021-09-29
- system type: gnu/linux

Packages
========

- org https://github.com/progfolio/org-mode/commit/f1fc22f861ca9610ad4f1e1227660712b46337e4


[1] https://www.github.com/progfolio/yodel

Attachment: 0001-lisp-org.el-org-save-all-org-buffers-Prevent-org-mod.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]