(require 'package) ;; Added by Package.el. This must come before configurations of ;; installed packages. Don't delete this line. If you don't want it, ;; just comment it out by adding a semicolon to the start of the line. ;; You may delete these explanatory comments. (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) (not (gnutls-available-p)))) (proto (if no-ssl "http" "https"))) (when no-ssl (warn "\ Your version of Emacs does not support SSL connections, which is unsafe because it allows man-in-the-middle attacks. There are two things you can do about this warning: 1. Install an Emacs version that does support SSL and be safe. 2. Remove this warning from your init file so you won't see it again.")) ;; 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 (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) (package-initialize) (setq custom-file "~/.emacs.d/bundle/custom.el") (load custom-file :noerror) (when (eq system-type 'gnu/linux) (load-theme 'nord)) (unless (eq system-type 'gnu/linux) (load-theme 'berrys)) ;; Load my custom bundles (add-to-list 'load-path (expand-file-name "~/.emacs.d/bundle")) (require 'os) (require 'fill-column-indicator) (require 'calendar-settings) (require 'org-mode-settings) (require 'sbcl-settings) (require 'display) (require 'hooks) ;; start a server, unless one is already running (when (require 'server nil t) (unless (server-running-p) (server-start))) ;; UTF-8 FTW (prefer-coding-system 'utf-8) (set-default-coding-systems 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (setq default-buffer-file-coding-system 'utf-8) (defalias 'yes-or-no-p 'y-or-n-p) (with-current-buffer "*scratch*" (emacs-lock-mode 'kill)) (defun copy-whole-buffer () "Copy entire buffer to clipboard" (interactive) (clipboard-kill-ring-save (point-min) (point-max))) (put 'narrow-to-region 'disabled nil) (put 'narrow-to-page 'disabled nil) (put 'upcase-region 'disabled nil) (defun duplicate-line() (interactive) (move-beginning-of-line 1) (kill-line) (yank) (open-line 1) (next-line 1) (yank) ) (add-to-list 'auto-mode-alist '("\\.yml\\'" . yaml-mode)) (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.rst?\\'" . sphinx-mode)) (add-to-list 'auto-mode-alist '("\\.py\\'" . elpy-mode)) ;; slime (setq slime-contribs '(slime-fancy)) ;; ==================== GLOBAL KEYS ==================== ;; (global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ca" 'org-agenda) (global-set-key "\C-cc" 'org-capture) (global-set-key "\C-cb" 'org-switchb) (global-set-key "\C-xg" 'magit-status) (global-set-key "\C-xM-g" 'magit-dispatch) (global-unset-key "\C-z") (defun git-blame-line () "Runs `git blame` on the current line and adds the commit id to the kill ring" (interactive) (let* ((line-number (save-excursion (goto-char (point-at-bol)) (+ 1 (count-lines 1 (point))))) (line-arg (format "%d,%d" line-number line-number)) (commit-buf (generate-new-buffer "*git-blame-line-commit*"))) (call-process "git" nil commit-buf nil "blame" (buffer-file-name) "-L" line-arg) (let* ((commit-id (with-current-buffer commit-buf (buffer-substring 1 9))) (log-buf (generate-new-buffer "*git-blame-line-log*"))) (kill-new commit-id) (call-process "git" nil log-buf nil "log" "-1" "--pretty=%h %an %s" commit-id) (with-current-buffer log-buf (message "Line %d: %s" line-number (buffer-string))) (kill-buffer log-buf)) (kill-buffer commit-buf))) (defun org-dblock-write:rangereport (params) "Display day-by-day time reports." (let* ((ts (plist-get params :tstart)) (te (plist-get params :tend)) (start (time-to-seconds (apply 'encode-time (org-parse-time-string ts)))) (end (time-to-seconds (apply 'encode-time (org-parse-time-string te)))) day-numbers) (setq params (plist-put params :tstart nil)) (setq params (plist-put params :end nil)) (while (<= start end) (save-excursion (insert "\n\n" (format-time-string (car org-time-stamp-formats) (seconds-to-time start)) "----------------\n") (org-dblock-write:clocktable (plist-put (plist-put params :tstart (format-time-string (car org-time-stamp-formats) (seconds-to-time start))) :tend (format-time-string (car org-time-stamp-formats) (seconds-to-time end)))) (setq start (+ 86400 start)))))) ;; Local Variables: ;; mode: emacs-lisp ;; coding: utf-8-unix ;; End: