Skip to content

Latest commit

 

History

History
1054 lines (778 loc) · 27.7 KB

config.org

File metadata and controls

1054 lines (778 loc) · 27.7 KB

BHMM’s GNU Emacs Config

My init.el file had grown to over 700 lines in two weeks. I was time to clean it up and bring some order to it.

This approach was inspired by Derek Taylor. The use of the org file for the configuration has several advantages. First, the sections can be folded while editing this file in orgmode. When all of the sections are folded, the entire 633 line documents is visbile in one screen. Second, the org file is rendered nicely by GitHub.

On startup, emacs strips out the emacs-lisp code and writes it to a config.el file. This process is called tangling. The config.el file is the file that emacs uses. The config.el file will be written to your emacs directory, (aka ~/.emacs.d). You still need some settings in your init.el file including one that calls config.org I used a function to do so that I obtainded from Karl Voit. This function is suppose to load the code chunks more rapidly. I added the DISABLED tag to some code chunk not load the code to save time. Emacs still takes 10-12 seconds to load.

setup of PATHS

(use-package exec-path-from-shell
  :init 
  (setenv "SHELL" "/usr/local/bin/zsh")
  :ensure t
  :if (memq window-system '(mac ns x))
  :config
  (setq exec-path-from-shell-variables '("PATH" "GOPATH"))
  (exec-path-from-shell-initialize))

Auto completion with the company package

Completion words longer than 4 characters using ispell

(use-package company
  :init
  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 2)
  :ensure t
  :config
  (global-company-mode t))

auto-complete

(eval-after-load "auto-complete"
  '(progn
      (ac-ispell-setup)))
(add-hook 'git-commit-mode-hook 'ac-ispell-ac-setup)
(add-hook 'mail-mode-hook 'ac-ispell-ac-setup)

ESS: Emacs Speaks Statistics

Elisp file for R coding with Emacs

Support for

  • BUGS
  • JSAGS
  • SAS
  • STATA
  • R
  • Julia
(use-package ess
  :ensure t
  :commands R
  :commands Julia
)
(setq inferior-ess-r-program "/opt/local/bin/R") 
(setq inferior-julia-program-name "/usr/local/bin/julia") ;; Juy 27, 2020 linked to /Applications/Julia-1.4.app

evil-mode

Evil-mode enable vim keybindings.

(use-package evil
  :ensure t
  :config
  (evil-mode 1))

General settings

Do not open second instance of Emacs

This was happening when using “open -a Emacs filename”.

(setq ns-pop-up-frames nil)

Expand-region

Enter C-= to expand selection.

(use-package expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)

If you expand too far, you can contract the region by pressing - (minus key), or by prefixing the shortcut you defined with a negative argument: C– C-=.

Hyper and Super key bindings

See this site for more information.

(setq ns-function-modifier 'hyper)  ; make fn key do Hyper

Line numbers setting

Display line numbers.

;;(setq display-line-numbers-type t)
(when (version<= "26.0.50" emacs-version)
  (global-display-line-numbers-mode))

Line wrapping

Enables the wrapping of strikethrough accross more than one line.

(use-package wrap-region
    :ensure t
    :config
    (wrap-region-global-mode t)
    (wrap-region-add-wrapper "~" "~" nil '(load "~/.emacs.d/lisp/ob-julia/ob-julia.el"))  ; code
    (wrap-region-add-wrapper "*" "*" nil 'org-mode)  ; bold
    (wrap-region-add-wrapper "/" "/" nil 'org-mode)  ; italic
    (wrap-region-add-wrapper "+" "+" nil 'org-mode)  ; strikethrough
    (wrap-region-add-wrapper "=" "=" nil 'org-mode)) ; verbatim

Powerline

The powerline is a menu bar above the minibuffer. It is adapted from Vim. There are several variants of the powerline avaiable for emacs. The default version of powerline shows the pmodoro clock, but blocks the wordcounter. I needed to test other themes. I found that the center theme shows the wordcounter in the center.

(use-package powerline
    :ensure t
    :config
    (powerline-center-theme)
    (setq powerline-arrow-shape 'arrow)   ;; the default
    (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.
    '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil))))
    '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil)))))
)
;; Settings for powerline

Trailing whitespaces

Do not end sentences with more than one whitespace.

(setq sentence-end-double-space nil)

Helm for promopting for yasnippets

I lifted this helm seupt from https://raw.githubusercontent.com/sachac/.emacs.d/gh-pages/Sacha.org.

(use-package helm
  :diminish helm-mode
  :init
  (progn
    (require 'helm-config)
    (setq helm-candidate-number-limit 100)
    ;; From https://gist.github.com/antifuchs/9238468
    (setq helm-idle-delay 0.0 ; update fast sources immediately (doesn't).
          helm-input-idle-delay 0.01  ; this actually updates things
                                        ; reeeelatively quickly.
          helm-yas-display-key-on-candidate t
          helm-quick-update t
          helm-M-x-requires-pattern nil
          helm-ff-skip-boring-files t)
    (helm-mode))
  :bind (("C-c h" . helm-mini)
         ("C-h a" . helm-apropos)
         ("C-x C-b" . helm-buffers-list)
         ("C-x b" . helm-buffers-list)
         ("M-y" . helm-show-kill-ring)
         ("M-x" . helm-M-x)
         ("C-x c o" . helm-occur)
         ("C-x c s" . helm-swoop)
         ("C-x c y" . helm-yas-complete)
         ("C-x c Y" . helm-yas-create-snippet-on-region)
         ("C-x c b" . my/helm-do-grep-book-notes)
         ("C-x c SPC" . helm-all-mark-rings)))
(ido-mode -1) ;; Turn off ido mode in case I enabled it accidentally

The yasnippet library’s use can be aided by helm. The code below require the using C-c y in place of tab to trigger the tab trigger in org files.

;;(use-package helm-config
;;    :ensure t
;;    :config
;;    (global-set-key (kbd "M-x") #'helm-M-x)
;;    (global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
;;    (global-set-key (kbd "C-x C-f") #'helm-find-files)
;;
;;    (defun shk-yas/helm-prompt (prompt choices &optional display-fn)
;;    ;; "Use helm to select a snippet. Put this into `yas-prompt-functions.'"
;;    (interactive)
;;    (if (require 'helm-config nil t)
;;      (let ((result (helm-other-buffer
;;                     (list `((name . ,prompt)
;;                             (candidates . ,(if display-fn (mapcar display-fn choices)
;;                                              choices))
;;                             (action . (("Expand" . identity)))))
;;                     "*helm-select-yasnippet")))
;;        (cond ((null results)
;;               (signal 'quit "user quit!"))
;;              (display-fn
;;               (catch 'result
;;                 (dolist (choice choices)
;;                   (when (equal (funcall display-fn choice) result)
;;                     (throw 'result choice)))))
;;              (t result)))
;;    nil)) )
(add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet")
(use-package yasnippet
    :config
    (yas-global-mode 1))

(use-package helm-c-yasnippet
    :config
    (setq helm-yas-space-match-any-greedy t)
    (global-set-key (kbd "C-c y") 'helm-yas-complete)
    (yas-load-directory "~/.emacs.d//snippets/yasnippet"))

Julia

(use-package julia-repl)
(add-hook 'julia-mode-hook 'julia-repl-mode) ;; always use minor mode

Latex via Autex

Turn on preview of LaTeX documents.

;;(load "preview-latex.el" nil t t)

Provide the command for compiling of tex files

;;(setq tex-dvi-view-command "(f=*; lualatex -shell-escape \"${f%.dvi}.tex\" && open \"${f%.dvi}.pdf\")")

Markdown

Open markdown with marked2

(setq markdown-open-command "/usr/local/bin/mark")

Markdown to pdf with pandoc

(setq markdown-split-window-direction 'right)

Parentheses

(use-package highlight-parentheses
  :ensure t
  :config
  (progn
    (highlight-parentheses-mode)
    (global-highlight-parentheses-mode))
  )

pdb-mode related

Charles Bond’s pdb.el has edited by Magnus as emacs-pdb-mode.el.

:ensure t
:config
(load-file "~/.emacs.d/plugins/emacs-pdb-mode/pdb-mode.el")
(setq pdb-rasmol-name "/Applications/PyMOL.app/Contents/bin/pymol")
(setq auto-mode-alist
   (cons (cons "pdb$" 'pdb-mode) 
         auto-mode-alist ) )
(autoload 'pdb-mode "PDB")

Python related

First, specify the python interpreter to be used. The package is “python” but the mode is “python-mode”.

(use-package python
  :mode ("\\.py" . python-mode)
  :interpreter ("python" . python-mode))
  :ensure t
  :config
  (setq python-python-command "/opt/local/bin/python")
  (flymake-mode) ;; <- This line makes the trick of disabling flymake in python mode!
  (use-package elpy
    :ensure t
    :init
    (add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
    :config
    (remove-hook 'elpy-modules 'elpy-module-flymake) ;; <- This removes flymake from elpy
    (setq python-indent-guess-indent-offset t);; 
    (setq python-indent-guess-indent-offset-verbose nil) ;; turn off warning about indent
    (setq elpy-rpc-backend "jedi")
    (elpy-enable)	
    :bind (:map elpy-mode-map
              ("M-." . elpy-goto-definition)
              ("M-," . pop-tag-mark))
)

python-pytest

It is more convenient to run pytest within emacs rather than outside of emacs on the command-line.

(use-package python-pytest
  :ensure t)

The Emacs IPython Notebook or EIN

EIN has been able to talk to Ipython or Jupyter since 2012. It is the oldest and most venerable interace between emacs and IPython. [[See]{[https://millejoh.github.io/emacs-ipython-notebook/]]

(use-package ein
  :ensure t)

noweb pweave

Pweave enables literate programming with Python.

;;Pnw-mode for Pweave reST documents
(defun Pnw-mode ()
       (require 'noweb-font-lock-mode)
       (noweb-mode)
       (setq noweb-default-code-mode 'python-mode)
       (setq noweb-doc-mode 'rst-mode))

(setq auto-mode-alist (append (list (cons "\\.prstw$" 'rstw-mode))
                   auto-mode-alist))

;Plw-mode for Pweave Latex documents
(defun Plw-mode ()
       (require 'noweb-font-lock-mode)
       (noweb-mode)
       (setq noweb-default-code-mode 'python-mode)
       (setq noweb-doc-mode 'latex-mode))

(setq auto-mode-alist (append (list (cons "\\.ptexw$" 'texw-mode))
                   auto-mode-alist))

poly-markdown

(use-package poly-markdown
  :ensure t)
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))

poly-markdown

Enable use of R-markdown.

(use-package poly-R
  :ensure t)

pymol-mode

My pymol-mode

;; load the package named pymol.
;; (load "pymol-mode") ;; best not to include the ending ".el" or ".elc"
;;
;; ;; (autoload 'pymol-mode "pymol" "The pymol-mode for the PyMOL macro language, *.pml." t)
;;
;; ;; setup files ending in ".pml" to open in pymol-mode
;; (add-to-list 'auto-mode-alist '("\\.pml\\'" . pymol-mode))
;;
;; (require 'pymol-mode)

spell checking

On the Mac, macports can be used to install the unix program aspell.

sudo port install aspell sudo port install aspell-dict-en

The setting below maps ispell to aspell. This program is used by flycheck and other spell checking software.

(setq ispell-program-name "/opt/local/bin/aspell")

Turn on flyspell for text files and for comments in programming modes

(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
;;(add-hook 'find-file-hooks 'turn-on-flyspell) ;; Turn on for all files.

syntex checking

(use-package flycheck
  :ensure t
  :init
  (global-flycheck-mode t)
  :config
  (add-hook 'after-init-hook #'global-flycheck-mode))

Turn on the syntax linter for elisp flymake.

(remove-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
'(ess-use-flymake nil)

stan-mode

See ESS above for interaction with R, Stata, JAGS, BUGS, and Julia.

;;; stan-mode.el
(use-package stan-mode
  ;; Uncomment if directly loading from your development repo
  ;; :load-path "your-path/stan-mode/stan-mode"
  :mode ("\\.stan\\'" . stan-mode)
  :hook (stan-mode . stan-mode-setup)
  ;;
  :config
  ;; The officially recommended offset is 2.
  (setq stan-indentation-offset 2))

;;; company-stan.el
(use-package company-stan
  ;; Uncomment if directly loading from your development repo
  ;; :load-path "your-path/stan-mode/company-stan/"
  :hook (stan-mode . company-stan-setup)
  ;;
  :config
  ;; Whether to use fuzzy matching in `company-stan'
  (setq company-stan-fuzzy nil))

;;; eldoc-stan.el
(use-package eldoc-stan
  ;; Uncomment if directly loading from your development repo
  ;; :load-path "your-path/stan-mode/eldoc-stan/"
  :hook (stan-mode . eldoc-stan-setup)
  ;;
  :config
  ;; No configuration options as of now.
  )

;;; flycheck-stan.el
(use-package flycheck-stan
  ;; Add a hook to setup `flycheck-stan' upon `stan-mode' entry
  :hook ((stan-mode . flycheck-stan-stanc2-setup)
         (stan-mode . flycheck-stan-stanc3-setup))
  :config
  ;; A string containing the name or the path of the stanc2 executable
  ;; If nil, defaults to `stanc2'
  (setq flycheck-stanc-executable nil)
  ;; A string containing the name or the path of the stanc2 executable
  ;; If nil, defaults to `stanc3'
  (setq flycheck-stanc3-executable nil))

;;; stan-snippets.el
(use-package stan-snippets
  ;; Uncomment if directly loading from your development repo
  ;; :load-path "your-path/stan-mode/stan-snippets/"
  :hook (stan-mode . stan-snippets-initialize)
  ;;
  :config
  ;; No configuration options as of now.
  )

treemacs

Like nerdtree in vim These are the default settings. See https://github.com/Alexander-Miller/treemacs for more information.

(use-package treemacs
  :ensure t
  :defer t
  :init
  (with-eval-after-load 'winum
    (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  :config
  (progn
    (setq treemacs-collapse-dirs                 (if treemacs-python-executable 3 0)
          treemacs-deferred-git-apply-delay      0.5
          treemacs-directory-name-transformer    #'identity
          treemacs-display-in-side-window        t
          treemacs-eldoc-display                 t
          treemacs-file-event-delay              5000
          treemacs-file-extension-regex          treemacs-last-period-regex-value
          treemacs-file-follow-delay             0.2
          treemacs-file-name-transformer         #'identity
          treemacs-follow-after-init             t
          treemacs-git-command-pipe              ""
          treemacs-goto-tag-strategy             'refetch-index
          treemacs-indentation                   2
          treemacs-indentation-string            " "
          treemacs-is-never-other-window         nil
          treemacs-max-git-entries               5000
          treemacs-missing-project-action        'ask
          treemacs-move-forward-on-expand        nil
          treemacs-no-png-images                 nil
          treemacs-no-delete-other-windows       t
          treemacs-project-follow-cleanup        nil
          treemacs-persist-file                  (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
          treemacs-position                      'left
          treemacs-recenter-distance             0.1
          treemacs-recenter-after-file-follow    nil
          treemacs-recenter-after-tag-follow     nil
          treemacs-recenter-after-project-jump   'always
          treemacs-recenter-after-project-expand 'on-distance
          treemacs-show-cursor                   nil
          treemacs-show-hidden-files             t
          treemacs-silent-filewatch              nil
          treemacs-silent-refresh                nil
          treemacs-sorting                       'alphabetic-asc
          treemacs-space-between-root-nodes      t
          treemacs-tag-follow-cleanup            t
          treemacs-tag-follow-delay              1.5
          treemacs-user-mode-line-format         nil
          treemacs-user-header-line-format       nil
          treemacs-width                         35)
    ;; The default width and height of the icons is 22 pixels. If you are
    ;; using a Hi-DPI display, uncomment this to double the icon size.
    ;;(treemacs-resize-icons 44)
    (treemacs-follow-mode t)
    (treemacs-filewatch-mode t)
    (treemacs-fringe-indicator-mode t)
    (pcase (cons (not (null (executable-find "git")))
                 (not (null treemacs-python-executable)))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple))))
  :bind
  (:map global-map
        ("M-0"       . treemacs-select-window)
        ("C-x t 1"   . treemacs-delete-other-windows)
        ("C-x t t"   . treemacs)
        ("C-x t B"   . treemacs-bookmark)
        ("C-x t C-t" . treemacs-find-file)
        ("C-x t M-t" . treemacs-find-tag))
)

(use-package treemacs-evil
  :after treemacs evil
  :ensure t)

(use-package treemacs-projectile
  :after treemacs projectile
  :ensure t)

(use-package treemacs-icons-dired
  :after treemacs dired
  :ensure t
  :config (treemacs-icons-dired-mode))

(use-package treemacs-magit
  :after treemacs magit
  :ensure t)

(use-package treemacs-persp ;;treemacs-persective if you use perspective.el vs. persp-mode
  :after treemacs persp-mode ;;or perspective vs. persp-mode
  :ensure t
  :config (treemacs-set-scope-type 'Perspectives))

;; ** Weather ;; ;; You have to follow the instructions from July 15, 2020 on the ;;issues section of the github site ;; to avoid the display of html code rather than the desired result. ;; The first element in the list of cites below has its weather reported after ;; enteting M-x wttrin and hitting return at the prompt “City name:”. ;; ;; This gives the same output as can be had with the go program wego. ;; This latter program can be run everytime you open a iterm2 shell by configuring the shell to run ~/go/bin/wego. ;; The emacs solution is faster because the opening zsh sheill spends 9 seconds loading. ;; ;; #+BEGIN_SRC emacs-lisp ;; (use-package wttrin) ;; :ensure t ;; :config ;; (setq wttrin-default-cities ‘(“Edmond, United States” “NYC” “Palo Alto, United States”))) ;; #+END_SRC ;; ;; ;; This is an alternative weather package. ;; It depends on forecast.io which was bought out by Apple.

webbrowser

Open urls in the eww web browser.

(setq browse-url-browser-function 'eww-browse-url)
(setq inhibit-startup-screen t)
(eww-open-file "~/Documents/WebpagesBlaine/index3.html")

word count

Set up word count (current sesssion + start/ total) Add the path to the rep.

(use-package wc-mode
    :init
    (add-to-list 'load-path "/Users/blaine/software/wc-mode/")
    :config
    (global-set-key "\C-cw" 'wc-mode)
    (add-hook 'org-mode-hook 'wc-mode)
)

Yasnippet

This is the snippet manager. It has a mice table view and a function for automating the writing of new snippets.

(use-package yasnippet
    :init 
    (add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet")
    :config
    (yas-global-mode 1))

org-mode

The amazing outlining and report preparation tool. I read somewhere that the org-mode setting should be at the file of this file.

(use-package org)
(use-package org-ref)
;;(use-package ox-latex)

ob-julia notebook

Github stie

;; removes ugly horizontal lines in html-exported code 
;; (not mandatory)
(setq org-html-keep-old-src t)

;; As ob-julia.el and ox-bibtex are less common, 
;; we use a local repository.
;;
;; Usage: emacs -q --load emacs_files/init.el
;;
;; In a more usual setting one should use:
;; (require 'ob-julia.el)
;; (require 'ox-bibtex)
(load-file "~/.emacs.d/lisp/ob-julia/ob-julia.el") ; works with ess-site, our notebook engine
;;(load-file "~/.emacs.d/lisp/ox-bibtex.el"); used for bibliography HTML-export 

;; allows julia src block (requires ob-julia.el)
(setq org-confirm-babel-evaluate nil)

(org-babel-do-load-languages
 'org-babel-load-languages
 '((julia . t)))

;; defines image width in the OrgMode buffer (this is not for html
;; exports, for this you must use #+HTML_ATTR: :width 900px for
;; instance)
;;
;; This is not mandatory, but useful when one uses the gr() Plots.jl
;; backend as it exports wide .png files. CAVEAT: use imagemagick for
;; image resizing.
;;
(setq org-image-actual-width (/ (display-pixel-width) 4))

;; uses the minted package instead of the listings one
(setq org-latex-listings 'minted)

;; defines how to generate the pdf file using lualatex + biber
(setq org-latex-pdf-process
      '("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "biber %b"
        "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

;; *** julia via emacs-jupyter ;; ;; #+BEGIN_SRC emacs-lisp ;; ;; ;; (use-package jupyter ;; :ensure t ;; :config ;; (require ‘jupyter-julia)) ;; ;; (setq org-src-fontify-natively t ;; org-src-tab-acts-natively t ;; org-confirm-babel-evaluate nil ;; org-edit-src-content-indentation 0) ;; ;; (org-babel-do-load-languages ;; ‘org-babel-load-languages ;; ‘((emacs-lisp . t) ;; (jupyter . t))) ;; ;; (add-to-list ‘org-structure-template-alist ;; ‘(“j” “#+BEGIN_SRC jupyter-julia :session jl ;; ? ;; #+END_SRC”)) ;; ;; (setq org-babel-default-header-args:jupyter-julia ‘((:async . “yes”) ;; (:exports . “both”) ;; (:results . “scalar”))) ;; ;; (use-package julia-snail ;; :hook (julia-mode . julia-snail-mode) ;; :config ;; (setq split-height-threshold 15)) ;; ;; ;; ;; (use-package flycheck-julia ;; :ensure t ;; :config ;; (flycheck-julia-setup) ;; (add-to-list ‘flycheck-global-modes ‘julia-mode) ;; (add-to-list ‘flycheck-global-modes ‘ess-julia-mode)) ;; ;; ;; ;;(setq org-confirm-babel-evaluate nil) ;; ;;(add-hook ‘org-babel-after-execute-hook ‘org-display-inline-images) ;; ;;(add-hook ‘org-mode-hook ‘org-display-inline-images) ;; ;;(add-to-list ‘load-path “/path/to/org-mode/contrib/lisp”) ;; ;;(org-babel-do-load-languages ;; ;; ‘org-babel-load-languages ;; ;; ‘((emacs-lisp . t) (julia . t))) ;; #+END_SRC

org-eww-mode

(add-hook 'org-mode-hook 'org-eww-mode)

set ORG MODE directory

(setq org-directory "~/org/")

Cycling the TODO states.

This defines the sequence. The sequence can be defined in a document like so #+TODO: TODO IN-PROGRESS WAITING DONE From https://blog.aaronbieber.com/2016/01/30/dig-into-org-mode.html.

Suggested key bindings from the tutorial by David O’Toole

https://orgmode.org/worg/org-tutorials/orgtutorial_dto.html

(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

Settings for org-aggenda files. See agenda with the command C-c a t.

(setq org-agenda-files (list "~/org/worktasks.org"
                             "~/org/seflearning.org" 
                             "~/org/home.org"))

Org-mode related settigs

(setq exec-path (append exec-path '("/opt/local/bin")))
(setq org-confirm-babel-evaluate nil) ;;don't prompt me to confirm everytime I want to evaluate a block

Cycle TODOs

(setq org-todo-keywords
      '((sequence "TODO" "WAITING" "IN-PROGRESS" "UNDER-REVIEW" "VERIFY" "DELEGATED" "|" "DONE" )))

Display/update images in the buffer after I evaluate

(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)

Skip spell checking of source code blocks

(add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))

Activate ipython

(use-package ob-ipython
     :ensure t
)

Integration with org-babel

Integration with org-babel is provided through the ob-jupyter library. To enable Jupyter support for source code blocks, add jupyter to org-babel-load-languages.

(org-babel-do-load-languages
 'org-babel-load-languages
 '( (ipython . t)
   (julia . t)
   (python . t)
   (latex . t)
   (jupyter . t) ) )

Bibtex Library

(setq reftex-default-bibliography '("~/Google Drive/BibtexLibraries/global.bib"))

See org-ref for use of these variables

(setq org-ref-bibliography-notes "~/Google Drive/BibtexLibraries/notes.org"
         org-ref-default-bibliography '("~/Google Drive/BibtexLibraries/global.bib")
         org-ref-pdf-directory "~/orgpdflibrary")

helm-bibtex for autocompletion of citekeys

(setq bibtex-completion-bibliography "~/Google Drive/BibtexLibraries/global.bib"
         bibtex-completion-library-path "~/orgpdflibrary"
         bibtex-completion-notes-path "~/Google Drive/BibtexLibraries")

Open pdf with system pdf viewer (works on mac)

(setq bibtex-completion-pdf-open-function
        (lambda (fpath)
          (start-process "open" "*open*" "open" fpath)))

Settings for org-pomodoro

(use-package org-pomodoro
    :ensure t
    :commands (org-pomodoro)
    :config
    (setq alert-user-configuration (quote ((((:category . "org-pomodoro")) libnotify nil)))))

Use minted instead of verbatim env for code blocks upon export to latex.

(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted) 

To use the python lexer for ipython blocks, add this setting:

(add-to-list 'org-latex-minted-langs '(ipython "python"))

Set options to be applied to all minted code blocks on export to latex

(setq org-latex-minted-options
     '(("frame" "lines") ("linenos=false") ("framerule=2pt") ("breaklines")))
(setq org-latex-pdf-process
      '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
(setq org-src-fontify-natively t)