GNU bug report logs - #25340
Save-some-buffers gets called when installing packages.

Previous Next

Package: emacs;

Reported by: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>

Date: Mon, 2 Jan 2017 22:43:01 UTC

Severity: minor

Tags: fixed, patch

Merged with 25964, 26056

Found in version 26.0.50

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25340 in the body.
You can then email your comments to 25340 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Mon, 02 Jan 2017 22:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 Jan 2017 22:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Save-some-buffers gets called when installing packages.
Date: Tue, 3 Jan 2017 01:42:13 +0300
[Message part 1 (text/plain, inline)]
Every time you install a new package you get called to save your 
modified buffers one by one. So, whenever I update my packages I can get 
like 30 packages and I have to press q at least 30 times. This behavior 
is pointless and somewhat annoying.

I've attached the laziest possible patch for this.

-- 
Best Regards,
Nikolay Kudryavtsev

[0001-Prevent-package-install-from-asking-to-save-buffers.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Thu, 05 Jan 2017 04:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Wed, 04 Jan 2017 23:35:08 -0500
Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> writes:

> Every time you install a new package you get called to save your
> modified buffers one by one. So, whenever I update my packages I can
> get like 30 packages and I have to press q at least 30 times. This
> behavior is pointless and somewhat annoying.
>
> I've attached the laziest possible patch for this.

> * lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): New argument
> `ignore-modified-buffers' that prevents `save-some-buffers' from getting
> called.

Instead of a boolean, what do you think about passing a directory, such
that only buffers visiting files in that directory or below would get
prompted for saving?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Thu, 05 Jan 2017 06:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Thu, 5 Jan 2017 09:26:31 +0300
[Message part 1 (text/plain, inline)]
Oh, that's a better idea. Fixed the patch.

The question now is whether there's even a need to add a new arg to 
byte-recompile-directory?

-- 
Best Regards,
Nikolay Kudryavtsev

[0001-Prevent-package-install-from-asking-to-save-buffers.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Fri, 06 Jan 2017 02:31:02 GMT) Full text and rfc822 format available.

Message #14 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Thu, 05 Jan 2017 21:31:10 -0500
Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> writes:

> The question now is whether there's even a need to add a new arg to
> byte-recompile-directory?

Possibly yes, since files can require others outside the directory being
compiled.  So we might not want to have this directory restriction
applied always.

> +                         (member (expand-file-name buffer-file-name)
> +                                 (directory-files directory t))))

I was thinking more along the lines of

    (string-prefix-p (expand-file-name directory)
                     (expand-file-name buffer-file-name))

(Or does that break in some weird file systems?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 07 Jan 2017 18:07:01 GMT) Full text and rfc822 format available.

Message #17 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sat, 7 Jan 2017 21:06:18 +0300
[Message part 1 (text/plain, inline)]
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.

Also, note that the check in byte-recompile-file actually makes calling 
save-some-buffers somewhat redundant.

-- 
Best Regards,
Nikolay Kudryavtsev

[0001-Prevent-package-install-from-asking-to-save-buffers.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 07 Jan 2017 18:47:02 GMT) Full text and rfc822 format available.

Message #20 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sat, 07 Jan 2017 13:47:41 -0500
Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> 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.
>

I don't see where byte-recompile-file is checking that?

> So, since I don't think that doing changes to byte-recompile-file is
> the best idea, here's my current version.
>
> Also, note that the check in byte-recompile-file actually makes
> calling save-some-buffers somewhat redundant.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sun, 08 Jan 2017 04:58:02 GMT) Full text and rfc822 format available.

Message #23 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sun, 8 Jan 2017 07:56:53 +0300
Search for "Save buffer %s first? ".

-- 
Best Regards,
Nikolay Kudryavtsev





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sun, 08 Jan 2017 05:33:02 GMT) Full text and rfc822 format available.

Message #26 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sun, 08 Jan 2017 00:33:41 -0500
Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> 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 () ...)))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sun, 08 Jan 2017 08:07:02 GMT) Full text and rfc822 format available.

Message #29 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sun, 8 Jan 2017 11:06:37 +0300
[Message part 1 (text/plain, inline)]
Ok, fixed.

P. S. Don't really like the name limit-buffer-saving, but can't think of 
a better one.

-- 
Best Regards,
Nikolay Kudryavtsev

[0001-Prevent-package-install-from-asking-to-save-buffers.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sun, 08 Jan 2017 17:03:02 GMT) Full text and rfc822 format available.

Message #32 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sun, 08 Jan 2017 12:03:34 -0500
Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> writes:

> Ok, fixed.

> +If fourth argument LIMIT-BUFFER-SAVING is t only buffers within
                                             ^^^ 
> +DIRECTORY are checked for modification."

I think there should be a comma there, do you agree?  Also, we should
say non-nil instead of t.

>
> P. S. Don't really like the name limit-buffer-saving, but can't think
> of a better one.

Maybe save-only-in-directory-p (that's even longer though).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Mon, 09 Jan 2017 15:34:01 GMT) Full text and rfc822 format available.

Message #35 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>, 25340 <at> debbugs.gnu.org
Subject: Fwd: bug#25340: Save-some-buffers gets called when installing
 packages.
Date: Mon, 9 Jan 2017 10:33:25 -0500
[Message part 1 (text/plain, inline)]
---------- Forwarded message ----------
From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Date: Mon, Jan 9, 2017 at 2:42 AM
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
To: npostavs <at> users.sourceforge.net


Fixed the comma. I'll leave choosing the name up to maintainers.


--
Best Regards,
Nikolay Kudryavtsev
[0001-Prevent-package-install-from-asking-to-save-buffers.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Mon, 16 Jan 2017 01:09:02 GMT) Full text and rfc822 format available.

Message #38 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Cc: 25340 <at> debbugs.gnu.org
Subject: Re: bug#25340: Fwd: bug#25340: Save-some-buffers gets called when
 installing packages.
Date: Sun, 15 Jan 2017 20:09:40 -0500
>
> Fixed the comma. I'll leave choosing the name up to maintainers.

Let's not get stuck on a choice of local variable name, your original
name is fine.  I think there should be a NEWS entry though.




Merged 25340 25964. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 04 Mar 2017 05:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 04 Mar 2017 10:19:02 GMT) Full text and rfc822 format available.

Message #43 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org, Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sat, 04 Mar 2017 11:18:22 +0100
npostavs <at> users.sourceforge.net writes:

> I was thinking more along the lines of
>
>     (string-prefix-p (expand-file-name directory)
>                      (expand-file-name buffer-file-name))
>

Why not use `file-in-directory-p', which is a function created for this
problem.

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 04 Mar 2017 11:26:02 GMT) Full text and rfc822 format available.

Message #46 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Politz <politza <at> hochschule-trier.de>
To: npostavs <at> users.sourceforge.net
Cc: 25340 <at> debbugs.gnu.org, Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sat, 04 Mar 2017 12:25:12 +0100
Also, what about excluding non-Lisp files.

#+BEGIN_SRC emacs-lisp
  (lambda ()
    ;; Assuming (buffer-file-name) is always non-nil.
    (string-match-p emacs-lisp-file-regexp (buffer-file-name))
    (file-in-directory-p (buffer-file-name) directory))
#+END_SRC

I thing, the string-match-p part could also be used unconditionally.

-ap




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 04 Mar 2017 14:47:01 GMT) Full text and rfc822 format available.

Message #49 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Andreas Politz <politza <at> hochschule-trier.de>
Cc: 25340 <at> debbugs.gnu.org, Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sat, 04 Mar 2017 09:47:10 -0500
Andreas Politz <politza <at> hochschule-trier.de> writes:

> npostavs <at> users.sourceforge.net writes:
>
>> I was thinking more along the lines of
>>
>>     (string-prefix-p (expand-file-name directory)
>>                      (expand-file-name buffer-file-name))
>>
>
> Why not use `file-in-directory-p', which is a function created for this
> problem.

Yeah, that makes sense, if I had known about that function I would have
suggested it.





Merged 25340 25964 26056. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 12 Mar 2017 01:31:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25340; Package emacs. (Sat, 18 Mar 2017 06:56:02 GMT) Full text and rfc822 format available.

Message #54 received at 25340 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 25340 <at> debbugs.gnu.org, tino.calancha <at> gmail.com,
 Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>, 26056 <at> debbugs.gnu.org,
 Andreas Politz <politza <at> hochschule-trier.de>
Subject: Re: bug#25340: Fwd: bug#25340: Save-some-buffers gets called when
 installing packages.
Date: Sat, 18 Mar 2017 15:55:21 +0900
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> ---------- Forwarded message ----------
> From: Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com>
> Date: Mon, Jan 9, 2017 at 2:42 AM
> Subject: Re: bug#25340: Save-some-buffers gets called when installing packages.
> To: npostavs <at> users.sourceforge.net
>
>
> Fixed the comma. I'll leave choosing the name up to maintainers.
>
>
> --
> Best Regards,
> Nikolay Kudryavtsev
Hi,

today i upgraded 5 packages using this patch.  It was nice not being
prompted to save modified buffers.
I am looking forward to see this feature added into the master branch.




Severity set to 'minor' from 'normal' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 20 May 2017 22:28:02 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 20 May 2017 22:28:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 25340 <at> debbugs.gnu.org and Nikolay Kudryavtsev <nikolay.kudryavtsev <at> gmail.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sat, 20 May 2017 22:28:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 18 Jun 2017 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.