From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#46374: 28.0.50; Ask me to save buffers only if they are under callers dir Date: Sun, 07 Mar 2021 21:34:13 +0100 Message-ID: <87ft16g0u2.fsf@gmail.com> References: <878s7z4ihk.fsf@gmail.com> <87a6sdzeh6.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25515"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46374@debbugs.gnu.org, stefan monnier , uyennhi.qm@gmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 07 21:35:10 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 1lJ07J-0006W0-EE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 21:35:09 +0100 Original-Received: from localhost ([::1]:60140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJ07I-0001rJ-Gr for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Mar 2021 15:35:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJ07C-0001rD-5t for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:35:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJ07B-0000po-VG for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:35:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lJ07B-00086j-Rm for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 15:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Mar 2021 20:35:01 +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.161514926531117 (code B ref 46374); Sun, 07 Mar 2021 20:35:01 +0000 Original-Received: (at 46374) by debbugs.gnu.org; 7 Mar 2021 20:34:25 +0000 Original-Received: from localhost ([127.0.0.1]:41605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ06a-00085p-TL for submit@debbugs.gnu.org; Sun, 07 Mar 2021 15:34:25 -0500 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:43603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ06W-00085a-Pj for 46374@debbugs.gnu.org; Sun, 07 Mar 2021 15:34:22 -0500 Original-Received: by mail-wm1-f54.google.com with SMTP id a25-20020a1cf0190000b029010b1cbe2dd0so2522216wmb.2 for <46374@debbugs.gnu.org>; Sun, 07 Mar 2021 12:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=u6IO9fCrjGg+BI2P3wa2HLiuIqJTO7agS6gEA9BNKfg=; b=tmDiYN+smgf/scyMDU3p+s8m8bzpE6R/qCrSttuF2cQhH7SxtIZPsT38buAO1SVxub 1eoikMK5k1lwlfTfKyHONqG/DlHZXmZaQoSC2E1LhuqxLaCHKLe711mZTcXhcfjPmMWS MTzNOwhSgTDxeyw/jKMX9ISaDsvaYpVZspBZfwAyBH3iDOP+BwOXN7+/5MnS+PffjTLV oUxHosSK9Tm/H8D1dl/9KqbUNcdaEPa6d1+WsZNFNG1yVGJLBMVwuSNiWOmoAQ3U2pkK mlkwBlX7JCaxgiuMRQG0T2GfZPoyb1iHUWGbnjPX59n18FLPkGTb453Ynx6gwIJCynkR sGmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=u6IO9fCrjGg+BI2P3wa2HLiuIqJTO7agS6gEA9BNKfg=; b=sQedp6ZweesIxUVx/vfb2yz/JD5AK75l9w7YvVBxlofR4yCrW7K53sDunlyuS/Yft5 WcIyiwZzcT68+Ory25USukvjsViNKhD9yuf8XPbDE+pphmyMAwtw5bgdEMU/9KM1sz1s cN0aSqdol6pjcXhTLKOarK6vozezruxViUA6KxmINY2BTNMxEUjjFWxZshvwEDQ8RUhn GD61rtac/xWFmyDt5YRMSd1uK33AZT8T4MoU4yi+WnFckivMWtzRSXd3vR+CZDtkeWz+ JMhEcmaHDOfrr04P1nAzQcViyJqCoCjMbIvN1xj7brc0wbjk/IO7Tw04nvlm0IWtVYCi CAmQ== X-Gm-Message-State: AOAM532fDIMMkHqeYMP5amtqO52Z9TLkRlH/2ORWoqXDoYJuaq7B2Htb igkMCQqKdm7kes/xxJo8YFA= X-Google-Smtp-Source: ABdhPJw44qY9GZDjCdB0vkCNTYPsoQUcQFBqnd4Mjio0AYKdFV5DXMCLlcQLk0FH4tlVBfIbIj5dFg== X-Received: by 2002:a05:600c:c4:: with SMTP id u4mr19282344wmm.27.1615149254868; Sun, 07 Mar 2021 12:34:14 -0800 (PST) Original-Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id a75sm15547030wme.10.2021.03.07.12.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 12:34:14 -0800 (PST) In-Reply-To: <87a6sdzeh6.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 09 Feb 2021 19:50: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:201780 Archived-At: Sorry for the late response: many meetings with investors. Then I went on a vacation to my castle in Seychelles. Eli Zaretskii writes: >> You are assuming that when save-some-buffers runs, the default >> directory is the same as when you issued whatever command triggered >> the call to save-some-buffers? Is that assumption really accurate? I don't know if there are some corner cases. In my experience, I am hit by this (very often) when using packages that call `compilation-start`. Prominent examples are `rgrep` or when downloading ELPA updates (they will trigger a compilation as well). The patch is serving me very well so far. Juri Linkov writes: >> @vindex save-some-buffers-default-predicategn >> +@vindex save-some-buffers-restrict-to-caller-subdirs >> You can customize the value of >> -@code{save-some-buffers-default-predicate} to control which buffers >> -Emacs will ask about. >> +@code{save-some-buffers-default-predicate} and >> +@code{save-some-buffers-restrict-to-caller-subdirs} to control which >> +buffers Emacs will ask about. > > Why not simply add a new option to the existing variable > save-some-buffers-default-predicate? For example: > > (defcustom save-some-buffers-default-predicate nil > "Default predicate for `save-some-buffers'." > :group 'auto-save > ;; FIXME nil should not be a valid option, let alone the default, > ;; eg so that add-function can be used. > :type '(choice (const :tag "Default" nil) > (const :tag "Subdirs of default directory" default-directory) > (const :tag "Project root" project-root) > function) Indeed, this was my initial implemention. Then I moved to the one I shared here; I found my second version superior for the following reason: 1. Users can restrict the buffer default directory AND still pass a predicate to filter by any other thing they wish; i.e. you don't need to chose either one of the other. 2. I find it cleaner having it in a separated option. Stefan Monnier >> If we want to have such a behavior and make it optional, it's fine by me. It's optional in my patch; some people might like the current situation: been prompted about any modified buffer. >> But if we want to make it a default behavior, then I think >> `project-root` would be much a much better choice (when available) than >> `default-directory`. Would this `project-root` feature work for `rgrep`? I mean, I can call `rgrep` in my local computer, out of any project, for instance to search for information in some plain text notes. In this case, `default-directory` works quite well.