Re: [O] org-link-set-parameters missing in ELPA version

From:

Richard Kim

Subject:

Re: [O] org-link-set-parameters missing in ELPA version

Date:

Sun, 11 Sep 2016 11:55:01 -0700

User-agent:

Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

I added the following elisp code at the start of my ~/.emacs to deal
with this problem. My analysis of the problem is described in the
comments. In short the root cause seems to be loading built-in org.el
during initialization rather than org.el from either org-plus-contrib or
org add-on packages. Symbols such as org-link-set-parameters are not
defined in built-in org.el of emacs 25. They are defined only in newer
versions of org package.
I use my own build of the following which is re-built once a week or two:
- emacs 25 from 'emacs-25' git branch
- org and org-plus-contribute packages from git source files
- spacemacs from 'develop' git branch
If I have erred in my analysis of the root cause, please let me know.
What I know is that before I started using the code below, I would get
emacs startup error every time after I removed all installed packages.
With this code, I no longer see any failure.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bootstrap `org-plus-contrib' and/or `org' packages
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The purpose of this section is to make sure that org-mode package(s) are
;; installed and setup early on so as to prevent built-in org-mode files from
;; getting loaded. The built-in org-mode commands are autoloaded so that none
;; of the built-in org files are actually loaded when emacs starts up. However
;; it is easy to get one or more org files to get loaded directly or indirectly
;; by using one or more org mode functions. Once that happens, then it is
;; nearly impossible to fix this. For example if built-in org.el gets loaded,
;; then subsequent (require 'org) will not reload org.el even if an org package
;; was installed which provided newer org.el! A workaround is to make sure that
;; the org package(s) are not only installed, but also activated (i.e.,
;; `load-path' setup) so that the first time (require 'org) is done, it will
;; cause the newer org.el to be loaded rather than the built in one.
;; Where to find packages to install from. If spacemacs is loaded, then it is
;; important that `package-archives' value here is the same as the one embedded
;; in spacemacs. Otherwise strange errors may pop up.
(if (file-directory-p "/u/me/public_html/elpa/elpa/")
(custom-set-variables
`(package-archives
`(("my-elpa" . ,(expand-file-name "/u/me/public_html/elpa/elpa/"))
("my-orgmode" . ,(expand-file-name
"/u/me/public_html/elpa/orgmode/")))))
(custom-set-variables
`(package-archives
`(("melpa" . "https://melpa.org/packages/&quot;)
("orgmode" . "http://orgmode.org/elpa/&quot;))))
)
;; Where to install packages to. Spacemacs honors this as of about Aug 2016.
(setq package-user-dir "/u/me/opt/elpa25/")
;; Do not activate all installed packages at the end of startup processing.
;; I activate packages as needed.
(setq package-enable-at-startup nil)
;; We must initialize packages before we can call `package-installed-p'.
;; However just do minimal setup (via 'no-activate optional argument), i.e., do
;; not activate any packages. Without `no-activate', all installed packages are
;; activated.
(unless (bound-and-true-p package--initialized)
(package-initialize 'no-activate)
(package-refresh-contents)
;; I use `use-package' to install and setup all packages except `use-pacakge'
;; itself. You can't use it if it is not already installed and activated. So
;; make sure that it is installed and setup using only built-in package.el
;; functions.
(if (package-installed-p 'use-package)
(package-activate 'use-package) ; just activate if already installed
(package-install 'use-package))
;; We *must* install `org-plus-contrib' or `org' package very early on so that
;; these shadow the built-in org-mode files. If this is not done early, and one
;; or more of the built-in org-mode files are loaded during emacs startup, then
;; failures may arise later on while installing `org-plus-contrib' or `org'
;; packages. Typical errors in such case are "void-function
;; org-link-set-parameters" or "void-function org-link-types". Such errors
;; started popping up with spacemacs around August 2016 when emacs is started
;; after removing all installed packages which forced installation of all
;; needed packages.
;;
;; The need to install this early on is the reason for all the setup done so
far.
(use-package org-plus-contrib :ensure t :defer t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setup spacemacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq spacemacs-start-directory "/u/me/opt/spacemacs/")
(load-file (expand-file-name "init.el" spacemacs-start-directory))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Setup my stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "/u/me/Private/elisp/init.el")
Heikki Lehvaslaiho <address@hidden> writes:
> I've been experiencing similar problems with increasing annoyance
> level for over a month. Thanks to these comments I think I got to the
> bottom of it!
>
> The MELPA package org-mac-link (latest is org-mac-link-20160808.220)
> has clearly continued being updated with new code that include calls
> to org-link-set-parameters. The org-mac-link.el in package
> org-plus-contrib has the code that works with org v8. Everyone who has
> been using MELPA, especially with use-package, to load org-mac-link.el
> has not been using the code in org-plus-contrib.
>
> I removed the downloaded org-mac-link package files and the
> corresponding depends-on line from my Cask file, and reverted to old
> require syntax to load org-mac-link . Problem solved.
>
> -Heikki
>
> Heikki Lehväslaiho - skype:heikki_lehvaslaiho cell: +358 40 850 6640
>http://about.me/heikki
>
> On 26 August 2016 at 04:31, Rob Duncan <address@hidden> wrote:
>>
>> Hi John,
>>
>> I deleted my existing packages and installed org-plus-contrib-20160822 and
>> everything works again.
>>
>> Thanks very much!
>>
>> Rob.
>>
>> > On Aug 25, 2016, at 6:15 PM, John Kitchin <address@hidden> wrote:
>> >
>> > I haven't been able to reproduce this in org-plus-contrib-20160822.
>> >
>> > Rob Duncan writes:
>> >
>> >> Hi John,
>> >>
>> >> My org is claiming to be version 8.3.5:
>> >>
>> >> Org-mode version 8.3.5 (8.3.5-elpa @
>> >> /Users/rduncan/.emacs.d/elpa/org-20160815/)
>> >>
>> >> Rob.
>> >>
>> >> On Aug 20, 2016, at 11:56 AM, John Kitchin
>> >> <address@hidden<mailto:address@hidden>> wrote:
>> >>
>> >> that seems weird, I thought that should only be in org 9. Is that on ELPA
>> >> somehow?
>> >>
>> >> John
>> >>
>> >> -----------------------------------
>> >> Professor John Kitchin
>> >> Doherty Hall A207F
>> >> Department of Chemical Engineering
>> >> Carnegie Mellon University
>> >> Pittsburgh, PA 15213
>> >> 412-268-7803
>> >> @johnkitchin
>> >> http://kitchingroup.cheme.cmu.edu<http://kitchingroup.cheme.cmu.edu/>
>> >>
>> >>
>> >> On Sat, Aug 20, 2016 at 2:45 PM, Rob Duncan
>> >> <address@hidden<mailto:address@hidden>> wrote:
>> >> I just installed org-mac-link version 20160808.220 from ELPA and I’m no
>> >> longer able to insert links from Mail.app and other applications. It used
>> >> to work…
>> >>
>> >> When I try to manually load org-mac-link.el I get this error message:
>> >>
>> >> eval-buffer: Symbol’s function definition is void: org-link-set-parameters
>> >>
>> >> Did I mess up the install, or is the package broken somehow?
>> >>
>> >> Thanks,
>> >>
>> >> Rob.
>> >
>> >
>> > --
>> > Professor John Kitchin
>> > Doherty Hall A207F
>> > Department of Chemical Engineering
>> > Carnegie Mellon University
>> > Pittsburgh, PA 15213
>> > 412-268-7803
>> > @johnkitchin
>> > http://kitchingroup.cheme.cmu.edu
>>