]> git.donarmstrong.com Git - lib.git/blob - emacs_el/configuration/org-mode-configuration.el
add configuration subdirectory
[lib.git] / emacs_el / configuration / org-mode-configuration.el
1 ;; The following lines are always needed. Choose your own keys.
2 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
3 (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
4 (global-set-key "\C-cl" 'org-store-link)
5 (global-set-key "\C-ca" 'org-agenda)
6 (global-set-key "\C-cb" 'org-iswitchb)
7 (setq-default org-log-done 'time)
8 (setq-default org-agenda-ndays 5)
9
10 ;; agenda configuration
11 ;; Do not dim blocked tasks
12 (setq org-agenda-dim-blocked-tasks nil)
13
14 ;; Compact the block agenda view
15 (setq org-agenda-compact-blocks t)
16
17 ;; Custom agenda command definitions
18 (setq org-agenda-custom-commands
19       (quote (("N" "Notes" tags "NOTE"
20                ((org-agenda-overriding-header "Notes")
21                 (org-tags-match-list-sublevels t)))
22               ("h" "Habits" tags-todo "STYLE=\"habit\""
23                ((org-agenda-overriding-header "Habits")
24                 (org-agenda-sorting-strategy
25                  '(todo-state-down effort-up category-keep))))
26               (" " "Agenda"
27                ((agenda "" nil)
28                 (tags "REFILE"
29                       ((org-agenda-overriding-header "Tasks to Refile")
30                        (org-tags-match-list-sublevels nil)))
31                 (tags-todo "-CANCELLED/!"
32                            ((org-agenda-overriding-header "Stuck Projects")
33                             (org-agenda-skip-function 'bh/skip-non-stuck-projects)
34                             (org-agenda-sorting-strategy
35                              '(category-keep))))
36                 (tags-todo "-HOLD-CANCELLED/!"
37                            ((org-agenda-overriding-header "Projects")
38                             (org-agenda-skip-function 'bh/skip-non-projects)
39                             (org-tags-match-list-sublevels 'indented)
40                             (org-agenda-sorting-strategy
41                              '(category-keep))))
42                 (tags-todo "-CANCELLED/!NEXT"
43                            ((org-agenda-overriding-header (concat "Project Next Tasks"
44                                                                   (if bh/hide-scheduled-and-waiting-next-tasks
45                                                                       ""
46                                                                     " (including WAITING and SCHEDULED tasks)")))
47                             (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
48                             (org-tags-match-list-sublevels t)
49                             (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
50                             (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
51                             (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
52                             (org-agenda-sorting-strategy
53                              '(todo-state-down effort-up category-keep))))
54                 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
55                            ((org-agenda-overriding-header (concat "Project Subtasks"
56                                                                   (if bh/hide-scheduled-and-waiting-next-tasks
57                                                                       ""
58                                                                     " (including WAITING and SCHEDULED tasks)")))
59                             (org-agenda-skip-function 'bh/skip-non-project-tasks)
60                             (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
61                             (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
62                             (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
63                             (org-agenda-sorting-strategy
64                              '(category-keep))))
65                 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
66                            ((org-agenda-overriding-header (concat "Standalone Tasks"
67                                                                   (if bh/hide-scheduled-and-waiting-next-tasks
68                                                                       ""
69                                                                     " (including WAITING and SCHEDULED tasks)")))
70                             (org-agenda-skip-function 'bh/skip-project-tasks)
71                             (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
72                             (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
73                             (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
74                             (org-agenda-sorting-strategy
75                              '(category-keep))))
76                 (tags-todo "-CANCELLED+WAITING|HOLD/!"
77                            ((org-agenda-overriding-header "Waiting and Postponed Tasks")
78                             (org-agenda-skip-function 'bh/skip-stuck-projects)
79                             (org-tags-match-list-sublevels nil)
80                             (org-agenda-todo-ignore-scheduled t)
81                             (org-agenda-todo-ignore-deadlines t)))
82                 (tags "-REFILE/"
83                       ((org-agenda-overriding-header "Tasks to Archive")
84                        (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
85                        (org-tags-match-list-sublevels nil))))
86                nil))))
87
88 ; org mode agenda files
89 (setq org-agenda-files
90       (quote ("~/projects/debbugs/debbugs.org"
91               "~/projects/notes/notes.org"
92               "~/projects/origins_of_life/ool.org"
93               "~/projects/sysadmin/sndservers/sndservers.org"
94               "~/projects/chaim/chaim.org"
95               "~/projects/chaim/papers/gwas_paper_2012/gwas_paper.org"
96           "~/projects/reviews/reviews.org"
97               "~/projects/fh/fh.org")))
98
99 (setq org-global-properties '(("Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
100 (setq org-columns-default-format "%40ITEM(Task) %TAGS %PRIORITY %TODO %13SCHEDULED %13DEADLINE %6Effort{:}  %CLOCKSUM")
101
102 (setq org-default-notes-file "~/projects/notes/notes.org")
103 (setq org-capture-templates  ;; mail-specific note template, identified by "m"
104       '(("m" "Mail" entry (file+headline "~/projects/notes/refile.org" "Mail")
105          "* %?\n\n  Source: %u, %c\n  %i")
106         ("t" "todo" entry (file "~/projects/notes/refile.org")
107          "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
108         ("r" "respond" entry (file "~/projects/notes/refile.org")
109          "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
110         ("n" "note" entry (file "~/projects/notes/refile.org")
111          "* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
112         ("s" "schedule" entry (file "~/projects/notes/refile.org")
113          "* %? \n%^{scheduled:}t\n%U\n%a\n" :clock-in t :clock-resume t)
114         ("j" "Journal" entry (file+datetree "~/projects/notes/diary.org")
115          "* %?\n%U\n" :clock-in t :clock-resume t)
116         ("w" "org-protocol" entry (file "~/projects/notes/refile.org")
117          "* TODO Review %c\n%U\n" :immediate-finish t)
118         ("m" "Meeting" entry (file "~/projects/notes/refile.org")
119          "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
120         ("p" "Phone call" entry (file "~/projects/notes/refile.org")
121          "* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
122         ("h" "Habit" entry (file "~/projects/notes/refile.org")
123          "* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n")
124         )
125       )
126
127 ;; Remove empty LOGBOOK drawers on clock out
128 (defun bh/remove-empty-drawer-on-clock-out ()
129   (interactive)
130   (save-excursion
131     (beginning-of-line 0)
132     (org-remove-empty-drawer-at "LOGBOOK" (point))))
133
134 (defun my/org-add-id ()
135   (interactive)
136   (save-excursion
137     (if (org-current-level)
138         ()
139       (forward-char 1)
140       )
141     (org-id-get-create)
142     )
143 )
144
145 ; org mode configuration from http://doc.norang.ca/org-mode.html
146 ;; Custom Key Bindings
147 (global-set-key (kbd "<f12>") 'org-agenda)
148 (global-set-key (kbd "<f5>") 'bh/org-todo)
149 (global-set-key (kbd "<S-f5>") 'bh/widen)
150 (global-set-key (kbd "<f7>") 'bh/set-truncate-lines)
151 (global-set-key (kbd "<f8>") 'org-cycle-agenda-files)
152 (global-set-key (kbd "<f9> <f9>") 'bh/show-org-agenda)
153 (global-set-key (kbd "<f9> b") 'bbdb)
154 (global-set-key (kbd "<f9> c") 'calendar)
155 (global-set-key (kbd "<f9> f") 'boxquote-insert-file)
156 (global-set-key (kbd "<f9> h") 'bh/hide-other)
157 (global-set-key (kbd "<f9> n") 'bh/toggle-next-task-display)
158 (global-set-key (kbd "<f9> w") 'widen)
159
160 (global-set-key (kbd "<f9> I") 'bh/punch-in)
161 (global-set-key (kbd "<f9> O") 'bh/punch-out)
162
163 (global-set-key (kbd "<f9> o") 'bh/make-org-scratch)
164
165 (global-set-key (kbd "<f9> r") 'boxquote-region)
166 (global-set-key (kbd "<f9> s") 'bh/switch-to-scratch)
167
168 (global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
169 (global-set-key (kbd "<f9> T") 'bh/toggle-insert-inactive-timestamp)
170
171 (global-set-key (kbd "<f9> v") 'visible-mode)
172 (global-set-key (kbd "<f9> l") 'org-toggle-link-display)
173 (global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)
174 (global-set-key (kbd "C-<f9>") 'previous-buffer)
175 (global-set-key (kbd "M-<f9>") 'org-toggle-inline-images)
176 (global-set-key (kbd "C-x n r") 'narrow-to-region)
177 (global-set-key (kbd "C-<f10>") 'next-buffer)
178 (global-set-key (kbd "<f11>") 'org-clock-goto)
179 (global-set-key (kbd "C-<f11>") 'org-clock-in)
180 (global-set-key (kbd "C-s-<f12>") 'bh/save-then-publish)
181 (global-set-key (kbd "C-c c") 'org-capture)
182
183 (defun bh/hide-other ()
184   (interactive)
185   (save-excursion
186     (org-back-to-heading 'invisible-ok)
187     (hide-other)
188     (org-cycle)
189     (org-cycle)
190     (org-cycle)))
191
192 (defun bh/set-truncate-lines ()
193   "Toggle value of truncate-lines and refresh window display."
194   (interactive)
195   (setq truncate-lines (not truncate-lines))
196   ;; now refresh window display (an idiom from simple.el):
197   (save-excursion
198     (set-window-start (selected-window)
199                       (window-start (selected-window)))))
200
201 (defun bh/make-org-scratch ()
202   (interactive)
203   (find-file "/tmp/publish/scratch.org")
204   (gnus-make-directory "/tmp/publish"))
205
206 (defun bh/switch-to-scratch ()
207   (interactive)
208   (switch-to-buffer "*scratch*"))
209
210 (setq org-use-fast-todo-selection t)
211 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
212
213 (setq org-todo-keywords
214       (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
215               (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
216
217 (setq org-todo-keyword-faces
218       (quote (("TODO" :foreground "red" :weight bold)
219               ("NEXT" :foreground "blue" :weight bold)
220               ("DONE" :foreground "forest green" :weight bold)
221               ("WAITING" :foreground "orange" :weight bold)
222               ("HOLD" :foreground "magenta" :weight bold)
223               ("CANCELLED" :foreground "forest green" :weight bold)
224               ("MEETING" :foreground "forest green" :weight bold)
225               ("PHONE" :foreground "forest green" :weight bold))))
226
227 (setq org-todo-state-tags-triggers
228       (quote (("CANCELLED" ("CANCELLED" . t))
229               ("WAITING" ("WAITING" . t))
230               ("HOLD" ("WAITING") ("HOLD" . t))
231               (done ("WAITING") ("HOLD"))
232               ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
233               ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
234               ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
235
236
237
238 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
239 ; add ids on creation of nodes
240 (add-hook 'org-capture-prepare-finalize-hook 'my/org-add-id)
241 ; create function to create headlines in file. This comes from
242 ; http://stackoverflow.com/questions/13340616/assign-ids-to-every-entry-in-org-mode
243 (defun my/org-add-ids-to-headlines-in-file ()
244   "Add ID properties to all headlines in the current file which
245 do not already have one."
246   (interactive)
247   (org-map-entries 'org-id-get-create))
248 ; if we wanted to do this to every buffer, do the following:
249 ; (add-hook 'org-mode-hook
250 ;           (lambda ()
251 ;             (add-hook 'before-save-hook 'my/org-add-ids-to-headlines-in-file nil 'local)))
252
253
254 ; resolve clocks after 10 minutes of idle; use xprintidle
255 (setq org-clock-idle-time 10)
256 (setq org-clock-x11idle-program-name "xprintidle")
257
258 ; this is from http://doc.norang.ca/org-mode.html#Capture
259 ; use C-M-r for org mode capture
260 (global-set-key (kbd "C-M-r") 'org-capture)
261
262 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
263 (setq org-refile-targets (quote ((nil :maxlevel . 9)
264                                  (org-agenda-files :maxlevel . 9))))
265
266 ; Use full outline paths for refile targets - we file directly with IDO
267 (setq org-refile-use-outline-path t)
268
269 ; Targets complete directly with IDO
270 (setq org-outline-path-complete-in-steps nil)
271
272 ; Allow refile to create parent tasks with confirmation
273 (setq org-refile-allow-creating-parent-nodes (quote confirm))
274
275 ; Use IDO for both buffer and file completion and ido-everywhere to t
276 (setq org-completion-use-ido t)
277 (setq ido-everywhere t)
278 (setq ido-max-directory-size 100000)
279 (ido-mode (quote both))
280 ; Use the current window when visiting files and buffers with ido
281 (setq ido-default-file-method 'selected-window)
282 (setq ido-default-buffer-method 'selected-window)
283 ; Use the current window for indirect buffer display
284 (setq org-indirect-buffer-display 'current-window)
285
286
287 ;;;; Refile settings
288 ; Exclude DONE state tasks from refile targets
289 (defun bh/verify-refile-target ()
290   "Exclude todo keywords with a done state from refile targets"
291   (not (member (nth 2 (org-heading-components)) org-done-keywords)))
292
293 (setq org-refile-target-verify-function 'bh/verify-refile-target)
294
295 ;; ensure that emacsclient will show just the note to be edited when invoked
296 ;; from Mutt, and that it will shut down emacsclient once finished;
297 ;; fallback to legacy behavior when not invoked via org-protocol.
298 (require 'org-protocol)
299 (add-hook 'org-capture-mode-hook 'delete-other-windows)
300 (setq my-org-protocol-flag nil)
301 (defadvice org-capture-finalize (after delete-frame-at-end activate)
302   "Delete frame at remember finalization"
303   (progn (if my-org-protocol-flag (delete-frame))
304          (setq my-org-protocol-flag nil)))
305 (defadvice org-capture-refile (around delete-frame-after-refile activate)
306   "Delete frame at remember refile"
307   (if my-org-protocol-flag
308       (progn
309         (setq my-org-protocol-flag nil)
310         ad-do-it
311         (delete-frame))
312     ad-do-it)
313   )
314 (defadvice org-capture-kill (after delete-frame-at-end activate)
315   "Delete frame at remember abort"
316   (progn (if my-org-protocol-flag (delete-frame))
317          (setq my-org-protocol-flag nil)))
318 (defadvice org-protocol-capture (before set-org-protocol-flag activate)
319   (setq my-org-protocol-flag t))
320
321
322 ;; org modules
323 (add-to-list 'org-modules 'org-habit)
324
325 ; this comes from http://upsilon.cc/~zack/blog/posts/2010/02/integrating_Mutt_with_Org-mode/
326 (defun open-mail-in-mutt (message)
327   "Open a mail message in Mutt, using an external terminal.
328
329 Message can be specified either by a path pointing inside a
330 Maildir, or by Message-ID."
331   (interactive "MPath or Message-ID: ")
332   (shell-command
333    (format "faf xterm -e \"%s %s\""
334        (substitute-in-file-name "$HOME/bin/mutt_open") message)))
335
336 ;; add support for "mutt:ID" links
337 (org-add-link-type "mutt" 'open-mail-in-mutt)
338
339 (defun my-org-mode-setup ()
340   (load-library "reftex")
341   (and (buffer-file-name)
342        (file-exists-p (buffer-file-name))
343        (progn
344          (reftex-parse-all)
345          (reftex-set-cite-format
346           '((?b . "[[bib::%l][%l-bib]]")
347             (?n . "[[note::%l][%l-notes]]")
348             (?c . "\\cite{%l}")
349             (?h . "*** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l paper]]")))
350          ))
351   (define-key org-mode-map (kbd "C-c )") 'reftex-citation)
352   (define-key org-mode-map (kbd "C-c [") 'reftex-citation)
353   (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)
354   (define-key org-mode-map (kbd "C-c 0") 'reftex-view-crossref)
355   )
356 (add-hook 'org-mode-hook 'my-org-mode-setup)
357
358 (defun org-mode-reftex-search ()
359   (interactive)
360   (org-open-link-from-string (format "[[notes:%s]]" (reftex-citation t))))
361
362 (defun open-research-paper (bibtexkey)
363   "Open a paper by bibtex key"
364   (interactive "bibtex key: ")
365   (shell-command
366    (format "%s %s"
367        (substitute-in-file-name "$HOME/bin/bibtex_to_paper") bibtexkey)))
368 (org-add-link-type "papers" 'open-research-paper)
369
370 ; I pretty much always want hiearchical checkboxes
371 (setq org-hierachical-checkbox-statistics nil)
372  
373 ;; stolen from
374 ;; http://www-public.it-sudparis.eu/~berger_o/weblog/2012/03/23/how-to-manage-and-export-bibliographic-notesrefs-in-org-mode/
375 (defun my-rtcite-export-handler (path desc format)
376   (message "my-rtcite-export-handler is called : path = %s, desc = %s, format = %s" path desc format)
377   (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
378                    (match-string 1 path)))
379          (path (substring path 0 (match-beginning 0))))
380     (cond ((eq format 'latex)
381            (if (or (not desc) 
382                    (equal 0 (search "rtcite:" desc)))
383                (format "\\cite{%s}" search)
384              (format "\\cite[%s]{%s}" desc search))))))
385
386 (org-add-link-type "rtcite" 
387                    'org-bibtex-open
388                    'my-rtcite-export-handler)
389
390
391 (setq-default org-mobile-directory "/rzlab.ucr.edu:/sites/dav.donarmstrong.com/root/org/")
392 (setq-default org-directory "/home/don/org-mode/")
393 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
394
395 ;; org mode ical export
396 (setq org-icalendar-timezone "America/Los_Angeles")
397 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
398 (setq org-icalendar-store-UID t)
399
400 ;; org babel support
401 (org-babel-do-load-languages
402  'org-babel-load-languages
403  '((emacs-lisp . t )
404    (R . t)
405    (latex . t)))
406 ;; org-babel-by-backend
407 (defmacro org-babel-by-backend (&rest body)
408    `(case (if (boundp 'backend) 
409               (org-export-backend-name backend)
410             nil) ,@body))
411
412
413
414 ;; org latex
415 ;; stolen from http://kieranhealy.org/esk/kjhealy.html
416 (require 'org-latex)   
417 ;; Choose either listings or minted for exporting source code blocks.
418 ;; Using minted (as here) requires pygments be installed. To use the
419 ;; default listings package instead, use
420 ;; (setq org-latex-listings t)
421 ;; and change references to "minted" below to "listings"
422 ; (setq org-latex-listings 'minted)
423
424 ;; default settings for minted code blocks
425 (setq org-latex-minted-options
426       '(;("frame" "single")
427         ("bgcolor" "bg") ; bg will need to be defined in the preamble of your document. It's defined in org-preamble-pdflatex.sty and org-preamble-xelatex.sty below.
428         ("fontsize" "\\small")
429         ))
430 ;; turn off the default toc behavior; deal with it properly in headers to files.
431 (defun org-latex-no-toc (depth)  
432   (when depth
433     (format "%% Org-mode is exporting headings to %s levels.\n"
434             depth)))
435 (setq org-latex-format-toc-function 'org-latex-no-toc)
436
437 (require 'ox-latex)
438 (add-to-list 'org-latex-classes
439              '("memarticle"
440                "\\documentclass[11pt,oneside,article]{memoir}\n"
441                ("\\section{%s}" . "\\section*{%s}")
442                ("\\subsection{%s}" . "\\subsection*{%s}")
443                ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
444                ("\\paragraph{%s}" . "\\paragraph*{%s}")
445                ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
446
447 (add-to-list 'org-latex-classes
448              '("membook"
449                "\\documentclass[11pt,oneside]{memoir}\n"
450                ("\\chapter{%s}" . "\\chapter*{%s}")
451                ("\\section{%s}" . "\\section*{%s}")
452                ("\\subsection{%s}" . "\\subsection*{%s}")
453                ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
454
455 (add-to-list 'org-latex-classes
456              '("letter"
457                "\\documentclass[11pt]{letter}
458 [NO-DEFAULT-PACKAGES]
459 [PACKAGES]
460 [EXTRA]"
461        ("\\section{%s}" . "\\section*{%s}")
462                ("\\subsection{%s}" . "\\subsection*{%s}")
463                ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
464                ("\\paragraph{%s}" . "\\paragraph*{%s}")
465                ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
466
467 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
468 ;; but adapted to use latexmk 4.22 or higher.  
469 (setq org-latex-pdf-process '("latexmk -pdflatex=xelatex -bibtex -use-make -pdf %f"))
470
471 ;; Default packages included in /every/ tex file, latex, pdflatex or xelatex
472 (setq org-latex-default-packages-alist
473       '())
474 (setq org-latex-packages-alist
475       '(("" "graphicx" t)
476         ("" "fontspec" t)
477         ("" "xunicode" t)
478         ("" "hyperref" t)
479         ("" "url" t)
480         ("" "rotating" t)
481         ("" "longtable" nil)
482         ("" "float" )))
483
484 (defun org-create-formula--latex-header ()
485   "Return LaTeX header appropriate for previewing a LaTeX snippet."
486   (let ((info (org-combine-plists (org-export--get-global-options
487                                    (org-export-get-backend 'latex))
488                                   (org-export--get-inbuffer-options
489                                    (org-export-get-backend 'latex)))))
490     (org-latex-guess-babel-language
491      (org-latex-guess-inputenc
492       (org-splice-latex-header
493        org-format-latex-header
494        org-latex-default-packages-alist
495        nil t
496        (plist-get info :latex-header)))
497      info)))
498
499
500 ; support ignoring headers in org mode export to latex
501 ; from http://article.gmane.org/gmane.emacs.orgmode/67692
502 (defadvice org-latex-headline (around my-latex-skip-headlines
503                                       (headline contents info) activate)
504   (if (member "ignoreheading" (org-element-property :tags headline))
505       (setq ad-return-value contents)
506     ad-do-it))