[-- Attachment #1.1.1: Type: text/plain, Size: 2152 bytes --] forgot to hit 'reply all.' -------- Forwarded Message -------- 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, 5 Oct 2021 15:47:42 -0400 From: Michael Powe <powem@ctpowe.net> To: Bhavin Gandhi <bhavin7392@gmail.com> Hello, I hesitate to reply, but here's a report from Windows 10. works as expected C:\Emacs\emacs-28\bin\runemacs.exe -Q -L C:\Users\micha\AppData\Roaming\.emacs.d\elpa\org-9.5\ 'G:\My Drive\org\daily.org' GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-08-11 Org mode version 9.5 (9.5-g0a86ad @ c:/Users/micha/AppData/Roaming/.emacs.d/elpa/org-9.5/) Now for the bad news. does not save files at all! C:\Emacs\emacs29\bin\runemacs.exe -Q 'G:\My Drive\org\daily.org' GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-02 Org mode version 9.5 (release_9.5 @ c:/Emacs/emacs29/share/emacs/29.0.50/lisp/org/) Upon invoking the save, contents of the file shift to the left, then shift back; and that's it. HTH. mp Bhavin Gandhi wrote on 10/5/2021 13:53: > Hello Marcel, > > On Tue, 5 Oct 2021 at 19:14, Marcel van der Boom <marcel@hsdev.com> wrote: >> […] >> - emacs -Q test.org >> - make sure the outline is unfolded >> - make a change so test.org is 'dirty' >> - M-x org-save-all-org-buffers >> >> Observed behaviour: >> The outline in test.org will collapse and only show 'Header one' >> >> Expected behaviour: >> Outline state does not change on calling `org-save-all-buffers` >> > I tried to follow the above steps with Emacs 27.1, and Org mode latest > main branch as well as the release_9.5 tag. The only different step I > took was this: > > emacs -Q -L ~/src/org-mode/lisp/ ~/test.org > > When I modify the test.org and call org-save-all-org-buffers, all the > headings remain unfolded. I tried to switch to a different buffer and > called the function, but still it remained in overview state. Maybe > someone with the latest Emacs build from master can try to reproduce? > -- Sent from Postbox <https://www.postbox-inc.com> [-- Attachment #1.1.2: Type: text/html, Size: 3521 bytes --] [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 972 bytes --]
[-- Attachment #1.1: Type: text/plain, Size: 3037 bytes --] Dear list, Confirmed. This is to confirm Micheal's overservation that `org-save-all-org-buffers' doesn't save any Org buffers any more in Emacs 28, compiled a few days ago from commit d86b2e59c and Org 9.5 from Elpa, running on Ubuntu Linux 21.04. I can't say if this is because of the upgrade of Org 9.5 or the newly compiled Emacs as I did both at the same time. Command used for testing: emacs -Q -L ~/.emacs.d/elpa/org-9.5/ /tmp/test.org Best regards, Lennart Karssen. On 05-10-2021 21:51, Michael Powe wrote: > > forgot to hit 'reply all.' > > > -------- Forwarded Message -------- > 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, 5 Oct 2021 15:47:42 -0400 > From: Michael Powe <powem@ctpowe.net> > To: Bhavin Gandhi <bhavin7392@gmail.com> > > > > Hello, > > I hesitate to reply, but here's a report from Windows 10. > > works as expected > C:\Emacs\emacs-28\bin\runemacs.exe -Q -L > C:\Users\micha\AppData\Roaming\.emacs.d\elpa\org-9.5\ 'G:\My > Drive\org\daily.org' > GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-08-11 > Org mode version 9.5 (9.5-g0a86ad @ > c:/Users/micha/AppData/Roaming/.emacs.d/elpa/org-9.5/) > > Now for the bad news. > > does not save files at all! > C:\Emacs\emacs29\bin\runemacs.exe -Q 'G:\My Drive\org\daily.org' > GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-02 > Org mode version 9.5 (release_9.5 @ > c:/Emacs/emacs29/share/emacs/29.0.50/lisp/org/) > > Upon invoking the save, contents of the file shift to the left, then > shift back; and that's it. > > HTH. > > mp > > Bhavin Gandhi wrote on 10/5/2021 13:53: >> Hello Marcel, >> >> On Tue, 5 Oct 2021 at 19:14, Marcel van der Boom <marcel@hsdev.com> wrote: >>> […] >>> - emacs -Q test.org >>> - make sure the outline is unfolded >>> - make a change so test.org is 'dirty' >>> - M-x org-save-all-org-buffers >>> >>> Observed behaviour: >>> The outline in test.org will collapse and only show 'Header one' >>> >>> Expected behaviour: >>> Outline state does not change on calling `org-save-all-buffers` >>> >> I tried to follow the above steps with Emacs 27.1, and Org mode latest >> main branch as well as the release_9.5 tag. The only different step I >> took was this: >> >> emacs -Q -L ~/src/org-mode/lisp/ ~/test.org >> >> When I modify the test.org and call org-save-all-org-buffers, all the >> headings remain unfolded. I tried to switch to a different buffer and >> called the function, but still it remained in overview state. Maybe >> someone with the latest Emacs build from master can try to reproduce? >> > > -- > Sent from Postbox <https://www.postbox-inc.com> -- *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* L.C. Karssen 's-Hertogenbosch The Netherlands lennart@karssen.org http://blog.karssen.org GPG key ID: A88F554A -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 236 bytes --]
I can confirm this too.
(defun org-save-all-org-buffers ()
"Save all Org buffers without user confirmation."
(interactive)
(message "Saving all Org buffers...")
(save-some-buffers t (lambda () (derived-mode-p 'org-mode)))
(when (featurep 'org-id) (org-id-locations-save))
(message "Saving all Org buffers... done"))
If I comment out this change to the function save-some-buffers, then org-save-all-org-buffers works again.
a9ad3d477441feefa3bf6107d58281cb64e0e78a
Author: Juri Linkov <juri@linkov.net>
AuthorDate: Fri Aug 13 10:10:29 2021 +0300
Commit: Juri Linkov <juri@linkov.net>
CommitDate: Fri Aug 13 10:10:29 2021 +0300
Parent: c4d34d24e3 CC Mode: Enhance C++ Mode raw strings to multi-line strings for any language
Merged: emacs-27 feature/native-comp
Contained: master
Follows: emacs-27.1 (8875)
Add save-some-buffers-root to save-some-buffers-default-predicate (bug#46374)
* lisp/files.el (save-some-buffers-default-predicate): Add choice
'save-some-buffers-root'.
(save-some-buffers-root): New predicate function.
(save-some-buffers): Check if 'pred' returns a lexically-bound lambda,
then use it as 'pred'.
(defun save-some-buffers (&optional arg pred)
"Save some modified file-visiting buffers. Asks user about each one.
You can answer `y' or SPC to save, `n' or DEL not to save, `C-r'
@@ -5758,6 +5772,11 @@ save-some-buffers
(interactive "P")
(unless pred
(setq pred save-some-buffers-default-predicate))
+ ;; Allow `pred' to be a function that returns a predicate
+ ;; with lexical bindings in its original environment (bug#46374).
+ (let ((pred-fun (and (functionp pred) (funcall pred))))
+ (when (functionp pred-fun)
+ (setq pred pred-fun)))
(let* ((switched-buffer nil)
(save-some-buffers--switch-window-callback
(lambda (buffer)
I think it has to do with how org-save-all-org-buffers sets the pred argument with:
(lambda () (derived-mode-p 'org-mode))
> On Oct 8, 2021, at 4:55 AM, Lennart C. Karssen <lennart@karssen.org> wrote:
>
> Dear list,
>
> Confirmed.
>
> This is to confirm Micheal's overservation that
> `org-save-all-org-buffers' doesn't save any Org buffers any more in
> Emacs 28, compiled a few days ago from commit d86b2e59c and Org 9.5 from
> Elpa, running on Ubuntu Linux 21.04.
> I can't say if this is because of the upgrade of Org 9.5 or the newly
> compiled Emacs as I did both at the same time.
> Command used for testing:
> emacs -Q -L ~/.emacs.d/elpa/org-9.5/ /tmp/test.org
>
>
> Best regards,
>
> Lennart Karssen.
>
> On 05-10-2021 21:51, Michael Powe wrote:
>>
>> forgot to hit 'reply all.'
>>
>>
>> -------- Forwarded Message --------
>> 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, 5 Oct 2021 15:47:42 -0400
>> From: Michael Powe <powem@ctpowe.net>
>> To: Bhavin Gandhi <bhavin7392@gmail.com>
>>
>>
>>
>> Hello,
>>
>> I hesitate to reply, but here's a report from Windows 10.
>>
>> works as expected
>> C:\Emacs\emacs-28\bin\runemacs.exe -Q -L
>> C:\Users\micha\AppData\Roaming\.emacs.d\elpa\org-9.5\ 'G:\My
>> Drive\org\daily.org'
>> GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-08-11
>> Org mode version 9.5 (9.5-g0a86ad @
>> c:/Users/micha/AppData/Roaming/.emacs.d/elpa/org-9.5/)
>>
>> Now for the bad news.
>>
>> does not save files at all!
>> C:\Emacs\emacs29\bin\runemacs.exe -Q 'G:\My Drive\org\daily.org'
>> GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-02
>> Org mode version 9.5 (release_9.5 @
>> c:/Emacs/emacs29/share/emacs/29.0.50/lisp/org/)
>>
>> Upon invoking the save, contents of the file shift to the left, then
>> shift back; and that's it.
>>
>> HTH.
>>
>> mp
>>
>> Bhavin Gandhi wrote on 10/5/2021 13:53:
>>> Hello Marcel,
>>>
>>> On Tue, 5 Oct 2021 at 19:14, Marcel van der Boom <marcel@hsdev.com> wrote:
>>>> […]
>>>> - emacs -Q test.org
>>>> - make sure the outline is unfolded
>>>> - make a change so test.org is 'dirty'
>>>> - M-x org-save-all-org-buffers
>>>>
>>>> Observed behaviour:
>>>> The outline in test.org will collapse and only show 'Header one'
>>>>
>>>> Expected behaviour:
>>>> Outline state does not change on calling `org-save-all-buffers`
>>>>
>>> I tried to follow the above steps with Emacs 27.1, and Org mode latest
>>> main branch as well as the release_9.5 tag. The only different step I
>>> took was this:
>>>
>>> emacs -Q -L ~/src/org-mode/lisp/ ~/test.org
>>>
>>> When I modify the test.org and call org-save-all-org-buffers, all the
>>> headings remain unfolded. I tried to switch to a different buffer and
>>> called the function, but still it remained in overview state. Maybe
>>> someone with the latest Emacs build from master can try to reproduce?
>>>
>>
>> --
>> Sent from Postbox <https://www.postbox-inc.com>
>
> --
> *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> L.C. Karssen
> 's-Hertogenbosch
> The Netherlands
>
> lennart@karssen.org
> http://blog.karssen.org
> GPG key ID: A88F554A
> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
>
The debugger shows that pred gets set to org-mode rather than the function to test for org mode.
Debugger entered--returning value: org-mode
(setq pred pred-fun)
* (progn (setq pred pred-fun))
* (if (functionp pred-fun) (progn (setq pred pred-fun)))
* (let ((pred-fun (and (functionp pred) (funcall pred)))) (if (functionp pred-fun) (progn (setq pred pred-fun))))
* (closure (backup-extract-version-start t) (&optional arg pred) "Save some modified file-visiting buffers. Asks us..." (interactive "P") (if pred nil (setq pred save-some-buffers-default-predicate)) (let ((pred-fun (and (functionp pred) (funcall pred)))) (if (functionp pred-fun) (progn (setq pred pred-fun)))) (let* ((switched-buffer nil) (save-some-buffers--switch-window-callback #'(lambda (buffer) (setq switched-buffer buffer))) queried autosaved-buffers files-done abbrevs-done) (unwind-protect (let ((wconfig (current-window-configuration))) (unwind-protect (progn (let ... ...) (setq files-done ...) (and save-abbrevs abbrevs-changed ...) (or queried ... abbrevs-done ...)) (set-window-configuration wconfig))) (if switched-buffer (progn (pop-to-buffer-same-window switched-buffer))))))(t #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_336>)
* apply((closure (backup-extract-version-start t) (&optional arg pred) "Save some modified file-visiting buffers. Asks us..." (interactive "P") (if pred nil (setq pred save-some-buffers-default-predicate)) (let ((pred-fun (and (functionp pred) (funcall pred)))) (if (functionp pred-fun) (progn (setq pred pred-fun)))) (let* ((switched-buffer nil) (save-some-buffers--switch-window-callback #'(lambda (buffer) (setq switched-buffer buffer))) queried autosaved-buffers files-done abbrevs-done) (unwind-protect (let ((wconfig (current-window-configuration))) (unwind-protect (progn (let ... ...) (setq files-done ...) (and save-abbrevs abbrevs-changed ...) (or queried ... abbrevs-done ...)) (set-window-configuration wconfig))) (if switched-buffer (progn (pop-to-buffer-same-window switched-buffer)))))) (t #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_336>))
* save-some-buffers(t #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_336>)
org-save-all-org-buffers()
funcall-interactively(org-save-all-org-buffers)
command-execute(org-save-all-org-buffers record)
execute-extended-command(nil "org-save-all-org-buffers" nil)
funcall-interactively(execute-extended-command nil "org-save-all-org-buffers" nil)
command-execute(execute-extended-command)
> On Oct 8, 2021, at 3:00 PM, Mark Barton <mbarton98@gmail.com> wrote:
>
> I can confirm this too.
>
> (defun org-save-all-org-buffers ()
> "Save all Org buffers without user confirmation."
> (interactive)
> (message "Saving all Org buffers...")
> (save-some-buffers t (lambda () (derived-mode-p 'org-mode)))
> (when (featurep 'org-id) (org-id-locations-save))
> (message "Saving all Org buffers... done"))
>
> If I comment out this change to the function save-some-buffers, then org-save-all-org-buffers works again.
>
> a9ad3d477441feefa3bf6107d58281cb64e0e78a
> Author: Juri Linkov <juri@linkov.net>
> AuthorDate: Fri Aug 13 10:10:29 2021 +0300
> Commit: Juri Linkov <juri@linkov.net>
> CommitDate: Fri Aug 13 10:10:29 2021 +0300
>
> Parent: c4d34d24e3 CC Mode: Enhance C++ Mode raw strings to multi-line strings for any language
> Merged: emacs-27 feature/native-comp
> Contained: master
> Follows: emacs-27.1 (8875)
>
> Add save-some-buffers-root to save-some-buffers-default-predicate (bug#46374)
>
> * lisp/files.el (save-some-buffers-default-predicate): Add choice
> 'save-some-buffers-root'.
> (save-some-buffers-root): New predicate function.
> (save-some-buffers): Check if 'pred' returns a lexically-bound lambda,
> then use it as 'pred'.
>
>
> (defun save-some-buffers (&optional arg pred)
> "Save some modified file-visiting buffers. Asks user about each one.
> You can answer `y' or SPC to save, `n' or DEL not to save, `C-r'
> @@ -5758,6 +5772,11 @@ save-some-buffers
> (interactive "P")
> (unless pred
> (setq pred save-some-buffers-default-predicate))
> + ;; Allow `pred' to be a function that returns a predicate
> + ;; with lexical bindings in its original environment (bug#46374).
> + (let ((pred-fun (and (functionp pred) (funcall pred))))
> + (when (functionp pred-fun)
> + (setq pred pred-fun)))
> (let* ((switched-buffer nil)
> (save-some-buffers--switch-window-callback
> (lambda (buffer)
>
> I think it has to do with how org-save-all-org-buffers sets the pred argument with:
> (lambda () (derived-mode-p 'org-mode))
>
>> On Oct 8, 2021, at 4:55 AM, Lennart C. Karssen <lennart@karssen.org> wrote:
>>
>> Dear list,
>>
>> Confirmed.
>>
>> This is to confirm Micheal's overservation that
>> `org-save-all-org-buffers' doesn't save any Org buffers any more in
>> Emacs 28, compiled a few days ago from commit d86b2e59c and Org 9.5 from
>> Elpa, running on Ubuntu Linux 21.04.
>> I can't say if this is because of the upgrade of Org 9.5 or the newly
>> compiled Emacs as I did both at the same time.
>> Command used for testing:
>> emacs -Q -L ~/.emacs.d/elpa/org-9.5/ /tmp/test.org
>>
>>
>> Best regards,
>>
>> Lennart Karssen.
>>
>> On 05-10-2021 21:51, Michael Powe wrote:
>>>
>>> forgot to hit 'reply all.'
>>>
>>>
>>> -------- Forwarded Message --------
>>> 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, 5 Oct 2021 15:47:42 -0400
>>> From: Michael Powe <powem@ctpowe.net>
>>> To: Bhavin Gandhi <bhavin7392@gmail.com>
>>>
>>>
>>>
>>> Hello,
>>>
>>> I hesitate to reply, but here's a report from Windows 10.
>>>
>>> works as expected
>>> C:\Emacs\emacs-28\bin\runemacs.exe -Q -L
>>> C:\Users\micha\AppData\Roaming\.emacs.d\elpa\org-9.5\ 'G:\My
>>> Drive\org\daily.org'
>>> GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-08-11
>>> Org mode version 9.5 (9.5-g0a86ad @
>>> c:/Users/micha/AppData/Roaming/.emacs.d/elpa/org-9.5/)
>>>
>>> Now for the bad news.
>>>
>>> does not save files at all!
>>> C:\Emacs\emacs29\bin\runemacs.exe -Q 'G:\My Drive\org\daily.org'
>>> GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32) of 2021-10-02
>>> Org mode version 9.5 (release_9.5 @
>>> c:/Emacs/emacs29/share/emacs/29.0.50/lisp/org/)
>>>
>>> Upon invoking the save, contents of the file shift to the left, then
>>> shift back; and that's it.
>>>
>>> HTH.
>>>
>>> mp
>>>
>>> Bhavin Gandhi wrote on 10/5/2021 13:53:
>>>> Hello Marcel,
>>>>
>>>> On Tue, 5 Oct 2021 at 19:14, Marcel van der Boom <marcel@hsdev.com> wrote:
>>>>> […]
>>>>> - emacs -Q test.org
>>>>> - make sure the outline is unfolded
>>>>> - make a change so test.org is 'dirty'
>>>>> - M-x org-save-all-org-buffers
>>>>>
>>>>> Observed behaviour:
>>>>> The outline in test.org will collapse and only show 'Header one'
>>>>>
>>>>> Expected behaviour:
>>>>> Outline state does not change on calling `org-save-all-buffers`
>>>>>
>>>> I tried to follow the above steps with Emacs 27.1, and Org mode latest
>>>> main branch as well as the release_9.5 tag. The only different step I
>>>> took was this:
>>>>
>>>> emacs -Q -L ~/src/org-mode/lisp/ ~/test.org
>>>>
>>>> When I modify the test.org and call org-save-all-org-buffers, all the
>>>> headings remain unfolded. I tried to switch to a different buffer and
>>>> called the function, but still it remained in overview state. Maybe
>>>> someone with the latest Emacs build from master can try to reproduce?
>>>>
>>>
>>> --
>>> Sent from Postbox <https://www.postbox-inc.com>
>>
>> --
>> *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
>> L.C. Karssen
>> 's-Hertogenbosch
>> The Netherlands
>>
>> lennart@karssen.org
>> http://blog.karssen.org
>> GPG key ID: A88F554A
>> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
>>
>
Your analysis is correct. I looked into this a couple days ago. See the following message for an explanation and a patch (testing appreciated): https://list.orgmode.org/87zgrmc2rg.fsf@gmail.com/T/#m9888bc09d77d7bba70ba99671aca72446c4d41b9
It works on my system with native compilation on macOS 11.6. I made the change to org.el that is in my local clone of the emacs master branch and recompiled.
Looking at the Help for the function, I see it is native compiled Lisp in my test here.
- *Help* - buffer
org-save-all-org-buffers is an interactive native compiled Lisp
function in ‘org.el’.
(org-save-all-org-buffers)
—
- diff -
Save all Org buffers without user confirmation.
modified lisp/org/org.el
@@ -15362,7 +15362,7 @@ org-save-all-org-buffers
"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) t)))
(when (featurep 'org-id) (org-id-locations-save))
(message "Saving all Org buffers... done"))
> On Oct 9, 2021, at 9:38 AM, No Wayman <iarchivedmywholelife@gmail.com> wrote:
>
>
> Your analysis is correct. I looked into this a couple days ago.
> See the following message for an explanation and a patch (testing appreciated):
>
> https://list.orgmode.org/87zgrmc2rg.fsf@gmail.com/T/#m9888bc09d77d7bba70ba99671aca72446c4d41b9
>
>