This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun load-recursively (dir-to-load &optional exclude-list) | |
"Load all .el files in DIR-TO-LOAD and its subdirectories (and their subdirectories, ...). | |
Exclude files (or directories) that are in EXCLUDE-LIST." | |
(let ((excluded-file-names (append exclude-list '("." "..")))) | |
(dolist (file (directory-files dir-to-load 'absolute-file-names)) | |
(unless (member (file-relative-name file dir-to-load) excluded-file-names) | |
(cond | |
((file-directory-p file) (load-recursively file exclude-list)) | |
((string= (file-name-extension file) "el") (load file))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mapc (lambda (keymap) (define-key keymap [escape] 'keyboard-escape-quit)) | |
(list minibuffer-local-map | |
minibuffer-local-ns-map | |
minibuffer-local-completion-map | |
minibuffer-local-must-match-map | |
minibuffer-local-isearch-map)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Modeline with left, center and right aligned parts (using powerline). | |
(package-ensure-installed 'powerline) | |
(setq-default mode-line-format | |
'((:eval | |
(let* | |
;;; Modeline sections. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; The macro: | |
(defmacro add-hook-one-time (hook function) | |
"Add FUNCTION to HOOK. Remove it after its first execution." | |
(let ((wrapper-function (make-symbol "wrapper-function-symbol"))) | |
`(progn | |
(defun ,wrapper-function () | |
"Wrapper function that will be executed only once, and then removed from the hook." | |
(funcall ,function) | |
(remove-hook ,hook ,wrapper-function)) | |
(add-hook ,hook ,wrapper-function)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Utilities for file modification time. | |
(require 'cl) | |
(defun file-modtime (file) | |
"Get the last modification time of FILE. | |
If FILE cannot be read, return nil." | |
(let ((attributes (file-attributes file))) | |
(if attributes | |
(cl-sixth attributes) | |
nil))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; ido-sort-mtime.el --- Sort Ido's file list by modification time | |
;; Copyright (C) 2013 Paweł Kraśnicki | |
;; Author: Paweł Kraśnicki | |
;; Created: 24 Apr 2013 | |
;; Version: 0.1 | |
;; Keywords: convenience, files | |
;; This program is free software; you can redistribute it and/or modify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Terminal (with XClip): Use CLIPBOARD for explicit cuts. Don't use PRIMARY. | |
(when (and (not window-system) | |
(getenv "DISPLAY") | |
(executable-find "xclip")) | |
;; On explicit yank, copy to CLIPBOARD. | |
(defun xclip-copy-to-clipboard (text) | |
"Copy TEXT to X's clipboard, using the `xclip` utility." | |
(let* ((process-connection-type nil) | |
(proc (start-process "xclip" nil "xclip" "-selection" "clipboard"))) | |
(process-send-string proc text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Change certain minor mode names. | |
(defvar mode-line-cleaner-minor-mode-alist | |
;; Some greek characters: ς ε ρ τ υ θ ι ο π α σ δ φ γ η ξ κ λ ζ χ ψ ω β ν μ | |
`((writegood-mode " WriteGood") | |
(auto-complete-mode " α") | |
(yas-minor-mode " γ") | |
(paredit-mode " Φ") | |
(volatile-highlights-mode " υ") | |
(undo-tree-mode "")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Remap basic motions to [htns] (for a Dvorak keyboard). | |
;;; Also remap some related keys. | |
(require 'conf/evil) | |
;; Left, down, up, right: [htns] (previously: [hjkl]). | |
(define-key evil-motion-state-map "h" 'evil-backward-char) | |
(define-key evil-motion-state-map "t" 'evil-next-line) | |
(define-key evil-motion-state-map "n" 'evil-previous-line) | |
(define-key evil-motion-state-map "s" 'evil-forward-char) (define-key evil-normal-state-map "s" nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Bindings. | |
(define-key sp-keymap (kbd "C-M-f") 'sp-forward-sexp) | |
(define-key sp-keymap (kbd "C-M-b") 'sp-backward-sexp) | |
(define-key sp-keymap (kbd "C-M-d") 'sp-down-sexp) | |
(define-key sp-keymap (kbd "C-M-a") 'sp-backward-down-sexp) | |
(define-key sp-keymap (kbd "C-S-a") 'sp-beginning-of-sexp) | |
(define-key sp-keymap (kbd "C-S-d") 'sp-end-of-sexp) |
OlderNewer