From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65719: [PATCH] Pass restart argument to 'kill-emacs-query-functions' Date: Sat, 04 Jan 2025 16:14:17 +0200 Message-ID: <86cyh2d5ty.fsf@gnu.org> References: <329566cab29d3bdd4cd7f2257ec9f92a@elken.dev> <0817cde8dd8dab055dafe2e8aa3d30d5@elken.dev> <2aae66e7-f7e3-4da4-aee8-0ff9a8db1f0a@elken.dev> <0d97a409-b9c4-4204-b5d0-1bb386056c56@elken.dev> <86v86tr5dj.fsf@gnu.org> <86sf1xr3ep.fsf@gnu.org> <60592464472415a836939db15e38a8cf@elken.dev> <86v7uud8ua.fsf@gnu.org> <9422f3bb7316d0fb3eba6dcc832e26c5@elken.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13702"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65719@debbugs.gnu.org, stefankangas@gmail.com To: me@elken.dev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 04 15:15:15 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tU4vr-0003PB-Ef for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Jan 2025 15:15:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tU4vl-0003uP-ME; Sat, 04 Jan 2025 09:15:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tU4vj-0003sY-La for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 09:15:07 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tU4vj-000128-BH for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 09:15:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=2qhD1K0GK5+KdtD7TPR+B2fTgmg4/y+xMryyPnnWS2A=; b=kMTfrnNIQPuFK5HlruDkP4BywGMCQREK4u+OXrPFsol34XbciakpxY0415i4EYIPPWC3Dzi7FcljdQRTP5Wo2+g0IgiWH8hQ/0kupEjYqIJ2yrnbF6MMPByCt7CCI6Mel7T0HmtYzvB1CoZSJ9zfKzsXLWPaUq2VnH/XD8tQS9lrPaHhReqouRIvT/6OHC4lwRLqbW3uVUEMDgsIHackcME9XPCVzRXQ7mz5YB5pBG5NG1GkmU/1S+N2SrTeGGPb/HM8wJBa6ItZTcH679+MslpfpA6z9o7DrZVJX5SE6+WmvwL7Wk0j6FwE+RmWLWKch+a9kOeNPt517lwuHyH1/A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tU4vf-0001kX-PW for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2025 09:15:05 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2025 14:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65719 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65719-submit@debbugs.gnu.org id=B65719.17360000736664 (code B ref 65719); Sat, 04 Jan 2025 14:15:03 +0000 Original-Received: (at 65719) by debbugs.gnu.org; 4 Jan 2025 14:14:33 +0000 Original-Received: from localhost ([127.0.0.1]:54024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tU4vA-0001jQ-Hk for submit@debbugs.gnu.org; Sat, 04 Jan 2025 09:14:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43052) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tU4v7-0001j8-7F for 65719@debbugs.gnu.org; Sat, 04 Jan 2025 09:14:29 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tU4v1-0000nX-Gi; Sat, 04 Jan 2025 09:14:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2qhD1K0GK5+KdtD7TPR+B2fTgmg4/y+xMryyPnnWS2A=; b=RkPfDLqVMrw4 4hv0AySC6kkoQ6WHieRfwMRWC89+i5PXHWm1iV+UUsasdNe1yhOafN4oLlz6gtqeTM98L2I0PxL78 G361dpnVqTxHDEPdY0Vdhrrt9M/CHM0HkcDc2zH/1sAaJY5otBoCLTwEu96+ByEagxeZLPy78x98Y dg44NgQPRed3D4m59c2rZQvBTxn2d/gxCzcP7qOx4JPvtpWp0qChiEN1NZcTD2U+iOmZTcbSg5wUV BSlQU4HINWFa7FpO36Fc/rYOuwjDsduIctcXb4sySUmPJaOTyp0Wz3YANkWbfFL1xJVtWd6BZBwAQ mKaN/QvWsvGnse5Ck2yNlw==; In-Reply-To: <9422f3bb7316d0fb3eba6dcc832e26c5@elken.dev> (me@elken.dev) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298411 Archived-At: > Date: Sat, 04 Jan 2025 13:34:23 +0000 > From: me@elken.dev > Cc: 65719@debbugs.gnu.org, stefankangas@gmail.com > > > Sorry, I still don't follow. What does your > > kill-emacs-query-functions hook do when passed the RESTART argument > > that is different from RESTART being nil (i.e. killing Emacs without > > restarting it)? > > The point is differentiating between a quick "Oh I just need to clear > out some memory or reset the state of my Emacs, but I want to carry on > working as I was" and "I'm done with Emacs now, next time I start it I > want it to be a clean slate". Adding another hook was the cleanest > option I could come up with. It's a strange (and maybe even dangerous) distinction. But in any case, I think a cleaner solution would be to bind a variable inside restart-emacs, and then your hook could examine it. Alternatively, ... > > In any case, the prefix argument is available via current-prefix-arg. > > Yes you're right, I realised after I sent it.... ...you could invoke restart-emacs with a prefix argument, and examine that in your kill-emacs-query-functions hook. AFAICT, this should work without any changes.