Skip to content

handle non-aborting unwinds from recursive-edit#426

Closed
Zoybean wants to merge 1 commit intomagit:mainfrom
Zoybean:unwind-recursive
Closed

handle non-aborting unwinds from recursive-edit#426
Zoybean wants to merge 1 commit intomagit:mainfrom
Zoybean:unwind-recursive

Conversation

@Zoybean
Copy link

@Zoybean Zoybean commented Mar 4, 2026

The function recursive-edit may unwind to its caller if any of the following forms is evaluated during the recursive edit:

  • (abort-recursive-edit) causing recursive-edit to quit
  • (throw 'exit t), causing recursive-edit to quit
  • (throw 'exit STRING), causing recursive-edit to (error STRING)

The advice transient--recursive-edit behaves correctly in all of the above cases, except in the 3rd case if the error signal is caught after transient--recursive-edit unwinds and before the whole transient unwinds. In this case, the transient is left in a poor state. See #425 for more detail on reproducing this.

Adding an unwind-protect to the advice resolves this, but I am unsure if any of the contents of the cond ought to change. Specifically, the first arm of the cond appears to be trying to pre-empt the unwinding and tidy up, but prior to this PR, this arm does not run in an unwind anyway, and transients seem to handle unwinding from recursive-edit just fine. However, I am not confident to remove this - I do not know if there are any edge-cases that this code was added to handle.

Fixes #425

@Zoybean
Copy link
Author

Zoybean commented Mar 4, 2026

Alas, it looks like this PR fixes my case but breaks magit-commit. This might need further investigation.

@Zoybean Zoybean marked this pull request as draft March 4, 2026 01:54
tarsius added a commit that referenced this pull request Mar 4, 2026
Turns out making aborts less fatal is more complicated than
I believed when I added the initial iteration of this advice
in [1: 5a1b2ba].

Closes #425.
Closes #426.

1: 2023-02-09 5a1b2ba
   Support using recursive-edit while transient is active

Suggested-by: Zoey Llewellyn Hewll <zoeyhewll@gmail.com>
@tarsius tarsius closed this in ecb2005 Mar 5, 2026
@Zoybean Zoybean deleted the unwind-recursive branch March 6, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

partially unwinding a recursive edit leaves transient in a bad state

1 participant