]> git.donarmstrong.com Git - emacs.git/blobdiff - .emacs
fix continued brace offset, remove perl style, and add tmux fixing code
[emacs.git] / .emacs
diff --git a/.emacs b/.emacs
index f37d936892081ae7023327f571051168e121091a..d7c020438055bead98f14e194597d198641dddf0 100644 (file)
--- a/.emacs
+++ b/.emacs
@@ -1,15 +1,15 @@
 (custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
  '(bibtex-user-optional-fields (quote (("annote" "Personal annotation (ignored)") ("abstract" "") ("pmid" "") ("doi" ""))))
  '(calendar-latitude [33 57 north])
  '(calendar-longitude [117 24 west])
  '(case-fold-search t)
  '(confirm-kill-emacs (quote y-or-n-p))
  '(cperl-lazy-help-time nil)
- '(debian-changelog-mailing-address "don@debian.org")
+ '(debian-changelog-mailing-address "don@debian.org" t)
  '(display-time t)
  '(display-time-24hr-format t)
  '(display-time-day-and-date t)
@@ -97,6 +97,7 @@
              "~/projects/origins_of_life/ool.org"
              "~/projects/sysadmin/sndservers/sndservers.org"
              "~/projects/chaim/chaim.org"
+             "~/projects/chaim/papers/gwas_paper_2012/gwas_paper.org"
              "~/projects/fh/fh.org")))
 
 (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")))
@@ -280,11 +281,13 @@ Argument DESCRIPTION MIME description."
       cperl-auto-newline-after-colon nil
       cperl-continued-statement-offset 4
       cperl-brace-offset -4
+      cperl-continued-brace-offset 0
       cperl-label-offset -4
       cperl-highlight-variables-indiscriminately t
       cperl-electric-lbrace-space nil
-      )
-(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
+      cperl-indent-parens-as-block t
+      cperl-tab-always-indent t)
+;(add-hook 'cperl-mode-hook (lambda () (cperl-set-style "PerlStyle")))
 
 
 
@@ -331,30 +334,47 @@ Argument DESCRIPTION MIME description."
 ;; ) 
 
 (require 'font-latex)
-(add-to-list 'font-latex-match-reference-keywords "fref")
-(add-to-list 'font-latex-match-reference-keywords "Fref")
-(add-to-list 'font-latex-match-reference-keywords "citep")
-(add-to-list 'font-latex-match-reference-keywords "citet")
-(font-latex-match-reference-make)
-(add-to-list 'font-latex-match-function-keywords "DLA")
-(add-to-list 'font-latex-match-function-keywords "RZ")
-(add-to-list 'font-latex-match-function-keywords "OM")
-(add-to-list 'font-latex-match-function-keywords "DL")
-(add-to-list 'font-latex-match-function-keywords "fixme")
-(add-to-list 'font-latex-match-function-keywords "acs")
-(add-to-list 'font-latex-match-function-keywords "acsp")
-(add-to-list 'font-latex-match-function-keywords "ac")
-(add-to-list 'font-latex-match-function-keywords "acp")
-(add-to-list 'font-latex-match-function-keywords "acl")
-(add-to-list 'font-latex-match-function-keywords "aclp")
-(add-to-list 'font-latex-match-function-keywords "acsu")
-(add-to-list 'font-latex-match-function-keywords "aclu")
-(add-to-list 'font-latex-match-function-keywords "acused")
-(font-latex-match-function-make)
+(setq font-latex-match-reference-keywords
+      '(
+        ("fref" "{")
+        ("Fref" "{")
+        ("citep" "{")
+        ("citet" "{")
+        ("acs" "{")
+        ("acsp" "{")
+        ("ac" "{")
+        ("acp" "{")
+        ("acl" "{")
+        ("aclp" "{")
+        ("acsu" "{")
+        ("aclu" "{")
+        ("acused" "{")
+;         ))
+; (setq font-latex-match-warning-keywords
+;       '(
+        ("DLA" "{")
+        ("RZ" "{")
+        ("OM" "{")
+        ("DL" "{")
+        ("fixme" "{")))
+      
 (setq-default TeX-parse-self t)
 (setq-default TeX-auto-save t)
 (setq-default TeX-master nil)
 
+;; this doesn't seem to work; not currently sure why
+; (setq font-latex-user-keyword-classes
+;       '(("my-warning-commands"
+;          (("DLA" "{")
+;           ("RZ" "{")
+;           ("OM" "{")
+;           ("DL" "{")
+;           ("fixme" "{")
+;           )
+;          (:foreground "red" :weight bold :underline (:color foreground-color :style line)))
+;         ))
+
+
 (defun insert-date ()
   "Insert date at point."
   (interactive)
@@ -431,10 +451,10 @@ Argument DESCRIPTION MIME description."
 (desktop-read)
 '(iswitchb-mode on)
 (custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
  '(menu ((((type x-toolkit)) (:background "black" :foreground "grey90")))))
 
 (defun ess-change-directory (path)
@@ -516,10 +536,12 @@ Argument DESCRIPTION MIME description."
          (reftex-set-cite-format
           '((?b . "[[bib::%l][%l-bib]]")
             (?n . "[[note::%l][%l-notes]]")
-            (?h . "** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l-paper]]")))
+            (?c . "\\cite{%l}")
+            (?h . "*** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l paper]]")))
          ))
   (define-key org-mode-map (kbd "C-c )") 'reftex-citation)
   (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)
+  (define-key org-mode-map (kbd "C-c 0") 'reftex-view-crossref)
   )
 (add-hook 'org-mode-hook 'my-org-mode-setup)
 
@@ -528,6 +550,31 @@ Argument DESCRIPTION MIME description."
   (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: ")
+  (shell-command
+   (format "%s %s"
+       (substitute-in-file-name "$HOME/bin/bibtex_to_paper") bibtexkey)))
+
+;; stolen from
+;; http://www-public.it-sudparis.eu/~berger_o/weblog/2012/03/23/how-to-manage-and-export-bibliographic-notesrefs-in-org-mode/
+(defun my-rtcite-export-handler (path desc format)
+  (message "my-rtcite-export-handler is called : path = %s, desc = %s, format = %s" path desc format)
+  (let* ((search (when (string-match "::#?\\(.+\\)\\'" path)
+                   (match-string 1 path)))
+         (path (substring path 0 (match-beginning 0))))
+    (cond ((eq format 'latex)
+           (if (or (not desc) 
+                   (equal 0 (search "rtcite:" desc)))
+               (format "\\cite{%s}" search)
+             (format "\\cite[%s]{%s}" desc search))))))
+
+(org-add-link-type "rtcite" 
+                   'org-bibtex-open
+                   'my-rtcite-export-handler)
+
+
 (setq-default org-mobile-directory "/rzlab.ucr.edu:/sites/dav.donarmstrong.com/root/org/")
 (setq-default org-directory "/home/don/org-mode/")
 (setq-default org-mobile-inbox-for-pull "/home/don/org-mode/from-mobile.org")
@@ -612,6 +659,97 @@ want to use in the modeline *in lieu of* the original.")
     (setq flymake-mode-line mode-line)
     (force-mode-line-update)))
 
+; fix up tmux xterm keys
+; stolen from http://unix.stackexchange.com/questions/24414/shift-arrow-not-working-in-emacs-within-tmux
+(if (getenv "TMUX")
+    (progn
+      (let ((x 2) (tkey ""))
+        (while (<= x 8)
+          ;; shift
+          (if (= x 2)
+              (setq tkey "S-"))
+          ;; alt
+          (if (= x 3)
+              (setq tkey "M-"))
+          ;; alt + shift
+          (if (= x 4)
+              (setq tkey "M-S-"))
+          ;; ctrl
+          (if (= x 5)
+              (setq tkey "C-"))
+          ;; ctrl + shift
+          (if (= x 6)
+              (setq tkey "C-S-"))
+          ;; ctrl + alt
+          (if (= x 7)
+              (setq tkey "C-M-"))
+          ;; ctrl + alt + shift
+          (if (= x 8)
+              (setq tkey "C-M-S-"))
+          
+          ;; arrows
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d A" x)) (kbd (format "%s<up>" tkey)))
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d B" x)) (kbd (format "%s<down>" tkey)))
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d C" x)) (kbd (format "%s<right>" tkey)))
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d D" x)) (kbd (format "%s<left>" tkey)))
+          ;; home
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d H" x)) (kbd (format "%s<home>" tkey)))
+          ;; end
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d F" x)) (kbd (format "%s<end>" tkey)))
+          ;; page up
+          (define-key key-translation-map (kbd (format "M-[ 5 ; %d ~" x)) (kbd (format "%s<prior>" tkey)))
+          ;; page down
+          (define-key key-translation-map (kbd (format "M-[ 6 ; %d ~" x)) (kbd (format "%s<next>" tkey)))
+          ;; insert
+          (define-key key-translation-map (kbd (format "M-[ 2 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
+          ;; delete
+          (define-key key-translation-map (kbd (format "M-[ 3 ; %d ~" x)) (kbd (format "%s<delete>" tkey)))
+          ;; f1
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d P" x)) (kbd (format "%s<f1>" tkey)))
+          ;; f2
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d Q" x)) (kbd (format "%s<f2>" tkey)))
+          ;; f3
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d R" x)) (kbd (format "%s<f3>" tkey)))
+          ;; f4
+          (define-key key-translation-map (kbd (format "M-[ 1 ; %d S" x)) (kbd (format "%s<f4>" tkey)))
+          ;; f5
+          (define-key key-translation-map (kbd (format "M-[ 15 ; %d ~" x)) (kbd (format "%s<f5>" tkey)))
+          ;; f6
+          (define-key key-translation-map (kbd (format "M-[ 17 ; %d ~" x)) (kbd (format "%s<f6>" tkey)))
+          ;; f7
+          (define-key key-translation-map (kbd (format "M-[ 18 ; %d ~" x)) (kbd (format "%s<f7>" tkey)))
+          ;; f8
+          (define-key key-translation-map (kbd (format "M-[ 19 ; %d ~" x)) (kbd (format "%s<f8>" tkey)))
+          ;; f9
+          (define-key key-translation-map (kbd (format "M-[ 20 ; %d ~" x)) (kbd (format "%s<f9>" tkey)))
+          ;; f10
+          (define-key key-translation-map (kbd (format "M-[ 21 ; %d ~" x)) (kbd (format "%s<f10>" tkey)))
+          ;; f11
+          (define-key key-translation-map (kbd (format "M-[ 23 ; %d ~" x)) (kbd (format "%s<f11>" tkey)))
+          ;; f12
+          (define-key key-translation-map (kbd (format "M-[ 24 ; %d ~" x)) (kbd (format "%s<f12>" tkey)))
+          ;; f13
+          (define-key key-translation-map (kbd (format "M-[ 25 ; %d ~" x)) (kbd (format "%s<f13>" tkey)))
+          ;; f14
+          (define-key key-translation-map (kbd (format "M-[ 26 ; %d ~" x)) (kbd (format "%s<f14>" tkey)))
+          ;; f15
+          (define-key key-translation-map (kbd (format "M-[ 28 ; %d ~" x)) (kbd (format "%s<f15>" tkey)))
+          ;; f16
+          (define-key key-translation-map (kbd (format "M-[ 29 ; %d ~" x)) (kbd (format "%s<f16>" tkey)))
+          ;; f17
+          (define-key key-translation-map (kbd (format "M-[ 31 ; %d ~" x)) (kbd (format "%s<f17>" tkey)))
+          ;; f18
+          (define-key key-translation-map (kbd (format "M-[ 32 ; %d ~" x)) (kbd (format "%s<f18>" tkey)))
+          ;; f19
+          (define-key key-translation-map (kbd (format "M-[ 33 ; %d ~" x)) (kbd (format "%s<f19>" tkey)))
+          ;; f20
+          (define-key key-translation-map (kbd (format "M-[ 34 ; %d ~" x)) (kbd (format "%s<f20>" tkey)))
+
+          (setq x (+ x 1))
+          ))
+      )
+  )
+
 ; apparently things like to step on C-;, so we'll use a hack from
 ; http://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs/5340797#5340797 to fix this