I\'ve been experimenting with the org-babel tutorial that describes how to put the bulk of your emacs init.el file into an org file. However, I would like to use org-mode 8 (mai
Though already solved and only somewhat related, I thought I would offer this for those who don't use package-based solutions but need to unload things like org and cedet/semantic, etc. without restarting emacs.
In general for unloading a set of features based on a starting name regexp, I would do something like this - which seems more complete than the hardcoded version from Andreas' answer, which doesn't seem to cover all loaded org features (at least in my case).
load-history
is a massive assoc list of files -> reqs,provides,defuns,...
(mapc
#'(lambda (f) (and (featurep f) (unload-feature f t)))
(loop for file-syms in load-history
for prov = (assoc 'provide file-syms)
with features
if (and prov (string-match "^org" (symbol-name (cdr prov))))
collect (cdr prov) into features
finally return features))
Replace the regexp "^org"
to suit your needs, or go wild and make it a defun.
This could also be modified to grab all loaded org features from load-history
, unload them, add the new load-path, and reload those same features from the new location.
I configure package repositories in an org-based configuration file as well, so, to adjust the load path I have this in my init.el prior to loading org:
;; remove org-mode shipped with emacs from the load-path
(setq custom-org-path (car (file-expand-wildcards
(concat my-init-dir "elpa/org-plus-contrib-20*"))))
(when custom-org-path
(setq load-path (remove-if (lambda (x) (string-match-p "org$" x)) load-path))
(add-to-list 'load-path custom-org-path))
Unloaded shipped org-mode and installed development version this way
(defun unload-org-mode ()
(interactive)
(and (featurep 'org-agenda)(unload-feature 'org-agenda t ))
(and (featurep 'org-bbdb)(unload-feature 'org-bbdb t ))
(and (featurep 'org-bibtex)(unload-feature 'org-bibtex t ))
(and (featurep 'org-compat)(unload-feature 'org-compat t ))
(and (featurep 'org-exp)(unload-feature 'org-exp t ))
(and (featurep 'org-exp-blocks)(unload-feature 'org-exp-blocks t ))
(and (featurep 'org-faces)(unload-feature 'org-faces t ))
(and (featurep 'org-footnote)(unload-feature 'org-footnote t ))
(and (featurep 'org-gnus)(unload-feature 'org-gnus t ))
(and (featurep 'org-html)(unload-feature 'org-html t ))
(and (featurep 'org-info)(unload-feature 'org-info t ))
(and (featurep 'org-infojs)(unload-feature 'org-infojs t ))
(and (featurep 'org-irc)(unload-feature 'org-irc t ))
(and (featurep 'org-jsinfo)(unload-feature 'org-jsinfo t ))
(and (featurep 'org-list)(unload-feature 'org-list t ))
(and (featurep 'org-macs)(unload-feature 'org-macs t ))
(and (featurep 'org-mew)(unload-feature 'org-mew t ))
(and (featurep 'org-mhe)(unload-feature 'org-mhe t ))
(and (featurep 'org-rmail)(unload-feature 'org-rmail t ))
(and (featurep 'org-src)(unload-feature 'org-src t ))
(and (featurep 'org-vm)(unload-feature 'org-vm t))
(and (featurep 'org-w3m)(unload-feature 'org-w3m t))
(and (featurep 'org-wl)(unload-feature 'org-wl t )))
(defun ar-load-PATH-TO-NEW-org-mode ()
(interactive)
(unload-org-mode)
(find-file "~/PATH-TO-NEW-org-mode/lisp/ob-python.el")
(add-to-list 'load-path "~/PATH-TO-NEW-org-mode")
(add-to-list 'load-path "~/PATH-TO-NEW-org-mode/lisp")
(load "~/PATH-TO-NEW-org-mode/lisp/ob-comint.el" nil t)
(load "~/PATH-TO-NEW-org-mode/lisp/ob-emacs-lisp.el" nil t)
(load "~/PATH-TO-NEW-org-mode/lisp/org.el" nil t)
(load "~/PATH-TO-NEW-org-mode/lisp/ob-eval.el" nil t)
(load "~/PATH-TO-NEW-org-mode/lisp/ob.el" nil t)
(load "~/PATH-TO-NEW-org-mode/lisp/ob-python.el")
;; (load "~/PATH-TO-NEW-org-mode/testing/org-test-ob-consts.el" nil t)
;; (load "~/PATH-TO-NEW-org-mode/testing/org-test.el" nil t)
(load-this-directory "~/PATH-TO-NEW-org-mode/lisp")
(org-babel-do-load-languages
'org-babel-load-languages
'(
(sh . t)
(python . t)
(emacs-lisp . t)
(perl . t)
(R . t)
))
)
(ar-load-PATH-TO-NEW-org-mode)
Replace PATH-TO-NEW-org-mode
with the directory your version whished resides.
Put (package-initialize)
before any calls to org-babel-load-file
or any other Org function, and you'll get the ELPA version.
I use same kind of initialization and recently did two major changes:
Here's how my init.el looks now,
https://github.com/d4gg4d/my-emacs/blob/master/init.el
Also,