From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir Date: Sun, 25 Apr 2021 01:13:13 +0300 Message-ID: <87tunvnxfo.fsf@linkov.net> References: <878s7z4ihk.fsf@gmail.com> <87a6sdzeh6.fsf@mail.linkov.net> <87ft16g0u2.fsf@gmail.com> <87tupmisel.fsf@mail.linkov.net> <1952f2d9-51b6-a4ba-6c9e-98594222f017@gmail.com> <87r1kpemnr.fsf@mail.linkov.net> <87mtv6yloe.fsf@gmail.com> <871rcgr4qp.fsf@mail.linkov.net> <87zgz3gfqo.fsf@mail.linkov.net> <87blbhhghk.fsf@mail.linkov.net> <87pmzsgzh3.fsf@gmail.com> <87o8fc5jq0.fsf@mail.linkov.net> <87wnsz7jmy.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7404"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 46374@debbugs.gnu.org, Stefan Monnier , =?UTF-8?Q?Qu=C3=A1ch_?= =?UTF-8?Q?M=E1=BB=B9_?= =?UTF-8?Q?Uy=C3=AAn?= Nhi To: Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 25 00:23:29 2021 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 1laQgT-0001pL-P8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Apr 2021 00:23:29 +0200 Original-Received: from localhost ([::1]:48254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laQgS-0003jB-PO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 24 Apr 2021 18:23:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laQf5-000280-5F for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 18:22:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laQf4-0006HP-J7 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 18:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1laQf4-0003Rw-F9 for bug-gnu-emacs@gnu.org; Sat, 24 Apr 2021 18:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 24 Apr 2021 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46374 X-GNU-PR-Package: emacs Original-Received: via spool by 46374-submit@debbugs.gnu.org id=B46374.161930290613235 (code B ref 46374); Sat, 24 Apr 2021 22:22:02 +0000 Original-Received: (at 46374) by debbugs.gnu.org; 24 Apr 2021 22:21:46 +0000 Original-Received: from localhost ([127.0.0.1]:41651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laQeo-0003RP-6x for submit@debbugs.gnu.org; Sat, 24 Apr 2021 18:21:46 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1laQel-0003RB-VM for 46374@debbugs.gnu.org; Sat, 24 Apr 2021 18:21:45 -0400 X-Originating-IP: 91.129.102.166 Original-Received: from mail.gandi.net (m91-129-102-166.cust.tele2.ee [91.129.102.166]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 53BCEE0003; Sat, 24 Apr 2021 22:21:34 +0000 (UTC) In-Reply-To: <87wnsz7jmy.fsf@gmail.com> (Tino Calancha's message of "Sun, 18 Apr 2021 16:27:33 +0200") 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" Xref: news.gmane.io gmane.emacs.bugs:204828 Archived-At: >>> I have noticed that I haven't enabled lexical-binding in my .emacs file, >>> which it is crucial for my use case. >>> To avoid surprises, I have mentioned this issue in the docstring. >> >> Unfortunately, your patch is truncated. Could you send a complete patch? > > Here is: Thanks. Your first patch was better in terms of customizability. It allowed the users to easily customize the used predicate, but its disadvantage was that it introduced a new defcustom. Would it be possible to merge the advantage of your first patch with the cleaner solution of your latest patch? > +(defvar save-some-buffers-fun-function (lambda () save-some-buffers-default-predicate) Maybe it's possible to hard-code this as the default option of the existing defcustom save-some-buffers-default-predicate? Currently there is such FIXME comment in save-some-buffers-default-predicate: ;; FIXME nil should not be a valid option, let alone the default, ;; eg so that add-function can be used. Is it possible to add the default value as a function that returns nil? This will implement FIXME, and will allow adding more options with more predicates: > +\(lambda () > + (let ((project-dir > + (or (and (project-current) (project-root (project-current))) > + default-directory))) > + (lambda () (file-in-directory-p default-directory project-dir)))) Then this code could be implemented as an additional option for save-some-buffers-default-predicate.