1 #+TITLE: emacs.org - Ganneffs emacs configuration
2 #+DESCRIPTION: My current Emacs configuration
3 #+KEYWORDS: org-mode Emacs configuration
4 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
5 #+SETUPFILE: ~/.emacs.d/elisp/org-templates/level-0.org
11 :ID: b6e6cf73-9802-4a7b-bd65-fdb6f9745319
13 The following functions are used throughout my config, and so I load
16 safe-load does not break emacs initialization, should a file be
17 unreadable while emacs boots up.
18 #+BEGIN_SRC emacs-lisp
19 (defvar safe-load-error-list ""
20 "*List of files that reported errors when loaded via safe-load")
22 (defun safe-load (file &optional noerror nomessage nosuffix)
23 "Load a file. If error on load, report back, wait for
24 a key stroke then continue on"
26 (condition-case nil (load file noerror nomessage nosuffix)
29 (setq safe-load-error-list (concat safe-load-error-list " " file))
30 (message "****** [Return to continue] Error loading %s" safe-load-error-list )
34 (defun safe-load-check ()
35 "Check for any previous safe-load loading errors. (safe-load.el)"
37 (if (string-equal safe-load-error-list "") ()
38 (message (concat "****** error loading: " safe-load-error-list))))
41 I have some stuff put away in my local dir. I don't want to load it all
42 at startup time, so it is using the autoload feature. For that to work
43 load the loaddefs, so autoload knows where to grab stuff
44 #+BEGIN_SRC emacs-lisp
45 (safe-load (concat jj-elisp-dir "/tiny/loaddefs.el"))
46 (safe-load (concat jj-elisp-local-dir "/loaddefs.el"))
49 Handier way to add modes to auto-mode-alist
50 #+BEGIN_SRC emacs-lisp
51 (defun add-auto-mode (mode &rest patterns)
52 "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
53 (dolist (pattern patterns)
54 (add-to-list 'auto-mode-alist (cons pattern mode))))
56 *** config helpers use-package/bind-key
57 Helpers for the config
58 https://github.com/jwiegley/use-package
59 #+BEGIN_SRC emacs-lisp
60 (require 'use-package)
64 [2014-05-20 Tue 22:36]
65 #+BEGIN_SRC emacs-lisp
66 (defmacro hook-into-modes (func modes)
67 `(dolist (mode-hook ,modes)
68 (add-hook mode-hook ,func)))
72 The Emacs Lisp Package Archive contains things I want.
73 #+BEGIN_SRC emacs-lisp
74 (when (> emacs-major-version 23)
76 (setq package-user-dir (expand-file-name "elpa" jj-elisp-dir))
77 (dolist (source '(("melpa" . "http://melpa.org/packages/")
78 ("melpa-stable" . "http://stable.melpa.org/packages/")
79 ("marmalade" . "http://marmalade-repo.org/packages/")
80 ("elpy" . "http://jorgenschaefer.github.io/packages/")
81 ("elpa" . "http://elpa.gnu.org/packages/")
83 (add-to-list 'package-archives source t))
90 We need to define the load-path. As I have lots of things I add
91 locally, its getting a few entries. I disliked the repeated
92 /add-to-list/ lines, so I now just take all subdirectories of
93 jj-elisp-dir and add them.
95 #+BEGIN_SRC emacs-lisp
97 (project (directory-files jj-elisp-dir t "\\w+"))
98 (when (file-directory-p project)
99 (if (string= project "emacs23")
100 (when (version< emacs-version "24")
101 (add-to-list 'load-path project))
102 (add-to-list 'load-path project))
103 ;(byte-recompile-directory project 0)
108 Help emacs to find the info files
109 #+BEGIN_SRC emacs-lisp :tangle yes
110 (setq Info-directory-list (cons jj-info-dir
111 '("/usr/local/share/info/"
113 "/usr/local/gnu/info/"
114 "/usr/local/gnu/lib/info/"
115 "/usr/local/gnu/lib/emacs/info/"
116 "/usr/local/emacs/info/"
117 "/usr/local/lib/info/"
118 "/usr/local/lib/emacs/info/"
119 "/usr/share/info/emacs-23"
121 "/usr/share/info/")))
122 (setq Info-default-directory-list
123 (cons jj-info-dir Info-default-directory-list))
129 :ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
131 I dislike the startup message
132 #+BEGIN_SRC emacs-lisp
133 (setq inhibit-splash-screen t)
134 (setq inhibit-startup-message t)
137 Usually I want the lines to break at 72 characters.
138 #+BEGIN_SRC emacs-lisp
139 (setq fill-column 72)
142 And it is nice to have a final newline in files.
143 (Now off, ethan-wspace is doing it better).
144 #+BEGIN_SRC emacs-lisp
145 (setq require-final-newline nil)
146 (setq mode-require-final-newline nil)
149 After I typed 300 characters or took a break for more than a minute it
150 would be nice of emacs to save whatever I am on in one of its auto-save
151 backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
152 #+BEGIN_SRC emacs-lisp
153 (setq auto-save-interval 300)
154 (setq auto-save-timeout 60)
157 Set my full name and my default mail address - for whatever wants to use
158 it later. Also, I am using gnus.
159 #+BEGIN_SRC emacs-lisp
160 (setq user-full-name "Joerg Jaspert")
161 (setq user-mail-address "joerg@ganneff.de")
162 (setq mail-user-agent (quote gnus-user-agent))
165 My default mail server. Well, simply a localhost, I have a forwarder that
166 puts mail off the right way, no need for emacs to have any further
168 #+BEGIN_SRC emacs-lisp
169 (setq smtpmail-default-smtp-server "localhost")
170 (setq smtpmail-smtp-server "localhost")
173 Enable automatic handling of compressed files.
174 #+BEGIN_SRC emacs-lisp
175 (auto-compression-mode 1)
178 Emacs forbids a certain set of commands, as they can be very confusing
179 for new users. Enable them.
180 #+BEGIN_SRC emacs-lisp
181 (put 'narrow-to-region 'disabled nil)
182 (put 'narrow-to-page 'disabled nil)
183 (put 'narrow-to-defun 'disabled nil)
184 (put 'upcase-region 'disabled nil)
185 (put 'downcase-region 'disabled nil)
189 I've tried various different fonts and while I like the Terminus font
190 most for my shells, in Emacs Inconsolata clearly wins.
191 #+BEGIN_SRC emacs-lisp
192 (set-frame-font "Inconsolata-14")
195 I always use dark backgrounds, so tell Emacs about it. No need to
197 #+BEGIN_SRC emacs-lisp
198 (setq-default frame-background-mode jj-color-style)
201 And I always liked dark backgrounds with colors setup for them. So I
202 switched through multiple themes doing it in emacs too, but never
203 entirely liked it. Until I found solarized, which is now not only my
204 emacs theme, but also for most of my other software too, especially my
205 shell. Consistent look is great.
206 #+BEGIN_SRC emacs-lisp :tangle no
207 (if (or (> emacs-major-version 23) (boundp 'custom-theme-load-path))
209 (defun jj-init-theme ()
211 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
212 (load-theme 'solarized-light t))
213 (set-face-attribute 'org-date nil :underline nil)
214 (message "Initializing theme solarized-dark")
216 (add-to-list 'custom-theme-load-path jj-theme-dir)
217 (add-hook 'after-init-hook 'jj-init-theme)
219 (add-to-list 'load-path (expand-file-name "emacs-color-theme-solarized" jj-elisp-dir))
220 (require 'color-theme-solarized)
221 (color-theme-solarized-dark)
224 #+BEGIN_SRC emacs-lisp
225 (use-package solarized
226 :load-path "elisp/solarized-emacs"
229 (defun jj-init-theme ()
231 ;; ;; make the fringe stand out from the background
232 (setq solarized-distinct-fringe-background t)
234 ;; ;; Don't change the font for some headings and titles
235 ;; (setq solarized-use-variable-pitch nil)
237 ;; ;; make the modeline high contrast
238 ;; (setq solarized-high-contrast-mode-line t)
240 ;; ;; Use less bolding
241 ;; (setq solarized-use-less-bold t)
243 ;; ;; Use more italics
244 ;; (setq solarized-use-more-italic t)
246 ;; ;; Use less colors for indicators such as git:gutter, flycheck and similar
247 ;; (setq solarized-emphasize-indicators nil)
249 ;; ;; Don't change size of org-mode headlines (but keep other size-changes)
250 ;; (setq solarized-scale-org-headlines nil)
252 ;; ;; Avoid all font-size changes
253 ;; (setq solarized-height-minus-1 1)
254 ;; (setq solarized-height-plus-1 1)
255 ;; (setq solarized-height-plus-2 1)
256 ;; (setq solarized-height-plus-3 1)
257 ;; (setq solarized-height-plus-4 1)
258 (setq x-underline-at-descent-line t)
260 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
261 (load-theme 'solarized-light t))
262 (set-face-attribute 'org-date nil :underline nil)
263 (message "Initializing theme solarized-dark")
265 (add-to-list 'custom-theme-load-path jj-theme-dir)
266 (add-hook 'after-init-hook 'jj-init-theme)
270 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
271 #+BEGIN_SRC emacs-lisp
272 (if (fboundp 'fringe-mode)
276 A bit more spacing between buffer lines
277 #+BEGIN_SRC emacs-lisp
278 (setq-default line-spacing 0.1)
281 [2013-04-21 So 20:54]
282 I do not want my cursor to blink.
283 #+BEGIN_SRC emacs-lisp
284 (blink-cursor-mode -1)
286 *** Menu, Tool and Scrollbar
287 I don't want to see the menu-bar, tool-bar or scrollbar.
288 #+BEGIN_SRC emacs-lisp
290 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
291 (when (fboundp mode) (funcall mode -1))))
293 **** When using emacs in daemon mode
294 Emacs has a very nice mode where it detaches itself and runs as daemon -
295 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
296 Client]]. It's fast, it's nice, it's convinient.
298 Except that Emacs behaves stupid when you do that and ignores your
299 menu/tool/scrollbar settings. Sucks.
301 For them to work even then, we have to do two things.
302 1. We have to set the frame alist. We simple set both,
303 =initial-frame-alist= and =default-frame-alist= to the same value here.
304 #+BEGIN_SRC emacs-lisp
305 (setq initial-frame-alist '(
306 (horizontal-scroll-bars . nil)
307 (vertical-scroll-bars . nil)
310 (setq default-frame-alist (copy-alist initial-frame-alist))
312 2. We have to disable the toolbar using the customize interface, so you
313 can find that in the [[id:0102208d-fdf6-4928-9e40-7e341bd3aa3a][Customized variables]] section.
315 *** Hilight current line in buffer
316 As it says, it does a hilight of the current line.
317 #+BEGIN_SRC emacs-lisp
318 (global-hl-line-mode +1)
320 *** Allow recursive minibuffers
321 This allows (additional) minibuffer commands while in the minibuffer.
322 #+BEGIN_SRC emacs-lisp
323 (setq enable-recursive-minibuffers 't)
326 *** Modeline related changes
327 I want to see line and column numbers, so turn them on.
328 Size indication lets me know how far I am in a buffer.
330 And modeline-posn is great. It will hilight the column number in the
331 modeline in red as soon as you are over the defined limit.
334 #+BEGIN_SRC emacs-lisp
336 (column-number-mode 1)
337 (size-indication-mode 1)
338 (display-time-mode 1)
339 (setq display-time-day-and-date nil)
340 (setq display-time-default-load-average nil)
341 (setq display-time-24hr-format t)
342 (setq modelinepos-column-limit 72)
344 (use-package modeline-posn
345 :ensure modeline-posn
348 (set-face-foreground 'modelinepos-column-warning "grey20")
349 (set-face-background 'modelinepos-column-warning "red")
350 (setq modelinepos-column-limit 72))
355 [2013-04-22 Mon 11:27]
356 The modeline is easily cluttered up with stuff I don't really need to
357 see. So lets hide those. There are two ways, one of them uses diminish
358 to get entirely rid of some modes, the other is a function taken from
359 "Mastering Emacs" which replaces the modes text with an own (set of)
361 #+BEGIN_SRC emacs-lisp
363 (diminish 'auto-fill-function)
364 (defvar mode-line-cleaner-alist
365 `((auto-complete-mode . " α")
366 (yas-minor-mode . " y")
367 (paredit-mode . " π")
371 (lisp-interaction-mode . "λ")
374 (emacs-lisp-mode . "EL")
376 (org-indent-mode . "")
381 "Alist for `clean-mode-line'.
383 When you add a new element to the alist, keep in mind that you
384 must pass the correct minor/major mode symbol and a string you
385 want to use in the modeline *in lieu of* the original.
387 Want some symbols? Go:
389 ;ςερτζθιοπασδφγηξκλυχψωβνμ
390 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
391 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
395 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
398 Unfortunately icicles breaks this with the way it adds/removes itself,
399 so take it our for now...
402 Back when I started with text-mode. But nowadays I want default mode to
403 be org-mode - it is just so much better to use. And does sensible things
404 with many README files out there, and various other "crap" you get to
406 #+BEGIN_SRC emacs-lisp :tangle yes
407 (setq-default major-mode 'org-mode)
409 #+BEGIN_SRC emacs-lisp :tangle no
410 (setq initial-major-mode 'org-mode)
414 [2013-04-23 Tue 16:43]
415 Shell. zsh in my case.
416 #+BEGIN_SRC emacs-lisp
417 (setq shell-file-name "zsh")
418 (setq shell-command-switch "-c")
419 (setq explicit-shell-file-name shell-file-name)
420 (setenv "SHELL" shell-file-name)
421 (setq explicit-sh-args '("-login" "-i"))
422 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
423 (setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
424 (setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
425 (setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
426 (setq comint-completion-autolist t) ; show completion list when ambiguous
427 (setq comint-input-ignoredups t) ; no duplicates in command history
428 (setq comint-completion-addsuffix t) ; insert space/slash after file completion
429 (setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
430 (setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
434 ** Miscellaneous stuff
435 Searches and matches should ignore case.
436 #+BEGIN_SRC emacs-lisp
437 (setq-default case-fold-search t)
440 Which buffers to get rid off at midnight.
441 #+BEGIN_SRC emacs-lisp
442 (setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
443 "*Man " "*Buffer List*"
449 "*magit" "*Calendar")))
452 Don't display a cursor in non-selected windows.
453 #+BEGIN_SRC emacs-lisp
454 (setq-default cursor-in-non-selected-windows nil)
457 What should be displayed in the mode-line for files with those types
459 #+BEGIN_SRC emacs-lisp
460 (setq eol-mnemonic-dos "(DOS)")
461 (setq eol-mnemonic-mac "(Mac)")
464 Much larger threshold for garbage collection prevents it to run too often.
465 #+BEGIN_SRC emacs-lisp
466 (setq gc-cons-threshold 48000000)
469 #+BEGIN_SRC emacs-lisp
470 (setq max-lisp-eval-depth 1000)
471 (setq max-specpdl-size 3000)
475 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
476 #+BEGIN_SRC emacs-lisp
477 (defun unfill-paragraph ()
478 "Takes a multi-line paragraph and makes it into a single line of text."
480 (let ((fill-column (point-max)))
481 (fill-paragraph nil)))
482 (bind-key "H-u" 'unfill-paragraph)
485 #+BEGIN_SRC emacs-lisp
486 (setq-default indicate-empty-lines t)
487 (setq sentence-end-double-space nil)
490 Hilight annotations in comments, like FIXME/TODO/...
491 #+BEGIN_SRC emacs-lisp
492 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
496 #+BEGIN_SRC emacs-lisp
497 (setq browse-url-browser-function (quote browse-url-generic))
498 (setq browse-url-generic-program "/usr/bin/x-www-browser")
501 *** When saving a script - make it executable
502 #+BEGIN_SRC emacs-lisp
503 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
507 #+BEGIN_SRC emacs-lisp
511 (add-hook 'after-init-hook 'server-start)))
514 ** Customized variables
515 [2013-05-02 Thu 22:14]
516 The following contains a set of variables i may reasonably want to
517 change on other systems - which don't affect the init file loading
518 process. So I *can* use the customization interface for it...
519 #+BEGIN_SRC emacs-lisp
520 (defgroup ganneff nil
521 "Modify ganneffs settings"
524 (defgroup ganneff-org-mode nil
525 "Ganneffs org-mode settings"
526 :tag "Ganneffs org-mode settings"
528 :link '(custom-group-link "ganneff"))
530 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
531 "ID of the organization task."
532 :tag "Organization Task ID"
534 :group 'ganneff-org-mode)
536 (defcustom org-my-archive-expiry-days 2
537 "The number of days after which a completed task should be auto-archived.
538 This can be 0 for immediate, or a floating point value."
539 :tag "Archive expiry days"
541 :group 'ganneff-org-mode)
546 [2013-05-21 Tue 23:22]
547 Restore removed var alias, used by ruby-electric-brace and others
548 #+BEGIN_SRC emacs-lisp
549 (unless (boundp 'last-command-char)
550 (defvaralias 'last-command-char 'last-command-event))
552 * Customized variables
554 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
556 Of course I want to be able to use the customize interface, and some
557 things can only be set via it (or so they say). I usually prefer to put
558 things I keep for a long while into statements somewhere else, not just
559 custom-set here, but we need it anyways.
561 #+BEGIN_SRC emacs-lisp
562 (setq custom-file jj-custom-file)
563 (safe-load custom-file)
566 The source of this is:
567 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
568 * Extra modes and their configuration
570 A defined abbrev is a word which expands, if you insert it, into some
571 different text. Abbrevs are defined by the user to expand in specific
573 #+BEGIN_SRC emacs-lisp
575 :commands abbrev-mode
576 :diminish abbrev-mode
578 (hook-into-modes #'abbrev-mode '(text-mode-hook))
581 (setq save-abbrevs 'silently)
582 (setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
583 (if (file-exists-p abbrev-file-name)
584 (quietly-read-abbrev-file))
586 (add-hook 'expand-load-hook
588 (add-hook 'expand-expand-hook 'indent-according-to-mode)
589 (add-hook 'expand-jump-hook 'indent-according-to-mode)))))
592 [2013-04-28 So 11:26]
593 avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.
594 #+BEGIN_SRC emacs-lisp
597 :commands (avy-goto-char avy-goto-char-2 avy-goto-line avy-goto-word-1 avy-goto-word-0 avy-isearch avy-goto-subword-0 avy-goto-subword-1 avy-copy-line avy-copy-region avy-move-line)
598 :bind (("H-SPC" . avy-goto-char-2)
599 ("M-g g" . avy-goto-line)
603 (setq avy-all-windows 'all-frames)
604 (setq avi-keys '(?a ?s ?d ?e ?f ?h ?j ?k ?l ?n ?m ?v ?r ?u) )
608 (bind-key "C-y" 'avy-isearch isearch-mode-map)
613 [2013-04-21 So 20:27]
614 Use H-w to switch windows
615 #+BEGIN_SRC emacs-lisp
616 (use-package ace-window
619 :bind ("H-w" . ace-window)
622 (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))
626 [2014-10-27 Mon 13:08]
627 electric-indent-mode is enough to keep your code nicely aligned when
628 all you do is type. However, once you start shifting blocks around,
629 transposing lines, or slurping and barfing sexps, indentation is bound
632 aggressive-indent-mode is a minor mode that keeps your code always
633 indented. It reindents after every command, making it more reliable
634 than electric-indent-mode.
635 #+BEGIN_SRC emacs-lisp
636 (use-package aggressive-indent
637 :ensure aggressive-indent
638 :commands (aggressive-indent-mode global-aggressive-indent-mode)
641 (global-aggressive-indent-mode 0)
642 (setq aggressive-indent-comments-too 0)
643 (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
647 [2014-06-01 Sun 23:02]
648 Provides a minor mode which displays current match and total matches
649 information in the mode-line in various search modes.
650 #+BEGIN_SRC emacs-lisp
657 (global-anzu-mode 1))
660 (setq anzu-search-threshold 1000)
661 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
664 [2014-05-21 Wed 00:33]
665 #+BEGIN_SRC emacs-lisp
667 :commands (ascii-on ascii-toggle ascii-display)
668 :bind (("C-c e A" . ascii-toggle))
671 (defun ascii-toggle ()
673 (defvar ascii-display nil)
678 (bind-key "C-c e A" 'ascii-toggle)))
681 #+BEGIN_SRC emacs-lisp
682 (setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
683 (setq TeX-auto-save t)
684 (setq TeX-parse-self t)
685 (setq TeX-PDF-mode t)
687 ** auto-complete mode
688 [2013-04-27 Sa 16:33]
689 And aren't we all lazy? I definitely am, and I like my emacs doing as
690 much possible work for me as it can.
691 So here, auto-complete-mode, which lets emacs do this, based on what I
693 #+BEGIN_SRC emacs-lisp
694 (use-package auto-complete-config
695 :ensure auto-complete
700 ;; hook AC into completion-at-point
701 (defun sanityinc/auto-complete-at-point ()
702 (when (and (not (minibufferp))
703 (fboundp 'auto-complete-mode)
706 (defun set-auto-complete-as-completion-at-point-function ()
707 (add-to-list 'completion-at-point-functions 'sanityinc/auto-complete-at-point))
708 ;; Exclude very large buffers from dabbrev
709 (defun sanityinc/dabbrev-friend-buffer (other-buffer)
710 (< (buffer-size other-buffer) (* 1 1024 1024)))
715 ;; custom keybindings to use tab, enter and up and down arrows
716 (bind-key "\t" 'ac-expand ac-complete-mode-map)
717 (bind-key "\r" 'ac-complete ac-complete-mode-map)
718 (bind-key "M-n" 'ac-next ac-complete-mode-map)
719 (bind-key "M-p" 'ac-previous ac-complete-mode-map)
720 (bind-key "C-s" 'ac-isearch ac-completing-map)
721 (bind-key "M-TAB" 'auto-complete ac-mode-map)
723 (setq ac-comphist-file (expand-file-name "ac-comphist.dat" jj-cache-dir))
724 (setq ac-use-comphist t)
725 (setq ac-expand-on-auto-complete nil)
727 (setq ac-auto-start 3)
729 (setq ac-menu-height 15)
730 (setq ac-quick-help-delay 0.5)
731 (setq ac-use-fuzzy t)
733 (ac-flyspell-workaround)
735 ;; use 't when auto-complete is disabled
736 (setq tab-always-indent 'complete)
737 (add-to-list 'completion-styles 'initials t)
739 ;; Use space and punctuation to accept the current the most likely completion.
740 (setq auto-completion-syntax-alist (quote (global accept . word)))
741 ;; Avoid completion for short trivial words.
742 (setq auto-completion-min-chars (quote (global . 3)))
743 (setq completion-use-dynamic t)
745 (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
747 ;; Exclude very large buffers from dabbrev
748 (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
750 (use-package ac-dabbrev
753 (set-default 'ac-sources
756 ac-source-words-in-buffer
757 ac-source-words-in-same-mode-buffers
758 ; ac-source-words-in-all-buffer
761 (dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
762 sass-mode yaml-mode csv-mode espresso-mode haskell-mode
763 html-mode nxml-mode sh-mode smarty-mode clojure-mode
764 lisp-mode textile-mode markdown-mode tuareg-mode python-mode
765 js3-mode css-mode less-css-mode sql-mode ielm-mode))
766 (add-to-list 'ac-modes mode))
768 (add-hook 'latex-mode-hook 'auto-complete-mode)
769 (add-hook 'LaTeX-mode-hook 'auto-complete-mode)
770 (add-hook 'prog-mode-hook 'auto-complete-mode)
771 (add-hook 'org-mode-hook 'auto-complete-mode)))
776 When files change outside emacs for whatever reason I want emacs to deal
777 with it. Not to have to revert buffers myself
778 #+BEGIN_SRC emacs-lisp
779 (use-package autorevert
780 :commands auto-revert-mode
781 :diminish auto-revert-mode
784 (setq global-auto-revert-mode t)
785 (setq global-auto-revert-non-file-buffers t)
786 (global-auto-revert-mode)))
790 Emacs should keep backup copies of files I edit, but I do not want them
791 to clutter up the filesystem everywhere. So I put them into one defined
792 place, backup-directory, which even contains my username (for systems
793 where =temporary-file-directory= is not inside my home).
794 #+BEGIN_SRC emacs-lisp
795 (use-package backups-mode
796 :load-path "elisp/backups-mode"
797 :bind (("\C-cv" . save-version)
798 ("\C-cb" . list-backups)
799 ("\C-ck" . kill-buffer-prompt)
800 ("\C-cw" . backup-walker-start))
803 (setq backup-directory jj-backup-directory)
804 ;(setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
805 ;(if (not (file-exists-p tramp-backup-directory))
806 ; (make-directory tramp-backup-directory))
807 ;(setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
808 (setq backup-directory-alist `(("." . ,jj-backup-directory)))
809 (setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
810 (setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
812 (setq version-control t) ;; Use version numbers for backups
813 (setq kept-new-versions 10) ;; Number of newest versions to keep
814 (setq kept-old-versions 2) ;; Number of oldest versions to keep
815 (setq delete-old-versions t) ;; Ask to delete excess backup versions?
816 (setq backup-by-copying t)
817 (setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
818 (setq make-backup-files t)
820 (defadvice kill-buffer (around kill-buffer)
821 "Always save before killing a file buffer"
822 (when (and (buffer-modified-p)
824 (file-exists-p (buffer-file-name)))
827 (ad-activate 'kill-buffer)
829 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
830 "Always save before killing emacs"
831 (save-some-buffers t)
833 (ad-activate 'save-buffers-kill-emacs)
835 (defun kill-buffer-prompt ()
836 "Allows one to kill a buffer without saving it.
837 This is necessary since once you start backups-mode all file based buffers
838 are saved automatically when they are killed"
840 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
842 (set-buffer-modified-p nil))
845 (setq backup-enable-predicate
847 (and (normal-backup-enable-predicate name)
849 (let ((method (file-remote-p name 'method)))
850 (when (stringp method)
851 (member method '("su" "sudo"))))))))))
855 [2014-12-11 Thu 11:31]
856 #+BEGIN_SRC emacs-lisp
857 (use-package browse-kill-ring
858 :commands (browse-kill-ring browse-kill-ring-mode)
859 :bind ("M-y" . browse-kill-ring)
863 [2014-06-10 Tue 22:20]
864 #+BEGIN_SRC emacs-lisp
866 :commands (cal/insert)
867 :bind ("C-c c" . cal/insert)
870 ; Weeks start on Monday, not sunday.
871 (setq calendar-week-start-day 1)
873 ; Display ISO week numbers in Calendar Mode
874 (copy-face font-lock-constant-face 'calendar-iso-week-face)
875 (set-face-attribute 'calendar-iso-week-face nil :height 0.7)
876 (setq calendar-intermonth-text
880 (calendar-iso-from-absolute
881 (calendar-absolute-from-gregorian (list month day year)))))
882 'font-lock-face 'calendar-iso-week-face))
883 (copy-face 'default 'calendar-iso-week-header-face)
884 (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7)
885 (setq calendar-intermonth-header
886 (propertize "Wk" ; or e.g. "KW" in Germany
887 'font-lock-face 'calendar-iso-week-header-face))))
892 [2013-05-21 Tue 23:18]
893 #+BEGIN_SRC emacs-lisp
894 (use-package crontab-mode
896 :commands crontab-mode
897 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
901 web-mode takes over, see [[*web-mode][web-mode]]
902 #+BEGIN_SRC emacs-lisp :tangle no
903 (use-package css-mode
904 :mode ("\\.css\\'" . css-mode)
909 (use-package flymake-css
913 (defun maybe-flymake-css-load ()
914 "Activate flymake-css as necessary, but not in derived modes."
915 (when (eq major-mode 'css-mode)
917 (add-hook 'css-mode-hook 'maybe-flymake-css-load)))
918 ;;; Auto-complete CSS keywords
919 (eval-after-load 'auto-complete
921 (dolist (hook '(css-mode-hook sass-mode-hook scss-mode-hook))
922 (add-hook hook 'ac-css-mode-setup))))))
926 I know that this lets it look "more like windows", but I don't much care
927 about its paste/copy/cut keybindings, the really nice part is the great
928 support for rectangular regions, which I started to use a lot since I
929 know this mode. The normal keybindings for those are just to useless.
930 #+BEGIN_SRC emacs-lisp
932 (setq cua-enable-cua-keys (quote shift))
935 Luckily cua-mode easily supports this, with the following line I just
936 get the CUA selection and rectangle stuff, not the keybindings. Yes,
937 even though the above =cua-enable-cua-keys= setting would only enable
938 them if the selection is done when the region was marked with a shifted
940 #+BEGIN_SRC emacs-lisp
941 (cua-selection-mode t)
945 #+BEGIN_SRC emacs-lisp
946 (require 'dpkg-dev-el-loaddefs nil 'noerror)
947 (require 'debian-el-loaddefs nil 'noerror)
949 (setq debian-changelog-full-name "Joerg Jaspert")
950 (setq debian-changelog-mailing-address "joerg@debian.org")
954 #+BEGIN_SRC emacs-lisp
955 (use-package diff-mode
957 :mode (("\\.diff" . diff-mode))
959 (use-package diff-mode-))
963 #+BEGIN_SRC emacs-lisp
965 :commands (dired dired-other-window dired-other-frame dired-noselect
966 dired-mode dired-jump)
967 :defines (dired-omit-regexp-orig)
970 (setq diredp-hide-details-initially-flag nil))
973 (setq dired-auto-revert-buffer (quote dired-directory-changed-p))
974 (setq dired-dwim-target t)
975 (setq dired-listing-switches "-alh")
976 (setq dired-listing-switches "-alXh --group-directories-first")
977 (setq dired-recursive-copies (quote top))
978 (setq dired-recursive-deletes (quote top))
979 (setq dired-guess-shell-alist-user
980 '(("\\.pdf\\'" "mupdf")
981 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
982 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
983 ("\\.\\(?:xcf\\)\\'" "gimp")
984 ("\\.csv\\'" "libreoffice")
985 ("\\.tex\\'" "pdflatex" "latex")
986 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
987 ("\\.html?\\'" "conkeror")))
989 (bind-key "F" 'find-name-dired dired-mode-map)
994 (use-package dired-x)
996 (use-package dired-single
1000 (bind-key "<return>" 'dired-single-buffer dired-mode-map)
1001 (bind-key "<mouse-1>" 'dired-single-buffer-mouse dired-mode-map)
1004 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
1010 (setq wdired-allow-to-change-permissions t)
1011 (bind-key "r" 'wdired-change-to-wdired-mode dired-mode-map)))
1013 (use-package gnus-dired
1014 :commands (gnus-dired-attach gnus-dired-mode)
1017 ;;(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
1018 (bind-key "a" 'gnus-dired-attach dired-mode-map)))
1023 (defvar mark-files-cache (make-hash-table :test #'equal))
1025 (defun mark-similar-versions (name)
1027 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
1028 (setq pat (match-string 1 pat)))
1029 (or (gethash pat mark-files-cache)
1030 (ignore (puthash pat t mark-files-cache)))))
1032 (defun dired-mark-similar-version ()
1034 (setq mark-files-cache (make-hash-table :test #'equal))
1035 (dired-mark-sexp '(mark-similar-versions name)))
1037 (defun dired-package-initialize ()
1038 (unless (featurep 'runner)
1039 (bind-key "M-!" 'async-shell-command dired-mode-map)
1040 (unbind-key "M-s f" dired-mode-map)
1042 (defadvice dired-omit-startup (after diminish-dired-omit activate)
1043 "Make sure to remove \"Omit\" from the modeline."
1044 (diminish 'dired-omit-mode) dired-mode-map)
1046 ;; Omit files that Git would ignore
1047 (defun dired-omit-regexp ()
1048 (let ((file (expand-file-name ".git"))
1050 (while (and (not (file-exists-p file))
1053 (file-name-directory
1054 (directory-file-name
1055 (file-name-directory file))))
1056 ;; Give up if we are already at the root dir.
1057 (not (string= (file-name-directory file)
1059 ;; Move up to the parent dir and try again.
1060 (setq file (expand-file-name ".git" parent-dir)))
1061 ;; If we found a change log in a parent, use that.
1062 (if (file-exists-p file)
1063 (let ((regexp (funcall dired-omit-regexp-orig))
1065 (shell-command-to-string "git clean -d -x -n")))
1066 (if (= 0 (length omitted-files))
1070 (if (> (length regexp) 0)
1079 (if (= ?/ (aref str (1- (length str))))
1083 (split-string omitted-files "\n" t)
1086 (funcall dired-omit-regexp-orig))))))
1088 (add-hook 'dired-mode-hook 'dired-package-initialize)
1090 (defun dired-double-jump (first-dir second-dir)
1092 (list (read-directory-name "First directory: "
1093 (expand-file-name "~")
1094 nil nil "/Downloads/")
1095 (read-directory-name "Second directory: "
1096 (expand-file-name "~")
1099 (dired-other-window second-dir))
1100 (bind-key "C-c J" 'dired-double-jump)
1102 (defun dired-back-to-top ()
1104 (goto-char (point-min))
1105 (dired-next-line 4))
1107 (define-key dired-mode-map
1108 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
1110 (defun dired-jump-to-bottom ()
1112 (goto-char (point-max))
1113 (dired-next-line -1))
1115 (define-key dired-mode-map
1116 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
1119 ** discover-my-major
1120 [2014-06-01 Sun 23:32]
1121 Discover key bindings and their meaning for the current Emacs major mode.
1122 #+BEGIN_SRC emacs-lisp
1123 (use-package discover-my-major
1124 :ensure discover-my-major
1125 :commands discover-my-major
1126 :bind ("C-h C-m" . discover-my-major))
1129 EasyPG is a GnuPG interface for Emacs.
1130 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1131 #+BEGIN_SRC emacs-lisp
1132 (use-package epa-file
1136 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1137 (defadvice epg--start (around advice-epg-disable-agent disable)
1138 "Don't allow epg--start to use gpg-agent in plain text
1140 (if (display-graphic-p)
1142 (let ((agent (getenv "GPG_AGENT_INFO")))
1143 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
1145 (setenv "GPG_AGENT_INFO" agent))))
1146 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
1147 (ad-activate 'epg--start)
1151 [2013-04-21 So 20:36]
1152 ediff - don't start another frame
1153 #+BEGIN_SRC emacs-lisp
1157 (defvar ctl-period-equals-map)
1158 (define-prefix-command 'ctl-period-equals-map)
1159 (bind-key "C-. =" 'ctl-period-equals-map)
1160 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
1162 :bind (("C-. = b" . ediff-buffers)
1163 ("C-. = B" . ediff-buffers3)
1164 ("C-. = =" . ediff-files)
1165 ("C-. = f" . ediff-files)
1166 ("C-. = F" . ediff-files3)
1167 ("C-. = r" . ediff-revision)
1168 ("C-. = p" . ediff-patch-file)
1169 ("C-. = P" . ediff-patch-buffer)
1170 ("C-. = l" . ediff-regions-linewise)
1171 ("C-. = w" . ediff-regions-wordwise))
1173 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
1174 (setq ediff-split-window-function 'split-window-horizontally)
1180 EMMS is the Emacs Multimedia System.
1181 #+BEGIN_SRC emacs-lisp :tangle no
1182 (require 'emms-source-file)
1183 (require 'emms-source-playlist)
1184 (require 'emms-info)
1185 (require 'emms-cache)
1186 (require 'emms-playlist-mode)
1187 (require 'emms-playing-time)
1188 (require 'emms-player-mpd)
1189 (require 'emms-playlist-sort)
1190 (require 'emms-mark)
1191 (require 'emms-browser)
1192 (require 'emms-lyrics)
1193 (require 'emms-last-played)
1194 (require 'emms-score)
1195 (require 'emms-tag-editor)
1196 (require 'emms-history)
1197 (require 'emms-i18n)
1199 (setq emms-playlist-default-major-mode 'emms-playlist-mode)
1200 (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track)
1201 (emms-playing-time 1)
1203 (add-hook 'emms-player-started-hook 'emms-last-played-update-current)
1204 ;(add-hook 'emms-player-started-hook 'emms-player-mpd-sync-from-emms)
1206 (when (fboundp 'emms-cache) ; work around compiler warning
1208 (setq emms-score-default-score 3)
1210 (defun emms-mpd-init ()
1211 "Connect Emms to mpd."
1213 (emms-player-mpd-connect))
1216 (require 'emms-player-mpd)
1217 (setq emms-player-mpd-server-name "localhost")
1218 (setq emms-player-mpd-server-port "6600")
1219 (add-to-list 'emms-info-functions 'emms-info-mpd)
1220 (add-to-list 'emms-player-list 'emms-player-mpd)
1221 (setq emms-volume-change-function 'emms-volume-mpd-change)
1222 (setq emms-player-mpd-sync-playlist t)
1224 (setq emms-source-file-default-directory "/var/lib/mpd/music")
1225 (setq emms-player-mpd-music-directory "/var/lib/mpd/music")
1226 (setq emms-info-auto-update t)
1227 (setq emms-lyrics-scroll-p t)
1228 (setq emms-lyrics-display-on-minibuffer t)
1229 (setq emms-lyrics-display-on-modeline nil)
1230 (setq emms-lyrics-dir "~/.emacs.d/var/lyrics")
1232 (setq emms-last-played-format-alist
1233 '(((emms-last-played-seconds-today) . "%H:%M")
1234 (604800 . "%a %H:%M") ; this week
1235 ((emms-last-played-seconds-month) . "%d.%m.%Y")
1236 ((emms-last-played-seconds-year) . "%d.%m.%Y")
1237 (t . "Never played")))
1240 (defun my-describe (track)
1241 (let* ((empty "...")
1242 (name (emms-track-name track))
1243 (type (emms-track-type track))
1244 (short-name (file-name-nondirectory name))
1245 (play-count (or (emms-track-get track 'play-count) 0))
1246 (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
1247 (artist (or (emms-track-get track 'info-artist) empty))
1248 (year (emms-track-get track 'info-year))
1249 (playing-time (or (emms-track-get track 'info-playing-time) 0))
1250 (min (/ playing-time 60))
1251 (sec (% playing-time 60))
1252 (album (or (emms-track-get track 'info-album) empty))
1253 (tracknumber (emms-track-get track 'info-tracknumber))
1254 (short-name (file-name-sans-extension
1255 (file-name-nondirectory name)))
1256 (title (or (emms-track-get track 'info-title) short-name))
1257 (rating (emms-score-get-score name))
1260 (format "%12s %20s (%.4s) [%-20s] - %2s. %-30s | %2d %s"
1261 (emms-last-played-format-date last-played)
1265 (if (and tracknumber ; tracknumber
1266 (not (zerop (string-to-number tracknumber))))
1267 (format "%02d" (string-to-number tracknumber))
1271 (make-string rating rate-char)))
1274 (setq emms-track-description-function 'my-describe)
1276 ;; (global-set-key (kbd "C-<f9> t") 'emms-play-directory-tree)
1277 ;; (global-set-key (kbd "H-<f9> e") 'emms-play-file)
1278 (global-set-key (kbd "H-<f9> <f9>") 'emms-mpd-init)
1279 (global-set-key (kbd "H-<f9> d") 'emms-play-dired)
1280 (global-set-key (kbd "H-<f9> x") 'emms-start)
1281 (global-set-key (kbd "H-<f9> v") 'emms-stop)
1282 (global-set-key (kbd "H-<f9> n") 'emms-next)
1283 (global-set-key (kbd "H-<f9> p") 'emms-previous)
1284 (global-set-key (kbd "H-<f9> o") 'emms-show)
1285 (global-set-key (kbd "H-<f9> h") 'emms-shuffle)
1286 (global-set-key (kbd "H-<f9> SPC") 'emms-pause)
1287 (global-set-key (kbd "H-<f9> a") 'emms-add-directory-tree)
1288 (global-set-key (kbd "H-<f9> b") 'emms-smart-browse)
1289 (global-set-key (kbd "H-<f9> l") 'emms-playlist-mode-go)
1291 (global-set-key (kbd "H-<f9> r") 'emms-toggle-repeat-track)
1292 (global-set-key (kbd "H-<f9> R") 'emms-toggle-repeat-playlist)
1293 (global-set-key (kbd "H-<f9> m") 'emms-lyrics-toggle-display-on-minibuffer)
1294 (global-set-key (kbd "H-<f9> M") 'emms-lyrics-toggle-display-on-modeline)
1296 (global-set-key (kbd "H-<f9> <left>") (lambda () (interactive) (emms-seek -10)))
1297 (global-set-key (kbd "H-<f9> <right>") (lambda () (interactive) (emms-seek +10)))
1298 (global-set-key (kbd "H-<f9> <down>") (lambda () (interactive) (emms-seek -60)))
1299 (global-set-key (kbd "H-<f9> <up>") (lambda () (interactive) (emms-seek +60)))
1301 (global-set-key (kbd "H-<f9> s u") 'emms-score-up-playing)
1302 (global-set-key (kbd "H-<f9> s d") 'emms-score-down-playing)
1303 (global-set-key (kbd "H-<f9> s o") 'emms-score-show-playing)
1304 (global-set-key (kbd "H-<f9> s s") 'emms-score-set-playing)
1306 (define-key emms-playlist-mode-map "u" 'emms-score-up-playing)
1307 (define-key emms-playlist-mode-map "d" 'emms-score-down-playing)
1308 (define-key emms-playlist-mode-map "o" 'emms-score-show-playing)
1309 (define-key emms-playlist-mode-map "s" 'emms-score-set-playing)
1310 (define-key emms-playlist-mode-map "r" 'emms-mpd-init)
1311 (define-key emms-playlist-mode-map "N" 'emms-playlist-new)
1313 (define-key emms-playlist-mode-map "x" 'emms-start)
1314 (define-key emms-playlist-mode-map "v" 'emms-stop)
1315 (define-key emms-playlist-mode-map "n" 'emms-next)
1316 (define-key emms-playlist-mode-map "p" 'emms-previous)
1318 (setq emms-playlist-buffer-name "*EMMS Playlist*"
1319 emms-playlist-mode-open-playlists t)
1325 'emms-browser-artist-face nil
1330 (setq emms-player-mpd-supported-regexp
1331 (or (emms-player-mpd-get-supported-regexp)
1332 (concat "\\`http://\\|"
1333 (emms-player-simple-regexp
1334 "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff"))))
1335 (emms-player-set emms-player-mpd 'regex emms-player-mpd-supported-regexp)
1339 Basic settings for emacs integrated shell
1340 #+BEGIN_SRC emacs-lisp :tangle no
1346 (defun eshell-initialize ()
1347 (defun eshell-spawn-external-command (beg end)
1348 "Parse and expand any history references in current input."
1351 (when (looking-back "&!" beg)
1352 (delete-region (match-beginning 0) (match-end 0))
1354 (insert "spawn "))))
1355 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1356 (eval-after-load "em-unix"
1358 (unintern 'eshell/su)
1359 (unintern 'eshell/sudo))))
1360 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1364 (defalias 'emacs 'find-file)
1365 (defalias 'ec 'find-file)
1366 (defalias 'e 'find-file)
1370 (use-package 'em-cmpl)
1371 (use-package 'em-prompt)
1372 (use-package 'em-term)
1374 (setq eshell-cmpl-cycle-completions nil
1375 eshell-save-history-on-exit t
1376 eshell-buffer-maximum-lines 20000
1377 eshell-history-size 350
1378 eshell-buffer-shorthand t
1379 eshell-highlight-prompt t
1380 eshell-plain-echo-behavior t
1381 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1383 (setenv "PAGER" "cat")
1384 (setq eshell-visual-commands
1385 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1386 (setq eshell-visual-subcommands
1387 '(("git" "log" "l" "diff" "show")))
1389 (add-to-list 'eshell-command-completions-alist
1390 '("gunzip" "gz\\'"))
1391 (add-to-list 'eshell-command-completions-alist
1392 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1394 (when (not (functionp 'eshell/rgrep))
1395 (defun eshell/rgrep (&rest args)
1396 "Use Emacs grep facility instead of calling external grep."
1397 (eshell-grep "rgrep" args t)))
1399 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1400 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1401 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1402 (add-hook 'eshell-preoutput-filter-functions
1403 'ansi-color-filter-apply)
1404 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1406 (defmacro with-face (str &rest properties)
1407 `(propertize ,str 'face (list ,@properties)))
1409 (defun eshell/abbr-pwd ()
1410 (let ((home (getenv "HOME"))
1411 (path (eshell/pwd)))
1413 ((string-equal home path) "~")
1414 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1417 (defun eshell/my-prompt ()
1418 (let ((header-bg "#161616"))
1420 (with-face user-login-name :foreground "cyan")
1421 (with-face (concat "@" hostname) :foreground "white")
1423 (with-face (eshell/abbr-pwd) :foreground "#009900")
1424 (if (= (user-uid) 0)
1425 (with-face "#" :foreground "red")
1426 (with-face "$" :foreground "#69b7f0"))
1429 (use-package eshell-prompt-extras
1433 (setq eshell-highlight-prompt nil
1434 ;; epe-git-dirty-char "Ϟ"
1435 epe-git-dirty-char "*"
1436 eshell-prompt-function 'epe-theme-dakrone)))
1438 (defun eshell/magit ()
1439 "Function to open magit-status for the current directory"
1441 (magit-status default-directory)
1444 (setq eshell-prompt-function 'eshell/my-prompt)
1445 (setq eshell-highlight-prompt nil)
1446 (setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1451 Incremental search is great, but annoyingly you need to type whatever
1452 you want. If you want to search for just the next (or previous)
1453 occurence of what is at your cursor position use the following.
1454 *C-x* will insert the current word while *M-up* and *M-down* will just
1455 jump to the next/previous occurence of it.
1456 #+BEGIN_SRC emacs-lisp
1457 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
1458 (bind-key* "<M-up>" 'sacha/search-word-backward)
1459 (bind-key* "<M-down>" 'sacha/search-word-forward)
1462 *** Frame configuration
1463 I want to see the buffername and its size, not the host I am on in my
1465 #+BEGIN_SRC emacs-lisp
1466 (setq frame-title-format "%b (%i)")
1469 *** Protect some buffers
1470 I don't want some buffers to be killed, **scratch** for example.
1471 In the past I had a long function that just recreated them, but the
1472 =keep-buffers= package is easier.
1473 #+BEGIN_SRC emacs-lisp
1474 (use-package keep-buffers
1477 (keep-buffers-mode 1)
1478 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1479 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1484 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
1486 #+BEGIN_SRC emacs-lisp
1487 (defalias 'yes-or-no-p 'y-or-n-p)
1490 *** Language/i18n stuff
1491 In this day and age, UTF-8 is the way to go.
1492 #+BEGIN_SRC emacs-lisp
1493 (set-language-environment 'utf-8)
1494 (set-default-coding-systems 'utf-8)
1495 (set-terminal-coding-system 'utf-8)
1496 (set-keyboard-coding-system 'utf-8)
1497 (set-clipboard-coding-system 'utf-8)
1498 (prefer-coding-system 'utf-8)
1499 (set-charset-priority 'unicode)
1500 (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
1501 (when (display-graphic-p)
1502 (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
1505 *** Hilight matching parentheses
1506 While I do have the nifty shortcut to jump to the other parentheses,
1507 hilighting them makes it obvious where they are.
1508 #+BEGIN_SRC emacs-lisp
1509 (use-package mic-paren
1513 *** Kill other buffers
1514 While many editors allow you to close "all the other files, not the one
1515 you are in", emacs doesn't have this... Except, now it will.
1516 (Update 30.05.2014: Not used ever, deactivated)
1517 #+BEGIN_SRC emacs-lisp :tangle no
1518 (bind-key "C-c k" 'prelude-kill-other-buffers)
1521 Default scrolling behaviour in emacs is a bit annoying, who wants to
1523 #+BEGIN_SRC emacs-lisp
1524 (setq scroll-margin 0)
1525 (setq scroll-conservatively 100000)
1526 (setq scroll-up-aggressively 0.0)
1527 (setq scroll-down-aggressively 0.0)
1528 (setq scroll-preserve-screen-position t)
1531 *** Copy/Paste with X
1532 [2013-04-09 Di 23:31]
1533 The default how emacs handles cutting/pasting with the primary selection
1534 changed in emacs24. I am used to the old way, so get it back.
1535 #+BEGIN_SRC emacs-lisp
1536 (setq select-enable-primary t)
1537 (setq select-enable-clipboard nil)
1538 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1539 (setq mouse-drag-copy-region t)
1541 *** Global keyboard changes not directly related to a mode
1542 Disable /suspend_frame/ function, I dislike it.
1543 #+BEGIN_SRC emacs-lisp
1545 (unbind-key "C-x C-z")
1548 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
1549 #+BEGIN_SRC emacs-lisp
1550 (defmacro bol-with-prefix (function)
1551 "Define a new function which calls FUNCTION.
1552 Except it moves to beginning of line before calling FUNCTION when
1553 called with a prefix argument. The FUNCTION still receives the
1555 (let ((name (intern (format "endless/%s-BOL" function))))
1559 "Call `%s', but move to BOL when called with a prefix argument."
1564 (call-interactively ',function))
1567 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
1568 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
1569 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
1572 Default of *C-k* is to kill from the point to the end of line. If
1573 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
1574 set, including newline. But to kill the entire line, one still needs a
1575 *C-a* in front of it. So I change it, by defining a function to do just this for
1577 #+BEGIN_SRC emacs-lisp :tangle no
1578 (defun kill-entire-line ()
1579 "Kill this entire line (including newline), regardless of where point is within the line."
1583 (back-to-indentation))
1585 (bind-key* "C-k" 'kill-entire-line)
1586 (global-set-key [remap kill-whole-line] 'kill-entire-line)
1589 And the same is true when I'm in org-mode, which has an own kill function...
1590 (the keybinding happens later, after org-mode is loaded fully)
1591 #+BEGIN_SRC emacs-lisp :tangle no
1592 (defun jj-org-kill-line (&optional arg)
1593 "Kill the entire line, regardless of where point is within the line, org-mode-version"
1597 (back-to-indentation)
1601 I really hate tabs, so I don't want any indentation to try using them.
1602 And in case a project really needs them, I can change it just for that
1603 file/project, but luckily none of those I work in is as broken.
1604 #+BEGIN_SRC emacs-lisp
1605 (setq-default indent-tabs-mode nil)
1608 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
1609 #+BEGIN_SRC emacs-lisp
1610 (bind-key* "M-5" 'match-paren)
1613 Instead of the default "mark-defun" I want a more readline-like setting.
1614 #+BEGIN_SRC emacs-lisp
1615 (bind-key "C-M-h" 'backward-kill-word)
1618 Align whatever with a regexp.
1619 #+BEGIN_SRC emacs-lisp
1620 (bind-key "C-x \\" 'align-regexp)
1624 #+BEGIN_SRC emacs-lisp
1625 (bind-key "C-+" 'text-scale-increase)
1626 (bind-key "C--" 'text-scale-decrease)
1629 Regexes are too useful, so use the regex search by default.
1630 #+begin_src emacs-lisp
1631 (bind-key "C-s" 'isearch-forward-regexp)
1632 (bind-key "C-r" 'isearch-backward-regexp)
1633 (bind-key "C-M-s" 'isearch-forward)
1634 (bind-key "C-M-r" 'isearch-backward)
1637 Rgrep is infinitely useful in multi-file projects.
1638 #+begin_src emacs-lisp
1639 (bind-key "C-x C-g" 'rgrep)
1642 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
1643 AKA transpose lines.
1644 #+BEGIN_SRC emacs-lisp
1645 (bind-key "<M-S-up>" 'move-line-up)
1646 (bind-key "<M-S-down>" 'move-line-down)
1649 "Pull" lines up, join them
1650 #+BEGIN_SRC emacs-lisp
1651 (defun join-line-or-lines-in-region ()
1652 "Join this line or the lines in the selected region.
1653 Joins single lines in reverse order to the default, ie. pulls the next one up."
1655 (cond ((region-active-p)
1656 (let ((min (line-number-at-pos (region-beginning))))
1657 (goto-char (region-end))
1658 (while (> (line-number-at-pos) min)
1660 (t (let ((current-prefix-arg '(4)))
1661 (call-interactively 'join-line)))))
1662 (bind-key "M-j" 'join-line-or-lines-in-region)
1665 When I press Enter I almost always want to go to the right indentation on the next line.
1666 #+BEGIN_SRC emacs-lisp
1667 (bind-key "RET" 'newline-and-indent)
1670 Easier undo, and i don't need suspend-frame
1671 #+BEGIN_SRC emacs-lisp
1672 (bind-key "C-z" 'undo)
1675 Window switching, go backwards. (C-x o goes to the next window)
1676 #+BEGIN_SRC emacs-lisp
1677 (bind-key "C-x O" (lambda ()
1683 #+BEGIN_SRC emacs-lisp
1684 (bind-key "C-x C-r" 'prelude-sudo-edit)
1687 M-space is bound to just-one-space, which is great for programming. What
1688 it does is remove all spaces around the cursor, except for one. But to
1689 be really useful, it also should include newlines. It doesn’t do this by
1690 default. Rather, you have to call it with a negative argument. Sure
1692 #+BEGIN_SRC emacs-lisp
1693 (bind-key "M-SPC" 'just-one-space-with-newline)
1696 Count which commands I use how often.
1697 #+BEGIN_SRC emacs-lisp
1698 (use-package keyfreq
1702 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
1703 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
1705 (keyfreq-autosave-mode 1)))
1708 Duplicate current line
1709 #+BEGIN_SRC emacs-lisp
1710 (defun duplicate-line ()
1711 "Insert a copy of the current line after the current line."
1714 (let ((line-text (buffer-substring-no-properties
1715 (line-beginning-position)
1716 (line-end-position))))
1717 (move-end-of-line 1)
1719 (insert line-text))))
1721 (bind-key "C-c p" 'duplicate-line)
1724 Smarter move to the beginning of the line. That is, it first moves to
1725 the beginning of the line - and on second keypress it goes to the
1726 first character on line.
1727 #+BEGIN_SRC emacs-lisp
1728 (defun smarter-move-beginning-of-line (arg)
1729 "Move point back to indentation of beginning of line.
1731 Move point to the first non-whitespace character on this line.
1732 If point is already there, move to the beginning of the line.
1733 Effectively toggle between the first non-whitespace character and
1734 the beginning of the line.
1736 If ARG is not nil or 1, move forward ARG - 1 lines first. If
1737 point reaches the beginning or end of the buffer, stop there."
1739 (setq arg (or arg 1))
1743 (let ((line-move-visual nil))
1744 (forward-line (1- arg))))
1746 (let ((orig-point (point)))
1747 (back-to-indentation)
1748 (when (= orig-point (point))
1749 (move-beginning-of-line 1))))
1751 ;; remap C-a to `smarter-move-beginning-of-line'
1752 (global-set-key [remap move-beginning-of-line]
1753 'smarter-move-beginning-of-line)
1757 Easily copy characters from the previous nonblank line, starting just
1758 above point. With a prefix argument, only copy ARG characters (never
1759 past EOL), no argument copies rest of line.
1760 #+BEGIN_SRC emacs-lisp
1762 (bind-key "H-y" 'copy-from-above-command)
1765 Open a new X Terminal pointing to the directory of the current
1767 #+BEGIN_SRC emacs-lisp
1768 (bind-key "H-t" 'jj-open-shell)
1772 #+BEGIN_SRC emacs-lisp
1773 (bind-key "H-a" 'align-code)
1777 #+BEGIN_SRC emacs-lisp
1778 (bind-key "C-c d" 'insert-date)
1781 Another key for indenting
1782 #+BEGIN_SRC emacs-lisp
1783 (bind-key "H-i" 'indent-region)
1786 Clean all whitespace stuff
1787 #+BEGIN_SRC emacs-lisp
1788 (bind-key "H-w" 'whitespace-cleanup)
1792 #+BEGIN_SRC emacs-lisp
1793 (bind-key "H-c" 'comment-dwim)
1796 Show keystrokes in progress
1797 #+BEGIN_SRC emacs-lisp
1798 (setq echo-keystrokes 0.1)
1801 Usually you can press the *Ins*ert key, to get into overwrite mode. I
1802 don't like that, have broken much with it and so just forbid it by
1804 #+BEGIN_SRC emacs-lisp
1805 (unbind-key "<insert>")
1806 (unbind-key "<kp-insert>")
1809 *** Easily navigate sillyCased words
1810 #+BEGIN_SRC emacs-lisp
1811 (global-subword-mode 1)
1813 *** Delete file of current buffer, then kill buffer
1814 [2014-06-14 Sat 23:03]
1815 #+BEGIN_SRC emacs-lisp
1816 (defun delete-current-buffer-file ()
1817 "Removes file connected to current buffer and kills buffer."
1819 (let ((filename (buffer-file-name))
1820 (buffer (current-buffer))
1821 (name (buffer-name)))
1822 (if (not (and filename (file-exists-p filename)))
1824 (when (yes-or-no-p "Are you sure you want to remove this file? ")
1825 (delete-file filename)
1826 (kill-buffer buffer)
1827 (message "File '%s' successfully removed" filename)))))
1829 (global-set-key (kbd "C-x C-k") 'delete-current-buffer-file)
1831 *** Rename file of current buffer
1832 [2014-06-14 Sat 23:04]
1833 #+BEGIN_SRC emacs-lisp
1834 (defun rename-current-buffer-file ()
1835 "Renames current buffer and file it is visiting."
1837 (let ((name (buffer-name))
1838 (filename (buffer-file-name)))
1839 (if (not (and filename (file-exists-p filename)))
1840 (error "Buffer '%s' is not visiting a file!" name)
1841 (let ((new-name (read-file-name "New name: " filename)))
1842 (if (get-buffer new-name)
1843 (error "A buffer named '%s' already exists!" new-name)
1844 (rename-file filename new-name 1)
1845 (rename-buffer new-name)
1846 (set-visited-file-name new-name)
1847 (set-buffer-modified-p nil)
1848 (message "File '%s' successfully renamed to '%s'"
1849 name (file-name-nondirectory new-name)))))))
1851 (global-set-key (kbd "C-x C-S-r") 'rename-current-buffer-file)
1853 *** Quickly find emacs lisp sources
1854 [2014-06-22 Sun 23:05]
1855 #+BEGIN_SRC emacs-lisp
1856 (bind-key "C-l" 'find-library 'help-command)
1857 (bind-key "C-f" 'find-function 'help-command)
1858 (bind-key "C-k" 'find-function-on-key 'help-command)
1859 (bind-key "C-v" 'find-variable 'help-command)
1862 [2015-01-26 Mon 16:01]
1863 #+BEGIN_SRC emacs-lisp
1864 (bind-key "M-s o" 'occur-dwim)
1868 [2014-06-01 Sun 15:00]
1869 Proper whitespace handling
1870 #+BEGIN_SRC emacs-lisp :tangle no
1871 (use-package ethan-wspace
1872 :ensure ethan-wspace
1873 :diminish (ethan-wspace-mode . "ew")
1875 (global-ethan-wspace-mode 1))
1879 [2014-06-01 Sun 15:16]
1880 #+BEGIN_SRC emacs-lisp
1881 (use-package expand-region
1882 :ensure expand-region
1883 :bind ("C-M-+" . er/expand-region)
1884 :commands er/expand-region)
1887 [2013-05-02 Thu 00:04]
1888 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
1889 fill prefix, such as a comment sequence in program code, and handling
1890 bullet points like “1.” or “*”.
1891 #+BEGIN_SRC emacs-lisp
1892 (use-package filladapt
1893 :diminish filladapt-mode
1895 (setq-default filladapt-mode t))
1898 [2013-04-28 So 22:21]
1899 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
1900 As the one time I tried Flymake i wasn't happy, thats easy to
1902 #+BEGIN_SRC emacs-lisp
1903 (use-package flycheck
1905 :diminish flycheck-mode
1906 :bind (("M-n" . next-error)
1907 ("M-p" . previous-error))
1910 (add-hook 'find-file-hook
1912 (when (not (equal 'emacs-lisp-mode major-mode))
1916 (use-package flycheck-color-mode-line
1917 :ensure flycheck-color-mode-line)
1918 (setq flycheck-highlighting-mode nil)
1919 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
1923 Obviously emacs can do syntax hilighting. For more things than you ever
1925 And I want to have it everywhere.
1926 #+BEGIN_SRC emacs-lisp
1927 (use-package font-lock
1930 (global-font-lock-mode 1)
1931 (setq font-lock-maximum-decoration t)))
1934 #+BEGIN_SRC emacs-lisp :tangle no
1935 (use-package git-commit
1936 :commands git-commit
1937 :mode ("COMMIT_EDITMSG" . git-commit-mode))
1941 #+BEGIN_SRC emacs-lisp :tangle no
1942 (use-package git-rebase
1943 :commands git-rebase
1944 :mode ("git-rebase-todo" . git-rebase-mode))
1947 [2014-05-21 Wed 22:56]
1948 #+BEGIN_SRC emacs-lisp
1949 (use-package git-gutter+
1951 :diminish git-gutter+-mode
1952 :bind (("C-x n" . git-gutter+-next-hunk)
1953 ("C-x p" . git-gutter+-previous-hunk)
1954 ("C-x v =" . git-gutter+-show-hunk)
1955 ("C-x r" . git-gutter+-revert-hunks)
1956 ("C-x s" . git-gutter+-stage-hunks)
1957 ("C-x c" . git-gutter+-commit)
1961 (setq git-gutter+-disabled-modes '(org-mode))
1962 (global-git-gutter+-mode 1))
1965 (use-package git-gutter-fringe+
1966 :ensure git-gutter-fringe+
1969 (setq git-gutter-fr+-side 'right-fringe)
1970 ;(git-gutter-fr+-minimal)
1975 [2015-02-22 Sun 14:00]
1976 Provides function that popup commit message at current line. This is
1977 useful when you want to know why this line was changed.
1978 #+BEGIN_SRC emacs-lisp
1979 (use-package git-messenger
1980 :ensure git-messenger
1981 :commands (git-messenger:popup-message)
1982 :bind (("C-x v p" . git-messenger:popup-message))
1985 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
1986 (add-hook 'git-messenger:popup-buffer-hook 'magit-commit-mode)
1987 (setq git-messenger:show-detail t)))
1990 [2014-07-23 Mi 12:57]
1991 Browse historic versions of a file with p (previous) and n (next).
1992 #+BEGIN_SRC emacs-lisp
1993 (use-package git-timemachine
1994 :ensure git-timemachine
1995 :commands git-timemachine)
1998 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
1999 what I want every emacs to know.
2000 #+BEGIN_SRC emacs-lisp
2001 (bind-key "C-c g" 'gnus) ; Start gnus with M-n
2007 [2015-02-20 Fri 16:27]
2008 When working with many windows at the same time, each window has a
2009 size that is not convenient for editing.
2011 golden-ratio helps on this issue by resizing automatically the windows
2012 you are working on to the size specified in the "Golden Ratio". The
2013 window that has the main focus will have the perfect size for editing,
2014 while the ones that are not being actively edited will be re-sized to
2015 a smaller size that doesn't get in the way, but at the same time will
2016 be readable enough to know it's content.
2017 #+BEGIN_SRC emacs-lisp
2018 (use-package golden-ratio
2019 :ensure golden-ratio
2020 :diminish golden-ratio-mode
2023 (golden-ratio-mode 1)
2024 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*"))
2025 (setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
2026 "gnus-article-mode" "calc-mode" "calc-trail-mode"
2031 [2015-02-22 Sun 13:28]
2032 Move point through buffer-undo-list positions.
2033 #+BEGIN_SRC emacs-lisp
2034 (use-package goto-last-change
2035 :commands (goto-last-change)
2036 :bind (("M-g l" . goto-last-change))
2040 [2014-06-11 Wed 22:27]
2041 guide-key.el displays the available key bindings automatically and
2044 For whatever reason I like this more than icicles <backtab> completion
2046 #+BEGIN_SRC emacs-lisp
2047 (use-package guide-key
2049 :diminish guide-key-mode
2052 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
2054 (setq guide-key/recursive-key-sequence-flag t)
2055 (setq guide-key/popup-window-position 'bottom)
2056 (setq guide-key/idle-delay 0.5)))
2061 [2014-05-21 Wed 23:51]
2062 #+BEGIN_SRC emacs-lisp
2063 (use-package hi-lock
2064 :bind (("M-o l" . highlight-lines-matching-regexp)
2065 ("M-o r" . highlight-regexp)
2066 ("M-o w" . highlight-phrase)))
2068 (use-package hilit-chg
2069 :bind ("M-o C" . highlight-changes-mode))
2073 Crazy way of completion. It looks at the word before point and then
2074 tries to expand it in various ways.
2075 #+BEGIN_SRC emacs-lisp
2076 (use-package hippie-exp
2077 :bind ("M-/" . hippie-expand)
2078 :commands hippie-expand
2081 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2082 try-expand-dabbrev-all-buffers
2083 try-expand-dabbrev-from-kill
2084 try-complete-file-name-partially
2085 try-complete-file-name
2086 try-expand-all-abbrevs try-expand-list
2088 try-complete-lisp-symbol-partially
2089 try-complete-lisp-symbol))))
2092 Replaced by web-mode [[*web-mode][web-mode]]
2093 #+BEGIN_SRC emacs-lisp :tangle no
2094 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
2095 (add-auto-mode 'html-helper-mode "\\.html$")
2096 (add-auto-mode 'html-helper-mode "\\.asp$")
2097 (add-auto-mode 'html-helper-mode "\\.phtml$")
2098 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
2099 (defalias 'html-mode 'html-helper-mode)
2102 [2015-01-26 Mon 15:50]
2103 This is a package for GNU Emacs that can be used to tie related
2104 commands into a family of short bindings with a common prefix - a
2107 Once you summon the Hydra through the prefixed binding (the body + any
2108 one head), all heads can be called in succession with only a short
2111 The Hydra is vanquished once Hercules, any binding that isn't the
2112 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2113 Hydra, will still serve his orignal purpose, calling his proper
2114 command. This makes the Hydra very seamless, it's like a minor mode
2115 that disables itself auto-magically.
2116 #+BEGIN_SRC emacs-lisp
2121 (setq hydra-is-helpful t)
2124 (defhydra hydra-zoom (:color red)
2126 ("g" text-scale-increase "in")
2127 ("l" text-scale-decrease "out")
2129 (bind-key "<F2>" 'hydra-zoom/toggle)
2131 (defhydra hydra-error (:color red)
2133 ("h" first-error "first")
2134 ("j" next-error "next")
2135 ("k" previous-error "prev")
2136 ("v" recenter-top-bottom "recenter")
2138 (bind-key "M-g e" 'hydra-error/body)
2140 (defhydra hydra-gnus (:color red)
2142 ("m" gnus-uu-mark-thread "mark thread")
2143 ("d" gnus-summary-delete-article "delete article(s)")
2144 ("r" gnus-summary-mark-as-read-forward "mark read")
2145 ("n" gnus-summary-next-thread "next thread")
2146 ("p" gnus-summary-prev-thread "previous thread")
2147 ("g" gnus-summary-next-group "next group")
2148 ("l" gnus-recenter "recenter")
2149 ("x" gnus-summary-limit-to-unread "unread")
2151 (bind-key "C-c h" 'hydra-gnus/body)
2153 (defhydra hydra-launcher (:color blue)
2156 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2157 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
2160 (bind-key "C-c r" 'hydra-launcher/body)
2162 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
2163 (defvar whitespace-mode nil)
2164 (defhydra hydra-toggle (:color pink)
2166 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
2167 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
2168 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
2169 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
2170 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
2173 ("a" abbrev-mode nil)
2174 ("c" auto-complete-mode nil)
2175 ("i" aggressive-indent-mode nil)
2176 ("d" toggle-debug-on-error nil)
2177 ("f" auto-fill-mode nil)
2178 ("g" golden-ratio-mode nil)
2179 ("t" toggle-truncate-lines nil)
2180 ("w" whitespace-mode nil)
2181 ("r" auto-revert-mode nil)
2182 ("l" linum-mode nil)
2183 ("k" linum-relative-toggle nil)
2185 (bind-key "C-c C-v" 'hydra-toggle/body)
2191 [2014-05-21 Wed 23:54]
2192 #+BEGIN_SRC emacs-lisp
2193 (use-package ibuffer
2195 :bind (("C-h h" . ibuffer)
2196 ("C-x C-b" . ibuffer)
2197 ("<XF86WebCam>" . ibuffer)
2200 :defines (ibuffer-filtering-alist
2201 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
2202 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
2205 (defvar my-ibufffer-separator " • ")
2206 (setq ibuffer-filter-group-name-face 'variable-pitch
2207 ibuffer-use-header-line t
2208 ibuffer-old-time 12)
2209 (unbind-key "M-o" ibuffer-mode-map)
2210 (bind-key "s" 'isearch-forward-regexp ibuffer-mode-map)
2211 (bind-key "." 'ibuffer-invert-sorting ibuffer-mode-map)
2216 (use-package ibuffer-vc
2219 (ibuffer-vc-set-filter-groups-by-vc-root
2220 ibuffer-vc-generate-filter-groups-by-vc-root))
2222 (use-package ibuffer-tramp
2224 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
2225 ibuffer-tramp-set-filter-groups-by-tramp-connection))
2226 ;; Switching to ibuffer puts the cursor on the most recent buffer
2227 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
2228 "Open ibuffer with cursor pointed to most recent buffer name"
2229 (let ((recent-buffer-name (buffer-name)))
2231 (ibuffer-update nil t)
2232 (unless (string= recent-buffer-name "*Ibuffer*")
2233 (ibuffer-jump-to-buffer recent-buffer-name))))
2235 (defun ibuffer-magit-status ()
2237 (--when-let (get-buffer "*Ibuffer*")
2238 (with-current-buffer it
2239 (let* ((selected-buffer (ibuffer-current-buffer))
2240 (buffer-path (with-current-buffer
2242 (or (buffer-file-name)
2243 list-buffers-directory
2244 default-directory)))
2246 (if (file-regular-p buffer-path)
2247 (file-name-directory buffer-path)
2249 (magit-status default-directory)))))
2250 (bind-key "i" 'ibuffer-magit-status ibuffer-mode-map)
2251 (bind-key "G" 'ibuffer-magit-status ibuffer-mode-map)
2253 (setq ibuffer-directory-abbrev-alist
2258 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
2259 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
2261 ("dak" . "/develop/dak/")
2263 ("config" . "~/.emacs.d/config/")
2265 ("systmp" . "/tmp/")
2266 ("puppet" . "~/git/puppet")
2270 (use-package ibuffer-git
2272 (use-package ibuffer-vc
2275 (define-ibuffer-column size-h
2276 (:name "Size" :inline t)
2278 ((> (buffer-size) 1000)
2279 (format "%7.1fk" (/ (buffer-size) 1000.0)))
2280 ((> (buffer-size) 1000000)
2281 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
2283 (format "%8d" (buffer-size)))))
2285 (use-package ibuf-ext)
2286 (define-ibuffer-filter filename2
2287 "Toggle current view to buffers with filename matching QUALIFIER."
2288 (:description "filename2"
2289 :reader (read-from-minibuffer "Filter by filename (regexp): "))
2290 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
2291 (ibuffer-awhen (with-current-buffer buf
2292 (or buffer-file-name
2294 (string-match qualifier it)))
2296 (defvar ibuffer-magit-filter-groups nil)
2297 (defun ibuffer-magit-define-filter-groups ()
2298 (when (and (not ibuffer-magit-filter-groups)
2299 (boundp 'magit-repo-dirs))
2300 (setq ibuffer-magit-filter-groups
2303 (file-name-nondirectory (directory-file-name it)))
2305 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
2307 (defun ibuffer-set-filter-groups-by-root ()
2309 ;; (ibuffer-projectile-define-filter-groups)
2310 ;; (ibuffer-magit-define-filter-groups)
2311 (setq ibuffer-filter-groups
2313 ;; ibuffer-projectile-filter-groups
2314 ibuffer-magit-filter-groups
2317 (or (mode . magit-log-edit-mode)
2318 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2319 (name . "^\\*Pymacs\\*$")
2320 (name . "^\\*helm.*\\*")
2321 (name . "^\\*Compile-log\\*$")
2322 (name . "^\\*Ido Completions\\*$")
2323 (name . "^\\*magit-\\(process\\)\\*$")
2327 (name . "^\\*scratch")
2328 (name . "^\\*Messages")
2331 (ibuffer-vc-generate-filter-groups-by-vc-root)
2332 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
2334 (defun toggle-ibuffer-filter-groups ()
2337 (let ((ibuf (get-buffer "*Ibuffer*")))
2339 (with-current-buffer ibuf
2340 (let ((selected-buffer (ibuffer-current-buffer)))
2341 (if (not ibuffer-filter-groups)
2342 (ibuffer-set-filter-groups-by-root)
2343 (setq ibuffer-filter-groups nil))
2344 (pop-to-buffer ibuf)
2345 (ibuffer-update nil t)
2346 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
2348 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
2350 (defun ibuffer-back-to-top ()
2352 (beginning-of-buffer)
2355 (defun ibuffer-jump-to-bottom ()
2361 (define-key ibuffer-mode-map
2362 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
2363 (define-key ibuffer-mode-map
2364 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
2366 (setq ibuffer-default-sorting-mode 'recency
2367 ibuffer-eliding-string "…"
2368 ibuffer-compile-formats t
2369 ibuffer-git-column-length 6
2370 ibuffer-show-empty-filter-groups nil
2371 ibuffer-default-directory "~/"
2374 (setq ibuffer-formats '((mark vc-status-mini
2376 (git-status 8 8 :left)
2380 (name 18 18 :left :elide)
2382 (size-h 9 -1 :right)
2384 (mode 16 16 :left :elide)
2385 " " filename-and-process)
2387 (git-status 8 8 :left)
2393 (setq ibuffer-saved-filter-groups
2396 ("dired" (mode . dired-mode))
2397 ("perl" (mode . cperl-mode))
2399 (mode . puppet-mode)
2400 (mode . yaml-mode)))
2401 ("ruby" (mode . ruby-mode))
2403 (name . "^\\*scratch\\*$")
2404 (name . "^\\*Compile-log\\*$")
2405 (name . "^\\*Completions\\*$")
2406 (name . "^\\*Messages\\*$")
2407 (name . "^\\*Backtrace\\*$")
2408 (name . "^\\*Packages*\\*$")
2409 (name . "^\\*Help*\\*$")
2412 (mode . message-mode)
2415 (mode . gnus-group-mode)
2416 (mode . gnus-summary-mode)
2417 (mode . gnus-article-mode)
2418 (name . "^\\.bbdb$")
2419 (name . "^\\.newsrc-dribble")))
2421 (filename . ".*/org/.*")
2422 (mode . org-agenda-mode)
2423 (name . "^diary$")))
2425 (mode . magit-log-edit-mode)
2426 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
2428 ;; -------------------------------------------------
2429 ;; programming languages #1
2431 (mode . emacs-lisp-mode)
2432 (mode . python-mode)
2434 (mode . coffee-mode)
2437 (mode . actionscript-mode)
2440 (mode . haskell-mode)
2446 ;; -------------------------------------------------
2447 ;; configuration/data files
2451 (mode . conf-mode)))
2452 ;; -------------------------------------------------
2453 ;; text/notetaking/org
2454 ("org agenda" (mode . org-agenda-mode))
2457 (name . "^\\*Calendar\\*$")
2458 (name . "^diary$")))
2462 (mode . markdown-mode)))
2463 ;; -------------------------------------------------
2466 (mode . image-mode)))
2467 ;; -------------------------------------------------
2469 ("w3m" (mode . w3m-mode))
2471 (mode . magit-status-mode)
2472 (mode . magit-log-mode)
2473 (mode . vc-annotate-mode)))
2474 ("dired" (mode . dired-mode))
2479 (name . "^\\*Personal Keybindings\\*$")))
2480 ;; -------------------------------------------------
2482 ("MORE" (or (mode . magit-log-edit-mode)
2483 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2484 (name . "^\\*Pymacs\\*$")
2485 (name . "^\\*Compile-log\\*$")
2486 (name . "^\\*Completions\\*$")
2487 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
2489 ("*buffer*" (name . "\\*.*\\*"))))))
2491 (add-hook 'ibuffer-mode-hook
2493 (ibuffer-auto-mode 1)
2494 (ibuffer-switch-to-saved-filter-groups "default")))
2496 ;; Unless you turn this variable on you will be prompted every time
2497 ;; you want to delete a buffer, even unmodified ones, which is way
2498 ;; too cautious for most people. You’ll still be prompted for
2499 ;; confirmation when deleting modified buffers after the option has
2501 (setq ibuffer-expert t)
2506 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
2507 ‘TAB’ completion is to typing things manually every time.”]]
2508 #+BEGIN_SRC emacs-lisp
2509 (use-package icicles
2510 :load-path "elisp/icicle/"
2515 Incremental mini-buffer completion preview: Type in the minibuffer,
2516 list of matching commands is echoed
2517 #+BEGIN_SRC emacs-lisp
2521 [2014-05-26 Mon 22:49]
2522 #+BEGIN_SRC emacs-lisp
2525 :commands (iedit-mode)
2527 :bind (("C-;" . iedit-mode)
2528 ("C-," . iedit-mode-toggle-on-function))
2533 [2014-05-20 Tue 23:35]
2534 #+BEGIN_SRC emacs-lisp
2536 :bind ("C-h C-i" . info-lookup-symbol)
2537 :commands info-lookup-symbol
2540 ;; (defadvice info-setup (after load-info+ activate)
2541 ;; (use-package info+))
2543 (defadvice Info-exit (after remove-info-window activate)
2544 "When info mode is quit, remove the window."
2545 (if (> (length (window-list)) 1)
2548 (use-package info-look
2549 :commands info-lookup-add-help)
2551 ** linum (line number)
2552 Various modes should have line numbers in front of each line.
2554 But then there are some where it would just be deadly - like org-mode,
2555 gnus, so we have a list of modes where we don't want to see it.
2556 #+BEGIN_SRC emacs-lisp
2558 :diminish linum-mode
2561 (setq linum-format "%3d ")
2562 (setq linum-mode-inhibit-modes-list '(org-mode
2569 (defadvice linum-on (around linum-on-inhibit-for-modes)
2570 "Stop the load of linum-mode for some major modes."
2571 (unless (member major-mode linum-mode-inhibit-modes-list)
2574 (ad-activate 'linum-on)
2576 (use-package linum-relative
2577 :ensure linum-relative
2580 (setq linum-format 'dynamic)
2583 (global-linum-mode 1))
2586 ** lisp editing stuff
2588 [2013-04-21 So 21:00]
2589 I'm not doing much of it, except for my emacs and gnus configs, but
2590 then I like it nice too...
2591 #+BEGIN_SRC emacs-lisp
2592 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
2594 (defun remove-elc-on-save ()
2595 "If you're saving an elisp file, likely the .elc is no longer valid."
2596 (make-local-variable 'after-save-hook)
2597 (add-hook 'after-save-hook
2599 (if (file-exists-p (concat buffer-file-name "c"))
2600 (delete-file (concat buffer-file-name "c"))))))
2602 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2603 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2605 (use-package paredit
2607 :diminish paredit-mode " π")
2609 (setq lisp-coding-hook 'lisp-coding-defaults)
2610 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
2612 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
2613 (add-hook 'emacs-lisp-mode-hook (lambda ()
2614 (run-hooks 'prelude-emacs-lisp-mode-hook)))
2616 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
2618 (after "elisp-slime-nav"
2619 '(diminish 'elisp-slime-nav-mode))
2620 (after "rainbow-mode"
2621 '(diminish 'rainbow-mode))
2623 '(diminish 'eldoc-mode))
2626 [2013-04-21 So 20:48]
2627 magit is a mode for interacting with git.
2628 #+BEGIN_SRC emacs-lisp
2631 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
2632 magit-git-repo-p magit-list-repos)
2634 :bind (("C-x g" . magit-status)
2635 ("C-x G" . magit-status-with-prefix))
2638 (setq magit-commit-signoff t
2639 magit-repo-dirs '("~/git"
2643 magit-repo-dirs-depth 4
2644 magit-log-auto-more t)
2646 (use-package magit-blame
2647 :commands magit-blame-mode
2650 ; (use-package magit-svn
2652 ; :commands (magit-svn-mode
2653 ; turn-on-magit-svn)
2656 (add-hook 'magit-mode-hook 'hl-line-mode)
2657 (defun magit-status-with-prefix ()
2659 (let ((current-prefix-arg '(4)))
2660 (call-interactively 'magit-status)))
2664 (setenv "GIT_PAGER" "")
2666 (unbind-key "M-h" magit-mode-map)
2667 (unbind-key "M-s" magit-mode-map)
2669 ; (use-package magit-find-file
2670 ; :ensure magit-find-file
2671 ; :commands (magit-find-file-completing-read)
2675 ; (bind-key "C-x C-f" 'magit-find-file-completing-read magit-mode-map)))
2677 (add-hook 'magit-log-edit-mode-hook
2679 (set-fill-column 72)
2682 (defadvice magit-status (around magit-fullscreen activate)
2683 (window-configuration-to-register :magit-fullscreen)
2685 (delete-other-windows))
2687 (defun magit-quit-session ()
2688 "Restores the previous window configuration and kills the magit buffer"
2691 (jump-to-register :magit-fullscreen))
2693 (bind-key "q" 'magit-quit-session magit-status-mode-map)
2695 (defun magit-rebase-unpushed (commit &optional args)
2696 "Start an interactive rebase sequence over all unpushed commits."
2697 (interactive (list (magit-get-tracked-branch)
2698 (magit-rebase-arguments)))
2699 (if (setq commit (magit-rebase-interactive-assert commit))
2700 (magit-run-git-sequencer "rebase" "-i" commit args)
2703 (magit-rebase-interactive (concat commit "^") (list ,@args))))))
2705 (magit-define-popup-action 'magit-rebase-popup ?l "Rebase unpushed" 'magit-rebase-unpushed)
2709 [2014-05-20 Tue 23:04]
2710 #+BEGIN_SRC emacs-lisp
2711 (use-package markdown-mode
2712 :mode (("\\.md\\'" . markdown-mode)
2713 ("\\.mdwn\\'" . markdown-mode))
2717 #+BEGIN_SRC emacs-lisp
2718 (use-package message
2721 (setq message-kill-buffer-on-exit t)))
2724 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
2726 I want to access it from anywhere using =F6=.
2727 #+BEGIN_SRC emacs-lisp
2728 (use-package mingus-stays-home
2729 :bind ( "<f6>" . mingus)
2733 (setq mingus-dired-add-keys t)
2734 (setq mingus-mode-always-modeline nil)
2735 (setq mingus-mode-line-show-elapsed-percentage nil)
2736 (setq mingus-mode-line-show-volume nil)
2737 (setq mingus-mpd-config-file "/etc/mpd.conf")
2738 (setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
2739 (setq mingus-mpd-root "/share/music/")))
2743 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
2744 #+BEGIN_SRC emacs-lisp
2745 (use-package miniedit
2750 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
2751 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
2752 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
2753 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
2758 [2013-05-21 Tue 23:39]
2759 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
2760 coexist in one buffer.
2761 #+BEGIN_SRC emacs-lisp :tangle no
2762 (use-package mmm-auto
2766 (setq mmm-global-mode 'buffers-with-submode-classes)
2767 (setq mmm-submode-decoration-level 2)
2768 (eval-after-load 'mmm-vars
2774 :face mmm-code-submode-face
2775 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
2776 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
2777 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2778 @ "\n" _ "\n" @ "</script>" @)))
2781 :face mmm-code-submode-face
2782 :front "<style[^>]*>[ \t]*\n?"
2783 :back "[ \t]*</style>"
2784 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2785 @ "\n" _ "\n" @ "</style>" @)))
2788 :face mmm-code-submode-face
2791 (dolist (mode (list 'html-mode 'nxml-mode))
2792 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
2793 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
2798 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
2800 #+BEGIN_SRC emacs-lisp
2801 (use-package mo-git-blame
2802 :ensure mo-git-blame
2803 :commands (mo-git-blame-current
2807 (setq mo-git-blame-blame-window-width 25)))
2811 [2013-04-08 Mon 23:57]
2812 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
2813 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
2814 #+BEGIN_SRC emacs-lisp
2815 (use-package multiple-cursors
2816 :ensure multiple-cursors
2818 :commands (mc/remove-fake-cursors
2819 mc/create-fake-cursor-at-point
2820 mc/pop-state-from-overlay
2821 mc/maybe-multiple-cursors-mode)
2822 :defines (multiple-cursors-mode
2824 mc--read-quoted-char
2825 rectangular-region-mode)
2826 :bind (("C-S-c C-S-c" . mc/edit-lines)
2827 ("C->" . mc/mark-next-like-this)
2828 ("C-<" . mc/mark-previous-like-this)
2829 ("C-c C-<" . mc/mark-all-like-this)
2830 ("C-c i" . mc/insert-numbers))
2833 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
2834 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
2835 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
2836 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
2837 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
2838 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
2841 [2014-08-27 Wed 17:15]
2843 #+BEGIN_SRC emacs-lisp
2844 (use-package neotree
2847 :bind (("<f8>" . neotree-toggle))
2848 :commands (neotree-find
2853 (setq neo-smart-open t))
2856 (bind-key "^" 'neotree-select-up-node neotree-mode-map)))
2859 [2013-05-22 Wed 22:02]
2860 nxml-mode is a major mode for editing XML.
2861 #+BEGIN_SRC emacs-lisp
2866 '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
2869 (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
2870 (fset 'xml-mode 'nxml-mode)
2871 (setq nxml-slash-auto-complete-flag t)
2873 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
2874 (defun pp-xml-region (begin end)
2875 "Pretty format XML markup in region. The function inserts
2876 linebreaks to separate tags that have nothing but whitespace
2877 between them. It then indents the markup by using nxml's
2883 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
2884 (backward-char) (insert "\n"))
2885 (indent-region begin end)))
2887 ;;----------------------------------------------------------------------------
2888 ;; Integration with tidy for html + xml
2889 ;;----------------------------------------------------------------------------
2890 ;; tidy is autoloaded
2891 (eval-after-load 'tidy
2893 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
2894 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
2899 *** General settings
2900 [2013-04-28 So 17:06]
2902 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
2903 it is quite extensive. Nevertheless, it starts out small, loading it.
2904 #+BEGIN_SRC emacs-lisp
2908 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
2909 that we need org-protocol.
2910 #+BEGIN_SRC emacs-lisp
2911 (require 'org-protocol)
2916 My current =org-agenda-files= variable only includes a set of
2918 #+BEGIN_SRC emacs-lisp
2919 (setq org-agenda-files (quote ("~/org/"
2925 (setq org-default-notes-file "~/org/notes.org")
2927 =org-mode= manages the =org-agenda-files= variable automatically using
2928 =C-c [= and =C-c ]= to add and remove files respectively. However,
2929 this replaces my directory list with a list of explicit filenames
2930 instead and is not what I want. If this occurs then adding a new org
2931 file to any of the above directories will not contribute to my agenda
2932 and I will probably miss something important.
2934 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
2935 prevent messing up my list of directories in the =org-agenda-files=
2936 variable. I just add and remove directories manually here. Changing
2937 the list of directories in =org-agenda-files= happens very rarely
2938 since new files in existing directories are automatically picked up.
2940 #+BEGIN_SRC emacs-lisp
2941 ;; Keep tasks with dates on the global todo lists
2942 (setq org-agenda-todo-ignore-with-date nil)
2944 ;; Keep tasks with deadlines on the global todo lists
2945 (setq org-agenda-todo-ignore-deadlines nil)
2947 ;; Keep tasks with scheduled dates on the global todo lists
2948 (setq org-agenda-todo-ignore-scheduled nil)
2950 ;; Keep tasks with timestamps on the global todo lists
2951 (setq org-agenda-todo-ignore-timestamp nil)
2953 ;; Remove completed deadline tasks from the agenda view
2954 (setq org-agenda-skip-deadline-if-done t)
2956 ;; Remove completed scheduled tasks from the agenda view
2957 (setq org-agenda-skip-scheduled-if-done t)
2959 ;; Remove completed items from search results
2960 (setq org-agenda-skip-timestamp-if-done t)
2962 ;; Include agenda archive files when searching for things
2963 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
2965 ;; Show all future entries for repeating tasks
2966 (setq org-agenda-repeating-timestamp-show-all t)
2968 ;; Show all agenda dates - even if they are empty
2969 (setq org-agenda-show-all-dates t)
2971 ;; Sorting order for tasks on the agenda
2972 (setq org-agenda-sorting-strategy
2973 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
2974 (todo category-up priority-down effort-up)
2975 (tags category-up priority-down effort-up)
2976 (search category-up))))
2978 ;; Start the weekly agenda on Monday
2979 (setq org-agenda-start-on-weekday 1)
2981 ;; Enable display of the time grid so we can see the marker for the current time
2982 (setq org-agenda-time-grid (quote ((daily today remove-match)
2983 #("----------------" 0 16 (org-heading t))
2984 (0800 1000 1200 1400 1500 1700 1900 2100))))
2986 ;; Display tags farther right
2987 (setq org-agenda-tags-column -102)
2989 ; position the habit graph on the agenda to the right of the default
2990 (setq org-habit-graph-column 50)
2992 ; turn habits back on
2993 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
2996 ;; Agenda sorting functions
2998 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
3001 (setq org-deadline-warning-days 30)
3003 ;; Always hilight the current agenda line
3004 (add-hook 'org-agenda-mode-hook
3005 '(lambda () (hl-line-mode 1))
3009 #+BEGIN_SRC emacs-lisp
3010 (setq org-agenda-persistent-filter t)
3011 (add-hook 'org-agenda-mode-hook
3012 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
3015 (add-hook 'org-agenda-mode-hook
3016 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
3019 (add-hook 'org-agenda-mode-hook
3020 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
3023 (add-hook 'org-agenda-mode-hook
3024 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
3027 (add-hook 'org-agenda-mode-hook
3028 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
3031 ; Rebuild the reminders everytime the agenda is displayed
3032 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
3034 ;(if (file-exists-p "~/org/refile.org")
3035 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
3037 ; Activate appointments so we get notifications
3040 (setq org-agenda-log-mode-items (quote (closed clock state)))
3041 (if (> emacs-major-version 23)
3042 (setq org-agenda-span 3)
3043 (setq org-agenda-ndays 3))
3045 (setq org-agenda-show-all-dates t)
3046 (setq org-agenda-start-on-weekday nil)
3047 (setq org-deadline-warning-days 14)
3050 *** Global keybindings.
3051 Start off by defining a series of keybindings.
3053 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
3054 setup manually, not by org-mode. Also turn off =C-c ;=, which
3055 comments headlines - a function never used.
3056 #+BEGIN_SRC emacs-lisp
3057 (add-hook 'org-mode-hook
3059 (org-defkey org-mode-map "\C-c[" 'undefined)
3060 (org-defkey org-mode-map "\C-c]" 'undefined)
3061 (org-defkey org-mode-map "\C-c;" 'undefined))
3065 And now a largish set of keybindings...
3066 #+BEGIN_SRC emacs-lisp
3067 (bind-key "C-c l" 'org-store-link)
3068 (bind-key "C-c a" 'org-agenda)
3069 ;(bind-key "C-c b" 'org-iswitchb)
3070 (define-key mode-specific-map [?a] 'org-agenda)
3072 (bind-key "<f12>" 'org-agenda)
3073 (bind-key "<f5>" 'bh/org-todo)
3074 (bind-key "<S-f5>" 'bh/widen)
3075 (bind-key "<f7>" 'bh/set-truncate-lines)
3076 ;(bind-key "<f8>" 'org-cycle-agenda-files)
3078 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
3079 (bind-key "<f9> b" 'bbdb)
3080 (bind-key "<f9> c" 'calendar)
3081 (bind-key "<f9> f" 'boxquote-insert-file)
3082 (bind-key "<f9> h" 'bh/hide-other)
3083 (bind-key "<f9> n" 'org-narrow-to-subtree)
3084 (bind-key "<f9> w" 'widen)
3085 (bind-key "<f9> u" 'bh/narrow-up-one-level)
3086 (bind-key "<f9> I" 'bh/punch-in)
3087 (bind-key "<f9> O" 'bh/punch-out)
3088 (bind-key "<f9> H" 'jj/punch-in-hw)
3089 (bind-key "<f9> W" 'jj/punch-out-hw)
3090 (bind-key "<f9> o" 'bh/make-org-scratch)
3091 (bind-key "<f9> p" 'bh/phone-call)
3092 (bind-key "<f9> r" 'boxquote-region)
3093 (bind-key "<f9> s" 'bh/switch-to-scratch)
3094 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
3095 (bind-key "<f9> T" 'tabify)
3096 (bind-key "<f9> U" 'untabify)
3097 (bind-key "<f9> v" 'visible-mode)
3098 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
3099 (bind-key "C-<f9>" 'previous-buffer)
3100 (bind-key "C-<f10>" 'next-buffer)
3101 (bind-key "M-<f9>" 'org-toggle-inline-images)
3102 ;(bind-key "C-x n r" 'narrow-to-region)
3103 (bind-key "<f11>" 'org-clock-goto)
3104 (bind-key "C-<f11>" 'org-clock-in)
3105 (bind-key "C-M-r" 'org-capture)
3106 (bind-key "C-c r" 'org-capture)
3107 (bind-key "C-S-<f12>" 'bh/save-then-publish)
3108 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
3112 *** Tasks, States, Todo fun
3114 First we define the global todo keywords.
3115 #+BEGIN_SRC emacs-lisp
3116 (setq org-todo-keywords
3117 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
3118 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
3120 (setq org-todo-keyword-faces
3121 (quote (("TODO" :foreground "red" :weight bold)
3122 ("NEXT" :foreground "light blue" :weight bold)
3123 ("DONE" :foreground "forest green" :weight bold)
3124 ("WAITING" :foreground "orange" :weight bold)
3125 ("HOLD" :foreground "orange" :weight bold)
3126 ("DELEGATED" :foreground "yellow" :weight bold)
3127 ("CANCELLED" :foreground "dark green" :weight bold)
3128 ("PHONE" :foreground "dark green" :weight bold))))
3131 **** Fast Todo Selection
3132 Fast todo selection allows changing from any task todo state to any
3133 other state directly by selecting the appropriate key from the fast
3134 todo selection key menu.
3135 #+BEGIN_SRC emacs-lisp
3136 (setq org-use-fast-todo-selection t)
3138 Changing a task state is done with =C-c C-t KEY=
3140 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
3143 #+BEGIN_SRC emacs-lisp
3144 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
3146 allows changing todo states with S-left and S-right skipping all of
3147 the normal processing when entering or leaving a todo state. This
3148 cycles through the todo states but skips setting timestamps and
3149 entering notes which is very convenient when all you want to do is fix
3150 up the status of an entry.
3152 **** Todo State Triggers
3153 I have a few triggers that automatically assign tags to tasks based on
3154 state changes. If a task moves to =CANCELLED= state then it gets a
3155 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
3156 =CANCELLED= tag. These are used for filtering tasks in agenda views
3157 which I'll talk about later.
3159 The triggers break down to the following rules:
3161 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
3162 - Moving a task to =WAITING= adds a =WAITING= tag
3163 - Moving a task to =HOLD= adds a =WAITING= tag
3164 - Moving a task to a done state removes a =WAITING= tag
3165 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
3166 - Moving a task to =NEXT= removes a =WAITING= tag
3167 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
3169 The tags are used to filter tasks in the agenda views conveniently.
3170 #+BEGIN_SRC emacs-lisp
3171 (setq org-todo-state-tags-triggers
3172 (quote (("CANCELLED" ("CANCELLED" . t))
3173 ("WAITING" ("WAITING" . t))
3174 ("HOLD" ("WAITING" . t) ("HOLD" . t))
3175 (done ("WAITING") ("HOLD"))
3176 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
3177 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
3178 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
3181 *** Capturing new tasks
3182 Org capture replaces the old remember mode.
3183 #+BEGIN_SRC emacs-lisp
3184 (setq org-directory "~/org")
3185 (setq org-default-notes-file "~/org/refile.org")
3187 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
3188 ;; see http://orgmode.org/manual/Template-elements.html
3189 (setq org-capture-templates
3190 (quote (("t" "todo" entry (file "~/org/refile.org")
3191 "* TODO %?\nAdded: %U\n"
3192 :clock-in t :clock-resume t)
3193 ("l" "linktodo" entry (file "~/org/refile.org")
3194 "* TODO %?\nAdded: %U\n%a\n"
3195 :clock-in t :clock-resume t)
3196 ("r" "respond" entry (file "~/org/refile.org")
3197 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
3198 :clock-in t :clock-resume t :immediate-finish t)
3199 ("n" "note" entry (file "~/org/refile.org")
3200 "* %? :NOTE:\nAdded: %U\n%a\n"
3201 :clock-in t :clock-resume t)
3202 ("d" "Delegated" entry (file "~/org/refile.org")
3203 "* DELEGATED %?\nAdded: %U\n%a\n"
3204 :clock-in t :clock-resume t)
3205 ("j" "Journal" entry (file+datetree "~/org/diary.org")
3207 :clock-in t :clock-resume t)
3208 ("w" "org-protocol" entry (file "~/org/refile.org")
3209 "* TODO Review %c\nAdded: %U\n"
3210 :immediate-finish t)
3211 ("p" "Phone call" entry (file "~/org/refile.org")
3212 "* PHONE %? :PHONE:\nAdded: %U"
3213 :clock-in t :clock-resume t)
3214 ("x" "Bookmark link" entry (file "~/org/refile.org")
3215 "* Bookmark: %c\n%i\nAdded: %U\n"
3216 :immediate-finish t)
3217 ("h" "Habit" entry (file "~/org/refile.org")
3218 "* NEXT %?\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\nAdded: %U\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n")
3222 Capture mode now handles automatically clocking in and out of a
3223 capture task. This all works out of the box now without special hooks.
3224 When I start a capture mode task the task is clocked in as specified
3225 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
3226 resumes on the original clocking task.
3228 The quick clocking in and out of capture mode tasks (often it takes
3229 less than a minute to capture some new task details) can leave
3230 empty clock drawers in my tasks which aren't really useful.
3231 The following prevents this.
3232 #+BEGIN_SRC emacs-lisp
3233 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
3237 All my newly captured entries end up in =refile.org= and want to be
3238 moved over to the right place. The following is the setup for it.
3239 #+BEGIN_SRC emacs-lisp
3240 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
3241 (setq org-refile-targets (quote ((nil :maxlevel . 9)
3242 (org-agenda-files :maxlevel . 9))))
3244 ; Use full outline paths for refile targets - we file directly with IDO
3245 (setq org-refile-use-outline-path t)
3247 ; Targets complete directly with IDO
3248 (setq org-outline-path-complete-in-steps nil)
3250 ; Allow refile to create parent tasks with confirmation
3251 (setq org-refile-allow-creating-parent-nodes (quote confirm))
3253 ; Use IDO for both buffer and file completion and ido-everywhere to t
3254 (setq org-completion-use-ido t)
3255 (setq org-completion-use-iswitchb nil)
3256 :; Use IDO for both buffer and file completion and ido-everywhere to t
3257 ;(setq ido-everywhere t)
3258 ;(setq ido-max-directory-size 100000)
3259 ;(ido-mode (quote both))
3260 ; Use the current window when visiting files and buffers with ido
3261 (setq ido-default-file-method 'selected-window)
3262 (setq ido-default-buffer-method 'selected-window)
3264 ;;;; Refile settings
3265 (setq org-refile-target-verify-function 'bh/verify-refile-target)
3269 Agenda view is the central place for org-mode interaction...
3270 #+BEGIN_SRC emacs-lisp
3271 ;; Do not dim blocked tasks
3272 (setq org-agenda-dim-blocked-tasks nil)
3273 ;; Compact the block agenda view
3274 (setq org-agenda-compact-blocks t)
3276 ;; Custom agenda command definitions
3277 (setq org-agenda-custom-commands
3278 (quote (("N" "Notes" tags "NOTE"
3279 ((org-agenda-overriding-header "Notes")
3280 (org-tags-match-list-sublevels t)))
3281 ("h" "Habits" tags-todo "STYLE=\"habit\""
3282 ((org-agenda-overriding-header "Habits")
3283 (org-agenda-sorting-strategy
3284 '(todo-state-down effort-up category-keep))))
3288 ((org-agenda-overriding-header "Tasks to Refile")
3289 (org-tags-match-list-sublevels nil)))
3290 (tags-todo "-HOLD-CANCELLED/!"
3291 ((org-agenda-overriding-header "Projects")
3292 (org-agenda-skip-function 'bh/skip-non-projects)
3293 (org-agenda-sorting-strategy
3295 (tags-todo "-CANCELLED/!"
3296 ((org-agenda-overriding-header "Stuck Projects")
3297 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3298 (tags-todo "-WAITING-CANCELLED/!NEXT"
3299 ((org-agenda-overriding-header "Next Tasks")
3300 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3301 (org-agenda-todo-ignore-scheduled t)
3302 (org-agenda-todo-ignore-deadlines t)
3303 (org-agenda-todo-ignore-with-date t)
3304 (org-tags-match-list-sublevels t)
3305 (org-agenda-sorting-strategy
3306 '(todo-state-down effort-up category-keep))))
3307 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3308 ((org-agenda-overriding-header "Tasks")
3309 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3310 (org-agenda-todo-ignore-scheduled t)
3311 (org-agenda-todo-ignore-deadlines t)
3312 (org-agenda-todo-ignore-with-date t)
3313 (org-agenda-sorting-strategy
3315 (tags-todo "-CANCELLED+WAITING/!"
3316 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
3317 (org-agenda-skip-function 'bh/skip-stuck-projects)
3318 (org-tags-match-list-sublevels nil)
3319 (org-agenda-todo-ignore-scheduled 'future)
3320 (org-agenda-todo-ignore-deadlines 'future)))
3322 ((org-agenda-overriding-header "Tasks to Archive")
3323 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3324 (org-tags-match-list-sublevels nil))))
3326 ("r" "Tasks to Refile" tags "REFILE"
3327 ((org-agenda-overriding-header "Tasks to Refile")
3328 (org-tags-match-list-sublevels nil)))
3329 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
3330 ((org-agenda-overriding-header "Stuck Projects")
3331 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3332 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
3333 ((org-agenda-overriding-header "Next Tasks")
3334 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3335 (org-agenda-todo-ignore-scheduled t)
3336 (org-agenda-todo-ignore-deadlines t)
3337 (org-agenda-todo-ignore-with-date t)
3338 (org-tags-match-list-sublevels t)
3339 (org-agenda-sorting-strategy
3340 '(todo-state-down effort-up category-keep))))
3341 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3342 ((org-agenda-overriding-header "Tasks")
3343 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3344 (org-agenda-sorting-strategy
3346 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
3347 ((org-agenda-overriding-header "Projects")
3348 (org-agenda-skip-function 'bh/skip-non-projects)
3349 (org-agenda-sorting-strategy
3351 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
3352 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
3353 (org-tags-match-list-sublevels nil))
3354 ("A" "Tasks to Archive" tags "-REFILE/"
3355 ((org-agenda-overriding-header "Tasks to Archive")
3356 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3357 (org-tags-match-list-sublevels nil))))))
3359 ; Overwrite the current window with the agenda
3360 (setq org-agenda-window-setup 'current-window)
3365 #+BEGIN_SRC emacs-lisp
3367 ;; Resume clocking task when emacs is restarted
3368 (org-clock-persistence-insinuate)
3370 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
3371 (setq org-clock-history-length 36)
3372 ;; Resume clocking task on clock-in if the clock is open
3373 (setq org-clock-in-resume t)
3374 ;; Change tasks to NEXT when clocking in
3375 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
3376 ;; Separate drawers for clocking and logs
3377 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
3378 ;; Save clock data and state changes and notes in the LOGBOOK drawer
3379 (setq org-clock-into-drawer t)
3380 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
3381 (setq org-clock-out-remove-zero-time-clocks t)
3382 ;; Clock out when moving task to a done state
3383 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
3384 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
3385 (setq org-clock-persist t)
3386 ;; Do not prompt to resume an active clock
3387 (setq org-clock-persist-query-resume nil)
3388 ;; Enable auto clock resolution for finding open clocks
3389 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
3390 ;; Include current clocking task in clock reports
3391 (setq org-clock-report-include-clocking-task t)
3393 ; use discrete minute intervals (no rounding) increments
3394 (setq org-time-stamp-rounding-minutes (quote (1 1)))
3396 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
3398 (setq bh/keep-clock-running nil)
3400 (setq org-agenda-clock-consistency-checks
3401 (quote (:max-duration "4:00"
3404 :gap-ok-around ("4:00"))))
3408 **** Setting a default clock task
3409 Per default the =** Organization= task in my tasks.org file receives
3410 misc clock time. This is the task I clock in on when I punch in at the
3411 start of my work day with =F9-I=. Punching-in anywhere clocks in this
3412 Organization task as the default task.
3414 If I want to change the default clocking task I just visit the
3415 new task in any org buffer and clock it in with =C-u C-u C-c C-x
3416 C-i=. Now this new task that collects miscellaneous clock
3417 minutes when the clock would normally stop.
3419 You can quickly clock in the default clocking task with =C-u C-c
3420 C-x C-i d=. Another option is to repeatedly clock out so the
3421 clock moves up the project tree until you clock out the
3422 top-level task and the clock moves to the default task.
3425 #+BEGIN_SRC emacs-lisp
3426 ;; Agenda clock report parameters
3427 (setq org-agenda-clockreport-parameter-plist
3428 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3430 ;; Agenda log mode items to display (closed and state changes by default)
3431 (setq org-agenda-log-mode-items (quote (closed state)))
3433 **** Task estimates, column view
3434 Setup column view globally with the following headlines
3435 #+BEGIN_SRC emacs-lisp
3436 ; Set default column view headings: Task Effort Clock_Summary
3437 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
3439 Setup the estimate for effort values.
3440 #+BEGIN_SRC emacs-lisp
3441 ; global Effort estimate values
3442 ; global STYLE property values for completion
3443 (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
3444 ("STYLE_ALL" . "habit"))))
3448 Tags are mostly used for filtering inside the agenda.
3449 #+BEGIN_SRC emacs-lisp
3450 ; Tags with fast selection keys
3451 (setq org-tag-alist (quote ((:startgroup)
3469 ; Allow setting single tags without the menu
3470 (setq org-fast-tag-selection-single-key (quote expert))
3472 ; For tag searches ignore tasks with scheduled and deadline dates
3473 (setq org-agenda-tags-todo-honor-ignore-options t)
3477 #+BEGIN_SRC emacs-lisp
3478 (setq org-archive-mark-done nil)
3479 (setq org-archive-location "%s_archive::* Archived Tasks")
3483 #+BEGIN_SRC emacs-lisp
3484 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
3485 (setq org-plantuml-jar-path "~/java/plantuml.jar")
3487 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
3489 ; Make babel results blocks lowercase
3490 (setq org-babel-results-keyword "results")
3492 (org-babel-do-load-languages
3493 (quote org-babel-load-languages)
3494 (quote ((emacs-lisp . t)
3513 ; Do not prompt to confirm evaluation
3514 ; This may be dangerous - make sure you understand the consequences
3515 ; of setting this -- see the docstring for details
3516 (setq org-confirm-babel-evaluate nil)
3518 ; Use fundamental mode when editing plantuml blocks with C-c '
3519 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
3522 #+BEGIN_SRC emacs-lisp
3523 ;; Don't have images visible on startup, breaks on console
3524 (setq org-startup-with-inline-images nil)
3527 #+BEGIN_SRC emacs-lisp
3528 (add-to-list 'org-structure-template-alist
3529 '("n" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"
3530 "<comment>\n?\n</comment>"))
3532 **** ditaa, graphviz, etc
3533 Those are all nice tools. Look at
3534 http://doc.norang.ca/org-mode.html#playingwithditaa for a nice intro
3537 *** Publishing and exporting
3540 Org-mode can export to a variety of publishing formats including (but not limited to)
3543 (plain text - but not the original org-mode file)
3547 which enables getting to lots of other formats like ODF, XML, etc
3549 via LaTeX or Docbook
3552 A new exporter created by Nicolas Goaziou was introduced in org 8.0.
3554 #+BEGIN_SRC emacs-lisp
3555 ;; Explicitly load required exporters
3559 ;; FIXME, check the following two
3560 ;(require 'ox-icalendar)
3563 ; experimenting with docbook exports - not finished
3564 (setq org-export-docbook-xsl-fo-proc-command "fop %s %s")
3565 (setq org-export-docbook-xslt-proc-command "xsltproc --output %s /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl %s")
3567 ;; define categories that should be excluded
3568 (setq org-export-exclude-category (list "google" "google"))
3569 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
3571 ; define how the date strings look
3572 (setq org-export-date-timestamp-format "%Y-%m-%d")
3573 ; Inline images in HTML instead of producting links to the image
3574 (setq org-html-inline-images t)
3575 ; Do not use sub or superscripts - I currently don't need this functionality in my documents
3576 (setq org-export-with-sub-superscripts nil)
3578 (setq org-html-head-extra (concat
3579 "<link rel=\"stylesheet\" href=\"https://ganneff.de/stylesheet.css\" type=\"text/css\" />\n"
3581 (setq org-html-head-include-default-style nil)
3582 ; Do not generate internal css formatting for HTML exports
3583 (setq org-export-htmlize-output-type (quote css))
3584 ; Export with LaTeX fragments
3585 (setq org-export-with-LaTeX-fragments t)
3586 ; Increase default number of headings to export
3587 (setq org-export-headline-levels 6)
3590 (setq org-publish-project-alist
3593 :base-directory "~/.emacs.d/"
3594 :base-extension "org"
3596 :publishing-directory "/develop/www/emacs"
3598 :publishing-function org-html-publish-to-html
3599 :headline-levels 4 ; Just the default for this project.
3605 :base-directory "~/.emacs.d/"
3606 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
3607 :publishing-directory "/develop/www/emacs"
3608 :exclude "elisp\\|elpa\\|elpa.off\\|auto-save-list\\|cache\\|eshell\\|image-dired\\|themes\\|url"
3610 :publishing-function org-publish-attachment
3612 ("inherit-org-info-js"
3613 :base-directory "/develop/vcs/org-info-js/"
3615 :base-extension "js"
3616 :publishing-directory "/develop/www/"
3617 :publishing-function org-publish-attachment
3619 ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
3624 (setq org-export-with-timestamps nil)
3629 #+BEGIN_SRC emacs-lisp
3630 (setq org-latex-to-pdf-process
3631 '("xelatex -interaction nonstopmode %f"
3632 "xelatex -interaction nonstopmode %f")) ;; for multiple passes
3633 (setq org-export-latex-listings 'minted)
3634 (setq org-latex-listings t)
3636 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3637 ;; but adapted to use latexmk 4.20 or higher.
3638 (defun my-auto-tex-cmd ()
3639 "When exporting from .org with latex, automatically run latex,
3640 pdflatex, or xelatex as appropriate, using latexmk."
3642 ;; default command: oldstyle latex via dvi
3643 (setq texcmd "latexmk -dvi -pdfps -quiet %f")
3645 (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3646 (setq texcmd "latexmk -pdf -quiet %f"))
3648 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3649 (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
3650 ;; LaTeX compilation command
3651 (setq org-latex-to-pdf-process (list texcmd)))
3653 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3655 ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3656 (setq org-export-latex-packages-alist
3658 ("" "longtable" nil)
3663 (defun my-auto-tex-parameters ()
3664 "Automatically select the tex packages to include."
3665 ;; default packages for ordinary latex or pdflatex export
3666 (setq org-export-latex-default-packages-alist
3667 '(("AUTO" "inputenc" t)
3677 ("" "hyperref" nil)))
3679 ;; Packages to include when xelatex is used
3680 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3681 (setq org-export-latex-default-packages-alist
3686 ("german" "babel" t)
3687 ("babel" "csquotes" t)
3689 ("xetex" "hyperref" nil)
3692 (if (string-match "#+LATEX_CMD: xelatex" (buffer-string))
3693 (setq org-export-latex-classes
3695 "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
3696 ("\\section{%s}" . "\\section*{%s}")
3697 ("\\subsection{%s}" . "\\subsection*{%s}")
3698 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3699 ("\\paragraph{%s}" . "\\paragraph*{%s}")
3700 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3701 org-export-latex-classes))))
3703 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
3706 *** Prevent editing invisible text
3707 The following setting prevents accidentally editing hidden text when
3708 the point is inside a folded region. This can happen if you are in
3709 the body of a heading and globally fold the org-file with =S-TAB=
3711 I find invisible edits (and undo's) hard to deal with so now I can't
3712 edit invisible text. =C-c C-r= (org-reveal) will display where the
3713 point is if it is buried in invisible text to allow editing again.
3715 #+BEGIN_SRC emacs-lisp
3716 (setq org-catch-invisible-edits 'error)
3720 #+BEGIN_SRC emacs-lisp
3721 ;; disable the default org-mode stuck projects agenda view
3722 (setq org-stuck-projects (quote ("" nil nil "")))
3724 ; force showing the next headline.
3725 (setq org-show-entry-below (quote ((default))))
3727 (setq org-show-following-heading t)
3728 (setq org-show-hierarchy-above t)
3729 (setq org-show-siblings (quote ((default))))
3731 (setq org-special-ctrl-a/e t)
3732 (setq org-special-ctrl-k t)
3733 (setq org-yank-adjusted-subtrees t)
3735 (setq org-table-export-default-format "orgtbl-to-csv")
3739 The following setting adds alphabetical lists like
3743 #+BEGIN_SRC emacs-lisp
3744 (if (> emacs-major-version 23)
3745 (setq org-list-allow-alphabetical t)
3746 (setq org-alphabetical-lists t))
3749 #+BEGIN_SRC emacs-lisp
3750 (setq org-remove-highlights-with-change nil)
3752 (setq org-list-demote-modify-bullet (quote (("+" . "-")
3759 (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
3762 ; If we leave Emacs running overnight - reset the appointments one minute after midnight
3763 (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
3768 #+BEGIN_SRC emacs-lisp
3769 ;; Enable abbrev-mode
3770 (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
3771 (setq org-startup-indented t)
3772 (setq org-startup-folded t)
3773 (setq org-cycle-separator-lines 0)
3776 I find extra blank lines in lists and headings a bit of a nuisance.
3777 To get a body after a list you need to include a blank line between
3778 the list entry and the body -- and indent the body appropriately.
3779 Most of my lists have no body detail so I like the look of collapsed
3780 lists with no blank lines better.
3782 The following setting prevents creating blank lines before headings
3783 but allows list items to adapt to existing blank lines around the items:
3784 #+BEGIN_SRC emacs-lisp
3785 (setq org-blank-before-new-entry (quote ((heading)
3786 (plain-list-item . auto))))
3789 #+BEGIN_SRC emacs-lisp
3790 (setq org-reverse-note-order nil)
3791 (setq org-default-notes-file "~/notes.org")
3794 Enforce task blocking. Tasks can't go done when there is any subtask
3795 still open. Unless they have a property of =NOBLOCKING: t=
3796 #+BEGIN_SRC emacs-lisp
3797 (setq org-enforce-todo-checkbox-dependencies t)
3798 (setq org-enforce-todo-dependencies t)
3801 #+BEGIN_SRC emacs-lisp
3802 (setq org-fast-tag-selection-single-key (quote expert))
3803 (setq org-footnote-auto-adjust t)
3804 (setq org-hide-block-startup t)
3805 (setq org-icalendar-alarm-time 15)
3806 (setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
3807 (setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
3808 (setq org-icalendar-honor-noexport-tag t)
3809 (setq org-icalendar-include-bbdb-anniversaries nil)
3810 (setq org-icalendar-include-body 200)
3811 (setq org-icalendar-include-todo nil)
3812 (setq org-icalendar-store-UID t)
3813 (setq org-icalendar-timezone "Europe/Berlin")
3814 (setq org-insert-mode-line-in-empty-file t)
3815 (setq org-log-done (quote note))
3816 (setq org-log-into-drawer t)
3817 (setq org-log-state-notes-insert-after-drawers nil)
3818 (setq org-log-reschedule (quote time))
3819 (setq org-log-states-order-reversed t)
3820 (setq org-mobile-agendas (quote all))
3821 (setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
3822 (setq org-mobile-inbox-for-pull "~/org/refile.org")
3823 (setq org-remember-store-without-prompt t)
3824 (setq org-return-follows-link t)
3825 (setq org-reverse-note-order t)
3827 ; regularly save our org-mode buffers
3828 (run-at-time "00:59" 3600 'org-save-all-org-buffers)
3830 (setq org-log-done t)
3832 (setq org-enable-priority-commands t)
3833 (setq org-default-priority ?E)
3834 (setq org-lowest-priority ?E)
3839 Speed commands enable single-letter commands in Org-mode files when
3840 the point is at the beginning of a headline, or at the beginning of a
3843 See the `=org-speed-commands-default=' variable for a list of the keys
3844 and commands enabled at the beginning of headlines. All code blocks
3845 are available at the beginning of a code block, the following key
3846 sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
3847 display a list of the code blocks commands and their related keys.
3849 #+BEGIN_SRC emacs-lisp
3850 (setq org-use-speed-commands nil)
3851 (setq org-speed-commands-user (quote (("0" . ignore)
3864 ("h" . bh/hide-other)
3867 (call-interactively 'org-insert-heading-respect-content))
3868 ("k" . org-kill-note-or-show-branches)
3871 ("q" . bh/show-org-agenda)
3873 ("s" . org-save-all-org-buffers)
3877 ("z" . org-add-note)
3882 ("F" . bh/restrict-to-file-or-follow)
3885 ("J" . org-clock-goto)
3889 ("N" . bh/narrow-to-org-subtree)
3890 ("P" . bh/narrow-to-org-project)
3895 ("U" . bh/narrow-up-one-org-level)
3902 (add-hook 'org-agenda-mode-hook
3904 (define-key org-agenda-mode-map "q" 'bury-buffer))
3907 (defvar bh/current-view-project nil)
3908 (add-hook 'org-agenda-mode-hook
3909 '(lambda () (org-defkey org-agenda-mode-map "V" 'bh/view-next-project))
3914 The following displays the contents of code blocks in Org-mode files
3915 using the major-mode of the code. It also changes the behavior of
3916 =TAB= to as if it were used in the appropriate major mode. This means
3917 that reading and editing code form inside of your Org-mode files is
3918 much more like reading and editing of code using its major mode.
3920 #+BEGIN_SRC emacs-lisp
3921 (setq org-src-fontify-natively t)
3922 (setq org-src-tab-acts-natively t)
3925 #+BEGIN_SRC emacs-lisp
3926 (setq org-src-preserve-indentation nil)
3927 (setq org-edit-src-content-indentation 0)
3931 #+BEGIN_SRC emacs-lisp
3932 (setq org-attach-directory "~/org/data/")
3934 #+BEGIN_SRC emacs-lisp
3935 (setq org-agenda-sticky t)
3938 **** Checklist handling
3939 [2013-05-11 Sat 22:15]
3941 #+BEGIN_SRC emacs-lisp
3942 ;(require 'org-checklist)
3946 I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
3948 #+BEGIN_SRC emacs-lisp
3949 (use-package cperl-mode
3950 :commands cperl-mode
3953 (defalias 'perl-mode 'cperl-mode)
3954 (add-auto-mode 'cperl-mode "\\.\\([pP][Llm]\\|al\\)\\'")
3955 (add-auto-mode 'pod-mode "\\.pod$")
3956 (add-auto-mode 'tt-mode "\\.tt$")
3957 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
3958 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
3959 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
3963 (setq cperl-invalid-face nil
3964 cperl-close-paren-offset -4
3965 cperl-continued-statement-offset 0
3966 cperl-indent-level 4
3967 cperl-indent-parens-as-block t
3969 cperl-electric-keywords t
3970 cperl-electric-lbrace-space t
3971 cperl-electric-parens nil
3972 cperl-highlight-variables-indiscriminately t
3973 cperl-imenu-addback t
3974 cperl-invalid-face (quote underline)
3975 cperl-lazy-help-time 5
3976 cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$"
3977 cperl-syntaxify-by-font-lock t
3978 cperl-use-syntax-table-text-property-for-tags t)
3980 ;; And have cperl mode give ElDoc a useful string
3981 (defun my-cperl-eldoc-documentation-function ()
3982 "Return meaningful doc string for `eldoc-mode'."
3984 (let ((cperl-message-on-help-error nil))
3986 (add-hook 'cperl-mode-hook
3988 (set (make-local-variable 'eldoc-documentation-function)
3989 'my-cperl-eldoc-documentation-function)
3994 [2014-05-22 Thu 00:05]
3995 #+BEGIN_SRC emacs-lisp
3996 (use-package puppet-mode
3997 :mode ("\\.pp\\'" . puppet-mode)
3998 :commands puppet-mode
4001 (defun my-puppet-mode-hook ()
4002 (setq require-final-newline nil))
4003 (add-hook 'puppet-mode-hook 'my-puppet-mode-hook))
4006 (use-package puppet-ext
4009 (bind-key "C-x ?" 'puppet-set-anchor puppet-mode-map)
4010 (bind-key "C-c C-r" 'puppet-create-require puppet-mode-map)))))
4014 Use elpy for the emacs python fun, but dont let it initialize all the
4015 various variables. Elpy author may like them, but I'm not him...
4016 #+BEGIN_SRC emacs-lisp
4019 :mode ("\.py" . python-mode)
4022 (safe-load (concat jj-elisp-dir "/elpy/elpy-autoloads.el"))
4029 :commands (nosetests-all nosetests-module nosetests-one
4030 nosetests-failed nosetests-pdb-all
4031 nosetests-pdb-module nosetests-pdb-one)
4036 :commands (pyvenv-activate pyvenv-deactivate pyvenv-mode pyvenv-restart-python)
4039 (use-package idomenu
4044 (use-package highlight-indentation
4046 :commands (highlight-indentation-mode))
4048 (use-package find-file-in-project
4050 :commands (find-file-in-project ffip-project-files ffip ))
4055 ;; Local variables in `python-mode'. This is not removed when Elpy
4056 ;; is disabled, which can cause some confusion.
4057 (add-hook 'python-mode-hook 'elpy-initialize-local-variables)
4059 (defun my-python-mode-hook ()
4060 (setq require-final-newline nil)
4061 (setq mode-require-final-newline))
4062 (add-hook 'python-mode-hook 'my-python-mode-hook)
4064 ;; Flymake support using flake8, including warning faces.
4065 (when (and (executable-find "flake8")
4066 (not (executable-find python-check-command)))
4067 (setq python-check-command "flake8"))
4069 ;; `flymake-no-changes-timeout': The original value of 0.5 is too
4070 ;; short for Python code, as that will result in the current line to
4071 ;; be highlighted most of the time, and that's annoying. This value
4072 ;; might be on the long side, but at least it does not, in general,
4073 ;; interfere with normal interaction.
4074 (setq flymake-no-changes-timeout 60)
4076 ;; `flymake-start-syntax-check-on-newline': This should be nil for
4077 ;; Python, as;; most lines with a colon at the end will mean the next
4078 ;; line is always highlighted as error, which is not helpful and
4080 (setq flymake-start-syntax-check-on-newline nil)
4082 ;; `ac-auto-show-menu': Short timeout because the menu is great.
4083 (setq ac-auto-show-menu 0.4)
4085 ;; `ac-quick-help-delay': I'd like to show the menu right with the
4086 ;; completions, but this value should be greater than
4087 ;; `ac-auto-show-menu' to show help for the first entry as well.
4088 (setq ac-quick-help-delay 0.5)
4090 ;; `yas-trigger-key': TAB, as is the default, conflicts with the
4091 ;; autocompletion. We also need to tell yasnippet about the new
4092 ;; binding. This is a bad interface to set the trigger key. Stop
4094 (let ((old (when (boundp 'yas-trigger-key)
4096 (setq yas-trigger-key "C-c C-i")
4097 (when (fboundp 'yas--trigger-key-reload)
4098 (yas--trigger-key-reload old)))
4100 ;; yas-snippet-dirs can be a string for a single directory. Make
4101 ;; sure it's a list in that case so we can add our own entry.
4102 (when (not (listp yas-snippet-dirs))
4103 (setq yas-snippet-dirs (list yas-snippet-dirs)))
4104 (add-to-list 'yas-snippet-dirs
4105 (concat (file-name-directory (locate-library "elpy"))
4109 ;; Now load yasnippets.
4112 (elpy-use-ipython)))
4117 #+BEGIN_SRC emacs-lisp :tangle no
4118 (autoload 'python-mode "python-mode" "Python Mode." t)
4119 (add-auto-mode 'python-mode "\\.py\\'")
4120 (add-auto-mode 'python-mode "\\.py$")
4121 (add-auto-mode 'python-mode "SConstruct\\'")
4122 (add-auto-mode 'python-mode "SConscript\\'")
4123 (add-to-list 'interpreter-mode-alist '("python" . python-mode))
4126 (set-variable 'py-indent-offset 4)
4127 (set-variable 'py-smart-indentation nil)
4128 (set-variable 'indent-tabs-mode nil)
4129 (define-key python-mode-map "\C-m" 'newline-and-indent)
4130 (turn-on-eldoc-mode)
4131 (defun python-auto-fill-comments-only ()
4133 (set (make-local-variable 'fill-nobreak-predicate)
4135 (not (python-in-string/comment)))))
4136 (add-hook 'python-mode-hook
4138 (python-auto-fill-comments-only)))
4140 (autoload 'pymacs-apply "pymacs")
4141 (autoload 'pymacs-call "pymacs")
4142 (autoload 'pymacs-eval "pymacs" nil t)
4143 (autoload 'pymacs-exec "pymacs" nil t)
4144 (autoload 'pymacs-load "pymacs" nil t))
4147 If an =ipython= executable is on the path, then assume that IPython is
4148 the preferred method python evaluation.
4149 #+BEGIN_SRC emacs-lisp :tangle no
4150 (when (executable-find "ipython")
4152 (setq org-babel-python-mode 'python-mode))
4154 (setq python-shell-interpreter "ipython")
4155 (setq python-shell-interpreter-args "")
4156 (setq python-shell-prompt-regexp "In \\[[0-9]+\\]: ")
4157 (setq python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: ")
4158 (setq python-shell-completion-setup-code
4159 "from IPython.core.completerlib import module_completion")
4160 (setq python-shell-completion-module-string-code
4161 "';'.join(module_completion('''%s'''))\n")
4162 (setq python-shell-completion-string-code
4163 "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
4165 ** rainbow-delimiters
4166 [2013-04-09 Di 23:38]
4167 [[http://www.emacswiki.org/emacs/RainbowDelimiters][EmacsWiki: Rainbow Delimiters]] is a “rainbow parentheses”-like mode
4168 which highlights parens, brackets, and braces according to their
4169 depth. Each successive level is highlighted a different color. This
4170 makes it easy to spot matching delimiters, orient yourself in the code,
4171 and tell which statements are at the same depth.
4172 #+BEGIN_SRC emacs-lisp
4173 (use-package rainbow-delimiters
4174 :ensure rainbow-delimiters
4175 :commands rainbow-delimiters-mode
4177 (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
4180 #+BEGIN_SRC emacs-lisp
4181 (use-package rainbow-mode
4182 :ensure rainbow-mode
4184 :diminish rainbow-mode)
4189 #+BEGIN_SRC emacs-lisp
4190 (use-package re-builder
4191 :commands re-builder
4194 (setq reb-re-syntax 'string))
4197 [2014-05-19 Mo 22:56]
4198 Recentf is a minor mode that builds a list of recently opened
4199 files. This list is is automatically saved across Emacs sessions.
4200 #+BEGIN_SRC emacs-lisp
4201 (use-package recentf
4202 :if (not noninteractive)
4203 :bind ("C-x C-r" . recentf-open-files)