unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 58909@debbugs.gnu.org
Subject: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save
Date: Tue, 1 Nov 2022 15:39:29 -0700	[thread overview]
Message-ID: <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@gmail.com> (raw)
In-Reply-To: <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@gmail.com>

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

On 11/1/2022 9:11 AM, Jim Porter wrote:
> However, I'm not sure how to do this in a complete way without tweaking 
> 'delete-frame-functions'. ...
Attached is a (hopefully) safer version of my change to 'delete-frame'. 
In this patch, a hook can only cancel frame deletion if FORCE is 
non-nil. This way, if there were ever some bug with a hook, you (or some 
code) can still force-delete the frame.

This would probably still need a NEWS entry, but I'm personally less 
worried about this change compared to my previous revision. What do you 
think?

[-- Attachment #2: 0001-Let-delete-frame-functions-quit-out-of-frame-deletio.patch --]
[-- Type: text/plain, Size: 1112 bytes --]

From ea7a6ff541ccfae474f32ffa1dedd3667ede63b7 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Tue, 1 Nov 2022 15:28:18 -0700
Subject: [PATCH] Let 'delete-frame-functions' quit out of frame deletion if
 FORCE is nil

* src/frame.c (delete_frame): When FORCE is nil, call
'delete-frame-functions' with 'call2' instead of 'safe_call2' to allow
hooks to quit out.
---
 src/frame.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/frame.c b/src/frame.c
index f076a5ba54..9722efa505 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2037,7 +2037,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
       x_clipboard_manager_save_frame (frame);
 #endif
 
-      safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
+      /* If FORCE is nil, allow hooks to quit out of frame deletion.  */
+      if (NILP (force))
+	call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
+      else
+	safe_call2 (Qrun_hook_with_args, Qdelete_frame_functions, frame);
     }
 
   /* delete_frame_functions may have deleted any frame, including this
-- 
2.25.1


  reply	other threads:[~2022-11-01 22:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-30 22:29 bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save Jim Porter
2022-10-31 12:44 ` Eli Zaretskii
2022-10-31 17:36   ` Jim Porter
2022-10-31 18:25     ` Eli Zaretskii
2022-10-31 19:38       ` Jim Porter
2022-10-31 19:52         ` Eli Zaretskii
2022-10-31 20:28           ` Jim Porter
2022-11-01  6:17             ` Eli Zaretskii
2022-10-31 19:28   ` Jim Porter
2022-10-31 19:43     ` Eli Zaretskii
2022-10-31 20:01       ` Jim Porter
2022-10-31 20:21         ` Eli Zaretskii
2022-10-31 21:06           ` Jim Porter
2022-11-01  6:39             ` Eli Zaretskii
2022-11-01 16:11               ` Jim Porter
2022-11-01 22:39                 ` Jim Porter [this message]
2022-11-02 12:16                   ` Eli Zaretskii
2022-11-02 16:36                     ` Jim Porter
2022-11-02 17:11                       ` Eli Zaretskii
2022-11-02 18:17                         ` Jim Porter
2022-11-02 18:42                           ` Eli Zaretskii
2022-11-02 19:16                             ` Jim Porter
2022-11-02 19:23                               ` Eli Zaretskii
2022-11-02 19:57                                 ` Jim Porter
2022-11-02 20:09                                   ` Eli Zaretskii
2022-11-02 22:09                                     ` bug#58909: 29.0.50; [PATCH] " Jim Porter
2022-11-03  6:25                                       ` Eli Zaretskii
2022-11-06 20:23                                         ` Jim Porter
2022-11-08 14:47                                           ` Eli Zaretskii
2022-11-08 15:08                                             ` Robert Pluim
2022-11-08 15:13                                               ` Eli Zaretskii
2022-11-08 15:29                                                 ` Robert Pluim
2022-11-08 16:52                                                   ` Jim Porter
2022-11-09 10:06                                                     ` Robert Pluim
2022-11-17  5:17                                                       ` Jim Porter
2023-09-07 21:03                                                         ` bug#58909: 29.0.50; [WIP PATCH] " Stefan Kangas
2023-09-08  1:21                                                           ` Jim Porter

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=0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=58909@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).