emacs.el 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. (package-initialize)
  2. (setq package-archives
  3. '(("gnu" . "http://elpa.gnu.org/packages/")
  4. ("melpa" . "http://melpa.org/packages/")))
  5. (setq custom-file "~/.emacs-custom.el")
  6. (load custom-file)
  7. (add-to-list 'load-path "~/install/git/org-mode/lisp/")
  8. (add-to-list 'load-path "~/install/git/org-mode/contrib/lisp/")
  9. (require 'org)
  10. (show-paren-mode 1)
  11. (menu-bar-mode 0)
  12. (set-face-foreground 'font-lock-keyword-face "DeepSkyBlue1")
  13. (set-face-foreground 'font-lock-string-face "Goldenrod")
  14. (require 'org)
  15. (load "/home/git/install/git/emacs-htmlize/htmlize.el")
  16. ;; (require 'htmlize)
  17. ;; to have things work correctly in batch-mode
  18. (require 'font-lock)
  19. (require 'cc-mode)
  20. (require 'ox-org)
  21. (c-after-font-lock-init)
  22. (setq make-backup-files nil
  23. vc-handled-backends nil)
  24. (setq org-export-default-language "en"
  25. org-export-html-extension "html"
  26. org-export-with-timestamps nil
  27. org-export-with-section-numbers nil
  28. org-export-with-tags 'not-in-toc
  29. org-export-skip-text-before-1st-heading nil
  30. org-export-with-sub-superscripts '{}
  31. org-export-with-LaTeX-fragments t
  32. org-export-with-archived-trees nil
  33. org-export-highlight-first-table-line t
  34. org-export-latex-listings-w-names nil
  35. org-html-head-include-default-style nil
  36. org-html-head ""
  37. org-export-htmlize-output-type 'css
  38. org-startup-folded nil
  39. org-export-allow-BIND t
  40. org-publish-list-skipped-files t
  41. org-publish-use-timestamps-flag t
  42. org-export-babel-evaluate nil
  43. org-confirm-babel-evaluate nil
  44. org-export-with-broken-links t)
  45. ;; re-export everything regardless of whether or not it's been modified
  46. ;; (setq org-publish-use-timestamps-flag nil)
  47. (setq worg-base "~/install/git/worg/")
  48. (setq worg-htmlroot "/home/git/worg_html/")
  49. (setq worg-base-directory worg-base)
  50. (setq worg-base-style-directory (concat worg-base "style/"))
  51. (setq worg-base-code-directory (concat worg-base "code/"))
  52. (setq worg-base-color-themes-directory (concat worg-base "color-themes/"))
  53. (setq worg-base-images-directory (concat worg-base "images/"))
  54. (setq worg-publish-directory worg-htmlroot)
  55. (setq worg-publish-style-directory (concat worg-htmlroot "style/"))
  56. (defun set-org-publish-project-alist ()
  57. "Set publishing projects for Orgweb and Worg."
  58. (interactive)
  59. (setq org-publish-project-alist
  60. `(("worg" :components ("worg-org-faq" "worg-pages" "worg-code" "worg-files" "worg-sources" "worg-extra" "worg-bibtex"))
  61. ("orgweb" :components ("orgwebpages" "orgweb-extra"))
  62. ("worg-org-faq"
  63. :base-directory ,worg-base-directory
  64. :base-extension "dummy"
  65. :include ("org-faq.org")
  66. :html-extension "html"
  67. :publishing-directory ,worg-publish-directory
  68. :publishing-function (org-html-publish-to-html)
  69. :section-numbers nil
  70. :table-of-contents nil
  71. :html-head "<link rel=\"stylesheet\" title=\"Standard\" href=\"/worg/style/worg.css\" type=\"text/css\" />
  72. <link rel=\"alternate stylesheet\" title=\"Zenburn\" href=\"/worg/style/worg-zenburn.css\" type=\"text/css\" />
  73. <link rel=\"alternate stylesheet\" title=\"Classic\" href=\"/worg/style/worg-classic.css\" type=\"text/css\" />
  74. <link rel=\"SHORTCUT ICON\" href=\"/org-mode-unicorn.ico\" type=\"image/x-icon\" />
  75. <link rel=\"icon\" href=\"/org-mode-unicorn.ico\" type=\"image/ico\" />"
  76. :recursive t
  77. :html-preamble ,(with-temp-buffer (insert-file-contents "/home/git/install/git/worg/preamble.html") (buffer-string))
  78. :html-postamble "<div id=\"show_source\"><input type=\"button\" value=\"Show Org source\" onClick='show_org_source()'></div><div id=\"license\"><p>Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the <a href=\"http://www.gnu.org/copyleft/fdl.html\">GNU Free Documentation License version 1.3</a> o\
  79. r later. The code examples and css stylesheets are licensed under the <a href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License v3</a> or later.</p></div>")
  80. ("worg-pages"
  81. :base-directory ,worg-base-directory
  82. :base-extension "org"
  83. :exclude "FIXME"
  84. :makeindex t
  85. :auto-sitemap t
  86. :sitemap-ignore-case t
  87. :html-extension "html"
  88. :publishing-directory ,worg-publish-directory
  89. :publishing-function (org-html-publish-to-html org-org-publish-to-org)
  90. :htmlized-source t
  91. :section-numbers nil
  92. :table-of-contents nil
  93. :html-head "<link rel=\"stylesheet\" title=\"Standard\" href=\"/worg/style/worg.css\" type=\"text/css\" />
  94. <link rel=\"alternate stylesheet\" title=\"Zenburn\" href=\"/worg/style/worg-zenburn.css\" type=\"text/css\" />
  95. <link rel=\"alternate stylesheet\" title=\"Classic\" href=\"/worg/style/worg-classic.css\" type=\"text/css\" />
  96. <link rel=\"SHORTCUT ICON\" href=\"/org-mode-unicorn.ico\" type=\"image/x-icon\" />
  97. <link rel=\"icon\" href=\"/org-mode-unicorn.ico\" type=\"image/ico\" />"
  98. :recursive t
  99. :html-preamble ,(with-temp-buffer (insert-file-contents "/home/git/install/git/worg/preamble.html") (buffer-string))
  100. :html-postamble "<div id=\"show_source\"><input type=\"button\" value=\"Show Org source\" onClick='show_org_source()'></div><div id=\"license\"><p>Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the <a href=\"http://www.gnu.org/copyleft/fdl.html\">GNU Free Documentation License version 1.3</a> o\
  101. r later. The code examples and css stylesheets are licensed under the <a href=\"http://www.gnu.org/licenses/gpl.html\">GNU General Public License v3</a> or later.</p></div>")
  102. ("worg-code"
  103. :base-directory ,worg-base-code-directory
  104. :base-extension "html\\|css\\|png\\|js\\|bz2\\|el\\|sty\\|awk\\|pl\\|texi\\|xcf\\|po\\|pot\\|inc\\|sh"
  105. :publishing-directory "/home/git/worg_html/code/"
  106. :recursive t
  107. :publishing-function org-publish-attachment)
  108. ("worg-sources"
  109. :base-directory ,worg-base-directory
  110. :base-extension "org"
  111. :publishing-directory "/home/git/worg_html/sources/"
  112. :recursive t
  113. :publishing-function org-publish-attachment)
  114. ("worg-files"
  115. :base-directory ,worg-base-directory
  116. :base-extension "png\\|jpg\\|gif\\|pdf\\|csv\\|tex\\|texi"
  117. :publishing-directory ,worg-publish-directory
  118. :recursive t
  119. :publishing-function org-publish-attachment)
  120. ("worg-extra"
  121. :base-directory ,worg-base-style-directory
  122. :base-extension "css"
  123. :publishing-directory ,worg-publish-style-directory
  124. :publishing-function org-publish-attachment)
  125. ("worg-bibtex"
  126. :base-directory "/home/git/install/git/worg/org-contrib/bibtex/"
  127. :base-extension "bib"
  128. :publishing-directory "/home/git/worg_html/org-contrib/bibtex/"
  129. :recursive nil
  130. :publishing-function org-publish-attachment)
  131. ("orgwebpages"
  132. :base-directory "~/install/git/orgweb/"
  133. :base-extension "org"
  134. :html-extension "html"
  135. :publishing-directory "/home/git/orgweb_html/"
  136. :publishing-function (org-html-publish-to-html)
  137. :auto-sitemap nil
  138. :section-numbers nil
  139. :table-of-contents t
  140. :html-head "<link rel=\"SHORTCUT ICON\" href=\"/org-mode-unicorn.ico\" type=\"image/x-icon\" />
  141. <link rel=\"icon\" href=\"/org-mode-unicorn.ico\" type=\"image/ico\" />"
  142. :html-preamble ,(with-temp-buffer (insert-file-contents "/home/git/install/git/orgweb/preamble.html") (buffer-string))
  143. :html-postamble nil
  144. :exclude "DS_Store"
  145. :recursive t)
  146. ("orgweb-extra"
  147. :base-directory "~/install/git/orgweb/"
  148. :base-extension "css\\|html\\|png\\|jpg\\|js"
  149. :publishing-directory "/home/git/orgweb_html/"
  150. :publishing-function org-publish-attachment
  151. :recursive t))))
  152. (set-org-publish-project-alist)
  153. (defun worg-fix-symbol-table ()
  154. (when (string-match "org-symbols\\.html" buffer-file-name)
  155. (goto-char (point-min))
  156. (while (re-search-forward "<td>&amp;\\([^<;]+;\\)" nil t)
  157. (replace-match (concat "<td>&" (match-string 1)) t t))))
  158. (defun publish-worg nil
  159. "Publish Worg."
  160. (interactive)
  161. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  162. (let ((org-format-latex-signal-error nil)
  163. (worg-base-directory worg-base)
  164. (worg-base-code-directory (concat worg-base "code/"))
  165. (worg-base-color-themes-directory (concat worg-base "color-themes/"))
  166. (worg-base-images-directory (concat worg-base "images/"))
  167. (worg-publish-directory worg-htmlroot))
  168. (set-org-publish-project-alist)
  169. (message "Emacs %s" emacs-version)
  170. (org-version)
  171. (org-publish-project "worg")))
  172. (defun publish-orgweb nil
  173. "Publish Org web pages."
  174. (interactive)
  175. (add-hook 'org-publish-after-export-hook 'worg-fix-symbol-table)
  176. (let ((org-format-latex-signal-error nil)
  177. (org-export-with-sub-superscripts nil))
  178. (set-org-publish-project-alist)
  179. (org-publish-project "orgweb")))
  180. (defun parse-org-quotes ()
  181. "Create ~/orgmode.org/org-quotes.js from org-quotes.org."
  182. (interactive)
  183. (load (concat worg-base "code/elisp/worg-fortune.el"))
  184. (worg-write-fortune-file
  185. (concat worg-base "org-quotes.org")
  186. "~/orgmode.org/org-quotes.js"
  187. 120
  188. "r_text[%d] = \"%s\";" "\n"
  189. 'worg-fortune-insert-javascript-pre
  190. 'worg-fortune-insert-javascript-post))