|
From: | Gregory Heytings |
Subject: | bug#51883: 29.0.50; Command to get accidentally deleted frames back |
Date: | Tue, 16 Nov 2021 21:29:35 +0000 |
Thanks for your comments, and thanks to Juri for his suggestion.Updated patch attached, which incorporates your comments and Juri's suggestion.
+(@code{make-frame-command}). A prefix argument undeletes the last deleted +frame, a numerical prefix argument between 0 and 15 undeletes the +corresponding deleted frame, where 0 is the most recently deleted frame.This is unusual meaning of prefix argument. Why not use zero for the last, 1 for the one before that, etc.?
You mean: 0 for the least recently deleted one, and 15 for the most recently deleted one? So to recover the frame you just deleted by accident, you'd have to type C-u 15 C-x 5 u? That seems unnatural to me, but perhaps it's just me.
+(add-hook 'delete-frame-functions #'undeleted-frame--save-deleted-frame) I'd rather we didn't do that by default. Several reasons: . the startup code deletes the terminal frame, so the above means we will always load frameset, which is not a small package, at startup, even if the user has no use for this functionality . using add-hook in Emacs's own code _by_default_ is not a good style; hooks are for customizing the default behavior . saving configurations of 16 deleted frames _by_default_ means we again impose on all users something that only some of them will useSo I'd suggest instead making this an opt-in feature or maybe even minor mode. Only when turned on should we save away the deleted frames.
A minor mode is another option, indeed. My feeling is that this feature is something about everyone would find useful, and that the cost you mention is not that high. And I solved the problem of the deletion of the terminal frame. So I made it an opt-out minor-mode.
(And did you consider wrapping this into some history-like feature, where users could interactively select which past frame to restore?)
Yes, I did consider this, but did not really know if it would be worth doing that. Apparently it is ;-) It's not yet clear to me how one could select one of the frames in a meaningful way. I'll try to do that later.
+The 16 most recently deleted frames can however be undeleted with +`undelete-frame', which see.The "however" part is "out of the blue" here; I'd drop it.
I see what you mean, but it's not out of the blue, it's meant to balance the "permanently eliminating" in "Delete FRAME, permanently eliminating it from use." two lines above.
Undelete-deleted-frames.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |