]> git.donarmstrong.com Git - emacs.git/blobdiff - .emacs
I actually do not want cperl-indent-parens-as-block because I hate that code style
[emacs.git] / .emacs
diff --git a/.emacs b/.emacs
index d7c020438055bead98f14e194597d198641dddf0..5fe719e7df4f3b2c956cdbf4110edee178664398 100644 (file)
--- a/.emacs
+++ b/.emacs
 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
 
 
+; resolve clocks after 10 minutes of idle; use xprintidle
+(setq org-clock-idle-time 10)
+(setq org-clock-x11idle-program-name "xprintidle")
+
 ; this is from http://doc.norang.ca/org-mode.html#Capture
 ; use C-M-r for org mode capture
 (global-set-key (kbd "C-M-r") 'org-capture)
   "Delete frame at remember finalization"
   (progn (if my-org-protocol-flag (delete-frame))
          (setq my-org-protocol-flag nil)))
+(defadvice org-capture-refile (around delete-frame-after-refile activate)
+  "Delete frame at remember refile"
+  (if my-org-protocol-flag
+      (progn
+        (setq my-org-protocol-flag nil)
+        ad-do-it
+        (delete-frame))
+    ad-do-it)
+  )
 (defadvice org-capture-kill (after delete-frame-at-end activate)
   "Delete frame at remember abort"
   (progn (if my-org-protocol-flag (delete-frame))
@@ -280,12 +293,13 @@ Argument DESCRIPTION MIME description."
       cperl-auto-newline nil
       cperl-auto-newline-after-colon nil
       cperl-continued-statement-offset 4
-      cperl-brace-offset -4
+      cperl-brace-offset -1
       cperl-continued-brace-offset 0
       cperl-label-offset -4
       cperl-highlight-variables-indiscriminately t
       cperl-electric-lbrace-space nil
-      cperl-indent-parens-as-block t
+      cperl-indent-parens-as-block nil
+      cperl-close-paren-offset -1
       cperl-tab-always-indent t)
 ;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
 
@@ -321,6 +335,11 @@ Argument DESCRIPTION MIME description."
 (add-hook 'LaTeX-mode-hook 'outline-minor-mode)   ; with AUCTeX LaTeX mode
 (add-hook 'latex-mode-hook 'outline-minor-mode)   ; with Emacs latex mode
 
+; use smart quotes by default instead of `` and ''
+; taken from http://kieranhealy.org/esk/kjhealy.html
+(setq TeX-open-quote "“")
+(setq TeX-close-quote "”")
+
 ;; (TeX-add-style-hook
 ;;  "latex"
 ;;  (lambda ()
@@ -549,7 +568,6 @@ Argument DESCRIPTION MIME description."
   (interactive)
   (org-open-link-from-string (format "[[notes:%s]]" (reftex-citation t))))
 
-
 (defun open-research-paper (bibtexkey)
   "Open a paper by bibtex key"
   (interactive "bibtex key: ")
@@ -579,6 +597,94 @@ Argument DESCRIPTION MIME description."
 (setq-default org-directory "/home/don/org-mode/")
 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
 
+;; org latex
+;; stolen from http://kieranhealy.org/esk/kjhealy.html
+(require 'org-latex)   
+;; Choose either listings or minted for exporting source code blocks.
+;; Using minted (as here) requires pygments be installed. To use the
+;; default listings package instead, use
+;; (setq org-latex-listings t)
+;; and change references to "minted" below to "listings"
+(setq org-latex-listings 'minted)
+
+;; default settings for minted code blocks
+(setq org-latex-minted-options
+      '(;("frame" "single")
+        ("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.
+        ("fontsize" "\\small")
+        ))
+;; turn off the default toc behavior; deal with it properly in headers to files.
+(defun org-latex-no-toc (depth)  
+  (when depth
+    (format "%% Org-mode is exporting headings to %s levels.\n"
+            depth)))
+(setq org-latex-format-toc-function 'org-latex-no-toc)
+
+(require 'ox-latex)
+(add-to-list 'org-latex-classes
+             '("memarticle"
+               "\\documentclass[11pt,oneside,article]{memoir}\n"
+               ("\\section{%s}" . "\\section*{%s}")
+               ("\\subsection{%s}" . "\\subsection*{%s}")
+               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+               ("\\paragraph{%s}" . "\\paragraph*{%s}")
+               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
+
+(add-to-list 'org-latex-classes
+             '("membook"
+               "\\documentclass[11pt,oneside]{memoir}\n"
+               ("\\chapter{%s}" . "\\chapter*{%s}")
+               ("\\section{%s}" . "\\section*{%s}")
+               ("\\subsection{%s}" . "\\subsection*{%s}")
+               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
+
+;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
+;; but adapted to use latexmk 4.22 or higher.  
+(defun my-auto-tex-cmd ()
+  "When exporting from .org with latex, automatically run latex,
+                     pdflatex, or xelatex as appropriate, using latexmk."
+  (let ((texcmd)))
+  ;; default command: pdflatex 
+  (setq texcmd "latexmk -pdflatex='pdflatex -synctex=1 --shell-escape --' -pdf %f")        
+  ;; pdflatex -> .pdf
+  (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
+      (setq texcmd "latexmk -pdflatex='pdflatex -synctex=1 --shell-escape' -pdf %f"))
+  ;; xelatex -> .pdf
+  (if (string-match "LATEX_CMD: xelatex" (buffer-string))
+      (setq texcmd "latexmk -pdflatex='xelatex -syntex=1 --shell-escape' -bibtex -use-make -pdf %f"))
+  ;; LaTeX compilation command
+  (setq org-latex-to-pdf-process (list texcmd)))
+
+(add-hook 'org-latex-after-initial-vars-hook 'my-auto-tex-cmd)
+
+;; Default packages included in /every/ tex file, latex, pdflatex or xelatex
+(setq org-latex-packages-alist
+      '(("" "graphicx" t)
+        ("" "longtable" nil)
+        ("" "float" )))
+
+;; Custom packages
+(defun my-auto-tex-parameters ()
+  "Automatically select the tex packages to include. See https://github.com/kjhealy/latex-custom-kjh for the support files included here."
+  ;; default packages for ordinary latex or pdflatex export
+  (setq org-latex-default-packages-alist
+        '(("AUTO" "inputenc" t)
+          ("minted,minion" "org-preamble-pdflatex" t)))        
+  ;; Packages to include when xelatex is used
+  (if (string-match "LATEX_CMD: xelatex" (buffer-string))
+      (setq org-latex-default-packages-alist
+            '(("minted" "org-preamble-xelatex" t) ))))
+
+(add-hook 'org-latex-after-initial-vars-hook 'my-auto-tex-parameters)
+
+; support ignoring headers in org mode export to latex
+; from http://article.gmane.org/gmane.emacs.orgmode/67692
+(defadvice org-latex-headline (around my-latex-skip-headlines
+                                      (headline contents info) activate)
+  (if (member "ignoreheading" (org-element-property :tags headline))
+      (setq ad-return-value contents)
+    ad-do-it))
+
 ; debian stuff
 (setq-default debian-changelog-mailing-address "don@debian.org")
 (setq-default debian-changelog-full-name "Don Armstrong")
@@ -659,6 +765,10 @@ want to use in the modeline *in lieu of* the original.")
     (setq flymake-mode-line mode-line)
     (force-mode-line-update)))
 
+; load sql-indent when sql is loaded
+(eval-after-load "sql"
+  '(load-library "sql-indent"))
+
 ; fix up tmux xterm keys
 ; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
 (if (getenv "TMUX")