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 no
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/emacs-color-theme-solarized"
229 (defun jj-init-theme ()
231 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
232 (load-theme 'solarized-light t))
233 (set-face-attribute 'org-date nil :underline nil)
234 (message "Initializing theme solarized-dark")
236 (add-to-list 'custom-theme-load-path jj-theme-dir)
237 (add-hook 'after-init-hook 'jj-init-theme)
241 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
242 #+BEGIN_SRC emacs-lisp
243 (if (fboundp 'fringe-mode)
247 A bit more spacing between buffer lines
248 #+BEGIN_SRC emacs-lisp
249 (setq-default line-spacing 0.1)
252 [2013-04-21 So 20:54]
253 I do not want my cursor to blink.
254 #+BEGIN_SRC emacs-lisp
255 (blink-cursor-mode -1)
257 *** Menu, Tool and Scrollbar
258 I don't want to see the menu-bar, tool-bar or scrollbar.
259 #+BEGIN_SRC emacs-lisp
261 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
262 (when (fboundp mode) (funcall mode -1))))
264 **** When using emacs in daemon mode
265 Emacs has a very nice mode where it detaches itself and runs as daemon -
266 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
267 Client]]. It's fast, it's nice, it's convinient.
269 Except that Emacs behaves stupid when you do that and ignores your
270 menu/tool/scrollbar settings. Sucks.
272 For them to work even then, we have to do two things.
273 1. We have to set the frame alist. We simple set both,
274 =initial-frame-alist= and =default-frame-alist= to the same value here.
275 #+BEGIN_SRC emacs-lisp
276 (setq initial-frame-alist '(
277 (horizontal-scroll-bars . nil)
278 (vertical-scroll-bars . nil)
281 (setq default-frame-alist (copy-alist initial-frame-alist))
283 2. We have to disable the toolbar using the customize interface, so you
284 can find that in the [[id:0102208d-fdf6-4928-9e40-7e341bd3aa3a][Customized variables]] section.
286 *** Hilight current line in buffer
287 As it says, it does a hilight of the current line.
288 #+BEGIN_SRC emacs-lisp
289 (global-hl-line-mode +1)
291 *** Allow recursive minibuffers
292 This allows (additional) minibuffer commands while in the minibuffer.
293 #+BEGIN_SRC emacs-lisp
294 (setq enable-recursive-minibuffers 't)
297 *** Modeline related changes
298 I want to see line and column numbers, so turn them on.
299 Size indication lets me know how far I am in a buffer.
301 And modeline-posn is great. It will hilight the column number in the
302 modeline in red as soon as you are over the defined limit.
305 #+BEGIN_SRC emacs-lisp
307 (column-number-mode 1)
308 (size-indication-mode 1)
309 (display-time-mode 1)
310 (setq display-time-day-and-date nil)
311 (setq display-time-default-load-average nil)
312 (setq display-time-24hr-format t)
313 (setq modelinepos-column-limit 72)
315 (use-package modeline-posn
316 :ensure modeline-posn
319 (set-face-foreground 'modelinepos-column-warning "grey20")
320 (set-face-background 'modelinepos-column-warning "red")
321 (setq modelinepos-column-limit 72))
326 [2013-04-22 Mon 11:27]
327 The modeline is easily cluttered up with stuff I don't really need to
328 see. So lets hide those. There are two ways, one of them uses diminish
329 to get entirely rid of some modes, the other is a function taken from
330 "Mastering Emacs" which replaces the modes text with an own (set of)
332 #+BEGIN_SRC emacs-lisp
334 (diminish 'auto-fill-function)
335 (defvar mode-line-cleaner-alist
336 `((auto-complete-mode . " α")
337 (yas-minor-mode . " y")
338 (paredit-mode . " π")
342 (lisp-interaction-mode . "λ")
345 (emacs-lisp-mode . "EL")
347 (org-indent-mode . "")
352 "Alist for `clean-mode-line'.
354 When you add a new element to the alist, keep in mind that you
355 must pass the correct minor/major mode symbol and a string you
356 want to use in the modeline *in lieu of* the original.
358 Want some symbols? Go:
360 ;ςερτζθιοπασδφγηξκλυχψωβνμ
361 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
362 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
366 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
369 Unfortunately icicles breaks this with the way it adds/removes itself,
370 so take it our for now...
373 Back when I started with text-mode. But nowadays I want default mode to
374 be org-mode - it is just so much better to use. And does sensible things
375 with many README files out there, and various other "crap" you get to
377 #+BEGIN_SRC emacs-lisp :tangle yes
378 (setq-default major-mode 'org-mode)
380 #+BEGIN_SRC emacs-lisp :tangle no
381 (setq initial-major-mode 'org-mode)
385 [2013-04-23 Tue 16:43]
386 Shell. zsh in my case.
387 #+BEGIN_SRC emacs-lisp
388 (setq shell-file-name "zsh")
389 (setq shell-command-switch "-c")
390 (setq explicit-shell-file-name shell-file-name)
391 (setenv "SHELL" shell-file-name)
392 (setq explicit-sh-args '("-login" "-i"))
393 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
394 (setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
395 (setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
396 (setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
397 (setq comint-completion-autolist t) ; show completion list when ambiguous
398 (setq comint-input-ignoredups t) ; no duplicates in command history
399 (setq comint-completion-addsuffix t) ; insert space/slash after file completion
400 (setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
401 (setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
405 ** Miscellaneous stuff
406 Searches and matches should ignore case.
407 #+BEGIN_SRC emacs-lisp
408 (setq-default case-fold-search t)
411 Which buffers to get rid off at midnight.
412 #+BEGIN_SRC emacs-lisp
413 (setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
414 "*Man " "*Buffer List*"
420 "*magit" "*Calendar")))
423 Don't display a cursor in non-selected windows.
424 #+BEGIN_SRC emacs-lisp
425 (setq-default cursor-in-non-selected-windows nil)
428 What should be displayed in the mode-line for files with those types
430 #+BEGIN_SRC emacs-lisp
431 (setq eol-mnemonic-dos "(DOS)")
432 (setq eol-mnemonic-mac "(Mac)")
435 Much larger threshold for garbage collection prevents it to run too often.
436 #+BEGIN_SRC emacs-lisp
437 (setq gc-cons-threshold 48000000)
440 #+BEGIN_SRC emacs-lisp
441 (setq max-lisp-eval-depth 1000)
442 (setq max-specpdl-size 3000)
446 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
447 #+BEGIN_SRC emacs-lisp
448 (defun unfill-paragraph ()
449 "Takes a multi-line paragraph and makes it into a single line of text."
451 (let ((fill-column (point-max)))
452 (fill-paragraph nil)))
453 (bind-key "H-u" 'unfill-paragraph)
456 #+BEGIN_SRC emacs-lisp
457 (setq-default indicate-empty-lines t)
458 (setq sentence-end-double-space nil)
461 Hilight annotations in comments, like FIXME/TODO/...
462 #+BEGIN_SRC emacs-lisp
463 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
467 #+BEGIN_SRC emacs-lisp
468 (setq browse-url-browser-function (quote browse-url-generic))
469 (setq browse-url-generic-program "/usr/bin/x-www-browser")
472 *** When saving a script - make it executable
473 #+BEGIN_SRC emacs-lisp
474 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
478 #+BEGIN_SRC emacs-lisp
482 (add-hook 'after-init-hook 'server-start)))
485 ** Customized variables
486 [2013-05-02 Thu 22:14]
487 The following contains a set of variables i may reasonably want to
488 change on other systems - which don't affect the init file loading
489 process. So I *can* use the customization interface for it...
490 #+BEGIN_SRC emacs-lisp
491 (defgroup ganneff nil
492 "Modify ganneffs settings"
495 (defgroup ganneff-org-mode nil
496 "Ganneffs org-mode settings"
497 :tag "Ganneffs org-mode settings"
499 :link '(custom-group-link "ganneff"))
501 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
502 "ID of the organization task."
503 :tag "Organization Task ID"
505 :group 'ganneff-org-mode)
507 (defcustom org-my-archive-expiry-days 2
508 "The number of days after which a completed task should be auto-archived.
509 This can be 0 for immediate, or a floating point value."
510 :tag "Archive expiry days"
512 :group 'ganneff-org-mode)
517 [2013-05-21 Tue 23:22]
518 Restore removed var alias, used by ruby-electric-brace and others
519 #+BEGIN_SRC emacs-lisp
520 (unless (boundp 'last-command-char)
521 (defvaralias 'last-command-char 'last-command-event))
523 * Customized variables
525 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
527 Of course I want to be able to use the customize interface, and some
528 things can only be set via it (or so they say). I usually prefer to put
529 things I keep for a long while into statements somewhere else, not just
530 custom-set here, but we need it anyways.
532 #+BEGIN_SRC emacs-lisp
533 (setq custom-file jj-custom-file)
534 (safe-load custom-file)
537 The source of this is:
538 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
539 * Extra modes and their configuration
541 A defined abbrev is a word which expands, if you insert it, into some
542 different text. Abbrevs are defined by the user to expand in specific
544 #+BEGIN_SRC emacs-lisp
546 :commands abbrev-mode
547 :diminish abbrev-mode
549 (hook-into-modes #'abbrev-mode '(text-mode-hook))
552 (setq save-abbrevs 'silently)
553 (setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
554 (if (file-exists-p abbrev-file-name)
555 (quietly-read-abbrev-file))
557 (add-hook 'expand-load-hook
559 (add-hook 'expand-expand-hook 'indent-according-to-mode)
560 (add-hook 'expand-jump-hook 'indent-according-to-mode)))))
563 [2013-04-28 So 11:26]
564 Quickly move around in buffers.
565 #+BEGIN_SRC emacs-lisp
566 (use-package ace-jump-mode
567 :ensure ace-jump-mode
568 :commands ace-jump-mode
569 :bind ("H-SPC" . ace-jump-mode))
572 [2013-04-21 So 20:27]
573 Use H-w to switch windows
574 #+BEGIN_SRC emacs-lisp
575 (use-package ace-window
578 :bind ("H-w" . ace-window))
581 [2014-10-27 Mon 13:08]
582 electric-indent-mode is enough to keep your code nicely aligned when
583 all you do is type. However, once you start shifting blocks around,
584 transposing lines, or slurping and barfing sexps, indentation is bound
587 aggressive-indent-mode is a minor mode that keeps your code always
588 indented. It reindents after every command, making it more reliable
589 than electric-indent-mode.
590 #+BEGIN_SRC emacs-lisp
591 (use-package aggressive-indent
592 :ensure aggressive-indent
593 :commands (aggressive-indent-mode global-aggressive-indent-mode)
596 (global-aggressive-indent-mode 0)
597 (setq aggressive-indent-comments-too 0)
598 (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
602 [2014-06-01 Sun 23:02]
603 Provides a minor mode which displays current match and total matches
604 information in the mode-line in various search modes.
605 #+BEGIN_SRC emacs-lisp
612 (global-anzu-mode 1))
615 (setq anzu-search-threshold 1000)
616 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
619 [2014-05-21 Wed 00:33]
620 #+BEGIN_SRC emacs-lisp
622 :commands (ascii-on ascii-toggle ascii-display)
623 :bind (("C-c e A" . ascii-toggle))
626 (defun ascii-toggle ()
628 (defvar ascii-display nil)
633 (bind-key "C-c e A" 'ascii-toggle)))
636 #+BEGIN_SRC emacs-lisp
637 (setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
638 (setq TeX-auto-save t)
639 (setq TeX-parse-self t)
640 (setq TeX-PDF-mode t)
642 ** auto-complete mode
643 [2013-04-27 Sa 16:33]
644 And aren't we all lazy? I definitely am, and I like my emacs doing as
645 much possible work for me as it can.
646 So here, auto-complete-mode, which lets emacs do this, based on what I
648 #+BEGIN_SRC emacs-lisp
649 (use-package auto-complete-config
650 :ensure auto-complete
655 ;; hook AC into completion-at-point
656 (defun sanityinc/auto-complete-at-point ()
657 (when (and (not (minibufferp))
658 (fboundp 'auto-complete-mode)
661 (defun set-auto-complete-as-completion-at-point-function ()
662 (add-to-list 'completion-at-point-functions 'sanityinc/auto-complete-at-point))
663 ;; Exclude very large buffers from dabbrev
664 (defun sanityinc/dabbrev-friend-buffer (other-buffer)
665 (< (buffer-size other-buffer) (* 1 1024 1024)))
670 ;; custom keybindings to use tab, enter and up and down arrows
671 (bind-key "\t" 'ac-expand ac-complete-mode-map)
672 (bind-key "\r" 'ac-complete ac-complete-mode-map)
673 (bind-key "M-n" 'ac-next ac-complete-mode-map)
674 (bind-key "M-p" 'ac-previous ac-complete-mode-map)
675 (bind-key "C-s" 'ac-isearch ac-completing-map)
676 (bind-key "M-TAB" 'auto-complete ac-mode-map)
678 (setq ac-comphist-file (expand-file-name "ac-comphist.dat" jj-cache-dir))
679 (setq ac-use-comphist t)
680 (setq ac-expand-on-auto-complete nil)
682 (setq ac-auto-start 3)
684 (setq ac-menu-height 15)
685 (setq ac-quick-help-delay 0.5)
686 (setq ac-use-fuzzy t)
688 (ac-flyspell-workaround)
690 ;; use 't when auto-complete is disabled
691 (setq tab-always-indent 'complete)
692 (add-to-list 'completion-styles 'initials t)
694 ;; Use space and punctuation to accept the current the most likely completion.
695 (setq auto-completion-syntax-alist (quote (global accept . word)))
696 ;; Avoid completion for short trivial words.
697 (setq auto-completion-min-chars (quote (global . 3)))
698 (setq completion-use-dynamic t)
700 (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
702 ;; Exclude very large buffers from dabbrev
703 (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
705 (use-package ac-dabbrev
708 (set-default 'ac-sources
711 ac-source-words-in-buffer
712 ac-source-words-in-same-mode-buffers
713 ; ac-source-words-in-all-buffer
716 (dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
717 sass-mode yaml-mode csv-mode espresso-mode haskell-mode
718 html-mode nxml-mode sh-mode smarty-mode clojure-mode
719 lisp-mode textile-mode markdown-mode tuareg-mode python-mode
720 js3-mode css-mode less-css-mode sql-mode ielm-mode))
721 (add-to-list 'ac-modes mode))
723 (add-hook 'latex-mode-hook 'auto-complete-mode)
724 (add-hook 'LaTeX-mode-hook 'auto-complete-mode)
725 (add-hook 'prog-mode-hook 'auto-complete-mode)
726 (add-hook 'org-mode-hook 'auto-complete-mode)))
731 When files change outside emacs for whatever reason I want emacs to deal
732 with it. Not to have to revert buffers myself
733 #+BEGIN_SRC emacs-lisp
734 (use-package autorevert
735 :commands auto-revert-mode
736 :diminish auto-revert-mode
739 (setq global-auto-revert-mode t)
740 (setq global-auto-revert-non-file-buffers t)
741 (global-auto-revert-mode)))
745 Emacs should keep backup copies of files I edit, but I do not want them
746 to clutter up the filesystem everywhere. So I put them into one defined
747 place, backup-directory, which even contains my username (for systems
748 where =temporary-file-directory= is not inside my home).
749 #+BEGIN_SRC emacs-lisp
750 (use-package backups-mode
751 :load-path "elisp/backups-mode"
752 :bind (("\C-cv" . save-version)
753 ("\C-cb" . list-backups)
754 ("\C-ck" . kill-buffer-prompt)
755 ("\C-cw" . backup-walker-start))
758 (setq backup-directory jj-backup-directory)
759 ;(setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
760 ;(if (not (file-exists-p tramp-backup-directory))
761 ; (make-directory tramp-backup-directory))
762 ;(setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
763 (setq backup-directory-alist `(("." . ,jj-backup-directory)))
764 (setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
765 (setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
767 (setq version-control t) ;; Use version numbers for backups
768 (setq kept-new-versions 10) ;; Number of newest versions to keep
769 (setq kept-old-versions 2) ;; Number of oldest versions to keep
770 (setq delete-old-versions t) ;; Ask to delete excess backup versions?
771 (setq backup-by-copying t)
772 (setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
773 (setq make-backup-files t)
775 (defadvice kill-buffer (around kill-buffer)
776 "Always save before killing a file buffer"
777 (when (and (buffer-modified-p)
779 (file-exists-p (buffer-file-name)))
782 (ad-activate 'kill-buffer)
784 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
785 "Always save before killing emacs"
786 (save-some-buffers t)
788 (ad-activate 'save-buffers-kill-emacs)
790 (defun kill-buffer-prompt ()
791 "Allows one to kill a buffer without saving it.
792 This is necessary since once you start backups-mode all file based buffers
793 are saved automatically when they are killed"
795 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
797 (set-buffer-modified-p nil))
800 (setq backup-enable-predicate
802 (and (normal-backup-enable-predicate name)
804 (let ((method (file-remote-p name 'method)))
805 (when (stringp method)
806 (member method '("su" "sudo"))))))))))
810 [2014-12-11 Thu 11:31]
811 #+BEGIN_SRC emacs-lisp
812 (use-package browse-kill-ring
813 :commands (browse-kill-ring browse-kill-ring-mode)
814 :bind ("M-y" . browse-kill-ring)
818 [2014-06-10 Tue 22:20]
819 #+BEGIN_SRC emacs-lisp
821 :commands (cal/insert)
822 :bind ("C-c c" . cal/insert)
825 ; Weeks start on Monday, not sunday.
826 (setq calendar-week-start-day 1)
828 ; Display ISO week numbers in Calendar Mode
829 (copy-face font-lock-constant-face 'calendar-iso-week-face)
830 (set-face-attribute 'calendar-iso-week-face nil :height 0.7)
831 (setq calendar-intermonth-text
835 (calendar-iso-from-absolute
836 (calendar-absolute-from-gregorian (list month day year)))))
837 'font-lock-face 'calendar-iso-week-face))
838 (copy-face 'default 'calendar-iso-week-header-face)
839 (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7)
840 (setq calendar-intermonth-header
841 (propertize "Wk" ; or e.g. "KW" in Germany
842 'font-lock-face 'calendar-iso-week-header-face))))
847 [2013-05-21 Tue 23:18]
848 #+BEGIN_SRC emacs-lisp
849 (use-package crontab-mode
851 :commands crontab-mode
852 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
856 web-mode takes over, see [[*web-mode][web-mode]]
857 #+BEGIN_SRC emacs-lisp :tangle no
858 (use-package css-mode
859 :mode ("\\.css\\'" . css-mode)
864 (use-package flymake-css
868 (defun maybe-flymake-css-load ()
869 "Activate flymake-css as necessary, but not in derived modes."
870 (when (eq major-mode 'css-mode)
872 (add-hook 'css-mode-hook 'maybe-flymake-css-load)))
873 ;;; Auto-complete CSS keywords
874 (eval-after-load 'auto-complete
876 (dolist (hook '(css-mode-hook sass-mode-hook scss-mode-hook))
877 (add-hook hook 'ac-css-mode-setup))))))
881 I know that this lets it look "more like windows", but I don't much care
882 about its paste/copy/cut keybindings, the really nice part is the great
883 support for rectangular regions, which I started to use a lot since I
884 know this mode. The normal keybindings for those are just to useless.
885 #+BEGIN_SRC emacs-lisp
887 (setq cua-enable-cua-keys (quote shift))
890 Luckily cua-mode easily supports this, with the following line I just
891 get the CUA selection and rectangle stuff, not the keybindings. Yes,
892 even though the above =cua-enable-cua-keys= setting would only enable
893 them if the selection is done when the region was marked with a shifted
895 #+BEGIN_SRC emacs-lisp
896 (cua-selection-mode t)
900 #+BEGIN_SRC emacs-lisp
901 (require 'dpkg-dev-el-loaddefs nil 'noerror)
902 (require 'debian-el-loaddefs nil 'noerror)
904 (setq debian-changelog-full-name "Joerg Jaspert")
905 (setq debian-changelog-mailing-address "joerg@debian.org")
909 #+BEGIN_SRC emacs-lisp
910 (use-package diff-mode
912 :mode (("\\.diff" . diff-mode))
914 (use-package diff-mode-))
918 #+BEGIN_SRC emacs-lisp
920 :commands (dired dired-other-window dired-other-frame dired-noselect
921 dired-mode dired-jump)
922 :defines (dired-omit-regexp-orig)
925 (setq diredp-hide-details-initially-flag nil))
928 (setq dired-auto-revert-buffer (quote dired-directory-changed-p))
929 (setq dired-dwim-target t)
930 (setq dired-listing-switches "-alh")
931 (setq dired-listing-switches "-alXh --group-directories-first")
932 (setq dired-recursive-copies (quote top))
933 (setq dired-recursive-deletes (quote top))
934 (setq dired-guess-shell-alist-user
935 '(("\\.pdf\\'" "mupdf" "evince")
936 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
937 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
938 ("\\.\\(?:xcf\\)\\'" "gimp")
939 ("\\.csv\\'" "libreoffice")
940 ("\\.tex\\'" "pdflatex" "latex")
941 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
942 ("\\.html?\\'" "conkeror")))
944 (bind-key "F" 'find-name-dired dired-mode-map)
949 (use-package dired-x)
951 (use-package dired-single
955 (bind-key "<return>" 'dired-single-buffer dired-mode-map)
956 (bind-key "<mouse-1>" 'dired-single-buffer-mouse dired-mode-map)
959 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
965 (setq wdired-allow-to-change-permissions t)
966 (bind-key "r" 'wdired-change-to-wdired-mode dired-mode-map)))
968 (use-package gnus-dired
969 :commands (gnus-dired-attach gnus-dired-mode)
972 ;;(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
973 (bind-key "a" 'gnus-dired-attach dired-mode-map)))
978 (defvar mark-files-cache (make-hash-table :test #'equal))
980 (defun mark-similar-versions (name)
982 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
983 (setq pat (match-string 1 pat)))
984 (or (gethash pat mark-files-cache)
985 (ignore (puthash pat t mark-files-cache)))))
987 (defun dired-mark-similar-version ()
989 (setq mark-files-cache (make-hash-table :test #'equal))
990 (dired-mark-sexp '(mark-similar-versions name)))
992 (defun dired-package-initialize ()
993 (unless (featurep 'runner)
994 (bind-key "M-!" 'async-shell-command dired-mode-map)
995 (unbind-key "M-s f" dired-mode-map)
997 (defadvice dired-omit-startup (after diminish-dired-omit activate)
998 "Make sure to remove \"Omit\" from the modeline."
999 (diminish 'dired-omit-mode) dired-mode-map)
1001 ;; Omit files that Git would ignore
1002 (defun dired-omit-regexp ()
1003 (let ((file (expand-file-name ".git"))
1005 (while (and (not (file-exists-p file))
1008 (file-name-directory
1009 (directory-file-name
1010 (file-name-directory file))))
1011 ;; Give up if we are already at the root dir.
1012 (not (string= (file-name-directory file)
1014 ;; Move up to the parent dir and try again.
1015 (setq file (expand-file-name ".git" parent-dir)))
1016 ;; If we found a change log in a parent, use that.
1017 (if (file-exists-p file)
1018 (let ((regexp (funcall dired-omit-regexp-orig))
1020 (shell-command-to-string "git clean -d -x -n")))
1021 (if (= 0 (length omitted-files))
1025 (if (> (length regexp) 0)
1034 (if (= ?/ (aref str (1- (length str))))
1038 (split-string omitted-files "\n" t)
1041 (funcall dired-omit-regexp-orig))))))
1043 (add-hook 'dired-mode-hook 'dired-package-initialize)
1045 (defun dired-double-jump (first-dir second-dir)
1047 (list (read-directory-name "First directory: "
1048 (expand-file-name "~")
1049 nil nil "/Downloads/")
1050 (read-directory-name "Second directory: "
1051 (expand-file-name "~")
1054 (dired-other-window second-dir))
1055 (bind-key "C-c J" 'dired-double-jump)
1057 (defun dired-back-to-top ()
1059 (goto-char (point-min))
1060 (dired-next-line 4))
1062 (define-key dired-mode-map
1063 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
1065 (defun dired-jump-to-bottom ()
1067 (goto-char (point-max))
1068 (dired-next-line -1))
1070 (define-key dired-mode-map
1071 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
1074 ** discover-my-major
1075 [2014-06-01 Sun 23:32]
1076 Discover key bindings and their meaning for the current Emacs major mode.
1077 #+BEGIN_SRC emacs-lisp
1078 (use-package discover-my-major
1079 :ensure discover-my-major
1080 :commands discover-my-major
1081 :bind ("C-h C-m" . discover-my-major))
1084 EasyPG is a GnuPG interface for Emacs.
1085 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1086 #+BEGIN_SRC emacs-lisp
1087 (use-package epa-file
1091 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1092 (defadvice epg--start (around advice-epg-disable-agent disable)
1093 "Don't allow epg--start to use gpg-agent in plain text
1095 (if (display-graphic-p)
1097 (let ((agent (getenv "GPG_AGENT_INFO")))
1098 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
1100 (setenv "GPG_AGENT_INFO" agent))))
1101 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
1102 (ad-activate 'epg--start)
1106 [2013-04-21 So 20:36]
1107 ediff - don't start another frame
1108 #+BEGIN_SRC emacs-lisp
1112 (defvar ctl-period-equals-map)
1113 (define-prefix-command 'ctl-period-equals-map)
1114 (bind-key "C-. =" 'ctl-period-equals-map)
1115 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
1117 :bind (("C-. = b" . ediff-buffers)
1118 ("C-. = B" . ediff-buffers3)
1119 ("C-. = =" . ediff-files)
1120 ("C-. = f" . ediff-files)
1121 ("C-. = F" . ediff-files3)
1122 ("C-. = r" . ediff-revision)
1123 ("C-. = p" . ediff-patch-file)
1124 ("C-. = P" . ediff-patch-buffer)
1125 ("C-. = l" . ediff-regions-linewise)
1126 ("C-. = w" . ediff-regions-wordwise))
1128 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
1129 (setq ediff-split-window-function 'split-window-horizontally)
1135 EMMS is the Emacs Multimedia System.
1136 #+BEGIN_SRC emacs-lisp :tangle no
1137 (require 'emms-source-file)
1138 (require 'emms-source-playlist)
1139 (require 'emms-info)
1140 (require 'emms-cache)
1141 (require 'emms-playlist-mode)
1142 (require 'emms-playing-time)
1143 (require 'emms-player-mpd)
1144 (require 'emms-playlist-sort)
1145 (require 'emms-mark)
1146 (require 'emms-browser)
1147 (require 'emms-lyrics)
1148 (require 'emms-last-played)
1149 (require 'emms-score)
1150 (require 'emms-tag-editor)
1151 (require 'emms-history)
1152 (require 'emms-i18n)
1154 (setq emms-playlist-default-major-mode 'emms-playlist-mode)
1155 (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track)
1156 (emms-playing-time 1)
1158 (add-hook 'emms-player-started-hook 'emms-last-played-update-current)
1159 ;(add-hook 'emms-player-started-hook 'emms-player-mpd-sync-from-emms)
1161 (when (fboundp 'emms-cache) ; work around compiler warning
1163 (setq emms-score-default-score 3)
1165 (defun emms-mpd-init ()
1166 "Connect Emms to mpd."
1168 (emms-player-mpd-connect))
1171 (require 'emms-player-mpd)
1172 (setq emms-player-mpd-server-name "localhost")
1173 (setq emms-player-mpd-server-port "6600")
1174 (add-to-list 'emms-info-functions 'emms-info-mpd)
1175 (add-to-list 'emms-player-list 'emms-player-mpd)
1176 (setq emms-volume-change-function 'emms-volume-mpd-change)
1177 (setq emms-player-mpd-sync-playlist t)
1179 (setq emms-source-file-default-directory "/var/lib/mpd/music")
1180 (setq emms-player-mpd-music-directory "/var/lib/mpd/music")
1181 (setq emms-info-auto-update t)
1182 (setq emms-lyrics-scroll-p t)
1183 (setq emms-lyrics-display-on-minibuffer t)
1184 (setq emms-lyrics-display-on-modeline nil)
1185 (setq emms-lyrics-dir "~/.emacs.d/var/lyrics")
1187 (setq emms-last-played-format-alist
1188 '(((emms-last-played-seconds-today) . "%H:%M")
1189 (604800 . "%a %H:%M") ; this week
1190 ((emms-last-played-seconds-month) . "%d.%m.%Y")
1191 ((emms-last-played-seconds-year) . "%d.%m.%Y")
1192 (t . "Never played")))
1195 (defun my-describe (track)
1196 (let* ((empty "...")
1197 (name (emms-track-name track))
1198 (type (emms-track-type track))
1199 (short-name (file-name-nondirectory name))
1200 (play-count (or (emms-track-get track 'play-count) 0))
1201 (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
1202 (artist (or (emms-track-get track 'info-artist) empty))
1203 (year (emms-track-get track 'info-year))
1204 (playing-time (or (emms-track-get track 'info-playing-time) 0))
1205 (min (/ playing-time 60))
1206 (sec (% playing-time 60))
1207 (album (or (emms-track-get track 'info-album) empty))
1208 (tracknumber (emms-track-get track 'info-tracknumber))
1209 (short-name (file-name-sans-extension
1210 (file-name-nondirectory name)))
1211 (title (or (emms-track-get track 'info-title) short-name))
1212 (rating (emms-score-get-score name))
1215 (format "%12s %20s (%.4s) [%-20s] - %2s. %-30s | %2d %s"
1216 (emms-last-played-format-date last-played)
1220 (if (and tracknumber ; tracknumber
1221 (not (zerop (string-to-number tracknumber))))
1222 (format "%02d" (string-to-number tracknumber))
1226 (make-string rating rate-char)))
1229 (setq emms-track-description-function 'my-describe)
1231 ;; (global-set-key (kbd "C-<f9> t") 'emms-play-directory-tree)
1232 ;; (global-set-key (kbd "H-<f9> e") 'emms-play-file)
1233 (global-set-key (kbd "H-<f9> <f9>") 'emms-mpd-init)
1234 (global-set-key (kbd "H-<f9> d") 'emms-play-dired)
1235 (global-set-key (kbd "H-<f9> x") 'emms-start)
1236 (global-set-key (kbd "H-<f9> v") 'emms-stop)
1237 (global-set-key (kbd "H-<f9> n") 'emms-next)
1238 (global-set-key (kbd "H-<f9> p") 'emms-previous)
1239 (global-set-key (kbd "H-<f9> o") 'emms-show)
1240 (global-set-key (kbd "H-<f9> h") 'emms-shuffle)
1241 (global-set-key (kbd "H-<f9> SPC") 'emms-pause)
1242 (global-set-key (kbd "H-<f9> a") 'emms-add-directory-tree)
1243 (global-set-key (kbd "H-<f9> b") 'emms-smart-browse)
1244 (global-set-key (kbd "H-<f9> l") 'emms-playlist-mode-go)
1246 (global-set-key (kbd "H-<f9> r") 'emms-toggle-repeat-track)
1247 (global-set-key (kbd "H-<f9> R") 'emms-toggle-repeat-playlist)
1248 (global-set-key (kbd "H-<f9> m") 'emms-lyrics-toggle-display-on-minibuffer)
1249 (global-set-key (kbd "H-<f9> M") 'emms-lyrics-toggle-display-on-modeline)
1251 (global-set-key (kbd "H-<f9> <left>") (lambda () (interactive) (emms-seek -10)))
1252 (global-set-key (kbd "H-<f9> <right>") (lambda () (interactive) (emms-seek +10)))
1253 (global-set-key (kbd "H-<f9> <down>") (lambda () (interactive) (emms-seek -60)))
1254 (global-set-key (kbd "H-<f9> <up>") (lambda () (interactive) (emms-seek +60)))
1256 (global-set-key (kbd "H-<f9> s u") 'emms-score-up-playing)
1257 (global-set-key (kbd "H-<f9> s d") 'emms-score-down-playing)
1258 (global-set-key (kbd "H-<f9> s o") 'emms-score-show-playing)
1259 (global-set-key (kbd "H-<f9> s s") 'emms-score-set-playing)
1261 (define-key emms-playlist-mode-map "u" 'emms-score-up-playing)
1262 (define-key emms-playlist-mode-map "d" 'emms-score-down-playing)
1263 (define-key emms-playlist-mode-map "o" 'emms-score-show-playing)
1264 (define-key emms-playlist-mode-map "s" 'emms-score-set-playing)
1265 (define-key emms-playlist-mode-map "r" 'emms-mpd-init)
1266 (define-key emms-playlist-mode-map "N" 'emms-playlist-new)
1268 (define-key emms-playlist-mode-map "x" 'emms-start)
1269 (define-key emms-playlist-mode-map "v" 'emms-stop)
1270 (define-key emms-playlist-mode-map "n" 'emms-next)
1271 (define-key emms-playlist-mode-map "p" 'emms-previous)
1273 (setq emms-playlist-buffer-name "*EMMS Playlist*"
1274 emms-playlist-mode-open-playlists t)
1280 'emms-browser-artist-face nil
1285 (setq emms-player-mpd-supported-regexp
1286 (or (emms-player-mpd-get-supported-regexp)
1287 (concat "\\`http://\\|"
1288 (emms-player-simple-regexp
1289 "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff"))))
1290 (emms-player-set emms-player-mpd 'regex emms-player-mpd-supported-regexp)
1294 Basic settings for emacs integrated shell
1295 #+BEGIN_SRC emacs-lisp :tangle no
1301 (defun eshell-initialize ()
1302 (defun eshell-spawn-external-command (beg end)
1303 "Parse and expand any history references in current input."
1306 (when (looking-back "&!" beg)
1307 (delete-region (match-beginning 0) (match-end 0))
1309 (insert "spawn "))))
1310 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1311 (eval-after-load "em-unix"
1313 (unintern 'eshell/su)
1314 (unintern 'eshell/sudo))))
1315 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1319 (defalias 'emacs 'find-file)
1320 (defalias 'ec 'find-file)
1321 (defalias 'e 'find-file)
1325 (use-package 'em-cmpl)
1326 (use-package 'em-prompt)
1327 (use-package 'em-term)
1329 (setq eshell-cmpl-cycle-completions nil
1330 eshell-save-history-on-exit t
1331 eshell-buffer-maximum-lines 20000
1332 eshell-history-size 350
1333 eshell-buffer-shorthand t
1334 eshell-highlight-prompt t
1335 eshell-plain-echo-behavior t
1336 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1338 (setenv "PAGER" "cat")
1339 (setq eshell-visual-commands
1340 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1341 (setq eshell-visual-subcommands
1342 '(("git" "log" "l" "diff" "show")))
1344 (add-to-list 'eshell-command-completions-alist
1345 '("gunzip" "gz\\'"))
1346 (add-to-list 'eshell-command-completions-alist
1347 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1349 (when (not (functionp 'eshell/rgrep))
1350 (defun eshell/rgrep (&rest args)
1351 "Use Emacs grep facility instead of calling external grep."
1352 (eshell-grep "rgrep" args t)))
1354 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1355 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1356 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1357 (add-hook 'eshell-preoutput-filter-functions
1358 'ansi-color-filter-apply)
1359 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1361 (defmacro with-face (str &rest properties)
1362 `(propertize ,str 'face (list ,@properties)))
1364 (defun eshell/abbr-pwd ()
1365 (let ((home (getenv "HOME"))
1366 (path (eshell/pwd)))
1368 ((string-equal home path) "~")
1369 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1372 (defun eshell/my-prompt ()
1373 (let ((header-bg "#161616"))
1375 (with-face user-login-name :foreground "cyan")
1376 (with-face (concat "@" hostname) :foreground "white")
1378 (with-face (eshell/abbr-pwd) :foreground "#009900")
1379 (if (= (user-uid) 0)
1380 (with-face "#" :foreground "red")
1381 (with-face "$" :foreground "#69b7f0"))
1384 (use-package eshell-prompt-extras
1388 (setq eshell-highlight-prompt nil
1389 ;; epe-git-dirty-char "Ϟ"
1390 epe-git-dirty-char "*"
1391 eshell-prompt-function 'epe-theme-dakrone)))
1393 (defun eshell/magit ()
1394 "Function to open magit-status for the current directory"
1396 (magit-status default-directory)
1399 (setq eshell-prompt-function 'eshell/my-prompt)
1400 (setq eshell-highlight-prompt nil)
1401 (setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1406 Incremental search is great, but annoyingly you need to type whatever
1407 you want. If you want to search for just the next (or previous)
1408 occurence of what is at your cursor position use the following.
1409 *C-x* will insert the current word while *M-up* and *M-down* will just
1410 jump to the next/previous occurence of it.
1411 #+BEGIN_SRC emacs-lisp
1412 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
1413 (bind-key* "<M-up>" 'sacha/search-word-backward)
1414 (bind-key* "<M-down>" 'sacha/search-word-forward)
1417 *** Frame configuration
1418 I want to see the buffername and its size, not the host I am on in my
1420 #+BEGIN_SRC emacs-lisp
1421 (setq frame-title-format "%b (%i)")
1424 *** Protect some buffers
1425 I don't want some buffers to be killed, **scratch** for example.
1426 In the past I had a long function that just recreated them, but the
1427 =keep-buffers= package is easier.
1428 #+BEGIN_SRC emacs-lisp
1429 (use-package keep-buffers
1432 (keep-buffers-mode 1)
1433 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1434 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1435 (push '("\\`*Group" . nil) keep-buffers-protected-alist)
1440 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
1442 #+BEGIN_SRC emacs-lisp
1443 (defalias 'yes-or-no-p 'y-or-n-p)
1446 *** Language/i18n stuff
1447 In this day and age, UTF-8 is the way to go.
1448 #+BEGIN_SRC emacs-lisp
1449 (set-language-environment 'utf-8)
1450 (set-default-coding-systems 'utf-8)
1451 (set-terminal-coding-system 'utf-8)
1452 (set-keyboard-coding-system 'utf-8)
1453 (set-clipboard-coding-system 'utf-8)
1454 (prefer-coding-system 'utf-8)
1455 (set-charset-priority 'unicode)
1456 (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
1457 (when (display-graphic-p)
1458 (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
1461 *** Hilight matching parentheses
1462 While I do have the nifty shortcut to jump to the other parentheses,
1463 hilighting them makes it obvious where they are.
1464 #+BEGIN_SRC emacs-lisp
1465 (use-package mic-paren
1469 *** Kill other buffers
1470 While many editors allow you to close "all the other files, not the one
1471 you are in", emacs doesn't have this... Except, now it will.
1472 (Update 30.05.2014: Not used ever, deactivated)
1473 #+BEGIN_SRC emacs-lisp :tangle no
1474 (bind-key "C-c k" 'prelude-kill-other-buffers)
1477 Default scrolling behaviour in emacs is a bit annoying, who wants to
1479 #+BEGIN_SRC emacs-lisp
1480 (setq scroll-margin 0)
1481 (setq scroll-conservatively 100000)
1482 (setq scroll-up-aggressively 0.0)
1483 (setq scroll-down-aggressively 0.0)
1484 (setq scroll-preserve-screen-position t)
1487 *** Copy/Paste with X
1488 [2013-04-09 Di 23:31]
1489 The default how emacs handles cutting/pasting with the primary selection
1490 changed in emacs24. I am used to the old way, so get it back.
1491 #+BEGIN_SRC emacs-lisp
1492 (setq select-enable-primary t)
1493 (setq select-enable-clipboard nil)
1494 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1495 (setq mouse-drag-copy-region t)
1497 *** Global keyboard changes not directly related to a mode
1498 Disable /suspend_frame/ function, I dislike it.
1499 #+BEGIN_SRC emacs-lisp
1501 (unbind-key "C-x C-z")
1504 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
1505 #+BEGIN_SRC emacs-lisp
1506 (defmacro bol-with-prefix (function)
1507 "Define a new function which calls FUNCTION.
1508 Except it moves to beginning of line before calling FUNCTION when
1509 called with a prefix argument. The FUNCTION still receives the
1511 (let ((name (intern (format "endless/%s-BOL" function))))
1515 "Call `%s', but move to BOL when called with a prefix argument."
1520 (call-interactively ',function))
1523 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
1524 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
1525 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
1528 Default of *C-k* is to kill from the point to the end of line. If
1529 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
1530 set, including newline. But to kill the entire line, one still needs a
1531 *C-a* in front of it. So I change it, by defining a function to do just this for
1533 #+BEGIN_SRC emacs-lisp :tangle no
1534 (defun kill-entire-line ()
1535 "Kill this entire line (including newline), regardless of where point is within the line."
1539 (back-to-indentation))
1541 (bind-key* "C-k" 'kill-entire-line)
1542 (global-set-key [remap kill-whole-line] 'kill-entire-line)
1545 And the same is true when I'm in org-mode, which has an own kill function...
1546 (the keybinding happens later, after org-mode is loaded fully)
1547 #+BEGIN_SRC emacs-lisp :tangle no
1548 (defun jj-org-kill-line (&optional arg)
1549 "Kill the entire line, regardless of where point is within the line, org-mode-version"
1553 (back-to-indentation)
1557 I really hate tabs, so I don't want any indentation to try using them.
1558 And in case a project really needs them, I can change it just for that
1559 file/project, but luckily none of those I work in is as broken.
1560 #+BEGIN_SRC emacs-lisp
1561 (setq-default indent-tabs-mode nil)
1564 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
1565 #+BEGIN_SRC emacs-lisp
1566 (bind-key* "M-5" 'match-paren)
1569 Instead of the default "mark-defun" I want a more readline-like setting.
1570 #+BEGIN_SRC emacs-lisp
1571 (bind-key "C-M-h" 'backward-kill-word)
1574 Align whatever with a regexp.
1575 #+BEGIN_SRC emacs-lisp
1576 (bind-key "C-x \\" 'align-regexp)
1580 #+BEGIN_SRC emacs-lisp
1581 (bind-key "C-+" 'text-scale-increase)
1582 (bind-key "C--" 'text-scale-decrease)
1585 Regexes are too useful, so use the regex search by default.
1586 #+begin_src emacs-lisp
1587 (bind-key "C-s" 'isearch-forward-regexp)
1588 (bind-key "C-r" 'isearch-backward-regexp)
1589 (bind-key "C-M-s" 'isearch-forward)
1590 (bind-key "C-M-r" 'isearch-backward)
1593 Rgrep is infinitely useful in multi-file projects.
1594 #+begin_src emacs-lisp
1595 (bind-key "C-x C-g" 'rgrep)
1598 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
1599 AKA transpose lines.
1600 #+BEGIN_SRC emacs-lisp
1601 (bind-key "<M-S-up>" 'move-line-up)
1602 (bind-key "<M-S-down>" 'move-line-down)
1605 "Pull" lines up, join them
1606 #+BEGIN_SRC emacs-lisp
1607 (defun join-line-or-lines-in-region ()
1608 "Join this line or the lines in the selected region.
1609 Joins single lines in reverse order to the default, ie. pulls the next one up."
1611 (cond ((region-active-p)
1612 (let ((min (line-number-at-pos (region-beginning))))
1613 (goto-char (region-end))
1614 (while (> (line-number-at-pos) min)
1616 (t (let ((current-prefix-arg '(4)))
1617 (call-interactively 'join-line)))))
1618 (bind-key "M-j" 'join-line-or-lines-in-region)
1621 When I press Enter I almost always want to go to the right indentation on the next line.
1622 #+BEGIN_SRC emacs-lisp
1623 (bind-key "RET" 'newline-and-indent)
1626 Easier undo, and i don't need suspend-frame
1627 #+BEGIN_SRC emacs-lisp
1628 (bind-key "C-z" 'undo)
1631 Window switching, go backwards. (C-x o goes to the next window)
1632 #+BEGIN_SRC emacs-lisp
1633 (bind-key "C-x O" (lambda ()
1639 #+BEGIN_SRC emacs-lisp
1640 (bind-key "C-x C-r" 'prelude-sudo-edit)
1643 M-space is bound to just-one-space, which is great for programming. What
1644 it does is remove all spaces around the cursor, except for one. But to
1645 be really useful, it also should include newlines. It doesn’t do this by
1646 default. Rather, you have to call it with a negative argument. Sure
1648 #+BEGIN_SRC emacs-lisp
1649 (bind-key "M-SPC" 'just-one-space-with-newline)
1652 Count which commands I use how often.
1653 #+BEGIN_SRC emacs-lisp
1654 (use-package keyfreq
1658 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
1659 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
1661 (keyfreq-autosave-mode 1)))
1664 Duplicate current line
1665 #+BEGIN_SRC emacs-lisp
1666 (defun duplicate-line ()
1667 "Insert a copy of the current line after the current line."
1670 (let ((line-text (buffer-substring-no-properties
1671 (line-beginning-position)
1672 (line-end-position))))
1673 (move-end-of-line 1)
1675 (insert line-text))))
1677 (bind-key "C-c p" 'duplicate-line)
1680 Smarter move to the beginning of the line. That is, it first moves to
1681 the beginning of the line - and on second keypress it goes to the
1682 first character on line.
1683 #+BEGIN_SRC emacs-lisp
1684 (defun smarter-move-beginning-of-line (arg)
1685 "Move point back to indentation of beginning of line.
1687 Move point to the first non-whitespace character on this line.
1688 If point is already there, move to the beginning of the line.
1689 Effectively toggle between the first non-whitespace character and
1690 the beginning of the line.
1692 If ARG is not nil or 1, move forward ARG - 1 lines first. If
1693 point reaches the beginning or end of the buffer, stop there."
1695 (setq arg (or arg 1))
1699 (let ((line-move-visual nil))
1700 (forward-line (1- arg))))
1702 (let ((orig-point (point)))
1703 (back-to-indentation)
1704 (when (= orig-point (point))
1705 (move-beginning-of-line 1))))
1707 ;; remap C-a to `smarter-move-beginning-of-line'
1708 (global-set-key [remap move-beginning-of-line]
1709 'smarter-move-beginning-of-line)
1713 Easily copy characters from the previous nonblank line, starting just
1714 above point. With a prefix argument, only copy ARG characters (never
1715 past EOL), no argument copies rest of line.
1716 #+BEGIN_SRC emacs-lisp
1718 (bind-key "H-y" 'copy-from-above-command)
1721 Open a new X Terminal pointing to the directory of the current
1723 #+BEGIN_SRC emacs-lisp
1724 (bind-key "H-t" 'jj-open-shell)
1728 #+BEGIN_SRC emacs-lisp
1729 (bind-key "H-a" 'align-code)
1733 #+BEGIN_SRC emacs-lisp
1734 (bind-key "C-c d" 'insert-date)
1737 Another key for indenting
1738 #+BEGIN_SRC emacs-lisp
1739 (bind-key "H-i" 'indent-region)
1742 Clean all whitespace stuff
1743 #+BEGIN_SRC emacs-lisp
1744 (bind-key "H-w" 'whitespace-cleanup)
1748 #+BEGIN_SRC emacs-lisp
1749 (bind-key "H-c" 'comment-dwim)
1752 Show keystrokes in progress
1753 #+BEGIN_SRC emacs-lisp
1754 (setq echo-keystrokes 0.1)
1757 Usually you can press the *Ins*ert key, to get into overwrite mode. I
1758 don't like that, have broken much with it and so just forbid it by
1760 #+BEGIN_SRC emacs-lisp
1761 (unbind-key "<insert>")
1762 (unbind-key "<kp-insert>")
1765 *** Easily navigate sillyCased words
1766 #+BEGIN_SRC emacs-lisp
1767 (global-subword-mode 1)
1769 *** Delete file of current buffer, then kill buffer
1770 [2014-06-14 Sat 23:03]
1771 #+BEGIN_SRC emacs-lisp
1772 (defun delete-current-buffer-file ()
1773 "Removes file connected to current buffer and kills buffer."
1775 (let ((filename (buffer-file-name))
1776 (buffer (current-buffer))
1777 (name (buffer-name)))
1778 (if (not (and filename (file-exists-p filename)))
1780 (when (yes-or-no-p "Are you sure you want to remove this file? ")
1781 (delete-file filename)
1782 (kill-buffer buffer)
1783 (message "File '%s' successfully removed" filename)))))
1785 (global-set-key (kbd "C-x C-k") 'delete-current-buffer-file)
1787 *** Rename file of current buffer
1788 [2014-06-14 Sat 23:04]
1789 #+BEGIN_SRC emacs-lisp
1790 (defun rename-current-buffer-file ()
1791 "Renames current buffer and file it is visiting."
1793 (let ((name (buffer-name))
1794 (filename (buffer-file-name)))
1795 (if (not (and filename (file-exists-p filename)))
1796 (error "Buffer '%s' is not visiting a file!" name)
1797 (let ((new-name (read-file-name "New name: " filename)))
1798 (if (get-buffer new-name)
1799 (error "A buffer named '%s' already exists!" new-name)
1800 (rename-file filename new-name 1)
1801 (rename-buffer new-name)
1802 (set-visited-file-name new-name)
1803 (set-buffer-modified-p nil)
1804 (message "File '%s' successfully renamed to '%s'"
1805 name (file-name-nondirectory new-name)))))))
1807 (global-set-key (kbd "C-x C-S-r") 'rename-current-buffer-file)
1809 *** Quickly find emacs lisp sources
1810 [2014-06-22 Sun 23:05]
1811 #+BEGIN_SRC emacs-lisp
1812 (bind-key "C-l" 'find-library 'help-command)
1813 (bind-key "C-f" 'find-function 'help-command)
1814 (bind-key "C-k" 'find-function-on-key 'help-command)
1815 (bind-key "C-v" 'find-variable 'help-command)
1818 [2015-01-26 Mon 16:01]
1819 #+BEGIN_SRC emacs-lisp
1820 (bind-key "M-s o" 'occur-dwim)
1824 [2014-06-01 Sun 15:00]
1825 Proper whitespace handling
1826 #+BEGIN_SRC emacs-lisp
1827 (use-package ethan-wspace
1828 :ensure ethan-wspace
1829 :diminish (ethan-wspace-mode . "ew")
1831 (global-ethan-wspace-mode 1))
1835 [2014-06-01 Sun 15:16]
1836 #+BEGIN_SRC emacs-lisp
1837 (use-package expand-region
1838 :ensure expand-region
1839 :bind ("C-M-+" . er/expand-region)
1840 :commands er/expand-region)
1843 [2013-05-02 Thu 00:04]
1844 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
1845 fill prefix, such as a comment sequence in program code, and handling
1846 bullet points like “1.” or “*”.
1847 #+BEGIN_SRC emacs-lisp
1848 (use-package filladapt
1849 :diminish filladapt-mode
1851 (setq-default filladapt-mode t))
1854 [2013-04-28 So 22:21]
1855 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
1856 As the one time I tried Flymake i wasn't happy, thats easy to
1858 #+BEGIN_SRC emacs-lisp
1859 (use-package flycheck
1861 :diminish flycheck-mode
1862 :bind (("M-n" . next-error)
1863 ("M-p" . previous-error))
1866 (add-hook 'find-file-hook
1868 (when (not (equal 'emacs-lisp-mode major-mode))
1872 (use-package flycheck-color-mode-line
1873 :ensure flycheck-color-mode-line)
1874 (setq flycheck-highlighting-mode nil)
1875 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
1879 Obviously emacs can do syntax hilighting. For more things than you ever
1881 And I want to have it everywhere.
1882 #+BEGIN_SRC emacs-lisp
1883 (use-package font-lock
1886 (global-font-lock-mode 1)
1887 (setq font-lock-maximum-decoration t)))
1890 #+BEGIN_SRC emacs-lisp
1891 (use-package git-commit-mode
1892 :ensure git-commit-mode
1893 :commands git-commit-mode
1894 :mode ("COMMIT_EDITMSG" . git-commit-mode))
1898 #+BEGIN_SRC emacs-lisp
1899 (use-package git-rebase-mode
1900 :ensure git-rebase-mode
1901 :commands git-rebase-mode
1902 :mode ("git-rebase-todo" . git-rebase-mode))
1905 [2014-05-21 Wed 22:56]
1906 #+BEGIN_SRC emacs-lisp
1907 (use-package git-gutter+
1909 :diminish git-gutter+-mode
1910 :bind (("C-x n" . git-gutter+-next-hunk)
1911 ("C-x p" . git-gutter+-previous-hunk)
1912 ("C-x v =" . git-gutter+-show-hunk)
1913 ("C-x r" . git-gutter+-revert-hunks)
1914 ("C-x s" . git-gutter+-stage-hunks)
1915 ("C-x c" . git-gutter+-commit)
1919 (setq git-gutter+-disabled-modes '(org-mode))
1920 (global-git-gutter+-mode 1))
1923 (use-package git-gutter-fringe+
1924 :ensure git-gutter-fringe+
1927 (setq git-gutter-fr+-side 'right-fringe)
1928 ;(git-gutter-fr+-minimal)
1933 [2015-02-22 Sun 14:00]
1934 Provides function that popup commit message at current line. This is
1935 useful when you want to know why this line was changed.
1936 #+BEGIN_SRC emacs-lisp
1937 (use-package git-messenger
1938 :ensure git-messenger
1939 :commands (git-messenger:popup-message)
1940 :bind (("C-x v p" . git-messenger:popup-message))
1943 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
1944 (add-hook 'git-messenger:popup-buffer-hook 'magit-commit-mode)
1945 (setq git-messenger:show-detail t)))
1948 [2014-07-23 Mi 12:57]
1949 Browse historic versions of a file with p (previous) and n (next).
1950 #+BEGIN_SRC emacs-lisp
1951 (use-package git-timemachine
1952 :ensure git-timemachine
1953 :commands git-timemachine)
1956 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
1957 what I want every emacs to know.
1958 #+BEGIN_SRC emacs-lisp
1959 (bind-key "C-c g" 'gnus) ; Start gnus with M-n
1965 [2015-02-20 Fri 16:27]
1966 When working with many windows at the same time, each window has a
1967 size that is not convenient for editing.
1969 golden-ratio helps on this issue by resizing automatically the windows
1970 you are working on to the size specified in the "Golden Ratio". The
1971 window that has the main focus will have the perfect size for editing,
1972 while the ones that are not being actively edited will be re-sized to
1973 a smaller size that doesn't get in the way, but at the same time will
1974 be readable enough to know it's content.
1975 #+BEGIN_SRC emacs-lisp
1976 (use-package golden-ratio
1977 :ensure golden-ratio
1978 :diminish golden-ratio-mode
1981 (golden-ratio-mode 1)
1982 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*"))
1983 (setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
1984 "gnus-article-mode" "calc-mode" "calc-trail-mode"
1989 [2015-02-22 Sun 13:28]
1990 Move point through buffer-undo-list positions.
1991 #+BEGIN_SRC emacs-lisp
1992 (use-package goto-last-change
1993 :commands (goto-last-change)
1994 :bind (("M-g l" . goto-last-change))
1998 [2014-06-11 Wed 22:27]
1999 guide-key.el displays the available key bindings automatically and
2002 For whatever reason I like this more than icicles <backtab> completion
2004 #+BEGIN_SRC emacs-lisp
2005 (use-package guide-key
2007 :diminish guide-key-mode
2010 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g"))
2012 (setq guide-key/recursive-key-sequence-flag t)
2013 (setq guide-key/popup-window-position 'bottom)
2014 (setq guide-key/idle-delay 0.5)))
2019 [2014-05-21 Wed 23:51]
2020 #+BEGIN_SRC emacs-lisp
2021 (use-package hi-lock
2022 :bind (("M-o l" . highlight-lines-matching-regexp)
2023 ("M-o r" . highlight-regexp)
2024 ("M-o w" . highlight-phrase)))
2026 (use-package hilit-chg
2027 :bind ("M-o C" . highlight-changes-mode))
2031 Crazy way of completion. It looks at the word before point and then
2032 tries to expand it in various ways.
2033 #+BEGIN_SRC emacs-lisp
2034 (use-package hippie-exp
2035 :bind ("M-/" . hippie-expand)
2036 :commands hippie-expand
2039 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2040 try-expand-dabbrev-all-buffers
2041 try-expand-dabbrev-from-kill
2042 try-complete-file-name-partially
2043 try-complete-file-name
2044 try-expand-all-abbrevs try-expand-list
2046 try-complete-lisp-symbol-partially
2047 try-complete-lisp-symbol))))
2050 Replaced by web-mode [[*web-mode][web-mode]]
2051 #+BEGIN_SRC emacs-lisp :tangle no
2052 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
2053 (add-auto-mode 'html-helper-mode "\\.html$")
2054 (add-auto-mode 'html-helper-mode "\\.asp$")
2055 (add-auto-mode 'html-helper-mode "\\.phtml$")
2056 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
2057 (defalias 'html-mode 'html-helper-mode)
2060 [2015-01-26 Mon 15:50]
2061 This is a package for GNU Emacs that can be used to tie related
2062 commands into a family of short bindings with a common prefix - a
2065 Once you summon the Hydra through the prefixed binding (the body + any
2066 one head), all heads can be called in succession with only a short
2069 The Hydra is vanquished once Hercules, any binding that isn't the
2070 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2071 Hydra, will still serve his orignal purpose, calling his proper
2072 command. This makes the Hydra very seamless, it's like a minor mode
2073 that disables itself auto-magically.
2074 #+BEGIN_SRC emacs-lisp
2079 (setq hydra-is-helpful t)
2082 (defhydra hydra-zoom (:color red)
2084 ("g" text-scale-increase "in")
2085 ("l" text-scale-decrease "out")
2087 (bind-key "<F2>" 'hydra-zoom/toggle)
2089 (defhydra hydra-error (:color red)
2091 ("h" first-error "first")
2092 ("j" next-error "next")
2093 ("k" previous-error "prev")
2094 ("v" recenter-top-bottom "recenter")
2096 (bind-key "M-g e" 'hydra-error/body)
2098 (defhydra hydra-gnus (:color red)
2100 ("m" gnus-uu-mark-thread "mark thread")
2101 ("d" gnus-summary-delete-article "delete article(s)")
2102 ("r" gnus-summary-mark-as-read-forward "mark read")
2103 ("n" gnus-summary-next-thread "next thread")
2104 ("p" gnus-summary-prev-thread "previous thread")
2105 ("g" gnus-summary-next-group "next group")
2106 ("l" gnus-recenter "recenter")
2107 ("x" gnus-summary-limit-to-unread "unread")
2109 (bind-key "C-c h" 'hydra-gnus/body)
2111 (defhydra hydra-launcher (:color blue)
2114 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2115 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
2118 (bind-key "C-c r" 'hydra-launcher/body)
2120 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
2121 (defvar whitespace-mode nil)
2122 (defhydra hydra-toggle (:color pink)
2124 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
2125 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
2126 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
2127 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
2128 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
2131 ("a" abbrev-mode nil)
2132 ("c" auto-complete-mode nil)
2133 ("i" aggressive-indent-mode nil)
2134 ("d" toggle-debug-on-error nil)
2135 ("f" auto-fill-mode nil)
2136 ("g" golden-ratio-mode nil)
2137 ("t" toggle-truncate-lines nil)
2138 ("w" whitespace-mode nil)
2139 ("r" auto-revert-mode nil)
2140 ("l" linum-mode nil)
2141 ("k" linum-relative-toggle nil)
2143 (bind-key "C-c C-v" 'hydra-toggle/body)
2149 [2014-05-21 Wed 23:54]
2150 #+BEGIN_SRC emacs-lisp
2151 (use-package ibuffer
2153 :bind (("C-h h" . ibuffer)
2154 ("C-x C-b" . ibuffer)
2155 ("<XF86WebCam>" . ibuffer)
2158 :defines (ibuffer-filtering-alist
2159 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
2160 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
2163 (defvar my-ibufffer-separator " • ")
2164 (setq ibuffer-filter-group-name-face 'variable-pitch
2165 ibuffer-use-header-line t
2166 ibuffer-old-time 12)
2167 (unbind-key "M-o" ibuffer-mode-map)
2168 (bind-key "s" 'isearch-forward-regexp ibuffer-mode-map)
2169 (bind-key "." 'ibuffer-invert-sorting ibuffer-mode-map)
2174 (use-package ibuffer-vc
2177 (ibuffer-vc-set-filter-groups-by-vc-root
2178 ibuffer-vc-generate-filter-groups-by-vc-root))
2180 (use-package ibuffer-tramp
2182 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
2183 ibuffer-tramp-set-filter-groups-by-tramp-connection))
2184 ;; Switching to ibuffer puts the cursor on the most recent buffer
2185 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
2186 "Open ibuffer with cursor pointed to most recent buffer name"
2187 (let ((recent-buffer-name (buffer-name)))
2189 (ibuffer-update nil t)
2190 (unless (string= recent-buffer-name "*Ibuffer*")
2191 (ibuffer-jump-to-buffer recent-buffer-name))))
2193 (defun ibuffer-magit-status ()
2195 (--when-let (get-buffer "*Ibuffer*")
2196 (with-current-buffer it
2197 (let* ((selected-buffer (ibuffer-current-buffer))
2198 (buffer-path (with-current-buffer
2200 (or (buffer-file-name)
2201 list-buffers-directory
2202 default-directory)))
2204 (if (file-regular-p buffer-path)
2205 (file-name-directory buffer-path)
2207 (magit-status default-directory)))))
2208 (bind-key "i" 'ibuffer-magit-status ibuffer-mode-map)
2209 (bind-key "G" 'ibuffer-magit-status ibuffer-mode-map)
2211 (setq ibuffer-directory-abbrev-alist
2216 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
2217 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
2219 ("dak" . "/develop/dak/")
2221 ("config" . "~/.emacs.d/config/")
2223 ("systmp" . "/tmp/")
2224 ("puppet" . "~/git/puppet")
2228 (use-package ibuffer-git
2230 (use-package ibuffer-vc
2233 (define-ibuffer-column size-h
2234 (:name "Size" :inline t)
2236 ((> (buffer-size) 1000)
2237 (format "%7.1fk" (/ (buffer-size) 1000.0)))
2238 ((> (buffer-size) 1000000)
2239 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
2241 (format "%8d" (buffer-size)))))
2243 (use-package ibuf-ext)
2244 (define-ibuffer-filter filename2
2245 "Toggle current view to buffers with filename matching QUALIFIER."
2246 (:description "filename2"
2247 :reader (read-from-minibuffer "Filter by filename (regexp): "))
2248 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
2249 (ibuffer-awhen (with-current-buffer buf
2250 (or buffer-file-name
2252 (string-match qualifier it)))
2254 (defvar ibuffer-magit-filter-groups nil)
2255 (defun ibuffer-magit-define-filter-groups ()
2256 (when (and (not ibuffer-magit-filter-groups)
2257 (boundp 'magit-repo-dirs))
2258 (setq ibuffer-magit-filter-groups
2261 (file-name-nondirectory (directory-file-name it)))
2263 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
2265 (defun ibuffer-set-filter-groups-by-root ()
2267 ;; (ibuffer-projectile-define-filter-groups)
2268 ;; (ibuffer-magit-define-filter-groups)
2269 (setq ibuffer-filter-groups
2271 ;; ibuffer-projectile-filter-groups
2272 ibuffer-magit-filter-groups
2275 (or (mode . magit-log-edit-mode)
2276 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2277 (name . "^\\*Pymacs\\*$")
2278 (name . "^\\*helm.*\\*")
2279 (name . "^\\*Compile-log\\*$")
2280 (name . "^\\*Ido Completions\\*$")
2281 (name . "^\\*magit-\\(process\\)\\*$")
2285 (name . "^\\*scratch")
2286 (name . "^\\*Messages")
2289 (ibuffer-vc-generate-filter-groups-by-vc-root)
2290 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
2292 (defun toggle-ibuffer-filter-groups ()
2295 (let ((ibuf (get-buffer "*Ibuffer*")))
2297 (with-current-buffer ibuf
2298 (let ((selected-buffer (ibuffer-current-buffer)))
2299 (if (not ibuffer-filter-groups)
2300 (ibuffer-set-filter-groups-by-root)
2301 (setq ibuffer-filter-groups nil))
2302 (pop-to-buffer ibuf)
2303 (ibuffer-update nil t)
2304 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
2306 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
2308 (defun ibuffer-back-to-top ()
2310 (beginning-of-buffer)
2313 (defun ibuffer-jump-to-bottom ()
2319 (define-key ibuffer-mode-map
2320 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
2321 (define-key ibuffer-mode-map
2322 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
2324 (setq ibuffer-default-sorting-mode 'recency
2325 ibuffer-eliding-string "…"
2326 ibuffer-compile-formats t
2327 ibuffer-git-column-length 6
2328 ibuffer-show-empty-filter-groups nil
2329 ibuffer-default-directory "~/"
2332 (setq ibuffer-formats '((mark vc-status-mini
2334 (git-status 8 8 :left)
2338 (name 18 18 :left :elide)
2340 (size-h 9 -1 :right)
2342 (mode 16 16 :left :elide)
2343 " " filename-and-process)
2345 (git-status 8 8 :left)
2351 (setq ibuffer-saved-filter-groups
2354 ("dired" (mode . dired-mode))
2355 ("perl" (mode . cperl-mode))
2357 (mode . puppet-mode)
2358 (mode . yaml-mode)))
2359 ("ruby" (mode . ruby-mode))
2361 (name . "^\\*scratch\\*$")
2362 (name . "^\\*Compile-log\\*$")
2363 (name . "^\\*Completions\\*$")
2364 (name . "^\\*Messages\\*$")
2365 (name . "^\\*Backtrace\\*$")
2366 (name . "^\\*Packages*\\*$")
2367 (name . "^\\*Help*\\*$")
2370 (mode . message-mode)
2373 (mode . gnus-group-mode)
2374 (mode . gnus-summary-mode)
2375 (mode . gnus-article-mode)
2376 (name . "^\\.bbdb$")
2377 (name . "^\\.newsrc-dribble")))
2379 (filename . ".*/org/.*")
2380 (mode . org-agenda-mode)
2381 (name . "^diary$")))
2383 (mode . magit-log-edit-mode)
2384 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
2386 ;; -------------------------------------------------
2387 ;; programming languages #1
2389 (mode . emacs-lisp-mode)
2390 (mode . python-mode)
2392 (mode . coffee-mode)
2395 (mode . actionscript-mode)
2398 (mode . haskell-mode)
2404 ;; -------------------------------------------------
2405 ;; configuration/data files
2409 (mode . conf-mode)))
2410 ;; -------------------------------------------------
2411 ;; text/notetaking/org
2412 ("org agenda" (mode . org-agenda-mode))
2415 (name . "^\\*Calendar\\*$")
2416 (name . "^diary$")))
2420 (mode . markdown-mode)))
2421 ;; -------------------------------------------------
2424 (mode . image-mode)))
2425 ;; -------------------------------------------------
2427 ("w3m" (mode . w3m-mode))
2429 (mode . magit-status-mode)
2430 (mode . magit-log-mode)
2431 (mode . vc-annotate-mode)))
2432 ("dired" (mode . dired-mode))
2437 (name . "^\\*Personal Keybindings\\*$")))
2438 ;; -------------------------------------------------
2440 ("MORE" (or (mode . magit-log-edit-mode)
2441 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2442 (name . "^\\*Pymacs\\*$")
2443 (name . "^\\*Compile-log\\*$")
2444 (name . "^\\*Completions\\*$")
2445 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
2447 ("*buffer*" (name . "\\*.*\\*"))))))
2449 (add-hook 'ibuffer-mode-hook
2451 (ibuffer-auto-mode 1)
2452 (ibuffer-switch-to-saved-filter-groups "default")))
2454 ;; Unless you turn this variable on you will be prompted every time
2455 ;; you want to delete a buffer, even unmodified ones, which is way
2456 ;; too cautious for most people. You’ll still be prompted for
2457 ;; confirmation when deleting modified buffers after the option has
2459 (setq ibuffer-expert t)
2464 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
2465 ‘TAB’ completion is to typing things manually every time.”]]
2466 #+BEGIN_SRC emacs-lisp
2467 (use-package icicles
2468 :load-path "elisp/icicle/"
2473 Incremental mini-buffer completion preview: Type in the minibuffer,
2474 list of matching commands is echoed
2475 #+BEGIN_SRC emacs-lisp
2479 [2014-05-26 Mon 22:49]
2480 #+BEGIN_SRC emacs-lisp
2483 :commands (iedit-mode)
2485 :bind (("C-;" . iedit-mode)
2486 ("C-," . iedit-mode-toggle-on-function))
2491 [2014-05-20 Tue 23:35]
2492 #+BEGIN_SRC emacs-lisp
2494 :bind ("C-h C-i" . info-lookup-symbol)
2495 :commands info-lookup-symbol
2498 ;; (defadvice info-setup (after load-info+ activate)
2499 ;; (use-package info+))
2501 (defadvice Info-exit (after remove-info-window activate)
2502 "When info mode is quit, remove the window."
2503 (if (> (length (window-list)) 1)
2506 (use-package info-look
2507 :commands info-lookup-add-help)
2509 ** linum (line number)
2510 Various modes should have line numbers in front of each line.
2512 But then there are some where it would just be deadly - like org-mode,
2513 gnus, so we have a list of modes where we don't want to see it.
2514 #+BEGIN_SRC emacs-lisp
2516 :diminish linum-mode
2519 (setq linum-format "%3d ")
2520 (setq linum-mode-inhibit-modes-list '(org-mode
2527 (defadvice linum-on (around linum-on-inhibit-for-modes)
2528 "Stop the load of linum-mode for some major modes."
2529 (unless (member major-mode linum-mode-inhibit-modes-list)
2532 (ad-activate 'linum-on)
2534 (use-package linum-relative
2535 :ensure linum-relative
2538 (setq linum-format 'dynamic)
2541 (global-linum-mode 1))
2544 ** lisp editing stuff
2546 [2013-04-21 So 21:00]
2547 I'm not doing much of it, except for my emacs and gnus configs, but
2548 then I like it nice too...
2549 #+BEGIN_SRC emacs-lisp
2550 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
2552 (defun remove-elc-on-save ()
2553 "If you're saving an elisp file, likely the .elc is no longer valid."
2554 (make-local-variable 'after-save-hook)
2555 (add-hook 'after-save-hook
2557 (if (file-exists-p (concat buffer-file-name "c"))
2558 (delete-file (concat buffer-file-name "c"))))))
2560 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2561 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2563 (use-package paredit
2565 :diminish paredit-mode " π")
2567 (setq lisp-coding-hook 'lisp-coding-defaults)
2568 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
2570 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
2571 (add-hook 'emacs-lisp-mode-hook (lambda ()
2572 (run-hooks 'prelude-emacs-lisp-mode-hook)))
2574 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
2576 (after "elisp-slime-nav"
2577 '(diminish 'elisp-slime-nav-mode))
2578 (after "rainbow-mode"
2579 '(diminish 'rainbow-mode))
2581 '(diminish 'eldoc-mode))
2584 [2013-04-21 So 20:48]
2585 magit is a mode for interacting with git.
2586 #+BEGIN_SRC emacs-lisp
2589 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
2590 magit-git-repo-p magit-list-repos)
2592 :bind (("C-x g" . magit-status)
2593 ("C-x G" . magit-status-with-prefix))
2596 (setq magit-commit-signoff t
2597 magit-repo-dirs '("~/git"
2601 magit-repo-dirs-depth 4
2602 magit-log-auto-more t)
2604 (use-package magit-blame
2605 :commands magit-blame-mode
2608 (use-package magit-svn
2610 :commands (magit-svn-mode
2614 (add-hook 'magit-mode-hook 'hl-line-mode)
2615 (defun magit-status-with-prefix ()
2617 (let ((current-prefix-arg '(4)))
2618 (call-interactively 'magit-status)))
2622 (setenv "GIT_PAGER" "")
2624 (unbind-key "M-h" magit-mode-map)
2625 (unbind-key "M-s" magit-mode-map)
2627 (use-package magit-find-file
2628 :ensure magit-find-file
2629 :commands (magit-find-file-completing-read)
2633 (bind-key "C-x C-f" 'magit-find-file-completing-read magit-mode-map)))
2635 (add-hook 'magit-log-edit-mode-hook
2637 (set-fill-column 72)
2640 (defadvice magit-status (around magit-fullscreen activate)
2641 (window-configuration-to-register :magit-fullscreen)
2643 (delete-other-windows))
2645 (defun magit-quit-session ()
2646 "Restores the previous window configuration and kills the magit buffer"
2649 (jump-to-register :magit-fullscreen))
2651 (bind-key "q" 'magit-quit-session magit-status-mode-map)
2655 [2014-05-20 Tue 23:04]
2656 #+BEGIN_SRC emacs-lisp
2657 (use-package markdown-mode
2658 :mode (("\\.md\\'" . markdown-mode)
2659 ("\\.mdwn\\'" . markdown-mode))
2663 #+BEGIN_SRC emacs-lisp
2664 (use-package message
2667 (setq message-kill-buffer-on-exit t)))
2670 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
2672 I want to access it from anywhere using =F6=.
2673 #+BEGIN_SRC emacs-lisp
2674 (use-package mingus-stays-home
2675 :bind ( "<f6>" . mingus)
2679 (setq mingus-dired-add-keys t)
2680 (setq mingus-mode-always-modeline nil)
2681 (setq mingus-mode-line-show-elapsed-percentage nil)
2682 (setq mingus-mode-line-show-volume nil)
2683 (setq mingus-mpd-config-file "/etc/mpd.conf")
2684 (setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
2685 (setq mingus-mpd-root "/share/music/")))
2689 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
2690 #+BEGIN_SRC emacs-lisp
2691 (use-package miniedit
2696 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
2697 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
2698 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
2699 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
2704 [2013-05-21 Tue 23:39]
2705 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
2706 coexist in one buffer.
2707 #+BEGIN_SRC emacs-lisp :tangle no
2708 (use-package mmm-auto
2712 (setq mmm-global-mode 'buffers-with-submode-classes)
2713 (setq mmm-submode-decoration-level 2)
2714 (eval-after-load 'mmm-vars
2720 :face mmm-code-submode-face
2721 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
2722 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
2723 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2724 @ "\n" _ "\n" @ "</script>" @)))
2727 :face mmm-code-submode-face
2728 :front "<style[^>]*>[ \t]*\n?"
2729 :back "[ \t]*</style>"
2730 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2731 @ "\n" _ "\n" @ "</style>" @)))
2734 :face mmm-code-submode-face
2737 (dolist (mode (list 'html-mode 'nxml-mode))
2738 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
2739 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
2744 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
2746 #+BEGIN_SRC emacs-lisp
2747 (use-package mo-git-blame
2748 :ensure mo-git-blame
2749 :commands (mo-git-blame-current
2753 (setq mo-git-blame-blame-window-width 25)))
2757 [2013-04-08 Mon 23:57]
2758 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
2759 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
2760 #+BEGIN_SRC emacs-lisp
2761 (use-package multiple-cursors
2762 :ensure multiple-cursors
2764 :commands (mc/remove-fake-cursors
2765 mc/create-fake-cursor-at-point
2766 mc/pop-state-from-overlay
2767 mc/maybe-multiple-cursors-mode)
2768 :defines (multiple-cursors-mode
2770 mc--read-quoted-char
2771 rectangular-region-mode)
2772 :bind (("C-S-c C-S-c" . mc/edit-lines)
2773 ("C->" . mc/mark-next-like-this)
2774 ("C-<" . mc/mark-previous-like-this)
2775 ("C-c C-<" . mc/mark-all-like-this)
2776 ("C-c i" . mc/insert-numbers))
2779 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
2780 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
2781 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
2782 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
2783 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
2784 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
2787 [2014-08-27 Wed 17:15]
2789 #+BEGIN_SRC emacs-lisp
2790 (use-package neotree
2793 :bind (("<f8>" . neotree-toggle))
2794 :commands (neotree-find
2799 (setq neo-smart-open t))
2802 (bind-key "^" 'neotree-select-up-node neotree-mode-map)))
2805 [2013-05-22 Wed 22:02]
2806 nxml-mode is a major mode for editing XML.
2807 #+BEGIN_SRC emacs-lisp
2812 '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
2815 (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
2816 (fset 'xml-mode 'nxml-mode)
2817 (setq nxml-slash-auto-complete-flag t)
2819 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
2820 (defun pp-xml-region (begin end)
2821 "Pretty format XML markup in region. The function inserts
2822 linebreaks to separate tags that have nothing but whitespace
2823 between them. It then indents the markup by using nxml's
2829 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
2830 (backward-char) (insert "\n"))
2831 (indent-region begin end)))
2833 ;;----------------------------------------------------------------------------
2834 ;; Integration with tidy for html + xml
2835 ;;----------------------------------------------------------------------------
2836 ;; tidy is autoloaded
2837 (eval-after-load 'tidy
2839 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
2840 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
2845 *** General settings
2846 [2013-04-28 So 17:06]
2848 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
2849 it is quite extensive. Nevertheless, it starts out small, loading it.
2850 #+BEGIN_SRC emacs-lisp
2854 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
2855 that we need org-protocol.
2856 #+BEGIN_SRC emacs-lisp
2857 (require 'org-protocol)
2862 My current =org-agenda-files= variable only includes a set of
2864 #+BEGIN_SRC emacs-lisp
2865 (setq org-agenda-files (quote ("~/org/"
2871 (setq org-default-notes-file "~/org/notes.org")
2873 =org-mode= manages the =org-agenda-files= variable automatically using
2874 =C-c [= and =C-c ]= to add and remove files respectively. However,
2875 this replaces my directory list with a list of explicit filenames
2876 instead and is not what I want. If this occurs then adding a new org
2877 file to any of the above directories will not contribute to my agenda
2878 and I will probably miss something important.
2880 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
2881 prevent messing up my list of directories in the =org-agenda-files=
2882 variable. I just add and remove directories manually here. Changing
2883 the list of directories in =org-agenda-files= happens very rarely
2884 since new files in existing directories are automatically picked up.
2886 #+BEGIN_SRC emacs-lisp
2887 ;; Keep tasks with dates on the global todo lists
2888 (setq org-agenda-todo-ignore-with-date nil)
2890 ;; Keep tasks with deadlines on the global todo lists
2891 (setq org-agenda-todo-ignore-deadlines nil)
2893 ;; Keep tasks with scheduled dates on the global todo lists
2894 (setq org-agenda-todo-ignore-scheduled nil)
2896 ;; Keep tasks with timestamps on the global todo lists
2897 (setq org-agenda-todo-ignore-timestamp nil)
2899 ;; Remove completed deadline tasks from the agenda view
2900 (setq org-agenda-skip-deadline-if-done t)
2902 ;; Remove completed scheduled tasks from the agenda view
2903 (setq org-agenda-skip-scheduled-if-done t)
2905 ;; Remove completed items from search results
2906 (setq org-agenda-skip-timestamp-if-done t)
2908 ;; Include agenda archive files when searching for things
2909 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
2911 ;; Show all future entries for repeating tasks
2912 (setq org-agenda-repeating-timestamp-show-all t)
2914 ;; Show all agenda dates - even if they are empty
2915 (setq org-agenda-show-all-dates t)
2917 ;; Sorting order for tasks on the agenda
2918 (setq org-agenda-sorting-strategy
2919 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
2920 (todo category-up priority-down effort-up)
2921 (tags category-up priority-down effort-up)
2922 (search category-up))))
2924 ;; Start the weekly agenda on Monday
2925 (setq org-agenda-start-on-weekday 1)
2927 ;; Enable display of the time grid so we can see the marker for the current time
2928 (setq org-agenda-time-grid (quote ((daily today remove-match)
2929 #("----------------" 0 16 (org-heading t))
2930 (0800 1000 1200 1400 1500 1700 1900 2100))))
2932 ;; Display tags farther right
2933 (setq org-agenda-tags-column -102)
2935 ; position the habit graph on the agenda to the right of the default
2936 (setq org-habit-graph-column 50)
2938 ; turn habits back on
2939 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
2942 ;; Agenda sorting functions
2944 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
2947 (setq org-deadline-warning-days 30)
2949 ;; Always hilight the current agenda line
2950 (add-hook 'org-agenda-mode-hook
2951 '(lambda () (hl-line-mode 1))
2955 #+BEGIN_SRC emacs-lisp
2956 (setq org-agenda-persistent-filter t)
2957 (add-hook 'org-agenda-mode-hook
2958 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
2961 (add-hook 'org-agenda-mode-hook
2962 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
2965 (add-hook 'org-agenda-mode-hook
2966 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
2969 (add-hook 'org-agenda-mode-hook
2970 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
2973 (add-hook 'org-agenda-mode-hook
2974 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
2977 ; Rebuild the reminders everytime the agenda is displayed
2978 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
2980 ;(if (file-exists-p "~/org/refile.org")
2981 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
2983 ; Activate appointments so we get notifications
2986 (setq org-agenda-log-mode-items (quote (closed clock state)))
2987 (if (> emacs-major-version 23)
2988 (setq org-agenda-span 3)
2989 (setq org-agenda-ndays 3))
2991 (setq org-agenda-show-all-dates t)
2992 (setq org-agenda-start-on-weekday nil)
2993 (setq org-deadline-warning-days 14)
2996 *** Global keybindings.
2997 Start off by defining a series of keybindings.
2999 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
3000 setup manually, not by org-mode. Also turn off =C-c ;=, which
3001 comments headlines - a function never used.
3002 #+BEGIN_SRC emacs-lisp
3003 (add-hook 'org-mode-hook
3005 (org-defkey org-mode-map "\C-c[" 'undefined)
3006 (org-defkey org-mode-map "\C-c]" 'undefined)
3007 (org-defkey org-mode-map "\C-c;" 'undefined))
3011 And now a largish set of keybindings...
3012 #+BEGIN_SRC emacs-lisp
3013 (bind-key "C-c l" 'org-store-link)
3014 (bind-key "C-c a" 'org-agenda)
3015 ;(bind-key "C-c b" 'org-iswitchb)
3016 (define-key mode-specific-map [?a] 'org-agenda)
3018 (bind-key "<f12>" 'org-agenda)
3019 (bind-key "<f5>" 'bh/org-todo)
3020 (bind-key "<S-f5>" 'bh/widen)
3021 (bind-key "<f7>" 'bh/set-truncate-lines)
3022 ;(bind-key "<f8>" 'org-cycle-agenda-files)
3024 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
3025 (bind-key "<f9> b" 'bbdb)
3026 (bind-key "<f9> c" 'calendar)
3027 (bind-key "<f9> f" 'boxquote-insert-file)
3028 (bind-key "<f9> h" 'bh/hide-other)
3029 (bind-key "<f9> n" 'org-narrow-to-subtree)
3030 (bind-key "<f9> w" 'widen)
3031 (bind-key "<f9> u" 'bh/narrow-up-one-level)
3032 (bind-key "<f9> I" 'bh/punch-in)
3033 (bind-key "<f9> O" 'bh/punch-out)
3034 (bind-key "<f9> H" 'jj/punch-in-hw)
3035 (bind-key "<f9> W" 'jj/punch-out-hw)
3036 (bind-key "<f9> o" 'bh/make-org-scratch)
3037 (bind-key "<f9> p" 'bh/phone-call)
3038 (bind-key "<f9> r" 'boxquote-region)
3039 (bind-key "<f9> s" 'bh/switch-to-scratch)
3040 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
3041 (bind-key "<f9> T" 'tabify)
3042 (bind-key "<f9> U" 'untabify)
3043 (bind-key "<f9> v" 'visible-mode)
3044 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
3045 (bind-key "C-<f9>" 'previous-buffer)
3046 (bind-key "C-<f10>" 'next-buffer)
3047 (bind-key "M-<f9>" 'org-toggle-inline-images)
3048 ;(bind-key "C-x n r" 'narrow-to-region)
3049 (bind-key "<f11>" 'org-clock-goto)
3050 (bind-key "C-<f11>" 'org-clock-in)
3051 (bind-key "C-M-r" 'org-capture)
3052 (bind-key "C-c r" 'org-capture)
3053 (bind-key "C-S-<f12>" 'bh/save-then-publish)
3054 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
3058 *** Tasks, States, Todo fun
3060 First we define the global todo keywords.
3061 #+BEGIN_SRC emacs-lisp
3062 (setq org-todo-keywords
3063 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
3064 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
3066 (setq org-todo-keyword-faces
3067 (quote (("TODO" :foreground "red" :weight bold)
3068 ("NEXT" :foreground "light blue" :weight bold)
3069 ("DONE" :foreground "forest green" :weight bold)
3070 ("WAITING" :foreground "orange" :weight bold)
3071 ("HOLD" :foreground "orange" :weight bold)
3072 ("DELEGATED" :foreground "yellow" :weight bold)
3073 ("CANCELLED" :foreground "dark green" :weight bold)
3074 ("PHONE" :foreground "dark green" :weight bold))))
3077 **** Fast Todo Selection
3078 Fast todo selection allows changing from any task todo state to any
3079 other state directly by selecting the appropriate key from the fast
3080 todo selection key menu.
3081 #+BEGIN_SRC emacs-lisp
3082 (setq org-use-fast-todo-selection t)
3084 Changing a task state is done with =C-c C-t KEY=
3086 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
3089 #+BEGIN_SRC emacs-lisp
3090 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
3092 allows changing todo states with S-left and S-right skipping all of
3093 the normal processing when entering or leaving a todo state. This
3094 cycles through the todo states but skips setting timestamps and
3095 entering notes which is very convenient when all you want to do is fix
3096 up the status of an entry.
3098 **** Todo State Triggers
3099 I have a few triggers that automatically assign tags to tasks based on
3100 state changes. If a task moves to =CANCELLED= state then it gets a
3101 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
3102 =CANCELLED= tag. These are used for filtering tasks in agenda views
3103 which I'll talk about later.
3105 The triggers break down to the following rules:
3107 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
3108 - Moving a task to =WAITING= adds a =WAITING= tag
3109 - Moving a task to =HOLD= adds a =WAITING= tag
3110 - Moving a task to a done state removes a =WAITING= tag
3111 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
3112 - Moving a task to =NEXT= removes a =WAITING= tag
3113 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
3115 The tags are used to filter tasks in the agenda views conveniently.
3116 #+BEGIN_SRC emacs-lisp
3117 (setq org-todo-state-tags-triggers
3118 (quote (("CANCELLED" ("CANCELLED" . t))
3119 ("WAITING" ("WAITING" . t))
3120 ("HOLD" ("WAITING" . t) ("HOLD" . t))
3121 (done ("WAITING") ("HOLD"))
3122 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
3123 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
3124 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
3127 *** Capturing new tasks
3128 Org capture replaces the old remember mode.
3129 #+BEGIN_SRC emacs-lisp
3130 (setq org-directory "~/org")
3131 (setq org-default-notes-file "~/org/refile.org")
3133 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
3134 ;; see http://orgmode.org/manual/Template-elements.html
3135 (setq org-capture-templates
3136 (quote (("t" "todo" entry (file "~/org/refile.org")
3137 "* TODO %?\nAdded: %U\n"
3138 :clock-in t :clock-resume t)
3139 ("l" "linktodo" entry (file "~/org/refile.org")
3140 "* TODO %?\nAdded: %U\n%a\n"
3141 :clock-in t :clock-resume t)
3142 ("r" "respond" entry (file "~/org/refile.org")
3143 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
3144 :clock-in t :clock-resume t :immediate-finish t)
3145 ("n" "note" entry (file "~/org/refile.org")
3146 "* %? :NOTE:\nAdded: %U\n%a\n"
3147 :clock-in t :clock-resume t)
3148 ("d" "Delegated" entry (file "~/org/refile.org")
3149 "* DELEGATED %?\nAdded: %U\n%a\n"
3150 :clock-in t :clock-resume t)
3151 ("j" "Journal" entry (file+datetree "~/org/diary.org")
3153 :clock-in t :clock-resume t)
3154 ("w" "org-protocol" entry (file "~/org/refile.org")
3155 "* TODO Review %c\nAdded: %U\n"
3156 :immediate-finish t)
3157 ("p" "Phone call" entry (file "~/org/refile.org")
3158 "* PHONE %? :PHONE:\nAdded: %U"
3159 :clock-in t :clock-resume t)
3160 ("x" "Bookmark link" entry (file "~/org/refile.org")
3161 "* Bookmark: %c\n%i\nAdded: %U\n"
3162 :immediate-finish t)
3163 ("h" "Habit" entry (file "~/org/refile.org")
3164 "* 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")
3168 Capture mode now handles automatically clocking in and out of a
3169 capture task. This all works out of the box now without special hooks.
3170 When I start a capture mode task the task is clocked in as specified
3171 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
3172 resumes on the original clocking task.
3174 The quick clocking in and out of capture mode tasks (often it takes
3175 less than a minute to capture some new task details) can leave
3176 empty clock drawers in my tasks which aren't really useful.
3177 The following prevents this.
3178 #+BEGIN_SRC emacs-lisp
3179 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
3183 All my newly captured entries end up in =refile.org= and want to be
3184 moved over to the right place. The following is the setup for it.
3185 #+BEGIN_SRC emacs-lisp
3186 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
3187 (setq org-refile-targets (quote ((nil :maxlevel . 9)
3188 (org-agenda-files :maxlevel . 9))))
3190 ; Use full outline paths for refile targets - we file directly with IDO
3191 (setq org-refile-use-outline-path t)
3193 ; Targets complete directly with IDO
3194 (setq org-outline-path-complete-in-steps nil)
3196 ; Allow refile to create parent tasks with confirmation
3197 (setq org-refile-allow-creating-parent-nodes (quote confirm))
3199 ; Use IDO for both buffer and file completion and ido-everywhere to t
3200 (setq org-completion-use-ido t)
3201 (setq org-completion-use-iswitchb nil)
3202 :; Use IDO for both buffer and file completion and ido-everywhere to t
3203 ;(setq ido-everywhere t)
3204 ;(setq ido-max-directory-size 100000)
3205 ;(ido-mode (quote both))
3206 ; Use the current window when visiting files and buffers with ido
3207 (setq ido-default-file-method 'selected-window)
3208 (setq ido-default-buffer-method 'selected-window)
3210 ;;;; Refile settings
3211 (setq org-refile-target-verify-function 'bh/verify-refile-target)
3215 Agenda view is the central place for org-mode interaction...
3216 #+BEGIN_SRC emacs-lisp
3217 ;; Do not dim blocked tasks
3218 (setq org-agenda-dim-blocked-tasks nil)
3219 ;; Compact the block agenda view
3220 (setq org-agenda-compact-blocks t)
3222 ;; Custom agenda command definitions
3223 (setq org-agenda-custom-commands
3224 (quote (("N" "Notes" tags "NOTE"
3225 ((org-agenda-overriding-header "Notes")
3226 (org-tags-match-list-sublevels t)))
3227 ("h" "Habits" tags-todo "STYLE=\"habit\""
3228 ((org-agenda-overriding-header "Habits")
3229 (org-agenda-sorting-strategy
3230 '(todo-state-down effort-up category-keep))))
3234 ((org-agenda-overriding-header "Tasks to Refile")
3235 (org-tags-match-list-sublevels nil)))
3236 (tags-todo "-HOLD-CANCELLED/!"
3237 ((org-agenda-overriding-header "Projects")
3238 (org-agenda-skip-function 'bh/skip-non-projects)
3239 (org-agenda-sorting-strategy
3241 (tags-todo "-CANCELLED/!"
3242 ((org-agenda-overriding-header "Stuck Projects")
3243 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3244 (tags-todo "-WAITING-CANCELLED/!NEXT"
3245 ((org-agenda-overriding-header "Next Tasks")
3246 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3247 (org-agenda-todo-ignore-scheduled t)
3248 (org-agenda-todo-ignore-deadlines t)
3249 (org-agenda-todo-ignore-with-date t)
3250 (org-tags-match-list-sublevels t)
3251 (org-agenda-sorting-strategy
3252 '(todo-state-down effort-up category-keep))))
3253 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3254 ((org-agenda-overriding-header "Tasks")
3255 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3256 (org-agenda-todo-ignore-scheduled t)
3257 (org-agenda-todo-ignore-deadlines t)
3258 (org-agenda-todo-ignore-with-date t)
3259 (org-agenda-sorting-strategy
3261 (tags-todo "-CANCELLED+WAITING/!"
3262 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
3263 (org-agenda-skip-function 'bh/skip-stuck-projects)
3264 (org-tags-match-list-sublevels nil)
3265 (org-agenda-todo-ignore-scheduled 'future)
3266 (org-agenda-todo-ignore-deadlines 'future)))
3268 ((org-agenda-overriding-header "Tasks to Archive")
3269 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3270 (org-tags-match-list-sublevels nil))))
3272 ("r" "Tasks to Refile" tags "REFILE"
3273 ((org-agenda-overriding-header "Tasks to Refile")
3274 (org-tags-match-list-sublevels nil)))
3275 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
3276 ((org-agenda-overriding-header "Stuck Projects")
3277 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3278 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
3279 ((org-agenda-overriding-header "Next Tasks")
3280 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3281 (org-agenda-todo-ignore-scheduled t)
3282 (org-agenda-todo-ignore-deadlines t)
3283 (org-agenda-todo-ignore-with-date t)
3284 (org-tags-match-list-sublevels t)
3285 (org-agenda-sorting-strategy
3286 '(todo-state-down effort-up category-keep))))
3287 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3288 ((org-agenda-overriding-header "Tasks")
3289 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3290 (org-agenda-sorting-strategy
3292 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
3293 ((org-agenda-overriding-header "Projects")
3294 (org-agenda-skip-function 'bh/skip-non-projects)
3295 (org-agenda-sorting-strategy
3297 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
3298 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
3299 (org-tags-match-list-sublevels nil))
3300 ("A" "Tasks to Archive" tags "-REFILE/"
3301 ((org-agenda-overriding-header "Tasks to Archive")
3302 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3303 (org-tags-match-list-sublevels nil))))))
3305 ; Overwrite the current window with the agenda
3306 (setq org-agenda-window-setup 'current-window)
3311 #+BEGIN_SRC emacs-lisp
3313 ;; Resume clocking task when emacs is restarted
3314 (org-clock-persistence-insinuate)
3316 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
3317 (setq org-clock-history-length 36)
3318 ;; Resume clocking task on clock-in if the clock is open
3319 (setq org-clock-in-resume t)
3320 ;; Change tasks to NEXT when clocking in
3321 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
3322 ;; Separate drawers for clocking and logs
3323 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
3324 ;; Save clock data and state changes and notes in the LOGBOOK drawer
3325 (setq org-clock-into-drawer t)
3326 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
3327 (setq org-clock-out-remove-zero-time-clocks t)
3328 ;; Clock out when moving task to a done state
3329 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
3330 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
3331 (setq org-clock-persist t)
3332 ;; Do not prompt to resume an active clock
3333 (setq org-clock-persist-query-resume nil)
3334 ;; Enable auto clock resolution for finding open clocks
3335 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
3336 ;; Include current clocking task in clock reports
3337 (setq org-clock-report-include-clocking-task t)
3339 ; use discrete minute intervals (no rounding) increments
3340 (setq org-time-stamp-rounding-minutes (quote (1 1)))
3342 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
3344 (setq bh/keep-clock-running nil)
3346 (setq org-agenda-clock-consistency-checks
3347 (quote (:max-duration "4:00"
3350 :gap-ok-around ("4:00"))))
3354 **** Setting a default clock task
3355 Per default the =** Organization= task in my tasks.org file receives
3356 misc clock time. This is the task I clock in on when I punch in at the
3357 start of my work day with =F9-I=. Punching-in anywhere clocks in this
3358 Organization task as the default task.
3360 If I want to change the default clocking task I just visit the
3361 new task in any org buffer and clock it in with =C-u C-u C-c C-x
3362 C-i=. Now this new task that collects miscellaneous clock
3363 minutes when the clock would normally stop.
3365 You can quickly clock in the default clocking task with =C-u C-c
3366 C-x C-i d=. Another option is to repeatedly clock out so the
3367 clock moves up the project tree until you clock out the
3368 top-level task and the clock moves to the default task.
3371 #+BEGIN_SRC emacs-lisp
3372 ;; Agenda clock report parameters
3373 (setq org-agenda-clockreport-parameter-plist
3374 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3376 ;; Agenda log mode items to display (closed and state changes by default)
3377 (setq org-agenda-log-mode-items (quote (closed state)))
3379 **** Task estimates, column view
3380 Setup column view globally with the following headlines
3381 #+BEGIN_SRC emacs-lisp
3382 ; Set default column view headings: Task Effort Clock_Summary
3383 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
3385 Setup the estimate for effort values.
3386 #+BEGIN_SRC emacs-lisp
3387 ; global Effort estimate values
3388 ; global STYLE property values for completion
3389 (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")
3390 ("STYLE_ALL" . "habit"))))
3394 Tags are mostly used for filtering inside the agenda.
3395 #+BEGIN_SRC emacs-lisp
3396 ; Tags with fast selection keys
3397 (setq org-tag-alist (quote ((:startgroup)
3415 ; Allow setting single tags without the menu
3416 (setq org-fast-tag-selection-single-key (quote expert))
3418 ; For tag searches ignore tasks with scheduled and deadline dates
3419 (setq org-agenda-tags-todo-honor-ignore-options t)
3423 #+BEGIN_SRC emacs-lisp
3424 (setq org-archive-mark-done nil)
3425 (setq org-archive-location "%s_archive::* Archived Tasks")
3429 #+BEGIN_SRC emacs-lisp
3430 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
3431 (setq org-plantuml-jar-path "~/java/plantuml.jar")
3433 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
3435 ; Make babel results blocks lowercase
3436 (setq org-babel-results-keyword "results")
3438 (org-babel-do-load-languages
3439 (quote org-babel-load-languages)
3440 (quote ((emacs-lisp . t)
3459 ; Do not prompt to confirm evaluation
3460 ; This may be dangerous - make sure you understand the consequences
3461 ; of setting this -- see the docstring for details
3462 (setq org-confirm-babel-evaluate nil)
3464 ; Use fundamental mode when editing plantuml blocks with C-c '
3465 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
3468 #+BEGIN_SRC emacs-lisp
3469 ;; Don't have images visible on startup, breaks on console
3470 (setq org-startup-with-inline-images nil)
3473 #+BEGIN_SRC emacs-lisp
3474 (add-to-list 'org-structure-template-alist
3475 '("n" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"
3476 "<comment>\n?\n</comment>"))
3478 **** ditaa, graphviz, etc
3479 Those are all nice tools. Look at
3480 http://doc.norang.ca/org-mode.html#playingwithditaa for a nice intro
3483 *** Publishing and exporting
3486 Org-mode can export to a variety of publishing formats including (but not limited to)
3489 (plain text - but not the original org-mode file)
3493 which enables getting to lots of other formats like ODF, XML, etc
3495 via LaTeX or Docbook
3498 A new exporter created by Nicolas Goaziou was introduced in org 8.0.
3500 #+BEGIN_SRC emacs-lisp
3501 ;; Explicitly load required exporters
3505 ;; FIXME, check the following two
3506 ;(require 'ox-icalendar)
3509 ; experimenting with docbook exports - not finished
3510 (setq org-export-docbook-xsl-fo-proc-command "fop %s %s")
3511 (setq org-export-docbook-xslt-proc-command "xsltproc --output %s /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl %s")
3513 ;; define categories that should be excluded
3514 (setq org-export-exclude-category (list "google" "google"))
3515 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
3517 ; define how the date strings look
3518 (setq org-export-date-timestamp-format "%Y-%m-%d")
3519 ; Inline images in HTML instead of producting links to the image
3520 (setq org-html-inline-images t)
3521 ; Do not use sub or superscripts - I currently don't need this functionality in my documents
3522 (setq org-export-with-sub-superscripts nil)
3524 (setq org-html-head-extra (concat
3525 "<link rel=\"stylesheet\" href=\"https://ganneff.de/stylesheet.css\" type=\"text/css\" />\n"
3527 (setq org-html-head-include-default-style nil)
3528 ; Do not generate internal css formatting for HTML exports
3529 (setq org-export-htmlize-output-type (quote css))
3530 ; Export with LaTeX fragments
3531 (setq org-export-with-LaTeX-fragments t)
3532 ; Increase default number of headings to export
3533 (setq org-export-headline-levels 6)
3536 (setq org-publish-project-alist
3539 :base-directory "~/.emacs.d/"
3540 :base-extension "org"
3542 :publishing-directory "/develop/www/emacs"
3544 :publishing-function org-html-publish-to-html
3545 :headline-levels 4 ; Just the default for this project.
3551 :base-directory "~/.emacs.d/"
3552 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
3553 :publishing-directory "/develop/www/emacs"
3554 :exclude "elisp\\|elpa\\|elpa.off\\|auto-save-list\\|cache\\|eshell\\|image-dired\\|themes\\|url"
3556 :publishing-function org-publish-attachment
3558 ("inherit-org-info-js"
3559 :base-directory "/develop/vcs/org-info-js/"
3561 :base-extension "js"
3562 :publishing-directory "/develop/www/"
3563 :publishing-function org-publish-attachment
3565 ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
3570 (setq org-export-with-timestamps nil)
3575 #+BEGIN_SRC emacs-lisp
3576 (setq org-latex-to-pdf-process
3577 '("xelatex -interaction nonstopmode %f"
3578 "xelatex -interaction nonstopmode %f")) ;; for multiple passes
3579 (setq org-export-latex-listings 'minted)
3580 (setq org-latex-listings t)
3582 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3583 ;; but adapted to use latexmk 4.20 or higher.
3584 (defun my-auto-tex-cmd ()
3585 "When exporting from .org with latex, automatically run latex,
3586 pdflatex, or xelatex as appropriate, using latexmk."
3588 ;; default command: oldstyle latex via dvi
3589 (setq texcmd "latexmk -dvi -pdfps -quiet %f")
3591 (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3592 (setq texcmd "latexmk -pdf -quiet %f"))
3594 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3595 (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
3596 ;; LaTeX compilation command
3597 (setq org-latex-to-pdf-process (list texcmd)))
3599 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3601 ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3602 (setq org-export-latex-packages-alist
3604 ("" "longtable" nil)
3609 (defun my-auto-tex-parameters ()
3610 "Automatically select the tex packages to include."
3611 ;; default packages for ordinary latex or pdflatex export
3612 (setq org-export-latex-default-packages-alist
3613 '(("AUTO" "inputenc" t)
3623 ("" "hyperref" nil)))
3625 ;; Packages to include when xelatex is used
3626 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3627 (setq org-export-latex-default-packages-alist
3632 ("german" "babel" t)
3633 ("babel" "csquotes" t)
3635 ("xetex" "hyperref" nil)
3638 (if (string-match "#+LATEX_CMD: xelatex" (buffer-string))
3639 (setq org-export-latex-classes
3641 "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
3642 ("\\section{%s}" . "\\section*{%s}")
3643 ("\\subsection{%s}" . "\\subsection*{%s}")
3644 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3645 ("\\paragraph{%s}" . "\\paragraph*{%s}")
3646 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3647 org-export-latex-classes))))
3649 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
3652 *** Prevent editing invisible text
3653 The following setting prevents accidentally editing hidden text when
3654 the point is inside a folded region. This can happen if you are in
3655 the body of a heading and globally fold the org-file with =S-TAB=
3657 I find invisible edits (and undo's) hard to deal with so now I can't
3658 edit invisible text. =C-c C-r= (org-reveal) will display where the
3659 point is if it is buried in invisible text to allow editing again.
3661 #+BEGIN_SRC emacs-lisp
3662 (setq org-catch-invisible-edits 'error)
3666 #+BEGIN_SRC emacs-lisp
3667 ;; disable the default org-mode stuck projects agenda view
3668 (setq org-stuck-projects (quote ("" nil nil "")))
3670 ; force showing the next headline.
3671 (setq org-show-entry-below (quote ((default))))
3673 (setq org-show-following-heading t)
3674 (setq org-show-hierarchy-above t)
3675 (setq org-show-siblings (quote ((default))))
3677 (setq org-special-ctrl-a/e t)
3678 (setq org-special-ctrl-k t)
3679 (setq org-yank-adjusted-subtrees t)
3681 (setq org-table-export-default-format "orgtbl-to-csv")
3685 The following setting adds alphabetical lists like
3689 #+BEGIN_SRC emacs-lisp
3690 (if (> emacs-major-version 23)
3691 (setq org-list-allow-alphabetical t)
3692 (setq org-alphabetical-lists t))
3695 #+BEGIN_SRC emacs-lisp
3696 (setq org-remove-highlights-with-change nil)
3698 (setq org-list-demote-modify-bullet (quote (("+" . "-")
3705 (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
3708 ; If we leave Emacs running overnight - reset the appointments one minute after midnight
3709 (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
3714 #+BEGIN_SRC emacs-lisp
3715 ;; Enable abbrev-mode
3716 (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
3717 (setq org-startup-indented t)
3718 (setq org-startup-folded t)
3719 (setq org-cycle-separator-lines 0)
3722 I find extra blank lines in lists and headings a bit of a nuisance.
3723 To get a body after a list you need to include a blank line between
3724 the list entry and the body -- and indent the body appropriately.
3725 Most of my lists have no body detail so I like the look of collapsed
3726 lists with no blank lines better.
3728 The following setting prevents creating blank lines before headings
3729 but allows list items to adapt to existing blank lines around the items:
3730 #+BEGIN_SRC emacs-lisp
3731 (setq org-blank-before-new-entry (quote ((heading)
3732 (plain-list-item . auto))))
3735 #+BEGIN_SRC emacs-lisp
3736 (setq org-reverse-note-order nil)
3737 (setq org-default-notes-file "~/notes.org")
3740 Enforce task blocking. Tasks can't go done when there is any subtask
3741 still open. Unless they have a property of =NOBLOCKING: t=
3742 #+BEGIN_SRC emacs-lisp
3743 (setq org-enforce-todo-checkbox-dependencies t)
3744 (setq org-enforce-todo-dependencies t)
3747 #+BEGIN_SRC emacs-lisp
3748 (setq org-fast-tag-selection-single-key (quote expert))
3749 (setq org-footnote-auto-adjust t)
3750 (setq org-hide-block-startup t)
3751 (setq org-icalendar-alarm-time 15)
3752 (setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
3753 (setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
3754 (setq org-icalendar-honor-noexport-tag t)
3755 (setq org-icalendar-include-bbdb-anniversaries nil)
3756 (setq org-icalendar-include-body 200)
3757 (setq org-icalendar-include-todo nil)
3758 (setq org-icalendar-store-UID t)
3759 (setq org-icalendar-timezone "Europe/Berlin")
3760 (setq org-insert-mode-line-in-empty-file t)
3761 (setq org-log-done (quote note))
3762 (setq org-log-into-drawer t)
3763 (setq org-log-state-notes-insert-after-drawers nil)
3764 (setq org-log-reschedule (quote time))
3765 (setq org-log-states-order-reversed t)
3766 (setq org-mobile-agendas (quote all))
3767 (setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
3768 (setq org-mobile-inbox-for-pull "~/org/refile.org")
3769 (setq org-remember-store-without-prompt t)
3770 (setq org-return-follows-link t)
3771 (setq org-reverse-note-order t)
3773 ; regularly save our org-mode buffers
3774 (run-at-time "00:59" 3600 'org-save-all-org-buffers)
3776 (setq org-log-done t)
3778 (setq org-enable-priority-commands t)
3779 (setq org-default-priority ?E)
3780 (setq org-lowest-priority ?E)
3785 Speed commands enable single-letter commands in Org-mode files when
3786 the point is at the beginning of a headline, or at the beginning of a
3789 See the `=org-speed-commands-default=' variable for a list of the keys
3790 and commands enabled at the beginning of headlines. All code blocks
3791 are available at the beginning of a code block, the following key
3792 sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
3793 display a list of the code blocks commands and their related keys.
3795 #+BEGIN_SRC emacs-lisp
3796 (setq org-use-speed-commands nil)
3797 (setq org-speed-commands-user (quote (("0" . ignore)
3810 ("h" . bh/hide-other)
3813 (call-interactively 'org-insert-heading-respect-content))
3814 ("k" . org-kill-note-or-show-branches)
3817 ("q" . bh/show-org-agenda)
3819 ("s" . org-save-all-org-buffers)
3823 ("z" . org-add-note)
3828 ("F" . bh/restrict-to-file-or-follow)
3831 ("J" . org-clock-goto)
3835 ("N" . bh/narrow-to-org-subtree)
3836 ("P" . bh/narrow-to-org-project)
3841 ("U" . bh/narrow-up-one-org-level)
3848 (add-hook 'org-agenda-mode-hook
3850 (define-key org-agenda-mode-map "q" 'bury-buffer))
3853 (defvar bh/current-view-project nil)
3854 (add-hook 'org-agenda-mode-hook
3855 '(lambda () (org-defkey org-agenda-mode-map "V" 'bh/view-next-project))
3860 The following displays the contents of code blocks in Org-mode files
3861 using the major-mode of the code. It also changes the behavior of
3862 =TAB= to as if it were used in the appropriate major mode. This means
3863 that reading and editing code form inside of your Org-mode files is
3864 much more like reading and editing of code using its major mode.
3866 #+BEGIN_SRC emacs-lisp
3867 (setq org-src-fontify-natively t)
3868 (setq org-src-tab-acts-natively t)
3871 #+BEGIN_SRC emacs-lisp
3872 (setq org-src-preserve-indentation nil)
3873 (setq org-edit-src-content-indentation 0)
3877 #+BEGIN_SRC emacs-lisp
3878 (setq org-attach-directory "~/org/data/")
3880 #+BEGIN_SRC emacs-lisp
3881 (setq org-agenda-sticky t)
3884 **** Checklist handling
3885 [2013-05-11 Sat 22:15]
3887 #+BEGIN_SRC emacs-lisp
3888 ;(require 'org-checklist)
3892 I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
3894 #+BEGIN_SRC emacs-lisp
3895 (use-package cperl-mode
3896 :commands cperl-mode
3899 (defalias 'perl-mode 'cperl-mode)
3900 (add-auto-mode 'cperl-mode "\\.\\([pP][Llm]\\|al\\)\\'")
3901 (add-auto-mode 'pod-mode "\\.pod$")
3902 (add-auto-mode 'tt-mode "\\.tt$")
3903 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
3904 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
3905 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
3909 (setq cperl-invalid-face nil
3910 cperl-close-paren-offset -4
3911 cperl-continued-statement-offset 0
3912 cperl-indent-level 4
3913 cperl-indent-parens-as-block t
3915 cperl-electric-keywords t
3916 cperl-electric-lbrace-space t
3917 cperl-electric-parens nil
3918 cperl-highlight-variables-indiscriminately t
3919 cperl-imenu-addback t
3920 cperl-invalid-face (quote underline)
3921 cperl-lazy-help-time 5
3922 cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$"
3923 cperl-syntaxify-by-font-lock t
3924 cperl-use-syntax-table-text-property-for-tags t)
3926 ;; And have cperl mode give ElDoc a useful string
3927 (defun my-cperl-eldoc-documentation-function ()
3928 "Return meaningful doc string for `eldoc-mode'."
3930 (let ((cperl-message-on-help-error nil))
3932 (add-hook 'cperl-mode-hook
3934 (set (make-local-variable 'eldoc-documentation-function)
3935 'my-cperl-eldoc-documentation-function)
3940 [2014-05-22 Thu 00:05]
3941 #+BEGIN_SRC emacs-lisp
3942 (use-package puppet-mode
3943 :mode ("\\.pp\\'" . puppet-mode)
3944 :commands puppet-mode
3947 (defun my-puppet-mode-hook ()
3948 (setq require-final-newline nil))
3949 (add-hook 'puppet-mode-hook 'my-puppet-mode-hook))
3952 (use-package puppet-ext
3955 (bind-key "C-x ?" 'puppet-set-anchor puppet-mode-map)
3956 (bind-key "C-c C-r" 'puppet-create-require puppet-mode-map)))))
3960 Use elpy for the emacs python fun, but dont let it initialize all the
3961 various variables. Elpy author may like them, but I'm not him...
3962 #+BEGIN_SRC emacs-lisp
3965 :mode ("\.py" . python-mode)
3968 (safe-load (concat jj-elisp-dir "/elpy/elpy-autoloads.el"))
3975 :commands (nosetests-all nosetests-module nosetests-one
3976 nosetests-failed nosetests-pdb-all
3977 nosetests-pdb-module nosetests-pdb-one)
3982 :commands (pyvenv-activate pyvenv-deactivate pyvenv-mode pyvenv-restart-python)
3985 (use-package idomenu
3990 (use-package highlight-indentation
3992 :commands (highlight-indentation-mode))
3994 (use-package find-file-in-project
3996 :commands (find-file-in-project ffip-project-files ffip ))
4001 ;; Local variables in `python-mode'. This is not removed when Elpy
4002 ;; is disabled, which can cause some confusion.
4003 (add-hook 'python-mode-hook 'elpy-initialize-local-variables)
4005 (defun my-python-mode-hook ()
4006 (setq require-final-newline nil)
4007 (setq mode-require-final-newline))
4008 (add-hook 'python-mode-hook 'my-python-mode-hook)
4010 ;; Flymake support using flake8, including warning faces.
4011 (when (and (executable-find "flake8")
4012 (not (executable-find python-check-command)))
4013 (setq python-check-command "flake8"))
4015 ;; `flymake-no-changes-timeout': The original value of 0.5 is too
4016 ;; short for Python code, as that will result in the current line to
4017 ;; be highlighted most of the time, and that's annoying. This value
4018 ;; might be on the long side, but at least it does not, in general,
4019 ;; interfere with normal interaction.
4020 (setq flymake-no-changes-timeout 60)
4022 ;; `flymake-start-syntax-check-on-newline': This should be nil for
4023 ;; Python, as;; most lines with a colon at the end will mean the next
4024 ;; line is always highlighted as error, which is not helpful and
4026 (setq flymake-start-syntax-check-on-newline nil)
4028 ;; `ac-auto-show-menu': Short timeout because the menu is great.
4029 (setq ac-auto-show-menu 0.4)
4031 ;; `ac-quick-help-delay': I'd like to show the menu right with the
4032 ;; completions, but this value should be greater than
4033 ;; `ac-auto-show-menu' to show help for the first entry as well.
4034 (setq ac-quick-help-delay 0.5)
4036 ;; `yas-trigger-key': TAB, as is the default, conflicts with the
4037 ;; autocompletion. We also need to tell yasnippet about the new
4038 ;; binding. This is a bad interface to set the trigger key. Stop
4040 (let ((old (when (boundp 'yas-trigger-key)
4042 (setq yas-trigger-key "C-c C-i")
4043 (when (fboundp 'yas--trigger-key-reload)
4044 (yas--trigger-key-reload old)))
4046 ;; yas-snippet-dirs can be a string for a single directory. Make
4047 ;; sure it's a list in that case so we can add our own entry.
4048 (when (not (listp yas-snippet-dirs))
4049 (setq yas-snippet-dirs (list yas-snippet-dirs)))
4050 (add-to-list 'yas-snippet-dirs
4051 (concat (file-name-directory (locate-library "elpy"))
4055 ;; Now load yasnippets.
4058 (elpy-use-ipython)))
4063 #+BEGIN_SRC emacs-lisp :tangle no
4064 (autoload 'python-mode "python-mode" "Python Mode." t)
4065 (add-auto-mode 'python-mode "\\.py\\'")
4066 (add-auto-mode 'python-mode "\\.py$")
4067 (add-auto-mode 'python-mode "SConstruct\\'")
4068 (add-auto-mode 'python-mode "SConscript\\'")
4069 (add-to-list 'interpreter-mode-alist '("python" . python-mode))
4072 (set-variable 'py-indent-offset 4)
4073 (set-variable 'py-smart-indentation nil)
4074 (set-variable 'indent-tabs-mode nil)
4075 (define-key python-mode-map "\C-m" 'newline-and-indent)
4076 (turn-on-eldoc-mode)
4077 (defun python-auto-fill-comments-only ()
4079 (set (make-local-variable 'fill-nobreak-predicate)
4081 (not (python-in-string/comment)))))
4082 (add-hook 'python-mode-hook
4084 (python-auto-fill-comments-only)))
4086 (autoload 'pymacs-apply "pymacs")
4087 (autoload 'pymacs-call "pymacs")
4088 (autoload 'pymacs-eval "pymacs" nil t)
4089 (autoload 'pymacs-exec "pymacs" nil t)
4090 (autoload 'pymacs-load "pymacs" nil t))
4093 If an =ipython= executable is on the path, then assume that IPython is
4094 the preferred method python evaluation.
4095 #+BEGIN_SRC emacs-lisp :tangle no
4096 (when (executable-find "ipython")
4098 (setq org-babel-python-mode 'python-mode))
4100 (setq python-shell-interpreter "ipython")
4101 (setq python-shell-interpreter-args "")
4102 (setq python-shell-prompt-regexp "In \\[[0-9]+\\]: ")
4103 (setq python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: ")
4104 (setq python-shell-completion-setup-code
4105 "from IPython.core.completerlib import module_completion")
4106 (setq python-shell-completion-module-string-code
4107 "';'.join(module_completion('''%s'''))\n")
4108 (setq python-shell-completion-string-code
4109 "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
4111 ** rainbow-delimiters
4112 [2013-04-09 Di 23:38]
4113 [[http://www.emacswiki.org/emacs/RainbowDelimiters][EmacsWiki: Rainbow Delimiters]] is a “rainbow parentheses”-like mode
4114 which highlights parens, brackets, and braces according to their
4115 depth. Each successive level is highlighted a different color. This
4116 makes it easy to spot matching delimiters, orient yourself in the code,
4117 and tell which statements are at the same depth.
4118 #+BEGIN_SRC emacs-lisp
4119 (use-package rainbow-delimiters
4120 :ensure rainbow-delimiters
4121 :commands rainbow-delimiters-mode
4123 (add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
4126 #+BEGIN_SRC emacs-lisp
4127 (use-package rainbow-mode
4128 :ensure rainbow-mode
4130 :diminish rainbow-mode)
4135 #+BEGIN_SRC emacs-lisp
4136 (use-package re-builder
4137 :commands re-builder
4140 (setq reb-re-syntax 'string))
4143 [2014-05-19 Mo 22:56]
4144 Recentf is a minor mode that builds a list of recently opened
4145 files. This list is is automatically saved across Emacs sessions.
4146 #+BEGIN_SRC emacs-lisp
4147 (use-package recentf
4148 :if (not noninteractive)
4149 :bind ("C-x C-r" . recentf-open-files)
4154 (setq recentf-max-menu-items 25)
4155 (setq recentf-save-file (expand-file-name ".recentf" jj-cache-dir))
4157 (defun recentf-add-dired-directory ()
4158 (if (and dired-directory
4159 (file-directory-p dired-directory)
4160 (not (string= "/" dired-directory)))
4161 (let ((last-idx (1- (length dired-directory))))
4163 (if (= ?/ (aref dired-directory last-idx))
4164 (substring dired-directory 0 last-idx)
4165 dired-directory)))))
4167 (add-hook 'dired-mode-hook 'recentf-add-dired-directory)))
4169 ** Region bindings mode
4170 [2013-05-01 Wed 22:51]
4171 This mode allows to have keybindings that are only alive when the
4172 region is active. Helpful for things that only do any useful action
4173 then, like for example the [[*multiple%20cursors][multiple cursors]] mode I load later.
4174 #+BEGIN_SRC emacs-lisp
4175 (use-package region-bindings-mode
4176 :ensure region-bindings-mode
4178 (region-bindings-mode-enable))
4181 [2013-05-22 Wed 22:33]
4182 Programming in ruby...
4185 #+BEGIN_SRC emacs-lisp
4186 (add-auto-mode 'ruby-mode
4187 "Rakefile\\'" "\\.rake\\'" "\.rxml\\'"
4188 "\\.rjs\\'" ".irbrc\\'" "\.builder\\'" "\\.ru\\'"
4189 "\\.gemspec\\'" "Gemfile\\'" "Kirkfile\\'")
4193 #+BEGIN_SRC emacs-lisp
4194 (use-package ruby-mode
4195 :mode ("\\.rb\\'" . ruby-mode)
4196 :interpreter ("ruby" . ruby-mode)
4203 (defvar yari-helm-source-ri-pages
4204 '((name . "RI documentation")