unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
Cc: 25340@debbugs.gnu.org
Subject: bug#25340: Save-some-buffers gets called when installing packages.
Date: Sun, 08 Jan 2017 00:33:41 -0500	[thread overview]
Message-ID: <878tqm2k0a.fsf@users.sourceforge.net> (raw)
In-Reply-To: <240fc1ee-a0b8-c95b-4353-9e6bf26db940@gmail.com> (Nikolay Kudryavtsev's message of "Sat, 7 Jan 2017 21:06:18 +0300")

Nikolay Kudryavtsev <nikolay.kudryavtsev@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 () ...)))





  parent reply	other threads:[~2017-01-08  5:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 22:42 bug#25340: Save-some-buffers gets called when installing packages Nikolay Kudryavtsev
2017-01-05  4:35 ` npostavs
2017-01-05  6:26   ` Nikolay Kudryavtsev
2017-01-06  2:31     ` npostavs
2017-01-07 18:06       ` Nikolay Kudryavtsev
2017-01-07 18:47         ` npostavs
2017-01-08  4:56           ` Nikolay Kudryavtsev
2017-01-08  5:33         ` npostavs [this message]
2017-01-08  8:06           ` Nikolay Kudryavtsev
2017-01-08 17:03             ` npostavs
     [not found]               ` <aa6168cc-d8eb-2c1c-70af-a63aed862b75@gmail.com>
2017-01-09 15:33                 ` bug#25340: Fwd: " Noam Postavsky
2017-01-16  1:09                   ` npostavs
2017-03-18  6:55                   ` Tino Calancha
2017-03-04 10:18       ` Andreas Politz
2017-03-04 14:47         ` npostavs
2017-03-04 11:25 ` Andreas Politz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tqm2k0a.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=25340@debbugs.gnu.org \
    --cc=nikolay.kudryavtsev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).