Hello, Trying to provide batch Emacs/Org scripts to colleagues, I must ensure that they have Org 8.
I wrote the following code so that users which have a default (Cygwin) Emacs 24.3.1 (with the default Org 7.9.3f) are proposed an upgrade through the `package' manager: --8<---------------cut here---------------start------------->8--- (require 'package) (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")) (package-initialize) ;; version info (let ((org-dir (file-name-directory (locate-library "org")))) (message "Org mode version %s (org @ %s)" (org-version) org-dir)) (unless (string-match "^8" (org-version)) (message "This version of Org mode is no longer supported") (if (yes-or-no-p (format "Install package `%s'? " 'org)) (ignore-errors (package-install 'org)) (setq debug-on-error nil) (error "Please upgrade to 8 or later"))) --8<---------------cut here---------------end--------------->8--- Problem experienced by colleagues: "Invalid function: org-with-silent-modifications". Looking on the web, I find a post [1] where Bastien tells: When installing from ELPA, please do so from a fresh Emacs session where no Org function has been called. That wasn't the case in the above code, as I first had to call `org-version' to check for their current version, then install from ELPA if they don't have an Org 8... So, - Is there a way to unload Org before installing from ELPA? (= workaround) or better: - Is there a way to fix the problem? (= solution) Best regards, Seb [1] http://comments.gmane.org/gmane.emacs.orgmode/70880 -- Sebastien Vauban