From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Connect use-package to package-selected-packages Date: Fri, 29 Jul 2016 17:04:51 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1469837148 6416 80.91.229.3 (30 Jul 2016 00:05:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2016 00:05:48 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 30 02:05:48 2016 Return-path: Envelope-to: geh-help-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 1bTHmk-0001oj-F5 for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jul 2016 02:05:46 +0200 Original-Received: from localhost ([::1]:33657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTHme-0000mE-Ee for geh-help-gnu-emacs@m.gmane.org; Fri, 29 Jul 2016 20:05:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTHmD-0000m8-LN for help-gnu-emacs@gnu.org; Fri, 29 Jul 2016 20:05:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTHmB-00020m-MT for help-gnu-emacs@gnu.org; Fri, 29 Jul 2016 20:05:12 -0400 Original-Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:34904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTHmB-00020g-I8 for help-gnu-emacs@gnu.org; Fri, 29 Jul 2016 20:05:11 -0400 Original-Received: by mail-qt0-x235.google.com with SMTP id x25so75698200qtx.2 for ; Fri, 29 Jul 2016 17:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=VB4pSLKZyvsqQu5yymSEM/PmZ7RuU9SrapSq71p8y9Q=; b=U2hFNOkCdSEkI72prHS0vw58Df7s7Gzed9KeTVPSrZ5Pk/d1wW1iVxL0eyOyBymaGn ZJGQOGoPuFnFHLqrprfly6pFOCVpARnR0W/dT3YHRet0i1/XbvvfNS6W+E5QV+htAGBh Xavx3bkMwy3j7glLatYBMn8+J8YDqNO6OY8pqxjR557o/w4w2Vv1GBstadtc4MrWu/5q uCdSzIFMQobhMoLi7fElPeH5MMBCinrVsTaPQSm9PQalPDc9HbcDBM6oIRw0eQo0AsS5 908GQ/8aoimzpm+Xv/h/bU2YZT1r6/qo0pSBkBbFP0fWhHcK56YbB/CdI5XwQlztEqXA UN2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=VB4pSLKZyvsqQu5yymSEM/PmZ7RuU9SrapSq71p8y9Q=; b=eZHNQqR5Jw1oB6nLmCaAnPDQFnDgPHuCeP7YaahVLOb71bNemTNiaRjhGkkBvmZw30 ehtX4xwK/lpQMxhr2OXAj47HxuCkDPgrNvCxnBMxVFWAzdSlCR+s4anHoh97JRQ5/rgS 0/tG2nARFAFpjr8T3JDR2X3A+3CNw+JRHirWojGBKO1146WI7tQVY3goFS+PxybozdDd o8QWyWrrfwc+uQh4J16oJX5sAJgWxaKRHKOCJuqiRru9749jUIZAUPsO+EU0wr0HGbrt jXVkaep2euXqyWOzbbMK50ZDOfPV5t/79NLPLz8/DFixSpCpfVLXJMcwmAMOsxSeo6AS K+uA== X-Gm-Message-State: AEkoouuHEI9lq/GFgRVrCtNgq078E11pa7wJ9khGbTs/1hqXD1gCio/F5+Gt/9JETo3MDwiZ4fVO52/Y8M67VA== X-Received: by 10.237.33.111 with SMTP id 102mr70920388qtc.56.1469837110846; Fri, 29 Jul 2016 17:05:10 -0700 (PDT) Original-Received: by 10.237.33.46 with HTTP; Fri, 29 Jul 2016 17:04:51 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111011 Archived-At: In a moment of boredom it occurred to me that, if you're using `use-package' for all your ELPA packages, the `package-selected-packages' mechanism is somewhat redundant. Why have Emacs maintain a list of "selected packages" when they're already listed in your init file? I threw this in my non-byte-compiled init file, and it seems to work as you'd expect[1]: (require 'package) (package-initialize) (advice-add 'package--save-selected-packages :override #'ignore) (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (defun use-package-select-package (name &rest args) (let ((ensure (cadr (member :ensure args)))) (when ensure (add-to-list 'package-selected-packages (if (eq ensure t) name ensure) nil #'eq)))) (advice-add 'use-package :before #'use-package-select-package) (require 'use-package) However, I haven't quite convinced myself that it's actually a good idea. Other `use-package' users, especially those of you that take advantage of `package-selected-packages', what do you think? If it is a good idea, I'll submit it as a(n optional) feature to `use-package'. John