emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mark Barton <mbarton98@gmail.com>
To: "Lennart C. Karssen" <lennart@karssen.org>,
	Juri Linkov <juri@linkov.net>
Cc: orgmode <emacs-orgmode@gnu.org>
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: Fri, 8 Oct 2021 15:30:21 -0700	[thread overview]
Message-ID: <082D5B9E-CD76-498A-A1C7-6A941CB8221B@gmail.com> (raw)
In-Reply-To: <C5A43881-2EB1-4DF8-85E7-E7E83C1C9EB4@gmail.com>

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



  reply	other threads:[~2021-10-08 22:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cdd5fdae-5c61-916b-9e6e-9e9d51a0a834@ctpowe.net>
2021-10-05 19:51 ` Fwd: [BUG] org-save-all-org-buffers reapplies startup visibility [9.5 (release_9.5 @ /usr/local/share/emacs/29.0.50/lisp/org/)] Michael Powe
2021-10-08 11:55   ` Lennart C. Karssen
2021-10-08 22:00     ` Mark Barton
2021-10-08 22:30       ` Mark Barton [this message]
2021-10-09 16:38         ` No Wayman
2021-10-09 18:43           ` Mark Barton
2021-10-05 13:14 Marcel van der Boom
2021-10-05 17:53 ` Bhavin Gandhi
2021-10-06  2:08 ` No Wayman
2021-10-09 19:33   ` Kyle Meyer

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=082D5B9E-CD76-498A-A1C7-6A941CB8221B@gmail.com \
    --to=mbarton98@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=juri@linkov.net \
    --cc=lennart@karssen.org \
    /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).