unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Gregory Heytings <gregory@heytings.org>, 51883@debbugs.gnu.org
Subject: bug#51883: 29.0.50; Command to get accidentally deleted frames back
Date: Fri, 14 Jan 2022 10:12:25 +0200	[thread overview]
Message-ID: <861r1aoi9i.fsf@mail.linkov.net> (raw)
In-Reply-To: <864k68ujbx.fsf@mail.linkov.net> (Juri Linkov's message of "Thu,  13 Jan 2022 10:32:34 +0200")

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

>>> Oh - and the tab-bar - Juri had mentioned it - do we have to do anything
>>> special about it?  In my tests your patch restored the tab-bar correctly
>>> I think.
>>
>> I'm waiting when the Gregory's patch will be pushed to master
>> to start testing the tab-bar with it :-)
>
> I guess Gregory has no access to the repo, so I've tested that
> restoring the tab-bar works correctly, and pushed to master.

I tried to use this, but undelete-frame-mode in the File menu
makes no sense: when you mistakenly deleted a frame, you want
to undelete it immediately, so you open the File menu, and
see the message "No way, you can't undelete the deleted frame,
because you were careless and not enabled a special mode".

So the most useful case for this feature is to get the
accidentally deleted frame back, and it fails to do this.

Instead, it allows undeleting 16 frames in a special mode.
Is there really a human that can delete 16 frames, and then
remember what was on the 16th frame back?

Rereading this thread indicates that the only concern about
enabling this by default was the memory footprint for remembering
16 frames.  OTOH, this feature is really useful for remembering
1 frame.  So this is what should be enabled by default:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: undelete-frame-max.patch --]
[-- Type: text/x-diff, Size: 2672 bytes --]

diff --git a/lisp/frame.el b/lisp/frame.el
index 599ffe591a..b82a4ae26f 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2529,6 +2529,12 @@ delete-other-frames
         (if iconify (iconify-frame this) (delete-frame this)))
       (setq this next))))
 
+(defcustom undelete-frame-max 1
+  "Maximum number of frames deleted with `delete-frame'."
+  :type 'integer
+  :group 'frames
+  :version "29.1")
+
 (eval-when-compile (require 'frameset))
 
 (defvar undelete-frame--deleted-frames nil
@@ -2536,7 +2542,7 @@ undelete-frame--deleted-frames
 
 (defun undelete-frame--handle-delete-frame (frame)
   "Save the configuration of frames deleted with `delete-frame'.
-Only the 16 most recently deleted frames are saved."
+Only the `undelete-frame-max' most recently deleted frames are saved."
   (when (frame-live-p frame)
     (setq undelete-frame--deleted-frames
           (cons
@@ -2555,26 +2561,18 @@ undelete-frame--handle-delete-frame
                         (cons '(display . :never)
                               frameset-filter-alist))))
            undelete-frame--deleted-frames))
-    (if (> (length undelete-frame--deleted-frames) 16)
+    (if (> (length undelete-frame--deleted-frames) undelete-frame-max)
         (setq undelete-frame--deleted-frames
               (butlast undelete-frame--deleted-frames)))))
 
-(define-minor-mode undelete-frame-mode
-  "Enable the `undelete-frame' command."
-  :group 'frames
-  :global t
-  (if undelete-frame-mode
-      (add-hook 'delete-frame-functions
-                #'undelete-frame--handle-delete-frame -75)
-    (remove-hook 'delete-frame-functions
-                 #'undelete-frame--handle-delete-frame)
-    (setq undelete-frame--deleted-frames nil)))
+(add-hook 'delete-frame-functions
+          #'undelete-frame--handle-delete-frame -75)
 
 (defun undelete-frame (&optional arg)
   "Undelete a frame deleted with `delete-frame'.
 Without a prefix argument, undelete the most recently deleted
 frame.
-With a numerical prefix argument ARG between 1 and 16, where 1 is
+With a numerical prefix argument ARG between 1 and `undelete-frame-max', where 1 is
 most recently deleted frame, undelete the ARGth deleted frame.
 When called from Lisp, returns the new frame."
   (interactive "P")
@@ -2586,7 +2584,7 @@ undelete-frame
              (frames (frame-list))
              (frameset (nth (1- number) undelete-frame--deleted-frames))
              (graphic (display-graphic-p)))
-        (if (not (<= 1 number 16))
+        (if (not (<= 1 number undelete-frame-max))
             (user-error "%d is not a valid deleted frame number argument"
                         number)
           (if (not frameset)

  reply	other threads:[~2022-01-14  8:12 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 23:38 bug#51883: 29.0.50; Command to get accidentally deleted frames back Michael Heerdegen
2021-11-16  7:53 ` Juri Linkov
2021-11-16  8:14   ` Lars Ingebrigtsen
2021-11-16 20:46   ` Juri Linkov
2021-11-16  8:49 ` Visuwesh via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-16 20:20   ` Juri Linkov
2021-11-16 15:17 ` Gregory Heytings
2021-11-16 17:05   ` Gregory Heytings
2021-11-16 17:40     ` Eli Zaretskii
2021-11-16 21:29       ` Gregory Heytings
2021-11-17 10:02         ` Gregory Heytings
2021-11-17 13:11         ` Eli Zaretskii
2021-11-17 17:06           ` Juri Linkov
2021-11-17 17:14             ` Eli Zaretskii
2021-11-19  9:00           ` Gregory Heytings
2021-11-19 12:17             ` Eli Zaretskii
2021-11-24  0:44               ` Gregory Heytings
2021-11-27 11:36                 ` Michael Heerdegen
2021-11-27 11:53                   ` Gregory Heytings
2021-11-27 12:05                     ` Eli Zaretskii
2021-11-27 12:12                       ` Gregory Heytings
2021-11-27 12:30                         ` Andreas Schwab
2021-11-27 12:34                         ` Eli Zaretskii
2021-11-27 12:23                       ` Michael Heerdegen
2021-11-27 12:40                         ` Eli Zaretskii
2021-11-27 13:22                           ` Michael Heerdegen
2021-11-27 13:26                             ` Eli Zaretskii
2021-11-27 13:34                               ` Michael Heerdegen
2021-11-27 13:56                                 ` Eli Zaretskii
2021-11-27 13:59                                   ` Michael Heerdegen
2021-11-27 14:02                                     ` Eli Zaretskii
2021-11-27 14:08                                       ` Michael Heerdegen
2021-11-27 14:47                                         ` Eli Zaretskii
2021-11-27 14:12                                 ` Gregory Heytings
2021-11-27 14:24                                   ` Michael Heerdegen
2021-11-27 14:26                                     ` Gregory Heytings
2021-11-27 14:33                                       ` Michael Heerdegen
2021-11-27 14:42                                         ` Gregory Heytings
2021-11-27 14:54                                           ` Michael Heerdegen
2021-11-27 17:19                                             ` Gregory Heytings
2021-11-28 15:47                                               ` Michael Heerdegen
2021-11-29 13:38                                                 ` Gregory Heytings
2021-11-29 18:18                                                   ` Michael Heerdegen
2021-11-29 19:07                                                     ` Michael Heerdegen
2021-11-29 20:19                                                       ` Juri Linkov
2022-01-13  8:32                                                         ` Juri Linkov
2022-01-14  8:12                                                           ` Juri Linkov [this message]
2022-01-16 20:59                                                             ` Juri Linkov
2022-01-17  0:08                                                               ` Michael Heerdegen
2022-01-17  8:24                                                                 ` Juri Linkov
2022-01-17 13:00                                                               ` Eli Zaretskii
2022-01-17 18:41                                                                 ` Juri Linkov
2022-01-17 18:51                                                                   ` Eli Zaretskii
2022-01-18 18:30                                                                     ` Juri Linkov
2022-01-19 18:37                                                                       ` Juri Linkov
2022-01-19 20:17                                                                         ` Eli Zaretskii
2021-12-12  2:44                                                     ` Michael Heerdegen
2022-01-10  8:13                                                       ` Michael Heerdegen
2021-11-27 14:48                                   ` Eli Zaretskii
2021-11-27 12:13                   ` Michael Heerdegen
2022-01-22 18:10               ` Juri Linkov
2022-01-21 17:52       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-22 18:08         ` Juri Linkov
2022-01-22 21:26           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-23  9:11             ` Juri Linkov
2022-01-23 16:01               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-23 18:12                 ` Juri Linkov
2022-01-23 21:26                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-24 18:12                     ` Juri Linkov
2022-01-24 18:32                       ` Eli Zaretskii
2022-01-25  9:28                         ` martin rudalics
2022-01-25 12:29                           ` Eli Zaretskii
2022-01-25 15:58                             ` martin rudalics
2022-01-27 17:21                               ` Juri Linkov
2022-01-27 17:27                                 ` Eli Zaretskii
2022-01-27 17:48                                   ` Juri Linkov
2022-01-24 23:00                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-27 17:19                         ` Juri Linkov
2022-01-30 16:39         ` Juri Linkov
2022-01-30 16:59           ` Eli Zaretskii
2022-01-30 17:17             ` Juri Linkov
2022-01-30 18:17               ` Eli Zaretskii
2022-01-30 20:49                 ` Juri Linkov
2021-11-16 20:30   ` Juri Linkov
2021-11-17  4:13 ` Richard Stallman
2021-11-17 10:07   ` Gregory Heytings
2021-11-17 16:39   ` bug#51883: [External] : " Drew Adams

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861r1aoi9i.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=51883@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=michael_heerdegen@web.de \
    /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.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).