unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51883: 29.0.50; Command to get accidentally deleted frames back
@ 2021-11-15 23:38 Michael Heerdegen
  2021-11-16  7:53 ` Juri Linkov
                   ` (3 more replies)
  0 siblings, 4 replies; 87+ messages in thread
From: Michael Heerdegen @ 2021-11-15 23:38 UTC (permalink / raw)
  To: 51883


Hello,

seems we don't have a command to restore a frame that the user has
killed by accident (note: we have `restore-frame', but that's something
different [related to maximizing commands]).  This is a feature request
to add such a command.

It seems this feature can't be implemented using window configurations
(AFAIU they die with their frame), and also not using frame
configurations (they don't work per frame) - but using one element
framesets seems to work:

#+begin_src emacs-lisp
(require 'frameset)
(require 'cl-lib)

(defvar my-killed-frame-ring-size 10)
(defvar my-killed-frames (make-ring my-killed-frame-ring-size))

(advice-add 'delete-frame :before #'my-remember-deleted-frame)

(defun my-remember-deleted-frame (&optional frame _force)
  (ring-insert my-killed-frames
               (frameset-save (list (or frame (selected-frame))))))

(defun my-restore-killed-frame (&optional n)
  (interactive "p")
  (let ((frames-before (frame-list)))
    (frameset-restore (ring-ref my-killed-frames (- (or n 1) 1)))
    (let ((restored (cl-set-difference (frame-list) frames-before)))
      (when (and restored (not (cdr restored)))
        (select-frame-set-input-focus (car restored))))))

(global-set-key [?\C-x ?5 ?t] #'my-restore-killed-frame)
#+end_src

Maybe having it in C would be better - I don't know.  A more convenient
access to frames killed earlier than the last one, instead of using the
prefix arg like above, might be appropriate (making the command
repeatable, maybe?)  Apart from these details the above is a start and
could just go to frameset.el.  Opinions?


TIA,

Michael.


In GNU Emacs 29.0.50 (build 25, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-11-15 built on drachen
Repository revision: 6b79b03c81f77ca00adeb80170653d4c0b53d46a
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)






^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2022-01-30 20:49 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).