Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.emacs-scripts
.emacs
.emacs-2is.el
.emacs-linux.el
.emacs-minimal
README.org
config.org
minimal-config.org

README.org

My Emacs Configuration

So I just learned about the org babel stuff, and I think I might save my emacs configuration in an org file like this, and then have emacs just load it with org-babel… It deff makes it easier to navigate around the file…

Repos & Core Packages

Melpa

Melpa is the big package repo that nearly everything can be found. It’s a must for emacs configs.

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)

Setup use-package if isn’t already

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))

Core Setup

Basic Stuff

Better Defaults

(use-package better-defaults
  :ensure t)

Splash Screen

Remove splash screen and use scratch instead as the home buffer

(setq inhibit-startup-message t
      inhibit-startup-echo-area-message t)

Backup Directory

Funnel all the auto backup files to one location.

(setq backup-directory-alist '(("." . "~/nextcloud/emacs/backups")))

Line Numbers

Switch line numbers on by default in all buffers

(global-linum-mode 1)

Menu Bar

Switch the Menubar off by default (I like to keep everything clean)

(menu-bar-mode -1)

… but still let me easily toggle it on/off

;; Toggle menubar keybind
(global-set-key (kbd "C-c m") 'menu-bar-mode)

Scroll Bar

Remove Scroll Bars

(scroll-bar-mode -1)

Tool Bar

Remove Tool Bars

(tool-bar-mode -1)

New Line indent

New lines auto indents

(define-key global-map (kbd "RET")
  'newline-and-indent)

Tool Tips

Tool Tips in echo area

(tooltip-mode -1)
(setq tooltip-use-echo-area t)

Smooth Scrolling

Smooth Scrolling

(use-package smooth-scroll
    :ensure t)

Themes

Load manual install theme dir

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")

Install Themes from Repos

List of themes to install

(use-package monokai-alt-theme
  :ensure t
  :defer t)
(use-package gruvbox-theme
  :ensure t
  :defer t)
(use-package darkokai-theme
  :ensure t
  :defer t)
(use-package darktooth-theme
  :ensure t
  :defer t)
(use-package creamsody-theme
  :ensure t
  :defer t)
(use-package github-theme
  :ensure t
  :defer t)
(use-package melancholy-theme
  :ensure t
  :defer t)
(use-package darkburn-theme
  :ensure t
  :defer t)
(use-package kaolin-themes
  :ensure t
  :defer t)
(use-package dracula-theme
  :ensure t
  :defer t)
(use-package darkokai-theme
  :ensure t
  :defer t)

Load Current default theme

(load-theme 'darkokai t)

Fonts

Set default font

(set-default-font "Hack-10")

Dashboard

Use the “dashboard” package for my startup screen.

(use-package dashboard
  :ensure t
  :config
  (dashboard-setup-startup-hook)

  ;; Edits
  (setq dashboard-banner-logo-title "Welcome to Emacs, Ryan!")
  (setq dashboard-startup-banner 'logo)
  (setq dashboard-items '((recents   . 5)
                          (bookmarks . 5)
                          (agenda    . 5))))

Window Management

Switch-Window

(use-package switch-window
  :ensure t)

Key Binding

;; Previous Window shortcut
(global-set-key (kbd "C-x p")
                (lambda() (interactive) (other-window -1)))
(global-set-key (kbd "C-x O")
                (lambda() (interactive) (switch-window)))
(global-set-key (kbd "C-x o")
                (lambda() (interactive) (other-window 1)))
(global-set-key (kbd "C-x \)")
                (lambda() (interactive) (other-frame 1)))
(global-set-key (kbd "C-x 0")
                (lambda() (interactive) (delete-window)))

(global-set-key (kbd "C-c z") 'zoom-window)

Evil Mode

Here is my Evile Mode setup. I’ve nested other use-pacages inside of it, so that if I am using evil, the packages that depend on it go ahead and configure themselves.

;; Evil Mode
(use-package evil
  :ensure t
  :config

  (evil-mode 1)
  (use-package evil-leader
    :ensure t
    :config
    (global-evil-leader-mode t)
    (evil-leader/set-leader "<SPC>")
    (evil-leader/set-key
      "s s" 'swiper
      "d x w" 'delete-trailing-whitespace)) 

  (use-package evil-surround
    :ensure t
    :config (global-evil-surround-mode))

  (use-package evil-indent-textobject
    :ensure t)

  (use-package evil-org
    :ensure t
    :config
    (evil-org-set-key-theme '(textobjects insert navigation additional shift todo heading))
    (add-hook 'org-mode-hook (lambda () (evil-org-mode))))

  (use-package powerline-evil
    :ensure t
    :config
    (powerline-evil-vim-color-theme)
    )
  )

Ivy

Setup and use Ivy

(use-package ivy
  :ensure t
  :config
  (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (setq enable-recursive-minibuffers t)
  ;; Ivy Keybindings
  (global-set-key (kbd "C-c C-r") 'ivy-resume))

Configure Swiper

(use-package swiper
  :ensure t
  :config
  (global-set-key "\C-s" 'swiper)
  )

Counsel configuration

(use-package counsel 
  :ensure t
  :config 
  (global-set-key (kbd "M-x") 'counsel-M-x)
  (global-set-key (kbd "C-x C-f") 'counsel-find-file))

Key Bindings

These will eventually be relocations to just be included with their respective use-package calls…

;; Eshell launch keybind
(global-set-key (kbd "C-c t") 'eshell)

;; Comment/Uncomment region
(global-set-key (kbd "C-c ;") 'comment-region)

;; Comment/Uncomment region
(global-set-key (kbd "C-c s") 'org-edit-src-code)

Writting

Org Mode

Yes. It get’s it’s own section. Again, I’ve nested everything. I might break that up though now if I the babel stuff to generate my configs…

 (use-package org
   :ensure t
   :config
   ;; Make sure org file code highlights correctly
   (setq org-src-fontify-natively t)
   (setq org-todo-keywords '((sequence "TODO" "In Progress" "|" "Waiting" "DONE" "Completed")
			      (sequence "Queue" "Working On" "On Hold" "|" "Finished" "Removed")))

   (evil-leader/set-key-for-mode 'org-mode
     "m i" 'org-clock-in
     "m C" 'org-toggle-checkbox
     "m o" 'org-clock-out
     "m c" 'org-clock-jump-to-current-clock
     "m d" 'org-clock-display
     "m e" 'org-set-effort
     "m p" 'org-pomodoro
     "m t" 'org-set-tags-command
     "m m" 'org-clock-modify-effort-estimate
     "m s" 'org-schedule)

   ;; ;; Org Agenda stuff
   (setq org-agenda-files '("~/nextcloud/emacs/org/archive/work.org"))

   (defun org-code (start end)
     "Wraps selected text with org code tags"
     (interactive "r")
     (let ((selected-text (buffer-substring (mark) (point)))
	    (db-name (read-from-minibuffer "Language[common-lisp]: ")))
	(when (eq db-name "")
	  (setf db-name "common-lisp"))
	(kill-region start end)
	(insert (format "#+BEGIN_SRC %s \n%s \n#+END_SRC" db-name selected-text))))

   (use-package org-pomodoro
     :ensure t
     :config
     ;; Persistent Clocking
     (setq org-clock-persist 'history)
     (org-clock-persistence-insinuate)

     ;; Default Table Params
     (setq org-clock-clocktable-default-properties '(:maxlevel 3 :scope subtree :tags "-Lunch"))


     ;; Org Pomodoro ;;
     ;; Setup pomodoro timer keybind
     (global-set-key (kbd "C-S-c C-S-p") 'org-pomodoro)
     (global-set-key (kbd "C-S-c C-S-e") 'org-pomodoro-extend-last-clock)

     (defun org-pomodoro-get-times ()
	(interactive)
	(message "work length: %s  short break: %s  long break: %s"
		 org-pomodoro-length
		 org-pomodoro-short-break-length
		 org-pomodoro-long-break-length))

     (defun org-pomodoro-set-pomodoro ()
	(interactive)
	(setf org-pomodoro-length 35)
	(setf org-pomodoro-short-break-length 9)
	(setf org-pomodoro-long-break-length 15))


     (org-pomodoro-set-pomodoro)

     (defun org-pomodoro-set-52-17 ()
	(interactive)
	(setf org-pomodoro-length 52)
	(setf org-pomodoro-short-break-length 17)
	(setf org-pomodoro-long-break-length 17)))
   )

Htmlize to export my org files to web pages:

(use-package htmlize
  :ensure t)

Add org-clock times into a :LOGBOOK: drawer.

(setq org-clock-into-drawer t)

Org Agenda open in current window

(setq org-agenda-window-setup 'current-window)

Markdown

(use-package markdown-mode
  :ensure t)

Spell Check

I use ispell for spell checking. The actual libraries are set depending on the system (in my ./emacs-linux.el and ./emacs-work.el files).

(use-package ispell
  :ensure t
  :bind
  (("C-c w" . 'ispell-word)
   ("C-c r" . 'ispell-region)))

Word Count

(use-package wc-mode
  :ensure t)

Auto word wrap

Automatically wrap my lines:

Removed default on for now… it’s actaully annoying for most things. I’ll eventually figure out which minor modes I want it on by default in and add those hooks here. I also left the setup command commented so I can default it to on again easily in the future if I want.

(use-package aggressive-fill-paragraph
  :ensure t
  :config
  ;;(afp-setup-recommended-hooks)
  )

Darkroom

(use-package darkroom
  :ensure t
  :bind (("C-c d" . darkroom-mode)))

Development

Auto Complete

(use-package auto-complete
  :ensure t
  :config
  (ac-config-default))

Indentation

aggressive-indent automatically indents buffers as I type out my code. I love it.

(use-package aggressive-indent
  :ensure t
  :config
  (global-aggressive-indent-mode t))

Fill Column Indicator

Draws a line for the fill column, or at a different location.

(use-package fill-column-indicator
    :ensure t) 

Parens

smart parens does auto paring for my parenthesis

(use-package smartparens
  :ensure t
  :config
  ;; Remove ' and  from pairing
  (sp-pair "'" nil :actions :rem)
  (sp-pair "`" "'" :actions :rem)
  (smartparens-global-mode 1))

Git

I use magit for easy git management

(use-package magit
  :ensure t
  :bind 
  (("C-c g"     . 'magit-status)
   ("C-c C-p"   . 'magit-push)))

Projects

Starting to learn projectile a little bit…

;; (use-package projectile
;;   :ensure t
;;   :config
;;   (projectile-global-mode)

;;   (use-package counsel-projectile
;;     :ensure t
;;     )
;;   )

Pretty Code

;; (require 'pretty-mode)
;; (pretty-lambda-mode t)

;;(global-pretty-lambda-mode t)

Yaml

Setup YAML mode for editing configs

(use-package yaml-mode
  :ensure t)

Json

Json mode:

(use-package json-mode
  :ensure t)

Python

Starting a python dev setup:

;; This should only run fully if elpy is installed
(unwind-protect
    (use-package elpy
      :ensure t))

Set default interpreter to python 3 instead of 2.

(setf python-shell-interpreter "python3")

Go

Setup my environment for programming in Go.

(use-package go-mode
  :ensure t
  :config
  (add-hook 'before-save-hook 'gofmt-before-save))

My Random Functions

Zoom-Window

Saves the current state of the buffers, and then zooms the current buffer full screen. When called again, goes back to origonal buffer setup.

(setq zoom-temp-window-configuration nil)
(defun zoom-window ()
  (interactive)
  (if zoom-temp-window-configuration
      (progn
        (set-window-configuration zoom-temp-window-configuration)
	(setq zoom-temp-window-configuration nil)
        (message "Window un-zoomed"))
    (progn
      (setq zoom-temp-window-configuration (current-window-configuration))
      (delete-other-windows)
      (message "Window zoomed"))))

eshell-clear-buffer

Clears my eshell more like a normal terminal would

(defun eshell-clear-buffer ()
  "Clear terminal"
  (interactive)
  (let ((inhibit-read-only t))
    (erase-buffer)
    (eshell-send-input)))

I need this hook for the function, and I like to set it to a keybind:

(add-hook 'eshell-mode-hook
	  '(lambda()
	     (local-set-key (kbd "C-l") 'eshell-clear-buffer)))

(global-set-key (kbd "C-c <delete>") 'eshell-clear-buffer)

Org SCRUM

Load my functions for org scrum stuff

(use-package ry-org-scrum
  :ensure t)

Load Other Configs

Work Settings

Linux

Load my Linux-specific configs

(when (string-equal system-type "gnu/linux")
  (load "~/dotfiles/emacs/.emacs-linux.el"))

The Rest

Auto Generated Stuff

Not sure what to do with this crap in my babel org config…

Theme Load

(put 'dired-find-alternate-file 'disabled nil)