Permalink
Browse files

move org-mode to use-package

This is a pain in the neck because emacs has a "built-in" version of
org-mode which is picked up by package, which throws off the :ensure
part of use-package. Go through some amount of heartache to try to
remove it. This will almost certainly break at some point.
1 parent d99193c commit 3af96f2c780a35d35bdf1b9ac19d80fe2e6ebbf8 @glasserc committed Mar 12, 2016
Showing with 24 additions and 4 deletions.
  1. +0 −3 .gitmodules
  2. +0 −1 dot/emacs.d/elhome/site-lisp/upstream/org-mode.git
  3. +24 −0 dot/emacs.d/lisp/ethan-packages.el
View
@@ -1,6 +1,3 @@
-[submodule "dot/emacs.d/elhome/site-lisp/upstream/org-mode.git"]
- path = dot/emacs.d/elhome/site-lisp/upstream/org-mode.git
- url = git://repo.or.cz/org-mode.git
[submodule "dot/emacs.d/elhome/site-lisp/upstream/ethan-wspace.git"]
path = dot/emacs.d/elhome/site-lisp/upstream/ethan-wspace.git
url = git://github.com/glasserc/ethan-wspace.git
Submodule org-mode.git deleted from 4412fe
@@ -3,8 +3,28 @@
'("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
+;; I think GNU ELPA has an `org` package, but this one may be more up
+;; to date?
+(add-to-list 'package-archives
+ '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)
+;; Work around built-in org-mode so we can load from ELPA.
+;; First, remove the built-in org directory from the load-path.
+;; Thanks to
+;; http://stackoverflow.com/questions/20603578/emacs-does-not-see-new-installation-of-org-mode/20616703#20616703.
+;; Without this, use-package will try to require org and succeed.
+(eval-when-compile
+ (require 'cl))
+(setq load-path (remove-if (lambda (x) (string-match-p "org$" x)) load-path))
+;; Second, trick emacs into forgetting about the fact that org is
+;; a "built-in" package by removing it from package--builtins.
+;; Without this, package will refuse to install org, since it's
+;; "already installed".
+;; package--builtins is only initialized when a query needs it.
+(package-built-in-p 'org) ;; prime package--builtins
+(setq package--builtins (assq-delete-all 'org package--builtins))
+
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
@@ -34,6 +54,10 @@
:config
(sml-modeline-mode))
+(use-package org
+ :ensure t
+ :pin org)
+
(use-package haml-mode
:ensure t)

0 comments on commit 3af96f2

Please sign in to comment.