Commit d2041c61 authored by Arjen Wiersma's avatar Arjen Wiersma

Cleanup old and used bits, restructure overgrown Org section

parent 2e6cb1c3
......@@ -1103,22 +1103,32 @@ The following are snippets, functions or other temporary code that I have found
* Org Mode
Formatting found on [[http://howardism.org/Technical/Emacs/orgmode-wordprocessor.html][Howardism]].
Also [[https://diego.codes/][Diego]] has some great stuff.
Formatting found on [[http://howardism.org/Technical/Emacs/orgmode-wordprocessor.html][Howardism]]. Also [[https://diego.codes/][Diego]] has some great stuff for
blogging/making a website using Emacs.
** The org package
#+begin_src emacs-lisp
(use-package org
:ensure t)
#+end_src
** Habits
#+begin_src emacs-lisp
(require 'org-habit)
(add-to-list 'org-modules 'org-habit)
#+end_src
** Editing Org files
#+begin_src emacs-lisp
(setq org-hide-emphasis-markers t)
(font-lock-add-keywords 'org-mode
'(("^ +\\([-*]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
(setq org-link-frame-setup
(quote
((vm . vm-visit-folder-other-frame)
......@@ -1127,13 +1137,6 @@ Also [[https://diego.codes/][Diego]] has some great stuff.
(file . find-file)
(wl . wl-other-frame))))
;; (use-package org-bullets
;; :ensure t)
(setq
;; org-bullets-bullet-list '(" ") ;; no bullets, needs org-bullets package
;; org-ellipsis " > "
)
(when (window-system)
(let* ((variable-tuple (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
......@@ -1155,16 +1158,13 @@ Also [[https://diego.codes/][Diego]] has some great stuff.
`(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))
`(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))
)
;; (use-package org-plus-contrib
;; :ensure t)
(require 'ox-html)
(require 'ox-publish)
#+end_src
(use-package htmlize
:ensure t)
** Agenda and capture templates
#+begin_src emacs-lisp
(setq org-agenda-files '("~/Dropbox/Apps/MobileOrg/inbox.org"
"~/Dropbox/Apps/MobileOrg/notes.org"
"~/Dropbox/Apps/MobileOrg/gtd.org"
......@@ -1205,25 +1205,51 @@ Also [[https://diego.codes/][Diego]] has some great stuff.
(defun org-current-is-todo ()
(string= "TODO" (org-get-todo-state)))
#+end_src
** Keybindings
#+begin_src emacs-lisp
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
#+end_src
A first attempt at a website structure with org-mode. The idea is to build my tutorial website, buildfunthings.com, from these static files.
** Publishing
- [[https://www.brautaset.org/articles/2017/blogging-with-org-mode.html][Reference 1]]
*** Packages
#+begin_src emacs-lisp
(require 'ox-html)
(require 'ox-publish)
(use-package htmlize
:ensure t)
(add-to-list 'load-path (expand-file-name (concat init-dir "ox-rss")))
(require 'ox-rss)
#+end_src
A first attempt at a website structure with org-mode. The idea is to build my tutorial website, buildfunthings.com, from these static files.
- [[https://www.brautaset.org/articles/2017/blogging-with-org-mode.html][Reference 1]]
*** Variables
#+begin_src emacs-lisp
(setq org-mode-websrc-directory "~/Dropbox/Apps/MobileOrg/website")
(setq org-mode-publishing-directory "~/Dropbox/Apps/MobileOrg/website/_site")
(setq org-html-htmlize-output-type 'css)
#+end_src
*** Support functions
#+begin_src emacs-lisp
(defun my-org-export-format-drawer (name content)
(concat "<div class=\"drawer " (downcase name) "\">\n"
"<h6>" (capitalize name) "</h6>\n"
......@@ -1231,6 +1257,31 @@ A first attempt at a website structure with org-mode. The idea is to build my tu
"\n</div>"))
(setq org-html-format-drawer-function 'my-org-export-format-drawer)
(defun org-mode-blog-preamble (options)
"The function that creates the preamble top section for the blog.
OPTIONS contains the property list from the org-mode export."
(let ((base-directory (plist-get options :base-directory)))
(org-babel-with-temp-filebuffer (expand-file-name "top-bar.html" base-directory) (buffer-string))))
(defun org-mode-blog-postamble (options)
"The function that creates the postamble, or bottom section for the blog.
OPTIONS contains the property list from the org-mode export."
(let ((base-directory (plist-get options :base-directory)))
(org-babel-with-temp-filebuffer (expand-file-name "bottom.html" base-directory) (buffer-string))))
(defun org-mode-blog-prepare (options)
"`index.org' should always be exported so touch the file before publishing."
(let* (
(buffer (find-file-noselect (expand-file-name "index.org" org-mode-websrc-directory) t)))
(with-current-buffer buffer
(set-buffer-modified-p t)
(save-buffer 0))
(kill-buffer buffer)))
#+end_src
*** Publishing configuration
#+begin_src emacs-lisp
;; Options: http://orgmode.org/manual/Publishing-options.html
(setq org-publish-project-alist
`(("all"
......@@ -1289,27 +1340,6 @@ A first attempt at a website structure with org-mode. The idea is to build my tu
:publishing-function org-publish-attachment
)
))
(defun org-mode-blog-preamble (options)
"The function that creates the preamble top section for the blog.
OPTIONS contains the property list from the org-mode export."
(let ((base-directory (plist-get options :base-directory)))
(org-babel-with-temp-filebuffer (expand-file-name "top-bar.html" base-directory) (buffer-string))))
(defun org-mode-blog-postamble (options)
"The function that creates the postamble, or bottom section for the blog.
OPTIONS contains the property list from the org-mode export."
(let ((base-directory (plist-get options :base-directory)))
(org-babel-with-temp-filebuffer (expand-file-name "bottom.html" base-directory) (buffer-string))))
(defun org-mode-blog-prepare (options)
"`index.org' should always be exported so touch the file before publishing."
(let* (
(buffer (find-file-noselect (expand-file-name "index.org" org-mode-websrc-directory) t)))
(with-current-buffer buffer
(set-buffer-modified-p t)
(save-buffer 0))
(kill-buffer buffer)))
#+end_src
*** org-reveal
......@@ -1330,7 +1360,6 @@ ox-reveal is broken in org 9.2 due to the template mechanism change.
:ensure t
:config (setq org-journal-dir "~/Dropbox/Apps/MobileOrg/journal"))
#+end_src
* Mail
* Email
......@@ -1452,6 +1481,7 @@ ox-reveal is broken in org 9.2 due to the template mechanism change.
(setq org-mu4e-link-query-in-headers-mode nil)
#+end_src
* Modeline
#+begin_src emacs-lisp
(use-package moody
......@@ -1462,10 +1492,6 @@ ox-reveal is broken in org 9.2 due to the template mechanism change.
(use-package minions
:config (minions-mode 1))
#+end_src
* Todo
Check out [[https://feedly.com/i/entry/kWIfLMJnR/XuC8kF6gpUVj8MtO1vBjHlxQ+/i6E/dJU=_15cfae53829:54d3901:517b1451][GTD in org-mode]]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment