Skip to content

Latest commit

 

History

History
334 lines (326 loc) · 13.9 KB

config.org

File metadata and controls

334 lines (326 loc) · 13.9 KB

Kris Victorsen’s Emacs configuration

Table of Contents

Bootstrap

Get emacs off the ground!

Load-path

(message "[kris] Setting load path")
(add-to-list 'load-path "~/.emacs.d/elisp/")
(add-to-list 'load-path (concat user-emacs-directory "literate/tron-doom/"))

Special files: gtd/agenda, media etc.

(setq kris/orgzly-dir "~/org/")
(setq kris/home-dir "~/")
;; GTD files
(setq kris/inbox-file (concat kris/orgzly-dir "inbox.org"))
(setq kris/todo-file (concat kris/orgzly-dir "todo.org"))
(setq kris/projects-file (concat kris/orgzly-dir "projects.org"))
(setq kris/inactive-projects-file (concat kris/orgzly-dir "inactive-projects.org"))
(setq kris/tickler-file (concat kris/orgzly-dir "tickler.org"))
(setq kris/someday-maybe-file (concat kris/orgzly-dir "someday-maybe.org"))

(setq kris/annoy-file (concat kris/orgzly-dir "annoy.org"))

(bind-key "H-a" '(lambda () (interactive) (find-file kris/annoy-file)))
(bind-key "H-t" '(lambda () (interactive) (find-file kris/todo-file)))
(bind-key "H-p" '(lambda () (interactive) (find-file kris/projects-file)))
(bind-key "H-P" '(lambda () (interactive) (find-file kris/inactive-projects-file)))
(bind-key "H-T" '(lambda () (interactive) (find-file kris/tickler-file)))
(bind-key "H-i" '(lambda () (interactive) (find-file kris/inbox-file)))
(bind-key "H-?" '(lambda () (interactive) (find-file kris/someday-maybe-file)))

Profiling? Uncomment this

;; (require 'package)
;; (package-initialize)

use-package: package management management

use-package github

  ;;(message "[kris] use-package setup")
;;; probably actually rm this
  ;;(unless (package-installed-p 'use-package)
    ;; Update the package if it needs updating.
    ;; NOTE: This contacts melpa every time you reload your config. Overhead!
    ;; (package-refresh-contents)
  ;;  (package-install 'use-package))
  ;;(require 'use-package)


;; All packages in a use-package macro should be automagically installed
  ;; (setq use-package-always-ensure t)

Tangling helpers / Literate programming support

  • NOTE: you must have each tangle block on a new line in order for it to be tangled correctly!!!!
  • NOTE: It is important that use-package has been loaded before this block is executed
  • This is because my external files have “use-package” statements, which won’t work if use-package hasn’t been loaded yet!
(message "[kris] Defining helper macros for tangling")
(setq-default kris/org-config-directory "literate")
(setq-default kris/org-config-dirpath
              (expand-file-name (concat user-emacs-directory
                                        kris/org-config-directory)))
(add-to-list 'load-path kris/org-config-dirpath)
(setq-default kris/config-org-files nil)

;; transforms the given name to "kris/name-config-file" and sets it
;; to the given org filename
(defmacro kris/new-config-file (name filename)
  (let ((full-file (make-symbol "full-filename")))
    `(let ((,full-file
            (concat (file-name-as-directory kris/org-config-dirpath)  ,filename ".org")))
       (defvar ,(intern (concat "kris/" (symbol-name name) "-config-file"))
         ,full-file)
       (add-to-list
        (quote kris/config-org-files) (quote (,name . ,filename)) t))))

Tangle external files

  • NOTE: It is important that use-package has been loaded before this block is executed
  • This is because my external files have “use-package” statements, which won’t work if use-package hasn’t been loaded yet!

OS-specific config

Sourcing macOS.org, windows.org

(message "[kris] OS-specific config")
(kris/new-config-file macOS "macOS")
(kris/new-config-file windows "windows")
(cond ((eq system-type 'darwin)
       (org-babel-load-file kris/macOS-config-file))
      ((member system-type '(ms-dos windows-nt cygwin))
       (org-babel-load-file kris/windows-config-file)))

Better defaults

Sourcing better-defaults.org

(kris/new-config-file better-defaults "better-defaults")
(org-babel-load-file kris/better-defaults-config-file)

Global settings

Sourcing global-settings.org

(kris/new-config-file global-settings "global-settings")
(org-babel-load-file kris/global-settings-config-file)

Minor packages

(kris/new-config-file minor-packages "minor-packages")
(org-babel-load-file kris/minor-packages-config-file)

Modeline

Sourcing kris-modeline.org

(kris/new-config-file modeline "modeline")
(org-babel-load-file kris/modeline-config-file)

Magit

Sourcing kris-magit.org

(kris/new-config-file kris-magit "kris-magit")
(org-babel-load-file kris/kris-magit-config-file)

Ivy

Sourcing kris-ivy.org

(kris/new-config-file kris-ivy "kris-ivy")
(org-babel-load-file kris/kris-ivy-config-file)

Company

Sourcing kris-company.org

(kris/new-config-file kris-company "kris-company")
(org-babel-load-file kris/kris-company-config-file)

Org-mode

Sourcing kris-org-mode.org

(kris/new-config-file kris-org-mode "kris-org-mode")
(org-babel-load-file kris/kris-org-mode-config-file)

Programming support

Sourcing programming-support.org

(kris/new-config-file programming-support "programming-support")
(org-babel-load-file kris/programming-support-config-file)

LaTeX

;;(kris/new-config-file kris-latex "kris-latex")
;;(org-babel-load-file kris/kris-latex-config-file)

Tron doom theme

;; Load my theme
(add-to-list 'custom-theme-load-path (concat user-emacs-directory "literate/tron-doom/"))
(load-theme 'tron-doom t) ; t for "don't ask me to load this theme"

;; Global settings (defaults)
(setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
      doom-themes-enable-italic t) ; if nil, italics is universally disabled

;; Enable flashing mode-line on errors
;; (doom-themes-visual-bell-config)

Getting help

This section is not part of my config file per say, but contains instructions for getting help with various parts of emacs

How-to’s

How to edit source code in org-mode file

  • New code block:
    • New source block (lang unspecified): <s [TAB]
    • New elisp block: <el [TAB]
  • Edit code block: C-c’

Embed an image in an org document

,#+BEGIN_EXAMPLE ,#+CAPTION: This is the caption for the next figure link (or table)

,#+NAME: figure ./my_image.png

Select all: C-x h

Moving a file into the ‘literate’ directory:

Suppose you made a file called new-thing

;; Macro to define a new external tangling file:
(kris/new-config-file new-thing "new-thing")
;; Actually load the external file:
'(org-babel-load-file kris/my-new-config-file)

Troubleshooting your config file

If you don’t know why your emacs is breaking, but suspect a tangling issue, then CHECK CONFIG.EL

Helpful resources

Within emacs

  • M-x describe-[key, face, mode, etc.]
    • C-h [k, o, f, m]: Quick keybindings for the describe-.* functions
  • Custom help written by me: *Cheatsheet

Online

Further plans

NEXT Migrate to org super agenda

See https://www.reddit.com/r/orgmode/comments/94q55z/combine_superagenda_with_undated_items/e3ptlkm

Replace hideshow mode with origami

See https://github.com/gregsexton/origami.el

Add submodules for repos that are not on MELPA

Gtd goals

https://github.com/jethrokuan/.emacs.d/blob/master/config.org#org-mode-for-gtd

Improvements to org mode

meta: check out melpa packages for “org-$PACKAGENAME”

org gcal

https://github.com/myuhe/org-gcal.el

org dotemacs

Summary: Store your emacs config as an org file, and choose which bits to load. Requires: org-7.9.3, cl-lib-1.0 Homepage: https://github.com/vapniks/org-dotemacs

better priorities

Summary: Display org priorities as custom strings Homepage: https://github.com/harrybournis/org-fancy-priorities

org context

package option: org-context

https://github.com/thisirs/org-context

package option: org-category-capture

https://github.com/IvanMalison/org-projectile This package provides an interface that can be used to capture TODOs with a category that is selected depending on a some piece of Emacs context.

org doing

org-doing Summary: Keep track of what you’re doing Homepage: https://github.com/omouse/org-doing

org redmine

Summary: Redmine tools using Emacs OrgMode Homepage: https://github.com/gongo/org-redmine

Kinesis-specific keyboard issues

  • My hands were hurting after long typing sessions. As a computer science student, I forsaw this as being a potentially-huge problem later on in life. So I decided to get a Kinesis Advantage 2 while I was still young, springy, and stupid enough to consider adapting my muscle memory to a new keyboard style. (…but fuck Dvorak. I ain’t crazy enough for Dvorak.) 2 weeks later, my new Kinesis arrived. I plugged her into my Mac, and with a perverse glee, I started up Emacs to see what was broken. Here, I shall document those things.
  • First, I live in the U.S. This keyboard therefore shipped with a P.C. layout. I followed the instructions for “Mac Mode”, as per the quickstart guide. It should be noted that before switching, my layout was modified from the stock OS X layout as follows:
  • Global modifications:

Integrated compiler / version control / logging facility

  • I’ve noticed that when coding in a compiled language such as C/C++, I often end up in this workflow:
    • Type some stuff
    • Save
    • Try compiling
    • If compiler errors
      • Make note of what’s wrong
      • Try to solve the problem
      • Try compiling again
  • It would be nice to be able to record the flow of [compiler error / troubleshooting idea / fix] for the purposes of version control
  • I want a package that will let me have a debugging diary which will archive my code, compiler output, and any thoughts that i’d like to record.
  • Ideally, the package would output an org doc with an undo-tree -like interface for retracing my steps in debugging

Set up steam integration with emacs

spotify controls in emacs

install & configure hackernews mode

Emacs/W3

;; (setq load-path (cons "/usr/share/emacs/site-lisp" load-path))
;; (condition-case () (require 'w3-auto "w3-auto") (error nil))

multiple-cursors

;; (use-package multiple-cursors
;;  :bind (("C-S-c C-S-c" . mc/edit-lines)))

Add more to yasnippet

Install the alert package

  • provides Growl-like notifications
  • would be useful for org-calendar

Install winner, windmove

See https://github.com/angrybacon/dotemacs/blob/master/dotemacs.org