From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#25340: Save-some-buffers gets called when installing packages. Date: Sun, 08 Jan 2017 00:33:41 -0500 Message-ID: <878tqm2k0a.fsf@users.sourceforge.net> References: <0467624a-368b-6b61-e08d-97a34c8c25fa@gmail.com> <87zij63z0j.fsf@users.sourceforge.net> <8a717ff8-c5f7-2b3e-33d0-0a0403dbddf5@gmail.com> <87fukw5381.fsf@users.sourceforge.net> <240fc1ee-a0b8-c95b-4353-9e6bf26db940@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483853606 11918 195.159.176.226 (8 Jan 2017 05:33:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Jan 2017 05:33:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 25340@debbugs.gnu.org To: Nikolay Kudryavtsev Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 08 06:33:23 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1cQ66O-0000sr-6A for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jan 2017 06:33:08 +0100 Original-Received: from localhost ([::1]:60314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ66S-0002uC-LT for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Jan 2017 00:33:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ66M-0002tt-0D for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 00:33:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ66I-0003Sm-Pe for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 00:33:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59255) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cQ66I-0003Sh-MU for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 00:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cQ66I-0002Xr-BF for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 00:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jan 2017 05:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25340 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25340-submit@debbugs.gnu.org id=B25340.14838535659754 (code B ref 25340); Sun, 08 Jan 2017 05:33:02 +0000 Original-Received: (at 25340) by debbugs.gnu.org; 8 Jan 2017 05:32:45 +0000 Original-Received: from localhost ([127.0.0.1]:46421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ660-0002XF-Nd for submit@debbugs.gnu.org; Sun, 08 Jan 2017 00:32:44 -0500 Original-Received: from mail-it0-f43.google.com ([209.85.214.43]:36288) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ65z-0002X1-Ci for 25340@debbugs.gnu.org; Sun, 08 Jan 2017 00:32:43 -0500 Original-Received: by mail-it0-f43.google.com with SMTP id c7so3128179itd.1 for <25340@debbugs.gnu.org>; Sat, 07 Jan 2017 21:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=0uxUI+w7T+iS7FiFiq5EB8xyrqxl2Swkd2qhyEX1um4=; b=NfLD/dQjeMdRcyV41ErC6LTglFzKMw5v7cTaV+wIebDWhMUu1vHvl6x1q+TzkJJJrH WuzjxYAnJ5rnk4ipJpCXO8GoHPBLDD1LGslIbd55NZiPCGtzqjm/Yf3EOUv1i3syP4to XVtKtN+xgtl5FceOFuismFFIqNB+qC0jJW0B1ikP7qiruyBNF9wAbqmhmMrsqxslCNBq GwDX/EXPUgrpZ0MnFVUmYn3s+ZwWwP5z0ApS1SThxk2kXPOUdh/pZF4l5ZFcOB08vQxP UF/92hG8dPYHr+bV4dWOK1yxS8RwJ0vVGGVd7ktdaM+6Uu2eJuVoSDQBmD0fBVy9eSti Vvcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=0uxUI+w7T+iS7FiFiq5EB8xyrqxl2Swkd2qhyEX1um4=; b=d1G+jwfoLAzcCAGnZZygr8hJVJ2qyywOdeEciIeRccz6ssAayqsbpT9X+LHwLv+olx fA602SbeIKXRuw3b57k7bUis/tlYROhZKEhhDLzsAHTZqG5Q1/7QrudkmMd1P8n6dc/A oI9mPx2E0J81SKXtd8Scvxc3c4aIuC/+i/2RVW06Opsi1f+nf4CqfUwQukyLp1YTcYXK AF0KVu072krn1FgCjIH7Dl6a3ybSmVIHAdyFPvFK9wis3ErOcO+Sv4DJ/xLE0bjKW3cF 8zCQBluAR7sQ34hBrTlgrQS1m54xcjZMzImxTIg/vdl1J+C7cDzlI00ychSyJYRCDdIm J4Yw== X-Gm-Message-State: AIkVDXKIpcSwCnS1oZeG17fbQYh1BpVI2zwLSNkfdvtT0KdsEX9QozuKJNtuRLL/jsfmnA== X-Received: by 10.36.238.139 with SMTP id b133mr4651708iti.81.1483853557697; Sat, 07 Jan 2017 21:32:37 -0800 (PST) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 81sm4268332itj.6.2017.01.07.21.32.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jan 2017 21:32:37 -0800 (PST) In-Reply-To: <240fc1ee-a0b8-c95b-4353-9e6bf26db940@gmail.com> (Nikolay Kudryavtsev's message of "Sat, 7 Jan 2017 21:06:18 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127893 Archived-At: Nikolay Kudryavtsev writes: > I had the idea of doing this: > > (defun byte-recompile-directory (directory &optional arg force > limit-buffer-saving) > > ... > > If forth argument LIMIT-BUFFER-SAVING is 'directory, only files within > DIRECTORY would be saved. When LIMIT-BUFFER-SAVING is t no existing buffers > would be checked for modification. > > > But I found out out that having LIMIT-BUFFER-SAVING with value t like > this would not work without an accompanying change to > byte-recompile-file - since byte-recompile-file already checks whether > there's a buffer for that file and that buffer is modified. So, since > I don't think that doing changes to byte-recompile-file is the best > idea, here's my current version. Ah, it's in byte-compile-file, not byte-REcompile-file. Since with the current code, if there is a buffer you don't want to save before compiling, you have to answer "no" twice, I think changing byte-compile-file would be a good thing to do. But we could leave it for later. > > Also, note that the check in byte-recompile-file actually makes > calling save-some-buffers somewhat redundant. I would say the redundancy is in the other direction, but yes, agreed. Patch looks okay, just a few minor comments, below. > * doc/lispref/compile.texi: Documented `limit-buffer-saving' argument ^^^^^^^^^^ Use present tense ("Document `foo' argument..."). > > +By default, user is prompted before recompilation to save modified > +buffers one by one. Setting @var{limit-buffer-saving} to @code{t} checks ^^^ End sentences with double space. > +If forth argument LIMIT-BUFFER-SAVING is t only buffers within ^^^^^ ^ fourth comma here, I think > +DIRECTORY would be checked for modification." ^^^^^^^^^^^^^^^^ I think that should be "are checked". > + (if limit-buffer-saving > + (save-some-buffers > + nil > + (lambda () > + (string-prefix-p (expand-file-name directory) > + (expand-file-name buffer-file-name)))) > + (save-some-buffers)) I would rather avoid doubling the call to save-some-buffers, so use something like (save-some-buffers nil (if limit-buffer-saving (lambda () ...)))