Skip to content

Instantly share code, notes, and snippets.

@peteWT
Created December 3, 2018 21:25
Show Gist options
  • Save peteWT/516e3bdc694048e164354019d715f7a6 to your computer and use it in GitHub Desktop.
Save peteWT/516e3bdc694048e164354019d715f7a6 to your computer and use it in GitHub Desktop.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(ac-config-default)
;;(global-auto-complete-mode t)
(setq python-shell-interpreter "python2")
(setq org-latex-caption-above nil)
(setq debug-on-error t)
;; active Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((sql . t)
(sqlite . t)
(python . t)
(latex . t)
(Emacs-lisp . nil)))
;; Dont ask to evaluate sql, python, sqlite in org-mode
(defun my-org-confirm-babel-evaluate (lang body)
(not (member lang '("python" "sqlite" "sql"))))
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
(exec-path-from-shell-copy-env "PYTHONPATH")
(with-eval-after-load 'ox
(require 'ox-pandoc))
(setq org-latex-pdf-process
'("xelatex -interaction nonstopmode -output-directory %o %f"
"bibtex %b"
"xelatex -interaction nonstopmode -output-directory %o %f"
"xelatex -interaction nonstopmode -output-directory %o %f"))
(add-to-list 'org-latex-packages-alist '("" "tabularx"))
(require 'org-ref)
;;SourceBlocks -- to be modified
(defun org-insert-source-block (name language switches header)
"Asks name, language, switches, header.
Inserts org-mode source code snippet"
(interactive "sname?
slanguage?
sswitches?
sheader? ")
(insert
(if (string= name "")
""
(concat "#+NAME: " name) )
(format "
#+BEGIN_SRC %s %s %s
#+END_SRC" language switches header
)
)
(forward-line -1)
(goto-char (line-end-position))
)
;;(load-theme 'nova)
(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-safe-themes
(quote
("2beaaef4f47f22c89948fdb3859799f8f2b64c1282ec21d71d6df49d68e68862" 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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment