From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] scratch/package.el-async-refresh bc0fc5e: Implement async refreshing in package-refresh-contents Date: Mon, 30 Mar 2015 21:46:49 -0400 Message-ID: References: <20150331002109.4237.29402@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427766438 15396 80.91.229.3 (31 Mar 2015 01:47:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 31 Mar 2015 01:47:18 +0000 (UTC) Cc: Artur Malabarba To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 31 03:47:11 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YclGn-0003dg-S0 for ged-emacs-devel@m.gmane.org; Tue, 31 Mar 2015 03:47:10 +0200 Original-Received: from localhost ([::1]:36520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YclGn-0006yt-4B for ged-emacs-devel@m.gmane.org; Mon, 30 Mar 2015 21:47:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YclGZ-0006yo-Ea for emacs-devel@gnu.org; Mon, 30 Mar 2015 21:46:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YclGU-0001ZN-G5 for emacs-devel@gnu.org; Mon, 30 Mar 2015 21:46:55 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:57006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YclGU-0001ZA-Ci for emacs-devel@gnu.org; Mon, 30 Mar 2015 21:46:50 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAs0BwsUGA2qSIlLglBJDAODPgNSgx4EqDuBOQ X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAs0BwsUGA2qSIlLglBJDAODPgNSgx4EqDuBOQ X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115007305" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Mar 2015 21:46:51 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 64DE097E; Mon, 30 Mar 2015 21:46:49 -0400 (EDT) In-Reply-To: (Artur Malabarba's message of "Tue, 31 Mar 2015 00:21:10 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184583 Archived-At: > +(defvar package--post-download-archives-hook nil > + "Hook run after the archive contents are downloaded.") > +(put 'package--post-download-archives-hook 'risky-local-variable t) > +(add-hook 'package--post-download-archives-hook #'package--notify-done) > +(add-hook 'package--post-download-archives-hook #'package--build-compatibility-table) > +(add-hook 'package--post-download-archives-hook #'package-read-all-archive-contents) I think this is one of those places where the default value can directly be placed in the defvar. After all, this is an internal hook, so it doesn't need to be easy to use. I personally would only place a single function on it, tho (which then calls the above 3 functions). Or I would keep it nil by default, and just put a call to that (new) function wherever you currently run package--post-download-archives-hook. > + (add-hook 'package--post-download-archives-hook > + #'package-menu--populate-new-package-list 'append) > + (add-hook 'package--post-download-archives-hook > + #'package-menu--revert 'append) > + (add-hook 'package--post-download-archives-hook > + #'package-menu--find-and-notify-upgrades 'append) Similarly, here I'd put a single function on the hook which then calls those 3. Stefan