init, config, and dotfiles

emacs.org 9.0KB

Emacs Configuration File

Emacs

Package Management

load the package manager, package, add several archives for package to pull from

#+BEGIN_SRC emacs-lisp ;(require 'package)

; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/")) ; (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ; (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))

; (setq package-enable-at-startup nil) ; (package-initialize) #+END_SRC

Personal Info

Display

#+BEGIN_SRC emacs-lisp (setq user-full-name "Zachary Faddis" user-mail-address "zach@zfadd.is") #+END_SRC

Theme

#+BEGIN_SRC emacs-lisp (load-theme 'nimbus) #+END_SRC

Line Numbers

#+BEGIN_SRC emacs-lisp (global-linum-mode 1) #+END_SRC

Line Limit

Limit Line Length to 80. Whenever I exceed 80 chars insert a newline at 80 and move the offending word to the next line

#+BEGIN_SRC emacs-lisp (setq-default auto-fill-function 'do-auto-fill) (setq-default fill-column 80) #+END_SRC

Minimal UI

Highlight Current Line

Highlight Matching Parathese

#+BEGIN_SRC emacs-lisp (scroll-bar-mode -1) (tool-bar-mode -1) (tooltip-mode -1) (menu-bar-mode -1) #+END_SRC #+BEGIN_SRC emacs-lisp (global-hl-line-mode) #+END_SRC #+BEGIN_SRC emacs-lisp

Use icons when available

Files

;; Show matching parens (setq show-paren-delay 0) (show-paren-mode 1) #+END_SRC #+BEGIN_SRC emacs-lisp (require 'all-the-icons) #+END_SRC

save backups in ~/.emacs/backups #+BEGIN_SRC emacs-lisp

(setq backup-directory-alist `((".*" . , "~/.emacs.d/backups"))) (setq auto-save-file-name-transforms `((".*" ,"~/.emacs.d/backups" t))) #+END_SRC

Prompts

change yes/no to y/n #+BEGIN_SRC emacs-lisp (fset 'yes-or-no-p 'y-or-n-p) #+END_SRC

Default Browser

#+BEGIN_SRC emacs-lisp

(setq browse-url-browser-function 'browse-url-firefox) #+END_SRC

#+RESULTS:

browse-url-firefox

Org Mode

#+BEGIN_SRC emacs-lisp (require 'org) #+END_SRC

File Hooks

use org mode for any file ending in .org, .txt, or .org_archive #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode)) #+END_SRC

Todo

Change the todo sequence and set shortcuts #+BEGIN_SRC emacs-lisp (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "DATE(d)" "|" "FIN(f)" "CANCEL(c)"))) #+END_SRC

Log the time a todo item is set to a finished state #+BEGIN_SRC emacs-lisp (setq org-log-into-drawer t) #+END_SRC

Time

Stuff the times of a headline into a drawer #+BEGIN_SRC emacs-lisp (setq org-log-done 'time) #+END_SRC

Agenda

#+BEGIN_SRC emacs-lisp (setq org-agenda-start-on-weekday nil)

(setq org-agenda-start-with-clockreport-mode t)

(setq org-agenda-files '("~/life/business.txt" "~/life/maintenance.txt" "~/life/social.txt" "~/life/experience.txt"))

(setq org-agenda-custom-commands '(("z" "Agenda and NEXT items" ((agenda "" ( (org-agenda-span 1))) (todo "NEXT" ) (agenda "" ( (org-agenda-start-day "+1d") (org-agenda-span 10)))))))

(setq org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t% s %b") (timeline . " % s") (todo . " %i %-12:c %b") (tags . " %i %-12:c") (search . " %i %-12:c"))) #+END_SRC

search/agenda context detail

Key Bindings

#+BEGIN_SRC emacs-lisp (setq org-show-context-detail '((agenda . local) (default . lineage))) #+END_SRC

#+BEGIN_SRC emacs-lisp (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ca" 'org-agenda) (global-set-key "\C-cb" 'org-iswitchb) #+END_SRC

Scheduling

Display

#+BEGIN_SRC emacs-lisp #+END_SRC

Make red anything surround by *'s #+BEGIN_SRC emacs-lisp (add-to-list 'org-emphasis-alist '("*" (:foreground "red") )) #+END_SRC

Use Bullets for headings #+BEGIN_SRC emacs-lisp (require 'org-bullets) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) #+END_SRC

Export

export settings #+BEGIN_SRC emacs-lisp (setq org-export-with-smart-quotes t) (setq org-export-wth-emphasize t) (setq org-export-with-author t) (setq org-export-with-broken-links t) (setq org-export-with-date t) (setq org-export-with-email t) (setq org-export-time-stamp-file nil) (setq org-export-with-title t) (setq org-export-wth-toc nil) (setq org-export-with-section-numbers nil) #+END_SRC

HTML

html settings #+BEGIN_SRC emacs-lisp (setq org-html-doctype "html5") (setq org-html-link-home "zfadd.is") #+END_SRC

Templates

#+BEGIN_SRC emacs-lisp (add-to-list 'org-structure-template-alist (list "c" (concat":PROPERTIES:\n" ":EMAIL:?\n" ":PHONE:\n" ":ADDRESS:\n" ":BIRTHDAY:\n" ":WEB:\n" ":END:")))

Source Blocks

    #+END_SRC
  • Use syntax highlighting for source blocks
  • #+BEGIN_SRC emacs-lisp (setq org-src-fontify-natively t) #+END_SRC
  • preserve indention when tangling code
  • #+BEGIN_SRC emacs-lisp (setq org-src-preserve-indentation t) #+END_SRC

Babel

  • hide blocks by default
  • #+BEGIN_SRC emacs-lisp (setq org-hide-block-startup t) #+END_SRC
  • Allow languages
  • #+BEGIN_SRC emacs-lisp (org-babel-do-load-languages 'org-babel-load-languages '((ledger . t) (shell . t) (python . t) (emacs-lisp . t))) #+END_SRC

Evil

#+BEGIN_SRC emacs-lisp (require 'evil) (evil-mode t) #+END_SRC

Disable in cretain modes

Novel

#+BEGIN_SRC emacs-lisp (add-to-list 'evil-emacs-state-modes 'elfeed-search-mode) (add-to-list 'evil-emacs-state-modes 'elfeed-show-mode) (add-to-list 'evil-emacs-state-modes 'magit-status) #+END_SRC

File hooks

Use nov-mode for any file with extension .epub

#+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) #+END_SRC

Web Mode

Package to give syntax highlighting for html, css, and various templating languages used by different frameworks

#+BEGIN_SRC emacs-lisp (require 'web-mode) #+END_SRC

File Hooks

Use web-mode for any file that ends with extension .html #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode)) #+END_SRC

Use the Django syntax highlighting engine for any file ending in html #+BEGIN_SRC emacs-lisp

(setq web-mode-engines-alist '(("django" . "\\.html\\'"))) #+END_SRC

Ledger

File Hooks

Start any file that ends with .ledger in ledger mode #+BEGIN_SRC emacs-lisp (add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode)) #+END_SRC

Display

Automatically align amount to 52nd collumn #+BEGIN_SRC emacs-lisp (setq ledger-post-auto-adjust-amounts t) #+END_SRC

Beeminder

#+BEGIN_SRC emacs-lisp (add-to-list 'load-path "/home/z/.emacs.d/beeminder/") ;(require 'request) ;(require 'anaphora) (require 'cl) (require 'beeminder) (setq beeminder-username "zacharius") (setq beeminder-auth-token "e5j8yjZJQyxVZ6qX228x") #+END_SRC

Declutter


  (add-to-list 'load-path "/home/z/.emacs.d/declutter")
  (require 'declutter)

NeoTree



  ;; NeoTree
  (require 'neotree)
  (setq neo-theme (if (display-graphic-p) 'icons 'arrow))

Magit


  (add-to-list 'load-path "/home/z/.emacs.d/magit/lisp")
  (require 'magit)

  (with-eval-after-load 'info
    (info-initialize)
    (add-to-list 'Info-directory-list
		 "~/.emacs.d/magit/Documentation/"))

keybindings

#+BEGIN_SRC emacs-lisp (global-set-key (kbd "C-x g") 'magit-status) #+END_SRC

Ibuffer

#+BEGIN_SRC emacs-lisp

(global-set-key (kbd "C-x C-b") 'ibuffer) ;; Use Ibuffer for Buffer List (setq ibuffer-saved-filter-groups '(("buffer groups" ("emacs-config" (filename . ".emacs.d")) ("documentation" (filename . "knxw")) ("organization" (or (filename . "life") (name . "\*Org Agenda\*"))) ("writings" (filename . "lit")) ("projects" (filename . "prj")) ("games" (filename . "games")))))

(add-hook 'ibuffer-mode-hook '(lambda () (ibuffer-switch-to-saved-filter-groups "buffer groups")))

(setq ibuffer-expert t)

#+END_SRC

Ido

#+BEGIN_SRC emacs-lisp

(setq ido-enable-flex-matching t) (setq ido-everywhere t) (ido-mode 1) #+END_SRC

Python

#+BEGIN_SRC emacs-lisp (elpy-enable) #+END_SRC