From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id /NkLMV/lkmMFgwEAbAwnHQ (envelope-from ) for ; Fri, 09 Dec 2022 08:35:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sONPMF/lkmNiegEA9RJhRA (envelope-from ) for ; Fri, 09 Dec 2022 08:35:59 +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 860684097F for ; Fri, 9 Dec 2022 08:35:59 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3XuV-00087l-Qm; Fri, 09 Dec 2022 02:35:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3XuD-0007qx-Dj for emacs-orgmode@gnu.org; Fri, 09 Dec 2022 02:34:49 -0500 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Xu7-0007zu-L7 for emacs-orgmode@gnu.org; Fri, 09 Dec 2022 02:34:49 -0500 Received: by mail-pl1-x629.google.com with SMTP id d3so4045951plr.10; Thu, 08 Dec 2022 23:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=DqKWRolRgnm/cuSB9fsbwWXLOXxTju4w7jSKdU7z45g=; b=SgfLxscf0A35EAStjG01UJ59sYd+zAsJ/ex+uuB+aO3P4032oitcayksTyEjwOXzjL wEKXMwknDRfV+LIpuc+tro6/mElGhlfwUjhYpqj52P7GkPpGoHcTHPNPfFRCCJQSQJTQ /TDrGqcwoDy1VwKPS1M391uh15RSDb0wunb/H+L81EkrJai1Ux0CMq2pcbg1F6MUWR4x VOGBvyiqzhZN4W6FKxM2ArWgUtALAfVN0T2LCnZaUKXjp+TT6mowEWHwZ1nm33ep8xGP +jqhbM7BFIgNRPzBd+ir4lOjsxWPfYmgV5mh66m+lqPcNd4zO5MECJBiOcf6oJi8niWF 8CLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=DqKWRolRgnm/cuSB9fsbwWXLOXxTju4w7jSKdU7z45g=; b=ObeAmYuda90vaqmEZ2Rpf65B8bVZB4NAx+wo48SleJ9jN51DGFSv0jRdHht/DUtUGL XpHfathDZA+Y9jbItfa/0iBEmXb7sohwyTfe6aqZqh6GUSFsstzHKmj0V9AeTTi3byOu PrFGmUUBHSGNcdOjuwRmm1WeX3LG5MMnmu9NAaxn+A68fLoxP4rhXGceRE/XYhEG5GGp D6+aXJJImRE2fnRL8kCgYKrCvwc8DaYRzI4iYPQ0sUL8r1M/BjaILBVgGjyhSiCHi7TO g25uRw8S7rhO84z1DW+2M0XeItKN3q+trhujXLXkoalqNs3yODDbEUpzQn//6lhTYOQG Va5g== X-Gm-Message-State: ANoB5plThLExCoAoRCSe/mqhrZRmJiAFLqFlitYvnGJ4BnAi+joXN6IA OeM2MHauNztPI9B/n00VzKcz2ugi9vI= X-Google-Smtp-Source: AA0mqf5zTWwMBtHJgq058mMHav/oMaLUAV2Ps+pfrqPt8P7CHP47ZttkUUSNzYSe6Bc9gDoudOBGfg== X-Received: by 2002:a17:902:c454:b0:189:fba2:3756 with SMTP id m20-20020a170902c45400b00189fba23756mr3808428plm.66.1670571281252; Thu, 08 Dec 2022 23:34:41 -0800 (PST) Received: from dingbat (203-173-24-107.dyn.iinet.net.au. [203.173.24.107]) by smtp.gmail.com with ESMTPSA id d6-20020a170902654600b00186b8752a78sm664491pln.80.2022.12.08.23.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 23:34:40 -0800 (PST) References: <87tu27jq7h.fsf@localhost> <87k032nyok.fsf@localhost> <39a5810d-75bc-4ddb-8722-703f762ed4de@app.fastmail.com> <86lenhxxs9.fsf@gmail.com> User-agent: mu4e 1.9.4; emacs 29.0.60 From: Tim Cross To: David Masterson Cc: emacs-orgmode@gnu.org, 59882@gnu.org Subject: Re: Multiple versions of Org in load-path problem Date: Fri, 09 Dec 2022 17:56:37 +1100 In-reply-to: Message-ID: <86cz8txc6q.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=theophilusx@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org 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=1670571359; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=DqKWRolRgnm/cuSB9fsbwWXLOXxTju4w7jSKdU7z45g=; b=Norx5ijgwt9ArApNxY0Uhjsp92F/e1mFl77df6w01eyooJ3Mfot4tcUOZOiI2knoyySoss /yDCpaal/+9i5YGD1KhU0umB69G4wD1NIzm2GU8EqJ3z/HBlHajRh5c7a19MrYs4OYS2in YDkDJdLm88pyta2CXJY+kFrIBlEXy3V/SqGvzADP9mCz/pdhzGAm94/GpwiVN4D2ETsZZB Kp9HHQh6XfOEHKrJiV46CN7nh0mjdJ1MQs9lFgP0bx+6pr5aYFTNuLZz9M3hLd1DYIi68K i36fj/yjEmWNwgMzkAGQpJlXt4tyOzw1HefQdg9t2Ae+pS+8qB7zILKCPkLLcg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1670571359; a=rsa-sha256; cv=none; b=C5ybgkuqjzW1yEKmn9dXdQOab6W4IZuwKIpKdyeN3ClJrRNvXjMv09aeA1VvH2BNVRK+Mz 0E1G7+DCUJdxELTy54uNlYXo/6aMO/ZF80KoGArLfLD1jpieecr8TANXtmlZTDyQjcIGuC Cq+dDSOc+fEQNP7BrL/NRpk0YEkvuzXf7Q2KkIi47bQ5Pv3ca+bdSp2iSE+ddx6BMMIP7U N3ENbfT1BvosdoVsgSJSwYHO+CiU6irZK+KNU2H8wFDJTCWdLLxbU43TpHLdrbsK7wIocX psleWLBH94pBKpPHVP50/gNc12ZhovJjS9F6u7ttSD8swbZuhg1whGJaCrzFPw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SgfLxscf; 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: -2.93 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SgfLxscf; 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: 860684097F X-Spam-Score: -2.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: XFAnQ3Zpz6tx David Masterson writes: > Tim Cross writes: > >> David Masterson writes: >> >>> "Michel Schinz" writes: >>> >>>> Just for the record, I also ran into problems when installing Org 9.6 >>>> using Emacs' package system on top of an older version that came with >>>> Emacs. If I tried to install it as usual (M-x list-packages, then >>>> install the package from there), I had errors during compilation related >>>> to `org-assert-version`, and then if I restarted Emacs, I would get a >>>> fatal error in an unrelated package. >>>> >>>> I managed to solve that problem by: >>>> 1. uninstalling Org 9.6 and exiting Emacs, >>>> 2. starting Emacs with -q, >>>> 3. installing Org 9.6 from there (using M-x list-packages as usual), >>>> 4. restarting Emacs. >>> >>> Interesting! I tried this (essentially) and it worked for my case. In >>> my case, I had a built-in Org-9.3 and I was trying to use list-packages >>> to install Org-9.6. I checked that using -q still added Org-9.3 to >>> the >>> load-path, but, since Org wasn't loaded, the install via list-packages >>> worked. >>> >>> The question is what's the proper way of doing this without '-q'? > > [...] > >> I don't think there is any safe way to install an updated version of >> org-mode other than >> >> 1. Use the -q approach outlined above > > Thinking about it, this only works if Org is in elpa as melpa (etc.) are > not added to package-archives. You'd have to do some handwritten elisp > out of *scratch* to setup package-archives if Org-9.6 was still coming > out of melpa. That's why this can only be labeled as a hack and not a > solution. > Well, yes, if your going to use this technique to load a package which is not in the default package archives you would need to add that archive first. People who use this technique often just have a 'update.el' file which they load/evaluate when starting Emacs with -q. >> 2. Craft your init.el file such that org functionality is only loaded >> when explicitly requested and always update as the first action after >> starting emacs. > > In this case, something happened in package-install when trying to > install Org-9.6 with a built-in Org-9.3. During the compilation check > (.el -> .elc) many files failed because the new 'org-assert-version' > macro was not defined. Sort of like, after package-install started > working on Org-9.6, org-macs.el (where org-assert-version should be) got > loaded *before* the new load-path had been set causing it to load the > old one from 9.3. Thereafter, everything went awry. > You must have some custom code in your init.el or are using something like use-package as package.el doesn't try to install or upgrade packages during init by default. Where people can come undone is when they are using use-package and set the :ensure t option. In this case, use-package will not know about the bundled version and will attempt to install org from ELPA. If use package runs after org has already been loaded (possibly because some other package has been loaded which depends on/requires org mode and has loaded the bundled version) then things will break because you will end up with a mixed version install. This is why I always ensure org is the very first use-package in my init.el and it comes before any other code which loads or initialises anything. >> The first approach is actually the easiest. The second is hard to get >> right and very fragile because packages like use-package and more >> specifically, other packages with leverage off org functionality, make it >> impossible to reliably know exactly when org is loaded. > > Using ':after" in use-package is supposed to help that, but I'm not sure > it is reliable. Packages are often incomplete about what other packages > it depends on. > You cannot rely on :after. The problem is, other packages may require org functionality and will load org when they are loaded. This can be very subtle as there are a lot of packages which only make very small use of org mode, but even that requires that org mode is loaded. >> An approach used by many 'canned' distributions is to postpone package >> updates. You have a function you run to check for updates which >> generates a list of packages to update and writes that list to a >> file. Each time emacs is started, it looks for this update list and if >> it finds it, it installs packages updates at the very beginning of the >> init process (before any of your other init.el code or custom >> blocks). The process also looks for org in the list of packages to >> update and if it is found, updates it first. > > Probably doesn't work in this case as you would need to be able to use > package.el suggesting that the load-path has been updated for all > built-ins already. The thing I note is that the load-path has already > been updated for built-ins at the beginning of > '~/.emacs.d/early-init.el', but the libraries haven't been loaded yet > (unless needed). That's okay if the newer version of a package then > cleanly replaces all the files in the old version. > It does work. Distributions like Sapcemacs use this approach and do not have the mixed versions issue. I've not looked closely at their implementation, but they well might do all this work as part of the early-init.el file. >> I don't think there is a safe way to load org mode after the init >> process i.e. after booting emacs by M-x package-update. > > Where is package-update called in the boot process of emacs? I don't > see package-update in Emacs v2.7. > Sorry, I wasn't clear. What I meant is that there is no clean and reliable way of running the package update process after emacs has initialised. The package.el API has changed, but previously, you would run M-x package-update-packages to update installed packages. Now it is M-x package-update-all. With many packages, you can run this command and update your installed packages. However, more complex packages, like org-mode, cannot handle this due to potential mixed version problems - a problem which has existed for many years. By default, there is no automated package update setting (unless that has been added in recent versions). There are some add-on packages which can do this and the elisp to make this happen is trivial (but much harder to do it and make it robust). >> I've had good success using straight.el. I had to be careful regarding >> how I structured my init.el file (ensuring any straight stuff happens >> first and the first use package stanza is for org. The main reason >> straight works well for me is that my work flow is to do a M-x >> straight-pull-all when I want to update my packages. This does a git >> pull for all the sources, but does not do any build/install. This occurs >> when I next start Emacs and because I have all the straight stuff at the >> start and because org mode is the first straight-use-package, the update >> and install happens before any other org functionality is loaded, >> avoiding mixed version issues. > > Where do you get straight.el? I don't see it in [m]elpa. No, to use straight.el, you add some code to your init.el which will retrieve the current straight.el file from the github repository. Straight.el does not use the ELPA/NONGNU ELPA/MELPA archives - at least not directly. It does use information from those archives to build recipes which it sues to obtain the code. Essentially, straight.el clones the package source repositories and builds it locally. It give a lot more control and is really great if you want to modify the code (basically, it creates a local fork). Of course, with all that extra power, there is also additional responsibility placed on the user. You may need to tell it which versions you want to use, which ones to 'pin' to, which branches or fix merge conflicts when you have made changes and want to update from the upstream soruces etc. I've been using it for about 12 months and find it really good. YMMV.