Skip to content

Instantly share code, notes, and snippets.

@constrict0r
Last active November 13, 2018 17:59
Show Gist options
  • Save constrict0r/a55c65f76ad17152c0ecae4a5542345d to your computer and use it in GitHub Desktop.
Save constrict0r/a55c65f76ad17152c0ecae4a5542345d to your computer and use it in GitHub Desktop.
My emacs configuration.
;; Set keybinding for agenda, capture and store link.
(global-set-key "\C-ca" 'org-agenda)
(setq org-default-notes-file (expand-file-name "~/Documentos/org/notas.org"))
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cl" 'org-store-link)
;; Set notes taking to work with GTD.
(custom-set-variables
'(elpy-rpc-python-command "python3")
'(elpy-test-runner (quote elpy-test-pytest-runner))
'(inhibit-startup-screen t)
'(org-agenda-files nil)
'(org-capture-templates
(quote
(("a" "action" checkitem
(file "~/Documentos/GTD/próximas-acciones.org")
"")
("b" "notebook" entry
(file "~/Documentos/org/piscunov/new.org")
"* #+TITLE: #
#+OPTIONS: toc:nil
#+OPTIONS: num:nil
* Given the function (x) = x^2 + 6x - 4. Check f(1) = 3.
#+BEGIN_SRC latex
\\begin{align}
f(x) &= x^2 + 6x - 4 \\\\
f(1) &= (1)^2 + 6(1) - 4 \\\\
f(1) &= 1 + 6 - 4 \\\\
f(1) &= 3
\\end{align}
#+END_SRC
#+BEGIN_SRC python header-args :results output :exports both
from math import pow
from sympy import pprint
pprint(pow(4,2) + 1)
#+END_SRC
#+RESULTS:
: 17.0")
("i" "incubation" entry
(file "~/Documentos/GTD/algún-día-tal-vez.org")
"* TODO")
("n" "note" entry
(file "~/Documentos/org/notas.org")
"*
%t %a")
("p" "project" entry
(file "~/Documentos/GTD/lista-proyectos.org")
"* TODO"))))
'(org-preview-latex-image-directory "./ltximg")
'(safe-local-variable-values (quote ((encoding . utf-8) (org-confirm-babel-evaluate)))))
(custom-set-faces)
;; Fix duckduckgo javascript redirect.
(defun duckduckgo (search-string)
"Search Duck Duck Go for SEARCH-STRING.
Use kd=-1 to turn off redirecting - seems to be required in order
for result links to work in DDG."
(interactive "sDuckDuckGo for: ")
(let ((url-format "https://duckduckgo.com/html/?q=%s&kd=-1"))
(eww (format url-format (url-hexify-string search-string)))))
;; Enable babel languages.
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(latex . t)
(python . t)))
;; Do not ask when evaluating code (insecure).
(setq org-confirm-babel-evaluate nil)
;; Open by default next actions list.
;;(find-file "~/Documentos/GTD/próximas-acciones.org")
;; Add melpa repositories.
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/")
t)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
;; Set custom theme.
(add-to-list 'custom-theme-load-path "wintermute.el")
(load-theme 'wintermute t)
;; Set visual bell.
(setq visible-bell t)
;; Set cursor color to white.
(set-cursor-color "#ffffff")
;; Set latex equations images bigger.
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5))
;; Set directory for backup files.
(setq backup-directory-alist '(("." . "~/.emacs-saves")))
;; Set minted to pretty print latex pdf source code.
(require 'ox-latex)
(setq org-latex-listings 'minted
org-latex-packages-alist '(("" "minted"))
org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
;; Set pretty bullets.
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
;; Set python version to use.
(setq py-python-command "python3")
;; Elpy for python development.
(package-initialize)
(elpy-enable)
(setenv "WORKON_HOME" "/home/constrict0r/.virtualenvs")
(add-hook 'comint-exec-hook
(lambda () (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) nil)))
;; Export to reestructured text.
(require 'ox-rst)
;; Enable line numbers.
(global-linum-mode 1)
;; Tox.
(setq tox-runner 'py.test)
;; Default enviroment for running tox (same as tox.ini).
(defvar tox-default-env "py35"
"Default argument for Tox")
;; Feeds.
(global-set-key (kbd "C-x w") 'elfeed)
(setq elfeed-feeds
'("https://feeds.feedburner.com/fayerwayer"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment