From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: using save-some-buffers-default-predicate Date: Mon, 06 Nov 2017 12:46:14 +0000 Message-ID: <87vainpobt.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1509972387 13423 195.159.176.226 (6 Nov 2017 12:46:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 6 Nov 2017 12:46:27 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 06 13:46:22 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBgnF-0003L1-UD for ged-emacs-devel@m.gmane.org; Mon, 06 Nov 2017 13:46:22 +0100 Original-Received: from localhost ([::1]:47785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBgnN-00046p-2U for ged-emacs-devel@m.gmane.org; Mon, 06 Nov 2017 07:46:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBgnH-00046j-30 for emacs-devel@gnu.org; Mon, 06 Nov 2017 07:46:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBgnD-0008NX-7Q for emacs-devel@gnu.org; Mon, 06 Nov 2017 07:46:23 -0500 Original-Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:43460) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBgnD-0008NN-0N for emacs-devel@gnu.org; Mon, 06 Nov 2017 07:46:19 -0500 Original-Received: by mail-wr0-x235.google.com with SMTP id 4so4217159wrt.0 for ; Mon, 06 Nov 2017 04:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=6BrPteSjK+IYGtviBrja78Irq2egvoPyP+4C5UUP9nQ=; b=u5ipy3K/1tnGszO+lZ4QQ9wbncUsArfuGRvYZD+n2Y/oIgg7ualsoRWrKf+7fgm395 vByU0mDUL7IkVLzTPx5p2oxobjrwLX+tMI2MLMOhEO2/rtVHEXP+haJGtJxUTJ5vrWFn DDBDlAM/t2hFK6/xqQ3hs9SMkt3cOIDnwa2UUL0r053d6ktAZ39wkilxAoBuzZTDtLl3 y1LWBjD6JrPkm1+amHK69Z1auM5C5bFvx6j8zobmhHH7jWEHzoyI+sm0S332Q8HCPTZh 2rUh7c4kn6ruvq9Lpxekh3BknS+CHvVPv6MqRQ9hhDUvhzsFAuAJDhVpbpe2Zr0pmeyj VslA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=6BrPteSjK+IYGtviBrja78Irq2egvoPyP+4C5UUP9nQ=; b=krjm3C3KXTTsDhoKM/OiaxpBrp870RdxxrEA6vBraOTqTkEbTe6Ye+nwso0BObDKro 8KrTdnUr/ASvvZCSpuIfrUJLxjR2dPAv1OfrfIZ5Uny8xcRwz9FVfMbGdcVw99grqFwW DKd3WSP04EyNAcVFrFzU9vkdFd7gtBviv4CvGL236TyKmsaXRR2n9OnkL+9POpwxLeWs y6o0hk/DgaNdn1BSi7MhrsGVy+2205+sWE/uMUmQJiRk7hJc7yaeSAPGRS0eL/E9q3om YjFjzrIwmNC9+jv7Dv7ZAkyWaobsMX1dWk6BDwE9AU1deXo+XrjySWs8D24piGqFp8Rg 06+Q== X-Gm-Message-State: AMCzsaUYeGHz8pWDUt5oPbHu/sN5DXEJa4nuV+fKRXHJalJlwSUDkjeD Gd23RoqKC9QHQijyI5sG6wzvi75W X-Google-Smtp-Source: ABhQp+QdqUEjjyABr4+4ycd+ynWygjNXO1/txw1L0h8ofrT9OcxrD/7CpiSO6NG3nvlRgDPEsU7uIQ== X-Received: by 10.223.190.132 with SMTP id i4mr13744539wrh.123.1509972377515; Mon, 06 Nov 2017 04:46:17 -0800 (PST) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id j125sm16822228wmf.24.2017.11.06.04.46.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2017 04:46:16 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219944 Archived-At: Hi all, Apologies if I'm late to the discussion and this particular question has been answered before, but let me first explain what I've always wanted save-some-buffers to do: ask me about unsaved buffers *in the project I'm working on*. So, shouldn't save-some-buffers include some kind of provision for this, like binding a special variable to the current project that the argless save-some-buffers-default-predicate can use? Currently I have this in my .emacs, which takes care of M-x compile, M-x tex-compile and probably other calls to save-some-buffers for this kind of operations. (defvar save-some-buffers-project nil "The current project when `save-some-buffers' is called.") =20=20=20=20 (defun a-good-default-pred () (if (null save-some-buffers-project) t (and buffer-file-name (eq (project-current) save-some-buffers-project)))) =20=20=20=20 (setq save-some-buffers-default-predicate 'a-good-default-pred) =20=20=20=20 (defun wrap-in-good-save-buffers-predicate (oldfun &rest args) (let ((save-some-buffers-project (project-current))) (apply oldfun args))) =20=20=20=20 (advice-add 'save-some-buffer :around 'wrap-in-good-save-buffers-predica= te) I'm not saying we should change the default of save-some-buffers-default-predicate (yet), but shouldn't something like this be easier to do? Jo=C3=A3o