[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] Re: [Feature request] I suggest delete-frame command can prompt

From: Christopher M. Miles
Subject: [SOLVED] Re: [Feature request] I suggest delete-frame command can prompt user for confirmation
Date: Mon, 15 Nov 2021 23:52:56 +0800
User-agent: mu4e 1.7.0; emacs 28.0.60

This is great. Have a way to restore killed frame will be a good replacement 
for my suggestion.
Thanks for your sharing. Michael.

Michael Heerdegen <> writes:

> Michael Heerdegen <> writes:
>> Wouldn't it be much more useful to be able to restore a killed frame?
> Like this maybe?
> #+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
> Michael.

[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]