From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iO7eCTAp/2FxuAAAgWs5BA (envelope-from ) for ; Sun, 06 Feb 2022 02:49:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wAwiBzAp/2GF9gAA9RJhRA (envelope-from ) for ; Sun, 06 Feb 2022 02:49:36 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BAC7B3DAE9 for ; Sun, 6 Feb 2022 02:49:35 +0100 (CET) Received: from localhost ([::1]:49628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nGWgI-0007wG-R6 for larch@yhetil.org; Sat, 05 Feb 2022 20:49:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGWfr-0007vr-0J for emacs-orgmode@gnu.org; Sat, 05 Feb 2022 20:49:07 -0500 Received: from [2a00:1450:4864:20::229] (port=46960 helo=mail-lj1-x229.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGWfo-0003ya-RB for emacs-orgmode@gnu.org; Sat, 05 Feb 2022 20:49:06 -0500 Received: by mail-lj1-x229.google.com with SMTP id p21so5334763ljn.13 for ; Sat, 05 Feb 2022 17:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=wXLW7NHwyKkbRyVWvvMyepHy3PIPmssh+YfdA6B3uGU=; b=bpbDwZzkEMacXRD5dI/OWEM/eVIWZa8QJXggJaBR3ayx1Qafdo+06OetW/56VRVpIF DHxfrnMRtDHfwiL61Suu5BCUwnqA1t1lCHEPWn5+qTTiR0HLwYyk5S8xQZdSvIeVVzcK QTWIjxYt9JyoxDRnEH2JHB26lguTpPwM6xJCsPMqftK2igyddENqgMRfpj8RVRHVbBc9 29TOOZ2p+IRQYBoBujyPXr+SEGvpgSVrbQUZ5QpxqY0DhuvVAkpuQnq6kLZ5/17gSA8B h4oS6I5bWuVWVTLKC0rymIV9+yZ9irzTOCDj9bO8SRalCZ1ciSKS+GV94SIo6MbQJKyW buwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=wXLW7NHwyKkbRyVWvvMyepHy3PIPmssh+YfdA6B3uGU=; b=sso0mm6bCOqyoaXU+r4Ku1AvBL4gjJ9DcAh31CYBjgh8whlNIVd4d+6DDBDKugTRHL sap+HvCIUsxn3WFc0+39QdtP6Oa6W175Fr+P9fmyHN8wgJgGgv9FzOPUY2ZqBXI5qHLB xPzNT9JDOAIY85m4Y0e+Y5t7ZmBRf51FRxPpmtRF+FZKMjg38ctGWCnBgm293IGl8hcj BWfS1ukrYXrUZCFOqttWnHG1h8Yvp2fxe29dtS1GfCmIl73NG49x91xCek8b7ZmqqwK3 TfsGaXHxhdepBGXGprVhvaO/exSPUDSiqVUO184GvHnuISuvJzZED92v7ckSKuY6Nqgc 2tKA== X-Gm-Message-State: AOAM533dEnc7pn/FE0AMN9R1ZpcVH4IQCH5HwddeUDBl37++o2KFoaCy kvNcw2SXL9nTz8NaQItCLkdy1/aO/67G5JGB3+U= X-Google-Smtp-Source: ABdhPJzHUrLp58NtnvXiUGRL441+z4eDW2ioIw8R16q2XAyJ2JkF9FqSR97J2XALw2Srii4a6sXv+W2WWYk97hpUtJc= X-Received: by 2002:a2e:bd83:: with SMTP id o3mr4460571ljq.51.1644112141230; Sat, 05 Feb 2022 17:49:01 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab3:5089:0:0:0:0:0 with HTTP; Sat, 5 Feb 2022 17:49:00 -0800 (PST) In-Reply-To: <87iltt6p94.fsf@gmail.com> References: <87wnibr5hq.fsf@gmail.com> <87iltt6p94.fsf@gmail.com> From: Samuel Wales Date: Sat, 5 Feb 2022 18:49:00 -0700 Message-ID: Subject: Re: Suggestion: convert dispatchers to use transient To: =?UTF-8?Q?Jo=C3=A3o_Pedro_de_Amorim_Paula?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::229 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=samologist@gmail.com; helo=mail-lj1-x229.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim Cross , emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644112175; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=wXLW7NHwyKkbRyVWvvMyepHy3PIPmssh+YfdA6B3uGU=; b=N0lORq0M5BBY2OXCwabwNFKCGLdFw7vp7MLdLzxRJNzbvLFW+ja3NF3kzjnmhAfDSNIfBe 3R0vrG+XsDYtYyUPJWqaF4d6gFOqkLhncFbQHhDOsdU7HqejSiG+1oHbXCkcm/HEv0lS99 gRTbRMkK2CvnsGLkTkM1gSxvMXGfPPwlO79Rr7MWtdXNpxUnVyEHhSd8n05zp3DA/zxYVC d4XFcNPAwYZXzFwBMFMKJreebAzYyOwZVm3YqnjJq9DjVBfh3kppSEMVO4oPbcTWhzoGky +Ei2+v2zXSswouBTcSECOFLZasPxML6m1AaA73zo9svRWuK1HU6bBKDIcQ8x1A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644112175; a=rsa-sha256; cv=none; b=Tj9U9T4Div0LZd1S2YxTcaENgUY6jFNr/dwkvgQMpg3Ifb2DNMlE1dw6izd9Mxw3jQqMCv e3HkkNHV3cMCGv8Dp8tALD2rxJslt5HT1bJHDZGcXCKARpJv2HMnb9vEdeM+qgxCzpZCSw WSV4W9U7sn2t11Uf1K4sT9V1ysgtj7RjwvjktyEbK3igTTLnQVuMMPs+8HKa1jM/ujgaca GnGIb9IUfNhKaXfGrZ+m+g2jNEX6uERmagzEyfSQM8CQTBB8JrOlK2SYeHeCuunq01avjF N/AJeTNEysYuuVUKgM4GVYoM2l8lojP/mbd2qxu8y/7WBGRGlGyND/GIpi27ug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bpbDwZzk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=bpbDwZzk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BAC7B3DAE9 X-Spam-Score: -9.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: O6vumPLKsRoh jus want to state the obvious here in case it is useful [but everybody probbly lready knows] --- not everybody uses packages or maybe trusts them has internet etc. On 2/5/22, Jo=C3=A3o Pedro de Amorim Paula wrote= : > On 04 February 2022 08:30, Tim Cross wrote: > >> I'm assuming it is, but I have to admit I'm still not 100% clear on >> how Emacs handles the situation where you use a library that is both >> built-in and available in ELPA. Does Emacs use the latest version >> available or does it use the built-in version until you explicitly >> select the ELPA versions? > > Welp, I happened to ponder the same question after trying to implement a > function to install packages that are not installed already (I'm not > using any helper configuration such as use-package, which would already > handle this). From what I gathered empirically, it appears that if > something is built-in, Emacs' package.el won't try to install -- it > checks with package-installed-p on any call to package-install, which > checks if the package is built-in with package-built-in-p as a fallback > on cond --, but you can force installation from the archives by passing > a package description object (defined as package-desc on package.el) > instead of a symbol > > (let ((pkg-desc (assq 'org package-archive-contents))) > (package-install pkg-desc)) > > and Emacs seems to be loading the newest version when it is a dependency > of something else. Though I'm not really sure, as most of the packages I > have from ELPA have the same version as the ones built-in on Emacs > 28.0.91. I'll try and install Emacs 27 to check this out. > > In the mean time, I guess this would be a good opportunity to share a > couple of functions I have with the purpose of installing packages. > > (defun pkg-description (package) > "Return the description for PACKAGE. > If PACKAGE is installed, the will be present on `package-alist', > otherwise look for it in `package-archive-contents'." > (or (cadr (assoc package package-alist)) > (cadr (assoc package package-archive-contents)))) > > (defun pkg-ensure-archive (package) > "Install PACKAGE from the archives, if not already installed." > (when-let ((pkg-desc (pkg-description package))) > (unless (package-installed-p pkg-desc) > (package-install-from-archive pkg-desc)))) > > (defun require-package (package &optional force) > "Ensure that PACKAGE is installed. > If FORCE is non-nil, force installation regardless if PACKAGE is > built-in or not. > > First, use `package-installed-p' to check if PACKAGE was > installed via the Emacs package manager, otherwise, try to > `require' PACKAGE; this ensures that we don't require PACKAGE if > it was installed using the package manager. If both of those > fail, run `package-refresh-contents' and install PACKAGE." > (unless (and (not force) > (or (package-installed-p package) > (require package nil 'no-error))) > (unless (assoc package package-archive-contents) > (package-refresh-contents)) > (if force > (pkg-ensure-archive package) > (package-install package)))) > > On the last one, the main function that I use, if FORCE is non-nil it > will download and install the package from the archives even if it is > built-in. > > Best regards, > > -- > Jo=C3=A3o Pedro de Amorim Paula > IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN) > --=20 The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com