spot/doc/org/init.el.in
Alexandre Duret-Lutz 99876048ed org: adjust to org-mode 9.1
This is needed so that SVG files are included as an <object...> rather
than as an <img...>, which in turn is needed to ensure SVG tooltips
will work.  We do not explicitly require org-mode 9.1, but we install
it if it is not present.

* HACKING: Mention the requirement.
* doc/org/.dir-locals.el.in, doc/org/init.el.in, doc/org/spot.css:
Adjust to org-mode 9.1.
* doc/Makefile.am: Run emacs with the site-lisp libraries, in
case it contains a more recent org-mode.
* elisp/ob-dot.el: Delete, this was a work around older versions.
* elisp/Makefile.am: Adjust.
2018-04-07 18:58:58 +02:00

132 lines
5.2 KiB
EmacsLisp

(setq load-path (append '("@abs_top_srcdir@/elisp/") ; for hoa-mode.el
load-path))
(setq debug-on-error t)
(package-initialize)
(require 'cl)
(setq features-before features)
(require 'org-version)
(print (org-version nil t t))
(print (concat "Org " org-version))
; The Org version that ships with emacs is usually too old.
(when (version< org-version "9.1")
(warn "Org-mode is too old; attempting to download a more recent version")
;; we need to unload any bits of org that were loaded before calling
;; install package, otherwise the byte code might mix the two versions.
(dolist (feature (set-difference features features-before))
(when (and (featurep feature)
(let ((feature-name (symbol-name feature)))
(or (string-prefix-p "org" feature-name)
(string-prefix-p "ob" feature-name))))
(message "unloading feature %s" feature)
(unload-feature feature t)))
;; install org-plus-contrib, not org, as the former includes htmlize
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-refresh-contents)
(let ((org-p-c (cadr (assq 'org-plus-contrib package-archive-contents))))
(package-install org-p-c)))
(unless (require 'htmlize nil t)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-refresh-contents)
(let ((htmlize (cadr (assq 'htmlize package-archive-contents))))
(package-install htmlize)))
(require 'ox-publish)
(require 'org-install)
(require 'hoa-mode)
(setq org-export-htmlize-output-type 'css)
(setq org-html-htmlize-output-type 'css)
; the .org-timestamp directory does not always exist, is not always
; created by org, and that causes issues on our buildfarm.
(setq org-publish-use-timestamps-flag nil)
;; The default value of writing to ~/.org-timestamps causes race
;; conditions when doing concurrent builds.
(setq org-publish-timestamp-directory "@abs_top_builddir@/.org-timestamps/")
(org-babel-do-load-languages
'org-babel-load-languages
`((,(if (version< org-version "8.3") 'sh 'shell) . t)
(dot . t)
(python . t)
(plantuml . t)
(C . t)))
(setq org-confirm-babel-evaluate nil)
(setq org-plantuml-jar-path "@abs_top_builddir@/doc/org/plantuml.jar")
(setq org-babel-temporary-directory "@abs_top_builddir@/doc/org/tmp")
;;; the directory might already exist from a previously aborted run.
(if (file-directory-p org-babel-temporary-directory)
(delete-directory org-babel-temporary-directory t))
(make-directory org-babel-temporary-directory t)
(setq org-babel-python-command "@PYTHON@")
(setq org-babel-C++-compiler "./g++wrap")
(setq shell-file-name "@SHELL@")
(setq org-babel-default-header-args:plantuml
'((:results . "file")
(:exports . "results")
;; Prevent the plantuml logo to appear on top of whatever you
;; are doing when the project compiles in the background.
(:java . "-Djava.awt.headless=true")))
(setenv "PATH"
(concat "@abs_top_builddir@/bin" path-separator (getenv "PATH")))
(setenv "PYTHONPATH"
(concat "@abs_top_builddir@/python/.libs:"
"@abs_top_builddir@/python:"
"@abs_top_srcdir@/python:"
"@abs_top_builddir@/python/spot/.libs:"
"@abs_top_builddir@/python/spot:"
"@abs_top_builddir@/spot/ltsmin/.libs"
"@abs_top_srcdir@/python/spot:"
(getenv "PYTHONPATH")))
(setenv "DYLD_LIBRARY_PATH"
(concat "@abs_top_builddir@/python/.libs:@abs_top_builddir@/spot/.libs:@abs_top_builddir@/buddy/src/.libs:"
(getenv "DYLD_LIBRARY_PATH")))
(setenv "SPOT_DOTDEFAULT" "Brf(Lato)C(#ffffa0)")
(setenv "SPOT_DOTEXTRA" "node[fontsize=12] fontsize=12 stylesheet=\"spot.css\" edge[arrowhead=vee, arrowsize=.7, fontsize=12]")
(setq org-export-html-home/up-format
"<div id=\"org-div-home-and-up\" style=\"text-align:center;white-space:nowrap;\">
<a accesskey=\"h\" href=\"%s\">UP</a> | <a accesskey=\"H\" href=\"%s\">HOME</a>
</div>")
(setq org-export-html-postamble nil)
(defun spot-publish-sitemap (title list)
"Same as org-publish-sitemap-default except it adds the SETUPFILE."
(concat "#+TITLE: " title
"\n#+SETUPFILE: setup.org\n#+HTML_LINK_UP: index.html\n\n"
(org-list-to-org list)))
(setq org-publish-project-alist
'(("spot-html"
:base-directory "@abs_top_srcdir@/doc/org/"
:base-extension "org"
:publishing-directory "@abs_top_srcdir@/doc/userdoc/"
:recursive t
:exclude "setup.org"
:auto-sitemap t
:sitemap-title "Sitemap for Spot"
:sitemap-function spot-publish-sitemap
:publishing-function org-html-publish-to-html
:html-head "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"spot.css\" />"
:auto-preamble t)
("spot-static"
:base-directory "@abs_top_srcdir@/doc/org/"
:base-extension "css\\|js\\|png\\|svg\\|jpg\\|gif\\|pdf"
:publishing-directory "@abs_top_srcdir@/doc/userdoc/"
:recursive t
:publishing-function org-publish-attachment)
("spot-all" :components ("spot-html" "spot-static"))))
(org-publish-all t)
;;; org-babel-remove-temporary-directory does not correctly remove
;;; nested directories and we have some files in tmp/.libs/ because of
;;; libtool. So we have to clean that ourselves.
(if (file-directory-p org-babel-temporary-directory)
(delete-directory org-babel-temporary-directory t))