init.el.in 5.52 KB
Newer Older
1
(setq load-path (append '("@abs_top_srcdir@/elisp/") ; for hoa-mode.el
2
			load-path))
3
4
5
6
7
8
9

(setq debug-on-error t)

(package-initialize)
(require 'cl)
(setq features-before features)

Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
10
(require 'org-version)
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(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)))

32
33
34
35
36
37
38
39
40
41
42
(let ((have-htmlize (require 'htmlize nil t))
      (have-ess (require 'ess nil t)))
  (unless (and have-htmlize have-ess)
    (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
    (package-refresh-contents)
    (unless have-htmlize
      (let ((htmlize (cadr (assq 'htmlize package-archive-contents))))
        (package-install htmlize)))
    (unless have-ess
      (let ((ess (cadr (assq 'ess package-archive-contents))))
        (package-install ess)))))
43
44
45

(require 'ox-publish)
(require 'org-install)
46
(require 'hoa-mode)
47
48

(setq org-export-htmlize-output-type 'css)
49
(setq org-html-htmlize-output-type 'css)
50
51
52
; 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)
53
54
55
;; 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/")
56

57
58
59
;; Prevent tabs from being inserted when org-mode reindent some code.
(setq-default indent-tabs-mode nil)

60
61
(org-babel-do-load-languages
 'org-babel-load-languages
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
62
 `((,(if (version< org-version "8.3") 'sh 'shell) . t)
63
   (dot . t)
64
   (python . t)
65
   (plantuml . t)
66
   (R . t)
67
   (C . t)))
68
(setq org-confirm-babel-evaluate nil)
69
(setq org-plantuml-jar-path "@abs_top_builddir@/doc/org/plantuml.jar")
70
(setq org-babel-temporary-directory "@abs_top_builddir@/doc/org/tmp")
71
72
73
;;; 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))
74
(make-directory org-babel-temporary-directory t)
75
(setq org-babel-python-command "@PYTHON@")
76
(setq org-babel-C++-compiler "./g++wrap")
77
(setq shell-file-name "@SHELL@")
78
(setq ess-ask-for-ess-directory nil)
79

80
81
82
(setq org-babel-default-header-args:plantuml
      '((:results . "file")
        (:exports . "results")
83
84
        ;; Prevent the plantuml logo to appear on top of whatever you
        ;; are doing when the project compiles in the background.
85
        (:java . "-Djava.awt.headless=true")))
86

87
(setenv "PATH"
88
	(concat "@abs_top_builddir@/bin" path-separator (getenv "PATH")))
89
(setenv "PYTHONPATH"
90
91
92
93
94
	(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:"
95
		"@abs_top_builddir@/spot/ltsmin/.libs"
96
		"@abs_top_srcdir@/python/spot:"
97
98
		(getenv "PYTHONPATH")))
(setenv "DYLD_LIBRARY_PATH"
99
	(concat "@abs_top_builddir@/python/.libs:@abs_top_builddir@/spot/.libs:@abs_top_builddir@/buddy/src/.libs:"
100
		(getenv "DYLD_LIBRARY_PATH")))
101
(setenv "SPOT_DOTDEFAULT" "Brf(Lato)C(#ffffa0)")
102
(setenv "SPOT_DOTEXTRA" "node[fontsize=12] fontsize=12 stylesheet=\"spot.css\" edge[arrowhead=vee, arrowsize=.7, fontsize=12]")
103

104
105
106
107
108
(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>")

109
110
(setq org-export-html-postamble nil)

111
112
113
114
115
116
(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)))

117
(setq org-publish-project-alist
118
      '(("spot-html"
119
120
121
122
	:base-directory "@abs_top_srcdir@/doc/org/"
	:base-extension "org"
	:publishing-directory "@abs_top_srcdir@/doc/userdoc/"
	:recursive t
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
123
124
125
	:exclude "setup.org"
	:auto-sitemap t
	:sitemap-title "Sitemap for Spot"
126
127
        :sitemap-function spot-publish-sitemap
	:publishing-function org-html-publish-to-html
128
	:html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"spot.css\" />"
129
130
131
	:auto-preamble t)
       ("spot-static"
	:base-directory "@abs_top_srcdir@/doc/org/"
132
	:base-extension "css\\|js\\|png\\|svg\\|jpg\\|gif\\|pdf"
133
134
135
136
137
138
	: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)
139
140
;;; org-babel-remove-temporary-directory does not correctly remove
;;; nested directories and we have some files in tmp/.libs/ because of
141
142
143
;;; libtool.  So we have to clean that ourselves.
(if (file-directory-p org-babel-temporary-directory)
    (delete-directory org-babel-temporary-directory t))