From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>,
25340@debbugs.gnu.org
Subject: bug#25340: Fwd: bug#25340: Save-some-buffers gets called when installing packages.
Date: Mon, 9 Jan 2017 10:33:25 -0500 [thread overview]
Message-ID: <CAM-tV-8RUrXSmf26OzOq0tfFUE5Yj8crKu1O6Ak5jjU9LK5SOA@mail.gmail.com> (raw)
In-Reply-To: <aa6168cc-d8eb-2c1c-70af-a63aed862b75@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
---------- Forwarded message ----------
From: Nikolay Kudryavtsev <nikolay.kudryavtsev@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@users.sourceforge.net
Fixed the comma. I'll leave choosing the name up to maintainers.
--
Best Regards,
Nikolay Kudryavtsev
[-- Attachment #2: 0001-Prevent-package-install-from-asking-to-save-buffers.patch --]
[-- Type: text/plain, Size: 3757 bytes --]
From ef16f5bc9c4c9fc3aec3ce7173328b5c6ba1af94 Mon Sep 17 00:00:00 2001
From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
Date: Sun, 8 Jan 2017 11:04:22 +0300
Subject: [PATCH] Prevent package-install from asking to save buffers
* lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): New argument
`limit-buffer-saving' that limits `save-some-buffers' to
the chosen directory.
* doc/lispref/compile.texi: Document `limit-buffer-saving' argument
of `byte-recompile-directory'.
* lisp/emacs-lisp/package.el (package--compile): Use
`limit-buffer-saving' when calling `byte-recompile-directory'.
---
doc/lispref/compile.texi | 6 +++++-
lisp/emacs-lisp/bytecomp.el | 14 +++++++++++---
lisp/emacs-lisp/package.el | 2 +-
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index b1cc04b..974d313 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -198,7 +198,7 @@ Compilation Functions
@end example
@end deffn
-@deffn Command byte-recompile-directory directory &optional flag force
+@deffn Command byte-recompile-directory directory &optional flag force limit-buffer-saving
@cindex library compilation
This command recompiles every @samp{.el} file in @var{directory} (or
its subdirectories) that needs recompilation. A file needs
@@ -217,6 +217,10 @@ Compilation Functions
If @var{force} is non-@code{nil}, this command recompiles every
@samp{.el} file that has a @samp{.elc} file.
+By default, before the recompilation, the user is prompted to save modified
+buffers one by one. Setting @var{limit-buffer-saving} to @code{t} checks
+only buffers within @var{directory}.
+
The returned value is unpredictable.
@end deffn
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 63be7e2..2e0fc79 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1621,7 +1621,7 @@ byte-force-recompile
(byte-recompile-directory directory nil t))
;;;###autoload
-(defun byte-recompile-directory (directory &optional arg force)
+(defun byte-recompile-directory (directory &optional arg force limit-buffer-saving)
"Recompile every `.el' file in DIRECTORY that needs recompilation.
This happens when a `.elc' file exists but is older than the `.el' file.
Files in subdirectories of DIRECTORY are processed also.
@@ -1634,12 +1634,20 @@ byte-recompile-directory
before scanning it.
If the third argument FORCE is non-nil, recompile every `.el' file
-that already has a `.elc' file."
+that already has a `.elc' file.
+
+If fourth argument LIMIT-BUFFER-SAVING is t, only buffers within
+DIRECTORY are checked for modification."
(interactive "DByte recompile directory: \nP")
(if arg (setq arg (prefix-numeric-value arg)))
(if noninteractive
nil
- (save-some-buffers)
+ (save-some-buffers
+ nil
+ (if limit-buffer-saving
+ (lambda ()
+ (string-prefix-p (expand-file-name directory)
+ (expand-file-name buffer-file-name)))))
(force-mode-line-update))
(with-current-buffer (get-buffer-create byte-compile-log-buffer)
(setq default-directory (expand-file-name directory))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 6728f1b..0851c5e 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -946,7 +946,7 @@ package--compile
(let ((warning-minimum-level :error)
(save-silently inhibit-message)
(load-path load-path))
- (byte-recompile-directory (package-desc-dir pkg-desc) 0 t)))
+ (byte-recompile-directory (package-desc-dir pkg-desc) 0 t t)))
;;;; Inferring package from current buffer
(defun package-read-from-string (str)
--
2.10.2.windows.1
next prev parent reply other threads:[~2017-01-09 15: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
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 ` Noam Postavsky [this message]
2017-01-16 1:09 ` bug#25340: Fwd: " 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=CAM-tV-8RUrXSmf26OzOq0tfFUE5Yj8crKu1O6Ak5jjU9LK5SOA@mail.gmail.com \
--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).