From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#19390: Acknowledgement (25.0.50; `package-activate' is too slow) Date: Tue, 16 Dec 2014 02:41:58 +0200 Message-ID: <548F7FD6.9040203@yandex.ru> References: <86a92oddfp.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1418690609 30305 80.91.229.3 (16 Dec 2014 00:43:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2014 00:43:29 +0000 (UTC) To: 19390@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 16 01:43:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y0gET-0006ez-0y for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 01:43:21 +0100 Original-Received: from localhost ([::1]:42582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0gES-0000cq-LB for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 Dec 2014 19:43:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0gEI-0000cX-GG for bug-gnu-emacs@gnu.org; Mon, 15 Dec 2014 19:43:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0gEB-0006Cq-0B for bug-gnu-emacs@gnu.org; Mon, 15 Dec 2014 19:43:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37936) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0gEA-0006Cm-Sw for bug-gnu-emacs@gnu.org; Mon, 15 Dec 2014 19:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y0gEA-0004Vy-D1 for bug-gnu-emacs@gnu.org; Mon, 15 Dec 2014 19:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Dec 2014 00:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19390 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19390-submit@debbugs.gnu.org id=B19390.141869052217279 (code B ref 19390); Tue, 16 Dec 2014 00:43:02 +0000 Original-Received: (at 19390) by debbugs.gnu.org; 16 Dec 2014 00:42:02 +0000 Original-Received: from localhost ([127.0.0.1]:47302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0gDC-0004US-Ax for submit@debbugs.gnu.org; Mon, 15 Dec 2014 19:42:02 -0500 Original-Received: from mail-wg0-f46.google.com ([74.125.82.46]:51567) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0gDB-0004UC-1J for 19390@debbugs.gnu.org; Mon, 15 Dec 2014 19:42:01 -0500 Original-Received: by mail-wg0-f46.google.com with SMTP id x13so16039991wgg.5 for <19390@debbugs.gnu.org>; Mon, 15 Dec 2014 16:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=px/ADO95XOrWidXm+tMYZ4LG8OZtPmyS6n7U6TfFCkg=; b=O7FFzu/QrtkzN1adTS97yO4kXkagO/sT5811IuCITlDPsMHRQ90zRjnQQotWBXA4kH w8f+/ELf+UguY5JrMJtVJndU8F5rAfbq16EKsDEIUm7Gc2q7unBWXxDl4I7UPYH4X+oz 7pngg/SBlcvJ5K3c3dzuQZCVdENjimsMNYZPbhWmuwqSieSa+ly0QAt9ROCoaFHGWz1G P09QC79lZWMUFC8H5qCV2O+7bXjb20Zb9cQysgx127wHnt96TyPuvBCuYpHqKFimdXM3 PZrE+hrDlTgRs85e6BHRZ0F4ikxX8+bcZiGOiyLjiYc41KFKGftPNOnkp+tGMUP+iQ+r EMrg== X-Received: by 10.180.211.2 with SMTP id my2mr20234wic.3.1418690520332; Mon, 15 Dec 2014 16:42:00 -0800 (PST) Original-Received: from [192.168.1.2] ([82.102.93.58]) by mx.google.com with ESMTPSA id fo12sm14986732wic.19.2014.12.15.16.41.59 for <19390@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Dec 2014 16:41:59 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97371 Archived-At: Here's one possible fix. We don't deal with the slowness of `package--list-loaded-files' at all, and instead only load them if `package-activate' had been called with non-nil second argument (which only happens now if the package is installed). This also changes the way `package-activate' calls itself recursively on dependencies: instead of always passing the version as the second argument, pass the same value of FORCE it's been called with. Passing the version seems to be a remnant of older code. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index cd948ae..394efc3 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -516,7 +516,7 @@ Return the max version (as a string) if the package is held at a lower version." force)) (t (error "Invalid element in `package-load-list'"))))) -(defun package-activate-1 (pkg-desc) +(defun package-activate-1 (pkg-desc &optional force) (let* ((name (package-desc-name pkg-desc)) (pkg-dir (package-desc-dir pkg-desc)) (pkg-dir-dir (file-name-as-directory pkg-dir))) @@ -527,7 +527,7 @@ Return the max version (as a string) if the package is held at a lower version." (let* ((old-lp load-path) (autoloads-file (expand-file-name (format "%s-autoloads" name) pkg-dir)) - (loaded-files-list (package--list-loaded-files pkg-dir))) + (loaded-files-list (and force (package--list-loaded-files pkg-dir)))) (with-demoted-errors (format "Error loading %s: %%s" name) (load autoloads-file nil t)) (when (and (eq old-lp load-path) @@ -636,14 +636,14 @@ If FORCE is true, (re-)activate it if it's already activated." (fail (catch 'dep-failure ;; Activate its dependencies recursively. (dolist (req (package-desc-reqs pkg-vec)) - (unless (package-activate (car req) (cadr req)) + (unless (package-activate (car req) force) (throw 'dep-failure req)))))) (if fail (warn "Unable to activate package `%s'. Required package `%s-%s' is unavailable" package (car fail) (package-version-join (cadr fail))) ;; If all goes well, activate the package itself. - (package-activate-1 pkg-vec))))))) + (package-activate-1 pkg-vec force))))))) (defun define-package (_name-string _version-string &optional _docstring _requirements