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))))
57 [2014-05-20 Tue 22:36]
58 #+BEGIN_SRC emacs-lisp
59 (defmacro hook-into-modes (func modes)
60 `(dolist (mode-hook ,modes)
61 (add-hook mode-hook ,func)))
65 The Emacs Lisp Package Archive contains things I want.
66 #+BEGIN_SRC emacs-lisp
67 (when (> emacs-major-version 23)
69 (setq package-user-dir (expand-file-name "elpa" jj-elisp-dir))
70 (dolist (source '(("melpa" . "http://melpa.org/packages/")
71 ("melpa-stable" . "http://stable.melpa.org/packages/")
72 ("marmalade" . "http://marmalade-repo.org/packages/")
73 ("elpy" . "http://jorgenschaefer.github.io/packages/")
74 ("elpa" . "http://elpa.gnu.org/packages/")
76 (add-to-list 'package-archives source t))
80 And Paradox is a nicer interface for it
81 #+BEGIN_SRC emacs-lisp
84 :commands (paradox-list-packages paradox-install paradox-upgrade-packages)
88 (setq paradox-github-token t)
91 *** config helpers use-package/bind-key
92 Helpers for the config
93 https://github.com/jwiegley/use-package
94 #+BEGIN_SRC emacs-lisp
95 (unless (package-installed-p 'use-package)
96 (package-refresh-contents)
97 (package-install 'use-package)))
98 (require 'use-package)
104 We need to define the load-path. As I have lots of things I add
105 locally, its getting a few entries. I disliked the repeated
106 /add-to-list/ lines, so I now just take all subdirectories of
107 jj-elisp-dir and add them.
109 #+BEGIN_SRC emacs-lisp
111 (project (directory-files jj-elisp-dir t "\\w+"))
112 (when (file-directory-p project)
113 (if (string= project "emacs23")
114 (when (version< emacs-version "24")
115 (add-to-list 'load-path project))
116 (add-to-list 'load-path project))
117 ;(byte-recompile-directory project 0)
122 Help emacs to find the info files
123 #+BEGIN_SRC emacs-lisp :tangle yes
124 (setq Info-directory-list (cons jj-info-dir
125 '("/usr/local/share/info/"
127 "/usr/local/gnu/info/"
128 "/usr/local/gnu/lib/info/"
129 "/usr/local/gnu/lib/emacs/info/"
130 "/usr/local/emacs/info/"
131 "/usr/local/lib/info/"
132 "/usr/local/lib/emacs/info/"
133 "/usr/share/info/emacs-23"
135 "/usr/share/info/")))
136 (setq Info-default-directory-list
137 (cons jj-info-dir Info-default-directory-list))
143 :ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
145 I dislike the startup message
146 #+BEGIN_SRC emacs-lisp
147 (setq inhibit-splash-screen t)
148 (setq inhibit-startup-message t)
151 Usually I want the lines to break at 72 characters.
152 #+BEGIN_SRC emacs-lisp
153 (setq fill-column 72)
156 And it is nice to have a final newline in files.
157 (Now off, ethan-wspace is doing it better).
158 #+BEGIN_SRC emacs-lisp
159 (setq require-final-newline nil)
160 (setq mode-require-final-newline nil)
163 After I typed 300 characters or took a break for more than a minute it
164 would be nice of emacs to save whatever I am on in one of its auto-save
165 backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
166 #+BEGIN_SRC emacs-lisp
167 (setq auto-save-interval 300)
168 (setq auto-save-timeout 60)
171 Set my full name and my default mail address - for whatever wants to use
172 it later. Also, I am using gnus.
173 #+BEGIN_SRC emacs-lisp
174 (setq user-full-name "Joerg Jaspert")
175 (setq user-mail-address "joerg@ganneff.de")
176 (setq mail-user-agent (quote gnus-user-agent))
179 My default mail server. Well, simply a localhost, I have a forwarder that
180 puts mail off the right way, no need for emacs to have any further
182 #+BEGIN_SRC emacs-lisp
183 (setq smtpmail-default-smtp-server "localhost")
184 (setq smtpmail-smtp-server "localhost")
187 Enable automatic handling of compressed files.
188 #+BEGIN_SRC emacs-lisp
189 (auto-compression-mode 1)
192 Emacs forbids a certain set of commands, as they can be very confusing
193 for new users. Enable them.
194 #+BEGIN_SRC emacs-lisp
195 (put 'narrow-to-region 'disabled nil)
196 (put 'narrow-to-page 'disabled nil)
197 (put 'narrow-to-defun 'disabled nil)
198 (put 'upcase-region 'disabled nil)
199 (put 'downcase-region 'disabled nil)
202 Recenter in a different order - first go to top, then middle, then
204 #+BEGIN_SRC emacs-lisp
205 (setq recenter-positions '(top middle bottom))
208 I've tried various different fonts and while I like the Terminus font
209 most for my shells, in Emacs Inconsolata clearly wins.
210 #+BEGIN_SRC emacs-lisp
211 (set-frame-font "Inconsolata-14")
214 I always use dark backgrounds, so tell Emacs about it. No need to
216 #+BEGIN_SRC emacs-lisp
217 (setq-default frame-background-mode jj-color-style)
220 And I always liked dark backgrounds with colors setup for them. So I
221 switched through multiple themes doing it in emacs too, but never
222 entirely liked it. Until I found solarized, which is now not only my
223 emacs theme, but also for most of my other software too, especially my
224 shell. Consistent look is great.
225 #+BEGIN_SRC emacs-lisp :tangle no
226 (if (or (> emacs-major-version 23) (boundp 'custom-theme-load-path))
228 (defun jj-init-theme ()
230 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
231 (load-theme 'solarized-light t))
232 (set-face-attribute 'org-date nil :underline nil)
233 (message "Initializing theme solarized-dark")
235 (add-to-list 'custom-theme-load-path jj-theme-dir)
236 (add-hook 'after-init-hook 'jj-init-theme)
238 (add-to-list 'load-path (expand-file-name "emacs-color-theme-solarized" jj-elisp-dir))
239 (require 'color-theme-solarized)
240 (color-theme-solarized-dark)
243 #+BEGIN_SRC emacs-lisp
244 (use-package color-theme-solarized
245 :ensure solarized-theme
248 (defun jj-init-theme ()
250 ;; ;; make the fringe stand out from the background
251 (setq solarized-distinct-fringe-background t)
253 ;; ;; Don't change the font for some headings and titles
254 ;; (setq solarized-use-variable-pitch nil)
256 ;; ;; make the modeline high contrast
257 ;; (setq solarized-high-contrast-mode-line t)
259 ;; ;; Use less bolding
260 ;; (setq solarized-use-less-bold t)
262 ;; ;; Use more italics
263 ;; (setq solarized-use-more-italic t)
265 ;; ;; Use less colors for indicators such as git:gutter, flycheck and similar
266 ;; (setq solarized-emphasize-indicators nil)
268 ;; ;; Don't change size of org-mode headlines (but keep other size-changes)
269 ;; (setq solarized-scale-org-headlines nil)
271 ;; ;; Avoid all font-size changes
272 ;; (setq solarized-height-minus-1 1)
273 ;; (setq solarized-height-plus-1 1)
274 ;; (setq solarized-height-plus-2 1)
275 ;; (setq solarized-height-plus-3 1)
276 ;; (setq solarized-height-plus-4 1)
277 (setq x-underline-at-descent-line t)
279 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
280 (load-theme 'solarized-light t))
281 (set-face-attribute 'org-date nil :underline nil)
282 (message "Initializing theme solarized-dark")
284 (add-to-list 'custom-theme-load-path jj-theme-dir)
285 (add-hook 'after-init-hook 'jj-init-theme)
289 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
290 #+BEGIN_SRC emacs-lisp
291 (if (fboundp 'fringe-mode)
295 A bit more spacing between buffer lines
296 #+BEGIN_SRC emacs-lisp
297 (setq-default line-spacing 0.1)
300 [2013-04-21 So 20:54]
301 I do not want my cursor to blink.
302 #+BEGIN_SRC emacs-lisp
303 (blink-cursor-mode -1)
305 *** Menu, Tool and Scrollbar
306 I don't want to see the menu-bar, tool-bar or scrollbar.
307 #+BEGIN_SRC emacs-lisp
309 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
310 (when (fboundp mode) (funcall mode -1))))
312 **** When using emacs in daemon mode
313 Emacs has a very nice mode where it detaches itself and runs as daemon -
314 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
315 Client]]. It's fast, it's nice, it's convinient.
317 Except that Emacs behaves stupid when you do that and ignores your
318 menu/tool/scrollbar settings. Sucks.
320 For them to work even then, we have to do two things.
321 1. We have to set the frame alist. We simple set both,
322 =initial-frame-alist= and =default-frame-alist= to the same value here.
323 #+BEGIN_SRC emacs-lisp
324 (setq initial-frame-alist '(
325 (horizontal-scroll-bars . nil)
326 (vertical-scroll-bars . nil)
329 (setq default-frame-alist (copy-alist initial-frame-alist))
331 2. We have to disable the toolbar using the customize interface, so you
332 can find that in the [[id:0102208d-fdf6-4928-9e40-7e341bd3aa3a][Customized variables]] section.
334 *** Hilight current line in buffer
335 As it says, it does a hilight of the current line.
336 #+BEGIN_SRC emacs-lisp
337 (global-hl-line-mode +1)
339 *** Allow recursive minibuffers
340 This allows (additional) minibuffer commands while in the minibuffer.
341 #+BEGIN_SRC emacs-lisp
342 (setq enable-recursive-minibuffers 't)
344 *** No GC during minibuffer action
345 [2016-02-15 Mon 22:09]
346 See [[https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/][Why are you changing gc cons threshold?]] for more details.
347 #+BEGIN_SRC emacs-lisp
348 (defun my-minibuffer-setup-hook ()
349 (setq gc-cons-threshold most-positive-fixnum))
351 (defun my-minibuffer-exit-hook ()
352 (setq gc-cons-threshold 800000))
354 (add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook)
355 (add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook)
357 *** Modeline related changes
358 I want to see line and column numbers, so turn them on.
359 Size indication lets me know how far I am in a buffer.
361 And modeline-posn is great. It will hilight the column number in the
362 modeline in red as soon as you are over the defined limit.
363 #+BEGIN_SRC emacs-lisp
365 (column-number-mode 1)
366 (size-indication-mode 1)
367 (display-time-mode 1)
368 (setq display-time-day-and-date nil)
369 (setq display-time-default-load-average nil)
370 (setq display-time-24hr-format t)
371 (setq modelinepos-column-limit 72)
373 (use-package modeline-posn
377 (set-face-foreground 'modelinepos-column-warning "grey20")
378 (set-face-background 'modelinepos-column-warning "red")
379 (setq modelinepos-column-limit 72))
384 [2013-04-22 Mon 11:27]
385 The modeline is easily cluttered up with stuff I don't really need to
386 see. So lets hide those. There are two ways, one of them uses diminish
387 to get entirely rid of some modes, the other is a function taken from
388 "Mastering Emacs" which replaces the modes text with an own (set of)
390 #+BEGIN_SRC emacs-lisp
392 (diminish 'auto-fill-function)
393 (defvar mode-line-cleaner-alist
394 `((auto-complete-mode . " α")
395 (yas-minor-mode . " y")
396 (paredit-mode . " π")
400 (lisp-interaction-mode . "λ")
403 (emacs-lisp-mode . "EL")
405 (org-indent-mode . "")
410 "Alist for `clean-mode-line'.
412 When you add a new element to the alist, keep in mind that you
413 must pass the correct minor/major mode symbol and a string you
414 want to use in the modeline *in lieu of* the original.
416 Want some symbols? Go:
418 ;ςερτζθιοπασδφγηξκλυχψωβνμ
419 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
420 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
424 ; (add-hook 'after-change-major-mode-hook 'clean-mode-line)
427 Unfortunately icicles breaks this with the way it adds/removes itself,
428 so take it our for now...
431 Back when I started with text-mode. But nowadays I want default mode to
432 be org-mode - it is just so much better to use. And does sensible things
433 with many README files out there, and various other "crap" you get to
435 #+BEGIN_SRC emacs-lisp :tangle yes
436 (setq-default major-mode 'org-mode)
438 #+BEGIN_SRC emacs-lisp :tangle no
439 (setq initial-major-mode 'org-mode)
443 [2013-04-23 Tue 16:43]
444 Shell. zsh in my case.
445 #+BEGIN_SRC emacs-lisp
446 (setq shell-file-name "zsh")
447 (setq shell-command-switch "-c")
448 (setq explicit-shell-file-name shell-file-name)
449 (setenv "SHELL" shell-file-name)
450 (setq explicit-sh-args '("-login" "-i"))
451 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
452 (setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
453 (setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
454 (setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
455 (setq comint-completion-autolist t) ; show completion list when ambiguous
456 (setq comint-input-ignoredups t) ; no duplicates in command history
457 (setq comint-completion-addsuffix t) ; insert space/slash after file completion
458 (setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
459 (setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
461 *** Keyboard related changes
463 This lets M-SPC cycle through spacing, that is
464 1. replace all spaces with a single space
466 3. restore the original spacing
467 #+BEGIN_SRC emacs-lisp :tangle yes
468 (bind-key "M-SPC" 'cycle-spacing)
470 **** Toggle/Cycle letter case
471 [2015-05-22 Fri 22:42]
473 This is from [[http://ergoemacs.org/emacs/modernization_upcase-word.html][Emacs: Toggle/Cycle Letter Case]]
475 Emacs has several user level commands for changing letter case. They
476 are: upcase-word 【Alt+u】, downcase-word 【Alt+l】, capitalize-word
479 There are also “region” versions for each: upcase-region 【Ctrl+x
480 Ctrl+u】, downcase-region 【Ctrl+x Ctrl+l】, capitalize-region, and
481 also upcase-initials-region. (Note: for elisp programing, there are
482 also these functions: upcase, capitalize, downcase, upcase-initials.)
484 One problem with these commands is that you need to move your cursor
485 to the beginning of the word first. For example, if you have the text
486 “THat”, and your cursor is on the “a”, and you call downcase-word, but
487 it doesn't do anything because it only start at the cursor point to
488 end of word. It would be nice if it'll just automatically perform the
489 operation on the whole word.
491 Another problem is that it does not consider the final result. For
492 example, if you have “oncE upon a time …”, and you select the whole
493 sentence and call upcase-initials-region, it becomes “OncE Upon A Time
494 …”. Note the capital E is not automatically lowered. For elisp
495 programing, the orthogonal precision is nice, but as user commands, it
496 is better to change the whole sentence.
498 Also, these commands have a “-word” and “-region” variants, great for
499 precision in elisp programing but not smart as user commands. It would
500 be nice if emacs automatically choose the right command depending
501 whether there is text selection.
502 #+BEGIN_SRC emacs-lisp :tangle yes
503 (bind-key "M-c" 'toggle-letter-case)
505 **** Faster pop-to-mark command
506 [2015-12-22 Di 14:56]
507 From [[http://endlessparentheses.com/faster-pop-to-mark-command.html?source=rss][Endless Parentheses]], a nice way to pop back in the marks.
508 #+BEGIN_SRC emacs-lisp :tangle yes
509 ;; When popping the mark, continue popping until the cursor
511 (defadvice pop-to-mark-command (around ensure-new-position activate)
514 (when (= p (point)) ad-do-it))))
515 (setq set-mark-command-repeat-pop t)
517 **** Don't kill-buffer, kill-this-buffer instead
518 From [[http://pragmaticemacs.com/emacs/dont-kill-buffer-kill-this-buffer-instead/][Pragmatic Emacs]]: By default C-x k runs the command kill-buffer
519 which prompts you for which buffer you want to kill, defaulting to the
520 current active buffer. I don’t know about you, but I rarely want to
521 kill a different buffer than the one I am looking at, so I rebind C-x
522 k to kill-this-buffer which just kills the current buffer without
523 prompting (unless there are unsaved changes).
524 #+BEGIN_SRC emacs-lisp :tangle yes
525 (global-set-key (kbd "C-x k") 'kill-this-buffer)
527 ** Miscellaneous stuff
528 Searches and matches should ignore case.
529 #+BEGIN_SRC emacs-lisp
530 (setq-default case-fold-search t)
533 Which buffers to get rid off at midnight.
534 #+BEGIN_SRC emacs-lisp
535 (setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
536 "*Man " "*Buffer List*"
542 "*magit" "*Calendar")))
545 Don't display a cursor in non-selected windows.
546 #+BEGIN_SRC emacs-lisp
547 (setq-default cursor-in-non-selected-windows nil)
550 What should be displayed in the mode-line for files with those types
552 #+BEGIN_SRC emacs-lisp
553 (setq eol-mnemonic-dos "(DOS)")
554 (setq eol-mnemonic-mac "(Mac)")
557 #+BEGIN_SRC emacs-lisp
558 (setq max-lisp-eval-depth 1000)
559 (setq max-specpdl-size 3000)
563 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
564 #+BEGIN_SRC emacs-lisp
565 (defun unfill-paragraph ()
566 "Takes a multi-line paragraph and makes it into a single line of text."
568 (let ((fill-column (point-max)))
569 (fill-paragraph nil)))
570 (bind-key "H-u" 'unfill-paragraph)
573 #+BEGIN_SRC emacs-lisp
574 (setq-default indicate-empty-lines t)
575 (setq sentence-end-double-space nil)
578 Hilight annotations in comments, like FIXME/TODO/...
579 #+BEGIN_SRC emacs-lisp :tangle no
580 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
584 #+BEGIN_SRC emacs-lisp
585 (setq browse-url-browser-function (quote browse-url-generic))
586 (setq browse-url-generic-program "/usr/bin/x-www-browser")
589 *** When saving a script - make it executable
590 #+BEGIN_SRC emacs-lisp
591 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
595 #+BEGIN_SRC emacs-lisp
599 (add-hook 'after-init-hook 'server-start)))
601 **** Edit-server for chromium extension "Edit with emacs"
602 [2015-10-15 Thu 22:32]
603 #+BEGIN_SRC emacs-lisp
604 (use-package edit-server
607 (setq edit-server-new-frame nil)
608 (edit-server-start)))
610 ** Customized variables
611 [2013-05-02 Thu 22:14]
612 The following contains a set of variables i may reasonably want to
613 change on other systems - which don't affect the init file loading
614 process. So I *can* use the customization interface for it...
615 #+BEGIN_SRC emacs-lisp
616 (defgroup ganneff nil
617 "Modify ganneffs settings"
620 (defgroup ganneff-org-mode nil
621 "Ganneffs org-mode settings"
622 :tag "Ganneffs org-mode settings"
624 :link '(custom-group-link "ganneff"))
626 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
627 "ID of the organization task."
628 :tag "Organization Task ID"
630 :group 'ganneff-org-mode)
632 (defcustom org-my-archive-expiry-days 2
633 "The number of days after which a completed task should be auto-archived.
634 This can be 0 for immediate, or a floating point value."
635 :tag "Archive expiry days"
637 :group 'ganneff-org-mode)
642 [2013-05-21 Tue 23:22]
643 Restore removed var alias, used by ruby-electric-brace and others
644 #+BEGIN_SRC emacs-lisp
645 (unless (boundp 'last-command-char)
646 (defvaralias 'last-command-char 'last-command-event))
648 * Customized variables
650 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
652 Of course I want to be able to use the customize interface, and some
653 things can only be set via it (or so they say). I usually prefer to put
654 things I keep for a long while into statements somewhere else, not just
655 custom-set here, but we need it anyways.
657 #+BEGIN_SRC emacs-lisp
658 (setq custom-file jj-custom-file)
659 (safe-load custom-file)
662 The source of this is:
663 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
664 * Extra modes and their configuration
666 A defined abbrev is a word which expands, if you insert it, into some
667 different text. Abbrevs are defined by the user to expand in specific
669 #+BEGIN_SRC emacs-lisp
671 :commands abbrev-mode
672 :diminish abbrev-mode
675 (setq save-abbrevs 'silently)
676 (setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
677 (if (file-exists-p abbrev-file-name)
678 (quietly-read-abbrev-file))
680 (hook-into-modes #'abbrev-mode '(text-mode-hook))
681 (add-hook 'expand-load-hook
683 (add-hook 'expand-expand-hook 'indent-according-to-mode)
684 (add-hook 'expand-jump-hook 'indent-according-to-mode)))))
687 [2016-02-15 Mon 22:19]
688 See [[http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html][Ispell and Abbrev, the Perfect Auto-Correct]].
689 #+BEGIN_SRC emacs-lisp
690 (define-key ctl-x-map "\C-i"
691 #'endless/ispell-word-then-abbrev)
693 (defun endless/ispell-word-then-abbrev (p)
694 "Call `ispell-word', then create an abbrev for it.
695 With prefix P, create local abbrev. Otherwise it will
697 If there's nothing wrong with the word at point, keep
698 looking for a typo until the beginning of buffer. You can
699 skip typos you don't want to fix with `SPC', and you can
700 abort completely with `C-g'."
704 (while (if (setq bef (thing-at-point 'word))
705 ;; Word was corrected or used quit.
706 (if (ispell-word nil 'quiet)
708 ;; Also end if we reach `bob'.
710 ;; If there's no word at point, keep looking
714 (setq aft (thing-at-point 'word)))
715 (if (and aft bef (not (equal aft bef)))
716 (let ((aft (downcase aft))
717 (bef (downcase bef)))
719 (if p local-abbrev-table global-abbrev-table)
721 (message "\"%s\" now expands to \"%s\" %sally"
722 bef aft (if p "loc" "glob")))
723 (user-error "No typo at or before point"))))
725 (setq save-abbrevs 'silently)
726 (setq-default abbrev-mode t)
729 [2013-04-28 So 11:26]
730 avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.
731 #+BEGIN_SRC emacs-lisp
734 :commands (avy-goto-char avy-goto-char-2 avy-goto-line avy-goto-word-1 avy-goto-word-0 avy-isearch avy-goto-subword-0 avy-goto-subword-1 avy-copy-line avy-copy-region avy-move-line)
735 :bind (("H-SPC" . avy-goto-char-2)
736 ("M-g g" . avy-goto-line)
740 (setq avy-all-windows 'all-frames)
741 (setq avi-keys '(?a ?s ?d ?e ?f ?h ?j ?k ?l ?n ?m ?v ?r ?u) )
745 (bind-key "C-y" 'avy-isearch isearch-mode-map)
750 [2013-04-21 So 20:27]
751 Use H-w to switch windows
752 #+BEGIN_SRC emacs-lisp
753 (use-package ace-window
756 :bind ("H-w" . ace-window)
759 (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))
763 [2014-10-27 Mon 13:08]
764 electric-indent-mode is enough to keep your code nicely aligned when
765 all you do is type. However, once you start shifting blocks around,
766 transposing lines, or slurping and barfing sexps, indentation is bound
769 aggressive-indent-mode is a minor mode that keeps your code always
770 indented. It reindents after every command, making it more reliable
771 than electric-indent-mode.
772 #+BEGIN_SRC emacs-lisp
773 (use-package aggressive-indent
774 :ensure aggressive-indent
775 :commands (aggressive-indent-mode global-aggressive-indent-mode)
778 (global-aggressive-indent-mode 0)
779 (setq aggressive-indent-comments-too 0)
780 (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
784 [2014-06-01 Sun 23:02]
785 Provides a minor mode which displays current match and total matches
786 information in the mode-line in various search modes.
787 #+BEGIN_SRC emacs-lisp
794 (setq anzu-search-threshold 1000)
796 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
799 [2014-05-21 Wed 00:33]
800 #+BEGIN_SRC emacs-lisp
802 :commands (ascii-on ascii-toggle ascii-display)
803 :bind (("C-c e A" . ascii-toggle))
806 (defun ascii-toggle ()
808 (defvar ascii-display nil)
813 (bind-key "C-c e A" 'ascii-toggle)))
816 #+BEGIN_SRC emacs-lisp
817 (setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
818 (setq TeX-auto-save t)
819 (setq TeX-parse-self t)
820 (setq TeX-PDF-mode t)
822 ** auto-complete mode
823 [2013-04-27 Sa 16:33]
824 And aren't we all lazy? I definitely am, and I like my emacs doing as
825 much possible work for me as it can.
826 So here, auto-complete-mode, which lets emacs do this, based on what I
828 #+BEGIN_SRC emacs-lisp
829 (use-package auto-complete-config
830 :ensure auto-complete
834 ;; hook AC into completion-at-point
835 (defun sanityinc/auto-complete-at-point ()
836 (when (and (not (minibufferp))
837 (fboundp 'auto-complete-mode)
840 (defun set-auto-complete-as-completion-at-point-function ()
841 (add-to-list 'completion-at-point-functions 'sanityinc/auto-complete-at-point))
842 ;; Exclude very large buffers from dabbrev
843 (defun sanityinc/dabbrev-friend-buffer (other-buffer)
844 (< (buffer-size other-buffer) (* 1 1024 1024)))
849 ;; custom keybindings to use tab, enter and up and down arrows
850 (bind-key "\t" 'ac-expand ac-complete-mode-map)
851 (bind-key "\r" 'ac-complete ac-complete-mode-map)
852 (bind-key "M-n" 'ac-next ac-complete-mode-map)
853 (bind-key "M-p" 'ac-previous ac-complete-mode-map)
854 (bind-key "C-s" 'ac-isearch ac-completing-map)
855 (bind-key "M-TAB" 'auto-complete ac-mode-map)
857 (setq ac-comphist-file (expand-file-name "ac-comphist.dat" jj-cache-dir))
858 (setq ac-use-comphist t)
859 (setq ac-expand-on-auto-complete nil)
861 (setq ac-auto-start 3)
863 (setq ac-menu-height 15)
864 (setq ac-quick-help-delay 0.5)
865 (setq ac-use-fuzzy t)
867 (ac-flyspell-workaround)
869 ;; use 't when auto-complete is disabled
870 (setq tab-always-indent 'complete)
871 (add-to-list 'completion-styles 'initials t)
873 ;; Use space and punctuation to accept the current the most likely completion.
874 (setq auto-completion-syntax-alist (quote (global accept . word)))
875 ;; Avoid completion for short trivial words.
876 (setq auto-completion-min-chars (quote (global . 3)))
877 (setq completion-use-dynamic t)
879 (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
881 ;; Exclude very large buffers from dabbrev
882 (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
884 (use-package ac-dabbrev
887 (set-default 'ac-sources
890 ac-source-words-in-buffer
891 ac-source-words-in-same-mode-buffers
892 ; ac-source-words-in-all-buffer
895 (dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
896 sass-mode yaml-mode csv-mode espresso-mode haskell-mode
897 html-mode nxml-mode sh-mode smarty-mode clojure-mode
898 lisp-mode textile-mode markdown-mode tuareg-mode python-mode
899 js3-mode css-mode less-css-mode sql-mode ielm-mode))
900 (add-to-list 'ac-modes mode))
902 (add-hook 'latex-mode-hook 'auto-complete-mode)
903 (add-hook 'LaTeX-mode-hook 'auto-complete-mode)
904 (add-hook 'prog-mode-hook 'auto-complete-mode)
905 (add-hook 'org-mode-hook 'auto-complete-mode)))
910 When files change outside emacs for whatever reason I want emacs to deal
911 with it. Not to have to revert buffers myself
912 #+BEGIN_SRC emacs-lisp
913 (use-package autorevert
914 :commands auto-revert-mode
915 :diminish auto-revert-mode
918 (setq global-auto-revert-mode t)
919 (setq global-auto-revert-non-file-buffers t)
920 (global-auto-revert-mode)))
924 Emacs should keep backup copies of files I edit, but I do not want them
925 to clutter up the filesystem everywhere. So I put them into one defined
926 place, backup-directory, which even contains my username (for systems
927 where =temporary-file-directory= is not inside my home).
928 #+BEGIN_SRC emacs-lisp
929 (use-package backups-mode
930 :load-path "elisp/backups-mode"
932 :bind (("\C-cv" . save-version)
933 ("\C-cb" . list-backups)
934 ("\C-ck" . kill-buffer-prompt)
935 ("\C-cw" . backup-walker-start))
938 (setq backup-directory jj-backup-directory)
939 ; (setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
940 ; (if (not (file-exists-p tramp-backup-directory))
941 ; (make-directory tramp-backup-directory))
942 ; (setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
943 (setq backup-directory-alist `(("." . ,jj-backup-directory)))
944 (setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
945 (setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
947 (setq version-control t) ;; Use version numbers for backups
948 (setq kept-new-versions 10) ;; Number of newest versions to keep
949 (setq kept-old-versions 2) ;; Number of oldest versions to keep
950 (setq delete-old-versions t) ;; Ask to delete excess backup versions?
951 (setq backup-by-copying t)
952 (setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
953 (setq make-backup-files t)
955 (defadvice kill-buffer (around kill-buffer)
956 "Always save before killing a file buffer"
957 (when (and (buffer-modified-p)
959 (file-exists-p (buffer-file-name)))
962 (ad-activate 'kill-buffer)
964 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
965 "Always save before killing emacs"
966 (save-some-buffers t)
968 (ad-activate 'save-buffers-kill-emacs)
970 (defun kill-buffer-prompt ()
971 "Allows one to kill a buffer without saving it.
972 This is necessary since once you start backups-mode all file based buffers
973 are saved automatically when they are killed"
975 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
977 (set-buffer-modified-p nil))
980 (setq backup-enable-predicate
982 (and (normal-backup-enable-predicate name)
984 (let ((method (file-remote-p name 'method)))
985 (when (stringp method)
986 (member method '("su" "sudo"))))))))))
990 [2014-12-11 Thu 11:31]
991 #+BEGIN_SRC emacs-lisp
992 (use-package browse-kill-ring
993 :commands (browse-kill-ring browse-kill-ring-mode)
994 :bind ("M-y" . browse-kill-ring)
998 [2014-06-10 Tue 22:20]
999 #+BEGIN_SRC emacs-lisp
1001 :commands (cal/insert)
1002 :bind ("C-c c" . cal/insert)
1005 ; Weeks start on Monday, not sunday.
1006 (setq calendar-week-start-day 1)
1008 ; Display ISO week numbers in Calendar Mode
1009 (copy-face font-lock-constant-face 'calendar-iso-week-face)
1010 (set-face-attribute 'calendar-iso-week-face nil :height 0.7)
1011 (setq calendar-intermonth-text
1015 (calendar-iso-from-absolute
1016 (calendar-absolute-from-gregorian (list month day year)))))
1017 'font-lock-face 'calendar-iso-week-face))
1018 (copy-face 'default 'calendar-iso-week-header-face)
1019 (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7)
1020 (setq calendar-intermonth-header
1021 (propertize "Wk" ; or e.g. "KW" in Germany
1022 'font-lock-face 'calendar-iso-week-header-face))))
1026 [2015-10-15 Thu 11:34]
1027 Corral is a lightweight package that lets you quickly wrap parentheses
1028 and other delimiters around text, intuitively surrounding what you
1029 want it to using just two commands.
1030 #+BEGIN_SRC emacs-lisp
1035 ; Interpret # and * as part of the word
1036 (setq corral-syntax-entries '((?# "_")
1040 (defhydra hydra-corral (:columns 4)
1042 ("(" corral-parentheses-backward "Back")
1043 (")" corral-parentheses-forward "Forward")
1044 ("[" corral-brackets-backward "Back")
1045 ("]" corral-brackets-forward "Forward")
1046 ("{" corral-braces-backward "Back")
1047 ("}" corral-braces-forward "Forward")
1048 ("\"" corral-double-quotes-backward "Back")
1049 ("2" corral-double-quotes-forward "Forward")
1050 ("'" corral-single-quotes-backward "Back")
1051 ("#" corral-single-quotes-forward "Forward")
1052 ("." hydra-repeat "Repeat"))
1053 (bind-key "C-c c" 'hydra-corral/body)
1057 [2013-05-21 Tue 23:18]
1058 #+BEGIN_SRC emacs-lisp
1059 (use-package crontab-mode
1060 :ensure crontab-mode
1061 :commands crontab-mode
1062 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
1066 web-mode takes over, see [[*web-mode][web-mode]]
1067 #+BEGIN_SRC emacs-lisp :tangle no
1068 (use-package css-mode
1069 :mode ("\\.css\\'" . css-mode)
1074 (use-package flymake-css
1078 (defun maybe-flymake-css-load ()
1079 "Activate flymake-css as necessary, but not in derived modes."
1080 (when (eq major-mode 'css-mode)
1081 (flymake-css-load)))
1082 (add-hook 'css-mode-hook 'maybe-flymake-css-load)))
1083 ;;; Auto-complete CSS keywords
1084 (eval-after-load 'auto-complete
1086 (dolist (hook '(css-mode-hook sass-mode-hook scss-mode-hook))
1087 (add-hook hook 'ac-css-mode-setup))))))
1091 I know that this lets it look "more like windows", but I don't much care
1092 about its paste/copy/cut keybindings, the really nice part is the great
1093 support for rectangular regions, which I started to use a lot since I
1094 know this mode. The normal keybindings for those are just to useless.
1095 #+BEGIN_SRC emacs-lisp
1097 (setq cua-enable-cua-keys (quote shift))
1100 Luckily cua-mode easily supports this, with the following line I just
1101 get the CUA selection and rectangle stuff, not the keybindings. Yes,
1102 even though the above =cua-enable-cua-keys= setting would only enable
1103 them if the selection is done when the region was marked with a shifted
1105 #+BEGIN_SRC emacs-lisp
1106 (cua-selection-mode t)
1110 #+BEGIN_SRC emacs-lisp
1111 (require 'dpkg-dev-el-loaddefs nil 'noerror)
1112 (require 'debian-el-loaddefs nil 'noerror)
1114 (setq debian-changelog-full-name "Joerg Jaspert")
1115 (setq debian-changelog-mailing-address "joerg@debian.org")
1119 #+BEGIN_SRC emacs-lisp
1120 (use-package diff-mode
1122 :mode (("\\.diff" . diff-mode)))
1126 #+BEGIN_SRC emacs-lisp
1128 :commands (dired dired-other-window dired-other-frame dired-noselect
1129 dired-mode dired-jump)
1130 :defines (dired-omit-regexp-orig)
1131 :bind (:map dired-mode-map
1132 ("F" . find-name-dired))
1135 (setq diredp-hide-details-initially-flag nil))
1138 (setq dired-auto-revert-buffer (quote dired-directory-changed-p))
1139 (setq dired-dwim-target t)
1140 (setq dired-listing-switches "-alh")
1141 (setq dired-listing-switches "-alXh --group-directories-first")
1142 (setq dired-recursive-copies (quote top))
1143 (setq dired-recursive-deletes (quote top))
1144 (setq dired-guess-shell-alist-user
1145 '(("\\.pdf\\'" "mupdf")
1146 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
1147 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
1148 ("\\.\\(?:xcf\\)\\'" "gimp")
1149 ("\\.csv\\'" "libreoffice")
1150 ("\\.tex\\'" "pdflatex" "latex")
1151 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
1152 ("\\.html?\\'" "conkeror")))
1157 (use-package dired-x)
1159 (use-package dired-single
1160 :ensure dired-single
1163 (bind-key "<return>" 'dired-single-buffer dired-mode-map)
1164 (bind-key "<mouse-1>" 'dired-single-buffer-mouse dired-mode-map)
1167 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
1173 (setq wdired-allow-to-change-permissions t)
1174 (bind-key "r" 'wdired-change-to-wdired-mode dired-mode-map)))
1176 (use-package gnus-dired
1177 :commands (gnus-dired-attach gnus-dired-mode)
1180 ;;(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
1181 (bind-key "a" 'gnus-dired-attach dired-mode-map)))
1186 (defvar mark-files-cache (make-hash-table :test #'equal))
1188 (defun mark-similar-versions (name)
1190 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
1191 (setq pat (match-string 1 pat)))
1192 (or (gethash pat mark-files-cache)
1193 (ignore (puthash pat t mark-files-cache)))))
1195 (defun dired-mark-similar-version ()
1197 (setq mark-files-cache (make-hash-table :test #'equal))
1198 (dired-mark-sexp '(mark-similar-versions name)))
1200 (defun dired-package-initialize ()
1201 (unless (featurep 'runner)
1202 (bind-key "M-!" 'async-shell-command dired-mode-map)
1203 (unbind-key "M-s f" dired-mode-map)
1205 (defadvice dired-omit-startup (after diminish-dired-omit activate)
1206 "Make sure to remove \"Omit\" from the modeline."
1207 (diminish 'dired-omit-mode) dired-mode-map)
1209 ;; Omit files that Git would ignore
1210 (defun dired-omit-regexp ()
1211 (let ((file (expand-file-name ".git"))
1213 (while (and (not (file-exists-p file))
1216 (file-name-directory
1217 (directory-file-name
1218 (file-name-directory file))))
1219 ;; Give up if we are already at the root dir.
1220 (not (string= (file-name-directory file)
1222 ;; Move up to the parent dir and try again.
1223 (setq file (expand-file-name ".git" parent-dir)))
1224 ;; If we found a change log in a parent, use that.
1225 (if (file-exists-p file)
1226 (let ((regexp (funcall dired-omit-regexp-orig))
1228 (shell-command-to-string "git clean -d -x -n")))
1229 (if (= 0 (length omitted-files))
1233 (if (> (length regexp) 0)
1242 (if (= ?/ (aref str (1- (length str))))
1246 (split-string omitted-files "\n" t)
1249 (funcall dired-omit-regexp-orig))))))
1251 (add-hook 'dired-mode-hook 'dired-package-initialize)
1253 (defun dired-double-jump (first-dir second-dir)
1255 (list (read-directory-name "First directory: "
1256 (expand-file-name "~")
1257 nil nil "/Downloads/")
1258 (read-directory-name "Second directory: "
1259 (expand-file-name "~")
1262 (dired-other-window second-dir))
1263 (bind-key "C-c J" 'dired-double-jump)
1265 (defun dired-back-to-top ()
1267 (goto-char (point-min))
1268 (dired-next-line 4))
1270 (define-key dired-mode-map
1271 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
1273 (defun dired-jump-to-bottom ()
1275 (goto-char (point-max))
1276 (dired-next-line -1))
1278 (define-key dired-mode-map
1279 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
1282 ** discover-my-major
1283 [2014-06-01 Sun 23:32]
1284 Discover key bindings and their meaning for the current Emacs major mode.
1285 #+BEGIN_SRC emacs-lisp
1286 (use-package discover-my-major
1287 :ensure discover-my-major
1288 :commands discover-my-major
1289 :bind ("C-h C-m" . discover-my-major))
1292 EasyPG is a GnuPG interface for Emacs.
1293 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1294 #+BEGIN_SRC emacs-lisp
1295 (use-package epa-file
1299 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1300 (defadvice epg--start (around advice-epg-disable-agent disable)
1301 "Don't allow epg--start to use gpg-agent in plain text
1303 (if (display-graphic-p)
1305 (let ((agent (getenv "GPG_AGENT_INFO")))
1306 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
1308 (setenv "GPG_AGENT_INFO" agent))))
1309 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
1310 (ad-activate 'epg--start)
1314 [2013-04-21 So 20:36]
1315 ediff - don't start another frame
1316 #+BEGIN_SRC emacs-lisp
1320 (defvar ctl-period-equals-map)
1321 (define-prefix-command 'ctl-period-equals-map)
1322 (bind-key "C-. =" 'ctl-period-equals-map)
1323 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
1325 :bind (("C-. = b" . ediff-buffers)
1326 ("C-. = B" . ediff-buffers3)
1327 ("C-. = =" . ediff-files)
1328 ("C-. = f" . ediff-files)
1329 ("C-. = F" . ediff-files3)
1330 ("C-. = r" . ediff-revision)
1331 ("C-. = p" . ediff-patch-file)
1332 ("C-. = P" . ediff-patch-buffer)
1333 ("C-. = l" . ediff-regions-linewise)
1334 ("C-. = w" . ediff-regions-wordwise))
1336 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
1337 (setq ediff-split-window-function 'split-window-horizontally)
1342 [2015-12-16 Wed 22:13]
1343 Allows chromium to "send" files (textbox inputs) to emacs to edit.
1344 #+BEGIN_SRC emacs-lisp
1345 (use-package edit-server
1350 (setq edit-server-new-frame t)
1351 (edit-server-start)))
1355 EMMS is the Emacs Multimedia System.
1356 #+BEGIN_SRC emacs-lisp :tangle no
1357 (require 'emms-source-file)
1358 (require 'emms-source-playlist)
1359 (require 'emms-info)
1360 (require 'emms-cache)
1361 (require 'emms-playlist-mode)
1362 (require 'emms-playing-time)
1363 (require 'emms-player-mpd)
1364 (require 'emms-playlist-sort)
1365 (require 'emms-mark)
1366 (require 'emms-browser)
1367 (require 'emms-lyrics)
1368 (require 'emms-last-played)
1369 (require 'emms-score)
1370 (require 'emms-tag-editor)
1371 (require 'emms-history)
1372 (require 'emms-i18n)
1374 (setq emms-playlist-default-major-mode 'emms-playlist-mode)
1375 (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track)
1376 (emms-playing-time 1)
1378 (add-hook 'emms-player-started-hook 'emms-last-played-update-current)
1379 ;(add-hook 'emms-player-started-hook 'emms-player-mpd-sync-from-emms)
1381 (when (fboundp 'emms-cache) ; work around compiler warning
1383 (setq emms-score-default-score 3)
1385 (defun emms-mpd-init ()
1386 "Connect Emms to mpd."
1388 (emms-player-mpd-connect))
1391 (require 'emms-player-mpd)
1392 (setq emms-player-mpd-server-name "localhost")
1393 (setq emms-player-mpd-server-port "6600")
1394 (add-to-list 'emms-info-functions 'emms-info-mpd)
1395 (add-to-list 'emms-player-list 'emms-player-mpd)
1396 (setq emms-volume-change-function 'emms-volume-mpd-change)
1397 (setq emms-player-mpd-sync-playlist t)
1399 (setq emms-source-file-default-directory "/var/lib/mpd/music")
1400 (setq emms-player-mpd-music-directory "/var/lib/mpd/music")
1401 (setq emms-info-auto-update t)
1402 (setq emms-lyrics-scroll-p t)
1403 (setq emms-lyrics-display-on-minibuffer t)
1404 (setq emms-lyrics-display-on-modeline nil)
1405 (setq emms-lyrics-dir "~/.emacs.d/var/lyrics")
1407 (setq emms-last-played-format-alist
1408 '(((emms-last-played-seconds-today) . "%H:%M")
1409 (604800 . "%a %H:%M") ; this week
1410 ((emms-last-played-seconds-month) . "%d.%m.%Y")
1411 ((emms-last-played-seconds-year) . "%d.%m.%Y")
1412 (t . "Never played")))
1415 (defun my-describe (track)
1416 (let* ((empty "...")
1417 (name (emms-track-name track))
1418 (type (emms-track-type track))
1419 (short-name (file-name-nondirectory name))
1420 (play-count (or (emms-track-get track 'play-count) 0))
1421 (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
1422 (artist (or (emms-track-get track 'info-artist) empty))
1423 (year (emms-track-get track 'info-year))
1424 (playing-time (or (emms-track-get track 'info-playing-time) 0))
1425 (min (/ playing-time 60))
1426 (sec (% playing-time 60))
1427 (album (or (emms-track-get track 'info-album) empty))
1428 (tracknumber (emms-track-get track 'info-tracknumber))
1429 (short-name (file-name-sans-extension
1430 (file-name-nondirectory name)))
1431 (title (or (emms-track-get track 'info-title) short-name))
1432 (rating (emms-score-get-score name))
1435 (format "%12s %20s (%.4s) [%-20s] - %2s. %-30s | %2d %s"
1436 (emms-last-played-format-date last-played)
1440 (if (and tracknumber ; tracknumber
1441 (not (zerop (string-to-number tracknumber))))
1442 (format "%02d" (string-to-number tracknumber))
1446 (make-string rating rate-char)))
1449 (setq emms-track-description-function 'my-describe)
1451 ;; (global-set-key (kbd "C-<f9> t") 'emms-play-directory-tree)
1452 ;; (global-set-key (kbd "H-<f9> e") 'emms-play-file)
1453 (global-set-key (kbd "H-<f9> <f9>") 'emms-mpd-init)
1454 (global-set-key (kbd "H-<f9> d") 'emms-play-dired)
1455 (global-set-key (kbd "H-<f9> x") 'emms-start)
1456 (global-set-key (kbd "H-<f9> v") 'emms-stop)
1457 (global-set-key (kbd "H-<f9> n") 'emms-next)
1458 (global-set-key (kbd "H-<f9> p") 'emms-previous)
1459 (global-set-key (kbd "H-<f9> o") 'emms-show)
1460 (global-set-key (kbd "H-<f9> h") 'emms-shuffle)
1461 (global-set-key (kbd "H-<f9> SPC") 'emms-pause)
1462 (global-set-key (kbd "H-<f9> a") 'emms-add-directory-tree)
1463 (global-set-key (kbd "H-<f9> b") 'emms-smart-browse)
1464 (global-set-key (kbd "H-<f9> l") 'emms-playlist-mode-go)
1466 (global-set-key (kbd "H-<f9> r") 'emms-toggle-repeat-track)
1467 (global-set-key (kbd "H-<f9> R") 'emms-toggle-repeat-playlist)
1468 (global-set-key (kbd "H-<f9> m") 'emms-lyrics-toggle-display-on-minibuffer)
1469 (global-set-key (kbd "H-<f9> M") 'emms-lyrics-toggle-display-on-modeline)
1471 (global-set-key (kbd "H-<f9> <left>") (lambda () (interactive) (emms-seek -10)))
1472 (global-set-key (kbd "H-<f9> <right>") (lambda () (interactive) (emms-seek +10)))
1473 (global-set-key (kbd "H-<f9> <down>") (lambda () (interactive) (emms-seek -60)))
1474 (global-set-key (kbd "H-<f9> <up>") (lambda () (interactive) (emms-seek +60)))
1476 (global-set-key (kbd "H-<f9> s u") 'emms-score-up-playing)
1477 (global-set-key (kbd "H-<f9> s d") 'emms-score-down-playing)
1478 (global-set-key (kbd "H-<f9> s o") 'emms-score-show-playing)
1479 (global-set-key (kbd "H-<f9> s s") 'emms-score-set-playing)
1481 (define-key emms-playlist-mode-map "u" 'emms-score-up-playing)
1482 (define-key emms-playlist-mode-map "d" 'emms-score-down-playing)
1483 (define-key emms-playlist-mode-map "o" 'emms-score-show-playing)
1484 (define-key emms-playlist-mode-map "s" 'emms-score-set-playing)
1485 (define-key emms-playlist-mode-map "r" 'emms-mpd-init)
1486 (define-key emms-playlist-mode-map "N" 'emms-playlist-new)
1488 (define-key emms-playlist-mode-map "x" 'emms-start)
1489 (define-key emms-playlist-mode-map "v" 'emms-stop)
1490 (define-key emms-playlist-mode-map "n" 'emms-next)
1491 (define-key emms-playlist-mode-map "p" 'emms-previous)
1493 (setq emms-playlist-buffer-name "*EMMS Playlist*"
1494 emms-playlist-mode-open-playlists t)
1500 'emms-browser-artist-face nil
1505 (setq emms-player-mpd-supported-regexp
1506 (or (emms-player-mpd-get-supported-regexp)
1507 (concat "\\`http://\\|"
1508 (emms-player-simple-regexp
1509 "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff"))))
1510 (emms-player-set emms-player-mpd 'regex emms-player-mpd-supported-regexp)
1514 Basic settings for emacs integrated shell
1515 #+BEGIN_SRC emacs-lisp :tangle no
1521 (defun eshell-initialize ()
1522 (defun eshell-spawn-external-command (beg end)
1523 "Parse and expand any history references in current input."
1526 (when (looking-back "&!" beg)
1527 (delete-region (match-beginning 0) (match-end 0))
1529 (insert "spawn "))))
1530 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1531 (eval-after-load "em-unix"
1533 (unintern 'eshell/su)
1534 (unintern 'eshell/sudo))))
1535 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1539 (defalias 'emacs 'find-file)
1540 (defalias 'ec 'find-file)
1541 (defalias 'e 'find-file)
1545 (use-package 'em-cmpl)
1546 (use-package 'em-prompt)
1547 (use-package 'em-term)
1549 (setq eshell-cmpl-cycle-completions nil
1550 eshell-save-history-on-exit t
1551 eshell-buffer-maximum-lines 20000
1552 eshell-history-size 350
1553 eshell-buffer-shorthand t
1554 eshell-highlight-prompt t
1555 eshell-plain-echo-behavior t
1556 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1558 (setenv "PAGER" "cat")
1559 (setq eshell-visual-commands
1560 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1561 (setq eshell-visual-subcommands
1562 '(("git" "log" "l" "diff" "show")))
1564 (add-to-list 'eshell-command-completions-alist
1565 '("gunzip" "gz\\'"))
1566 (add-to-list 'eshell-command-completions-alist
1567 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1569 (when (not (functionp 'eshell/rgrep))
1570 (defun eshell/rgrep (&rest args)
1571 "Use Emacs grep facility instead of calling external grep."
1572 (eshell-grep "rgrep" args t)))
1574 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1575 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1576 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1577 (add-hook 'eshell-preoutput-filter-functions
1578 'ansi-color-filter-apply)
1579 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1581 (defmacro with-face (str &rest properties)
1582 `(propertize ,str 'face (list ,@properties)))
1584 (defun eshell/abbr-pwd ()
1585 (let ((home (getenv "HOME"))
1586 (path (eshell/pwd)))
1588 ((string-equal home path) "~")
1589 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1592 (defun eshell/my-prompt ()
1593 (let ((header-bg "#161616"))
1595 (with-face user-login-name :foreground "cyan")
1596 (with-face (concat "@" hostname) :foreground "white")
1598 (with-face (eshell/abbr-pwd) :foreground "#009900")
1599 (if (= (user-uid) 0)
1600 (with-face "#" :foreground "red")
1601 (with-face "$" :foreground "#69b7f0"))
1604 (use-package eshell-prompt-extras
1608 (setq eshell-highlight-prompt nil
1609 ;; epe-git-dirty-char "Ϟ"
1610 epe-git-dirty-char "*"
1611 eshell-prompt-function 'epe-theme-dakrone)))
1613 (defun eshell/magit ()
1614 "Function to open magit-status for the current directory"
1616 (magit-status default-directory)
1619 (setq eshell-prompt-function 'eshell/my-prompt)
1620 (setq eshell-highlight-prompt nil)
1621 (setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1626 Incremental search is great, but annoyingly you need to type whatever
1627 you want. If you want to search for just the next (or previous)
1628 occurence of what is at your cursor position use the following.
1629 *C-x* will insert the current word while *M-up* and *M-down* will just
1630 jump to the next/previous occurence of it.
1631 #+BEGIN_SRC emacs-lisp
1632 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
1633 (bind-key* "<M-up>" 'sacha/search-word-backward)
1634 (bind-key* "<M-down>" 'sacha/search-word-forward)
1637 *** Frame configuration
1638 I want to see the buffername and its size, not the host I am on in my
1640 #+BEGIN_SRC emacs-lisp
1641 (setq frame-title-format "%b (%i)")
1644 *** Protect some buffers
1645 I don't want some buffers to be killed, **scratch** for example.
1646 In the past I had a long function that just recreated them, but the
1647 =keep-buffers= package is easier.
1648 #+BEGIN_SRC emacs-lisp
1649 (use-package keep-buffers
1652 (keep-buffers-mode 1)
1653 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1654 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1659 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
1661 #+BEGIN_SRC emacs-lisp
1662 (defalias 'yes-or-no-p 'y-or-n-p)
1665 *** Language/i18n stuff
1666 In this day and age, UTF-8 is the way to go.
1667 #+BEGIN_SRC emacs-lisp
1668 (set-language-environment 'utf-8)
1669 (set-default-coding-systems 'utf-8)
1670 (set-terminal-coding-system 'utf-8)
1671 (set-keyboard-coding-system 'utf-8)
1672 (set-clipboard-coding-system 'utf-8)
1673 (prefer-coding-system 'utf-8)
1674 (set-charset-priority 'unicode)
1675 (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
1676 (when (display-graphic-p)
1677 (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
1680 *** Hilight matching parentheses
1681 While I do have the nifty shortcut to jump to the other parentheses,
1682 hilighting them makes it obvious where they are.
1683 #+BEGIN_SRC emacs-lisp
1684 (use-package mic-paren
1688 *** Kill other buffers
1689 While many editors allow you to close "all the other files, not the one
1690 you are in", emacs doesn't have this... Except, now it will.
1691 (Update 30.05.2014: Not used ever, deactivated)
1692 #+BEGIN_SRC emacs-lisp :tangle no
1693 (bind-key "C-c k" 'prelude-kill-other-buffers)
1696 Default scrolling behaviour in emacs is a bit annoying, who wants to
1698 #+BEGIN_SRC emacs-lisp
1699 (setq scroll-margin 3)
1700 (setq scroll-conservatively 100000)
1701 (setq scroll-up-aggressively 0.0)
1702 (setq scroll-down-aggressively 0.0)
1703 (setq scroll-preserve-screen-position 'always)
1706 *** Copy/Paste with X
1707 [2013-04-09 Di 23:31]
1708 The default how emacs handles cutting/pasting with the primary selection
1709 changed in emacs24. I am used to the old way, so get it back.
1710 #+BEGIN_SRC emacs-lisp
1711 (setq select-enable-primary t)
1712 (setq select-enable-clipboard nil)
1713 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1714 (setq mouse-drag-copy-region t)
1716 *** Global keyboard changes not directly related to a mode
1717 Disable /suspend_frame/ function, I dislike it.
1718 #+BEGIN_SRC emacs-lisp
1720 (unbind-key "C-x C-z")
1723 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
1724 #+BEGIN_SRC emacs-lisp
1725 (defmacro bol-with-prefix (function)
1726 "Define a new function which calls FUNCTION.
1727 Except it moves to beginning of line before calling FUNCTION when
1728 called with a prefix argument. The FUNCTION still receives the
1730 (let ((name (intern (format "endless/%s-BOL" function))))
1734 "Call `%s', but move to BOL when called with a prefix argument."
1739 (call-interactively ',function))
1742 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
1743 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
1744 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
1747 Default of *C-k* is to kill from the point to the end of line. If
1748 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
1749 set, including newline. But to kill the entire line, one still needs a
1750 *C-a* in front of it. So I change it, by defining a function to do just this for
1752 #+BEGIN_SRC emacs-lisp :tangle no
1753 (defun kill-entire-line ()
1754 "Kill this entire line (including newline), regardless of where point is within the line."
1758 (back-to-indentation))
1760 (bind-key* "C-k" 'kill-entire-line)
1761 (global-set-key [remap kill-whole-line] 'kill-entire-line)
1764 And the same is true when I'm in org-mode, which has an own kill function...
1765 (the keybinding happens later, after org-mode is loaded fully)
1766 #+BEGIN_SRC emacs-lisp :tangle no
1767 (defun jj-org-kill-line (&optional arg)
1768 "Kill the entire line, regardless of where point is within the line, org-mode-version"
1772 (back-to-indentation)
1776 I really hate tabs, so I don't want any indentation to try using them.
1777 And in case a project really needs them, I can change it just for that
1778 file/project, but luckily none of those I work in is as broken.
1779 #+BEGIN_SRC emacs-lisp
1780 (setq-default indent-tabs-mode nil)
1783 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
1784 #+BEGIN_SRC emacs-lisp
1785 (bind-key* "M-5" 'match-paren)
1788 Instead of the default "mark-defun" I want a more readline-like setting.
1789 #+BEGIN_SRC emacs-lisp
1790 (bind-key "C-M-h" 'backward-kill-word)
1793 Align whatever with a regexp.
1794 #+BEGIN_SRC emacs-lisp
1795 (bind-key "C-x \\" 'align-regexp)
1799 #+BEGIN_SRC emacs-lisp
1800 (bind-key "C-+" 'text-scale-increase)
1801 (bind-key "C--" 'text-scale-decrease)
1804 Regexes are too useful, so use the regex search by default.
1805 Disabled, see ivy-mode.
1806 #+begin_src emacs-lisp :tangle no
1807 (bind-key "C-s" 'isearch-forward-regexp)
1808 (bind-key "C-r" 'isearch-backward-regexp)
1809 (bind-key "C-M-s" 'isearch-forward)
1810 (bind-key "C-M-r" 'isearch-backward)
1813 Rgrep is infinitely useful in multi-file projects.
1814 #+begin_src emacs-lisp
1815 (bind-key "C-x C-g" 'rgrep)
1818 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
1819 AKA transpose lines.
1820 #+BEGIN_SRC emacs-lisp
1821 (bind-key "<M-S-up>" 'move-line-up)
1822 (bind-key "<M-S-down>" 'move-line-down)
1825 "Pull" lines up, join them
1826 #+BEGIN_SRC emacs-lisp
1827 (defun join-line-or-lines-in-region ()
1828 "Join this line or the lines in the selected region.
1829 Joins single lines in reverse order to the default, ie. pulls the next one up."
1831 (cond ((region-active-p)
1832 (let ((min (line-number-at-pos (region-beginning))))
1833 (goto-char (region-end))
1834 (while (> (line-number-at-pos) min)
1836 (t (let ((current-prefix-arg '(4)))
1837 (call-interactively 'join-line)))))
1838 (bind-key "M-j" 'join-line-or-lines-in-region)
1841 When I press Enter I almost always want to go to the right indentation on the next line.
1842 #+BEGIN_SRC emacs-lisp
1843 (bind-key "RET" 'newline-and-indent)
1846 Easier undo, and i don't need suspend-frame
1847 #+BEGIN_SRC emacs-lisp
1848 (bind-key "C-z" 'undo)
1851 Window switching, go backwards. (C-x o goes to the next window)
1852 #+BEGIN_SRC emacs-lisp
1853 (bind-key "C-x O" (lambda ()
1859 #+BEGIN_SRC emacs-lisp
1860 (bind-key "C-x C-r" 'prelude-sudo-edit)
1863 M-space is bound to just-one-space, which is great for programming. What
1864 it does is remove all spaces around the cursor, except for one. But to
1865 be really useful, it also should include newlines. It doesn’t do this by
1866 default. Rather, you have to call it with a negative argument. Sure
1868 #+BEGIN_SRC emacs-lisp
1869 (bind-key "M-SPC" 'just-one-space-with-newline)
1872 Count which commands I use how often.
1873 #+BEGIN_SRC emacs-lisp
1874 (use-package keyfreq
1878 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
1879 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
1881 (keyfreq-autosave-mode 1)))
1884 Duplicate current line
1885 #+BEGIN_SRC emacs-lisp
1886 (defun duplicate-line ()
1887 "Insert a copy of the current line after the current line."
1890 (let ((line-text (buffer-substring-no-properties
1891 (line-beginning-position)
1892 (line-end-position))))
1893 (move-end-of-line 1)
1895 (insert line-text))))
1897 (bind-key "C-c p" 'duplicate-line)
1900 Smarter move to the beginning of the line. That is, it first moves to
1901 the beginning of the line - and on second keypress it goes to the
1902 first character on line.
1903 #+BEGIN_SRC emacs-lisp
1904 (defun smarter-move-beginning-of-line (arg)
1905 "Move point back to indentation of beginning of line.
1907 Move point to the first non-whitespace character on this line.
1908 If point is already there, move to the beginning of the line.
1909 Effectively toggle between the first non-whitespace character and
1910 the beginning of the line.
1912 If ARG is not nil or 1, move forward ARG - 1 lines first. If
1913 point reaches the beginning or end of the buffer, stop there."
1915 (setq arg (or arg 1))
1919 (let ((line-move-visual nil))
1920 (forward-line (1- arg))))
1922 (let ((orig-point (point)))
1923 (back-to-indentation)
1924 (when (= orig-point (point))
1925 (move-beginning-of-line 1))))
1927 ;; remap C-a to `smarter-move-beginning-of-line'
1928 (global-set-key [remap move-beginning-of-line]
1929 'smarter-move-beginning-of-line)
1933 Easily copy characters from the previous nonblank line, starting just
1934 above point. With a prefix argument, only copy ARG characters (never
1935 past EOL), no argument copies rest of line.
1936 #+BEGIN_SRC emacs-lisp
1938 (bind-key "H-y" 'copy-from-above-command)
1941 Open a new X Terminal pointing to the directory of the current
1943 #+BEGIN_SRC emacs-lisp
1944 (bind-key "H-t" 'jj-open-shell)
1948 #+BEGIN_SRC emacs-lisp
1949 (bind-key "H-a" 'align-code)
1953 #+BEGIN_SRC emacs-lisp
1954 (bind-key "C-c d" 'insert-date)
1957 Another key for indenting
1958 #+BEGIN_SRC emacs-lisp
1959 (bind-key "H-i" 'indent-region)
1962 Clean all whitespace stuff
1963 #+BEGIN_SRC emacs-lisp
1964 (bind-key "H-w" 'whitespace-cleanup)
1968 #+BEGIN_SRC emacs-lisp
1969 (bind-key "H-c" 'comment-dwim)
1972 Show keystrokes in progress
1973 #+BEGIN_SRC emacs-lisp
1974 (setq echo-keystrokes 0.1)
1977 Usually you can press the *Ins*ert key, to get into overwrite mode. I
1978 don't like that, have broken much with it and so just forbid it by
1980 #+BEGIN_SRC emacs-lisp
1981 (unbind-key "<insert>")
1982 (unbind-key "<kp-insert>")
1985 *** Easily navigate sillyCased words
1986 #+BEGIN_SRC emacs-lisp
1987 (global-subword-mode 1)
1989 *** Delete file of current buffer, then kill buffer
1990 [2014-06-14 Sat 23:03]
1991 #+BEGIN_SRC emacs-lisp
1992 (defun delete-current-buffer-file ()
1993 "Removes file connected to current buffer and kills buffer."
1995 (let ((filename (buffer-file-name))
1996 (buffer (current-buffer))
1997 (name (buffer-name)))
1998 (if (not (and filename (file-exists-p filename)))
2000 (when (yes-or-no-p "Are you sure you want to remove this file? ")
2001 (delete-file filename)
2002 (kill-buffer buffer)
2003 (message "File '%s' successfully removed" filename)))))
2005 (global-set-key (kbd "C-x C-k") 'delete-current-buffer-file)
2007 *** Rename file of current buffer
2008 [2014-06-14 Sat 23:04]
2009 #+BEGIN_SRC emacs-lisp
2010 (defun rename-current-buffer-file ()
2011 "Renames current buffer and file it is visiting."
2013 (let ((name (buffer-name))
2014 (filename (buffer-file-name)))
2015 (if (not (and filename (file-exists-p filename)))
2016 (error "Buffer '%s' is not visiting a file!" name)
2017 (let ((new-name (read-file-name "New name: " filename)))
2018 (if (get-buffer new-name)
2019 (error "A buffer named '%s' already exists!" new-name)
2020 (rename-file filename new-name 1)
2021 (rename-buffer new-name)
2022 (set-visited-file-name new-name)
2023 (set-buffer-modified-p nil)
2024 (message "File '%s' successfully renamed to '%s'"
2025 name (file-name-nondirectory new-name)))))))
2027 (global-set-key (kbd "C-x C-S-r") 'rename-current-buffer-file)
2029 *** Quickly find emacs lisp sources
2030 [2014-06-22 Sun 23:05]
2031 #+BEGIN_SRC emacs-lisp
2032 (bind-key "C-l" 'find-library 'help-command)
2033 (bind-key "C-f" 'find-function 'help-command)
2034 (bind-key "C-k" 'find-function-on-key 'help-command)
2035 (bind-key "C-v" 'find-variable 'help-command)
2038 [2015-01-26 Mon 16:01]
2039 #+BEGIN_SRC emacs-lisp
2040 (bind-key "M-s o" 'occur-dwim)
2044 [2014-06-01 Sun 15:00]
2045 Proper whitespace handling
2046 #+BEGIN_SRC emacs-lisp :tangle no
2047 (use-package ethan-wspace
2048 :ensure ethan-wspace
2049 :diminish (ethan-wspace-mode . "ew")
2051 (global-ethan-wspace-mode 1))
2055 [2014-06-01 Sun 15:16]
2056 #+BEGIN_SRC emacs-lisp
2057 (use-package expand-region
2058 :ensure expand-region
2059 :bind ("C-M-+" . er/expand-region)
2060 :commands er/expand-region)
2063 [2013-05-02 Thu 00:04]
2064 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
2065 fill prefix, such as a comment sequence in program code, and handling
2066 bullet points like “1.” or “*”.
2067 #+BEGIN_SRC emacs-lisp
2068 (use-package filladapt
2069 :diminish filladapt-mode
2071 (setq-default filladapt-mode t))
2074 [2013-04-28 So 22:21]
2075 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
2076 As the one time I tried Flymake i wasn't happy, thats easy to
2078 #+BEGIN_SRC emacs-lisp
2079 (use-package flycheck
2081 :diminish flycheck-mode
2082 :bind (("M-n" . next-error)
2083 ("M-p" . previous-error))
2086 (use-package flycheck-color-mode-line
2087 :ensure flycheck-color-mode-line)
2088 (setq flycheck-highlighting-mode 'nil)
2089 (setq flycheck-flake8-maximum-line-length '150)
2090 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
2091 (setq flycheck-sh-shellcheck-executable "/usr/bin/shellcheck -e 2086")
2092 (add-hook 'find-file-hook
2094 (when (not (equal 'emacs-lisp-mode major-mode))
2099 Obviously emacs can do syntax hilighting. For more things than you ever
2101 And I want to have it everywhere.
2102 #+BEGIN_SRC emacs-lisp
2103 (use-package font-lock
2106 (global-font-lock-mode 1)
2107 (setq font-lock-maximum-decoration t)))
2110 [2015-08-31 Mon 11:27]
2111 Display nice lines instead of page breaks
2112 #+BEGIN_SRC emacs-lisp
2113 (use-package form-feed
2118 #+BEGIN_SRC emacs-lisp :tangle no
2119 (use-package git-commit
2120 :commands git-commit
2121 :mode ("COMMIT_EDITMSG" . git-commit-mode))
2125 #+BEGIN_SRC emacs-lisp :tangle no
2126 (use-package git-rebase
2127 :commands git-rebase
2128 :mode ("git-rebase-todo" . git-rebase-mode))
2131 [2014-05-21 Wed 22:56]
2132 #+BEGIN_SRC emacs-lisp
2133 (use-package git-gutter+
2135 :diminish git-gutter+-mode
2136 :bind (("C-x n" . git-gutter+-next-hunk)
2137 ("C-x p" . git-gutter+-previous-hunk)
2138 ("C-x v =" . git-gutter+-show-hunk)
2139 ("C-x r" . git-gutter+-revert-hunks)
2140 ("C-x s" . git-gutter+-stage-hunks)
2141 ("C-x c" . git-gutter+-commit)
2145 (setq git-gutter+-disabled-modes '(org-mode))
2146 (global-git-gutter+-mode 1)
2147 (use-package git-gutter-fringe+
2148 :ensure git-gutter-fringe+
2151 (setq git-gutter-fr+-side 'right-fringe)
2152 ;(git-gutter-fr+-minimal)
2157 [2015-02-22 Sun 14:00]
2158 Provides function that popup commit message at current line. This is
2159 useful when you want to know why this line was changed.
2160 #+BEGIN_SRC emacs-lisp
2161 (use-package git-messenger
2162 :ensure git-messenger
2163 :commands (git-messenger:popup-message)
2164 :bind (("C-x v p" . git-messenger:popup-message))
2167 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
2168 (add-hook 'git-messenger:popup-buffer-hook 'magit-revision-mode)
2169 (setq git-messenger:show-detail t)))
2172 [2014-07-23 Mi 12:57]
2173 Browse historic versions of a file with p (previous) and n (next).
2174 #+BEGIN_SRC emacs-lisp
2175 (use-package git-timemachine
2176 :ensure git-timemachine
2177 :commands git-timemachine)
2180 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
2181 what I want every emacs to know.
2182 #+BEGIN_SRC emacs-lisp
2183 (bind-key "C-c g" 'gnus) ; Start gnus with M-n
2189 [2015-02-20 Fri 16:27]
2190 When working with many windows at the same time, each window has a
2191 size that is not convenient for editing.
2193 golden-ratio helps on this issue by resizing automatically the windows
2194 you are working on to the size specified in the "Golden Ratio". The
2195 window that has the main focus will have the perfect size for editing,
2196 while the ones that are not being actively edited will be re-sized to
2197 a smaller size that doesn't get in the way, but at the same time will
2198 be readable enough to know it's content.
2199 #+BEGIN_SRC emacs-lisp
2200 (use-package golden-ratio
2201 :ensure golden-ratio
2202 :diminish golden-ratio-mode
2205 (golden-ratio-mode 1)
2206 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*" "*Ediff Control Panel*"))
2207 (setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
2208 "gnus-article-mode" "calc-mode" "calc-trail-mode"
2213 [2015-02-22 Sun 13:28]
2214 Move point through buffer-undo-list positions.
2215 #+BEGIN_SRC emacs-lisp
2216 (use-package goto-last-change
2217 :commands (goto-last-change)
2218 :bind (("M-g l" . goto-last-change))
2222 [2014-06-11 Wed 22:27]
2223 guide-key.el displays the available key bindings automatically and
2226 For whatever reason I like this more than icicles <backtab> completion
2228 #+BEGIN_SRC emacs-lisp
2229 (use-package guide-key
2231 :diminish guide-key-mode
2234 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
2236 (setq guide-key/recursive-key-sequence-flag t)
2237 (setq guide-key/popup-window-position 'bottom)
2238 (setq guide-key/idle-delay 0.5)))
2243 [2014-05-21 Wed 23:51]
2244 #+BEGIN_SRC emacs-lisp
2245 (use-package hi-lock
2246 :bind (("M-o l" . highlight-lines-matching-regexp)
2247 ("M-o r" . highlight-regexp)
2248 ("M-o w" . highlight-phrase)
2249 ("M-o u" . unhighlight-regexp)))
2251 (use-package hilit-chg
2252 :bind ("M-o C" . highlight-changes-mode))
2256 Crazy way of completion. It looks at the word before point and then
2257 tries to expand it in various ways.
2258 #+BEGIN_SRC emacs-lisp
2259 (use-package hippie-exp
2260 :bind ("M-/" . hippie-expand)
2261 :commands hippie-expand
2264 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2265 try-expand-dabbrev-all-buffers
2266 try-expand-dabbrev-from-kill
2267 try-complete-file-name-partially
2268 try-complete-file-name
2269 try-expand-all-abbrevs try-expand-list
2271 try-complete-lisp-symbol-partially
2272 try-complete-lisp-symbol))))
2275 Replaced by web-mode [[*web-mode][web-mode]]
2276 #+BEGIN_SRC emacs-lisp :tangle no
2277 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
2278 (add-auto-mode 'html-helper-mode "\\.html$")
2279 (add-auto-mode 'html-helper-mode "\\.asp$")
2280 (add-auto-mode 'html-helper-mode "\\.phtml$")
2281 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
2282 (defalias 'html-mode 'html-helper-mode)
2285 [2015-01-26 Mon 15:50]
2286 This is a package for GNU Emacs that can be used to tie related
2287 commands into a family of short bindings with a common prefix - a
2290 Once you summon the Hydra through the prefixed binding (the body + any
2291 one head), all heads can be called in succession with only a short
2294 The Hydra is vanquished once Hercules, any binding that isn't the
2295 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2296 Hydra, will still serve his orignal purpose, calling his proper
2297 command. This makes the Hydra very seamless, it's like a minor mode
2298 that disables itself auto-magically.
2299 #+BEGIN_SRC emacs-lisp
2304 (setq hydra-is-helpful t)
2307 (defhydra hydra-zoom (:color red)
2309 ("g" text-scale-increase "in")
2310 ("l" text-scale-decrease "out")
2312 (bind-key "<F2>" 'hydra-zoom/toggle)
2314 (defhydra hydra-error (:color red)
2316 ("h" first-error "first")
2317 ("j" next-error "next")
2318 ("k" previous-error "prev")
2319 ("v" recenter-top-bottom "recenter")
2321 (bind-key "M-g e" 'hydra-error/body)
2323 (defhydra hydra-gnus (:color red)
2325 ("m" gnus-uu-mark-thread "mark thread")
2326 ("d" gnus-summary-delete-article "delete article(s)")
2327 ("r" gnus-summary-mark-as-read-forward "mark read")
2328 ("n" gnus-summary-next-thread "next thread")
2329 ("p" gnus-summary-prev-thread "previous thread")
2330 ("g" gnus-summary-next-group "next group")
2331 ("l" gnus-recenter "recenter")
2332 ("x" gnus-summary-limit-to-unread "unread")
2334 (bind-key "C-c h" 'hydra-gnus/body)
2336 (defhydra hydra-launcher (:color blue)
2339 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2340 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
2343 (bind-key "C-c r" 'hydra-launcher/body)
2345 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
2346 (defvar whitespace-mode nil)
2347 (defhydra hydra-toggle (:color pink)
2349 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
2350 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
2351 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
2352 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
2353 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
2356 ("a" abbrev-mode nil)
2357 ("c" auto-complete-mode nil)
2358 ("i" aggressive-indent-mode nil)
2359 ("d" toggle-debug-on-error nil)
2360 ("f" auto-fill-mode nil)
2361 ("g" golden-ratio-mode nil)
2362 ("t" toggle-truncate-lines nil)
2363 ("w" whitespace-mode nil)
2364 ("r" auto-revert-mode nil)
2365 ("l" linum-mode nil)
2366 ("k" linum-relative-toggle nil)
2368 (bind-key "C-c C-v" 'hydra-toggle/body)
2374 [2014-05-21 Wed 23:54]
2375 #+BEGIN_SRC emacs-lisp
2376 (use-package ibuffer
2378 :bind (("C-h h" . ibuffer)
2379 ("C-x C-b" . ibuffer)
2380 ("<XF86WebCam>" . ibuffer)
2383 :defines (ibuffer-filtering-alist
2384 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
2385 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
2388 (defvar my-ibufffer-separator " • ")
2389 (setq ibuffer-filter-group-name-face 'variable-pitch
2390 ibuffer-use-header-line t
2391 ibuffer-old-time 12)
2392 (unbind-key "M-o" ibuffer-mode-map)
2393 (bind-key "s" 'isearch-forward-regexp ibuffer-mode-map)
2394 (bind-key "." 'ibuffer-invert-sorting ibuffer-mode-map)
2399 (use-package ibuffer-vc
2402 (ibuffer-vc-set-filter-groups-by-vc-root
2403 ibuffer-vc-generate-filter-groups-by-vc-root))
2405 (use-package ibuffer-tramp
2407 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
2408 ibuffer-tramp-set-filter-groups-by-tramp-connection))
2409 ;; Switching to ibuffer puts the cursor on the most recent buffer
2410 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
2411 "Open ibuffer with cursor pointed to most recent buffer name"
2412 (let ((recent-buffer-name (buffer-name)))
2414 (ibuffer-update nil t)
2415 (unless (string= recent-buffer-name "*Ibuffer*")
2416 (ibuffer-jump-to-buffer recent-buffer-name))))
2418 (defun ibuffer-magit-status ()
2420 (--when-let (get-buffer "*Ibuffer*")
2421 (with-current-buffer it
2422 (let* ((selected-buffer (ibuffer-current-buffer))
2423 (buffer-path (with-current-buffer
2425 (or (buffer-file-name)
2426 list-buffers-directory
2427 default-directory)))
2429 (if (file-regular-p buffer-path)
2430 (file-name-directory buffer-path)
2432 (magit-status default-directory)))))
2433 (bind-key "i" 'ibuffer-magit-status ibuffer-mode-map)
2434 (bind-key "G" 'ibuffer-magit-status ibuffer-mode-map)
2436 (setq ibuffer-directory-abbrev-alist
2441 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
2442 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
2444 ("dak" . "/develop/dak/")
2446 ("config" . "~/.emacs.d/config/")
2448 ("systmp" . "/tmp/")
2449 ("puppet" . "~/git/puppet")
2453 (use-package ibuffer-git
2455 (use-package ibuffer-vc
2458 (define-ibuffer-column size-h
2459 (:name "Size" :inline t)
2461 ((> (buffer-size) 1000)
2462 (format "%7.1fk" (/ (buffer-size) 1000.0)))
2463 ((> (buffer-size) 1000000)
2464 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
2466 (format "%8d" (buffer-size)))))
2468 (use-package ibuf-ext)
2469 (define-ibuffer-filter filename2
2470 "Toggle current view to buffers with filename matching QUALIFIER."
2471 (:description "filename2"
2472 :reader (read-from-minibuffer "Filter by filename (regexp): "))
2473 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
2474 (ibuffer-awhen (with-current-buffer buf
2475 (or buffer-file-name
2477 (string-match qualifier it)))
2479 (defvar ibuffer-magit-filter-groups nil)
2480 (defun ibuffer-magit-define-filter-groups ()
2481 (when (and (not ibuffer-magit-filter-groups)
2482 (boundp 'magit-repo-dirs))
2483 (setq ibuffer-magit-filter-groups
2486 (file-name-nondirectory (directory-file-name it)))
2488 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
2490 (defun ibuffer-set-filter-groups-by-root ()
2492 ;; (ibuffer-projectile-define-filter-groups)
2493 ;; (ibuffer-magit-define-filter-groups)
2494 (setq ibuffer-filter-groups
2496 ;; ibuffer-projectile-filter-groups
2497 ibuffer-magit-filter-groups
2500 (or (mode . magit-log-edit-mode)
2501 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2502 (name . "^\\*Pymacs\\*$")
2503 (name . "^\\*helm.*\\*")
2504 (name . "^\\*Compile-log\\*$")
2505 (name . "^\\*Ido Completions\\*$")
2506 (name . "^\\*magit-\\(process\\)\\*$")
2510 (name . "^\\*\\(tramp/.*\\)\\*$"))))
2513 (name . "^\\*scratch")
2514 (name . "^\\*Messages")
2517 (ibuffer-vc-generate-filter-groups-by-vc-root)
2518 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
2520 (defun toggle-ibuffer-filter-groups ()
2523 (let ((ibuf (get-buffer "*Ibuffer*")))
2525 (with-current-buffer ibuf
2526 (let ((selected-buffer (ibuffer-current-buffer)))
2527 (if (not ibuffer-filter-groups)
2528 (ibuffer-set-filter-groups-by-root)
2529 (setq ibuffer-filter-groups nil))
2530 (pop-to-buffer ibuf)
2531 (ibuffer-update nil t)
2532 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
2534 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
2536 (defun ibuffer-back-to-top ()
2538 (beginning-of-buffer)
2541 (defun ibuffer-jump-to-bottom ()
2547 (define-key ibuffer-mode-map
2548 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
2549 (define-key ibuffer-mode-map
2550 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
2552 (setq ibuffer-default-sorting-mode 'recency
2553 ibuffer-eliding-string "…"
2554 ibuffer-compile-formats t
2555 ibuffer-git-column-length 6
2556 ibuffer-show-empty-filter-groups nil
2557 ibuffer-default-directory "~/"
2560 (setq ibuffer-formats '((mark vc-status-mini
2562 (git-status 8 8 :left)
2566 (name 18 18 :left :elide)
2568 (size-h 9 -1 :right)
2570 (mode 16 16 :left :elide)
2571 " " filename-and-process)
2573 (git-status 8 8 :left)
2579 (setq ibuffer-saved-filter-groups
2582 ("dired" (mode . dired-mode))
2583 ("perl" (mode . cperl-mode))
2585 (mode . puppet-mode)
2586 (mode . yaml-mode)))
2587 ("ruby" (mode . ruby-mode))
2589 (name . "^\\*scratch\\*$")
2590 (name . "^\\*Compile-log\\*$")
2591 (name . "^\\*Completions\\*$")
2592 (name . "^\\*Messages\\*$")
2593 (name . "^\\*Backtrace\\*$")
2594 (name . "^\\*Packages*\\*$")
2595 (name . "^\\*Help*\\*$")
2599 (mode . message-mode)
2602 (mode . gnus-group-mode)
2603 (mode . gnus-summary-mode)
2604 (mode . gnus-article-mode)
2605 (name . "^\\.bbdb$")
2606 (name . "^\\.newsrc-dribble")))
2608 (mode . org-agenda-mode)
2609 (name . "^*Org Agenda")))
2611 (filename . ".*/org/.*")
2612 ;(mode . org-agenda-mode)
2613 (name . "^diary$")))
2615 (mode . magit-status-mode)
2616 (mode . magit-log-mode)
2617 (mode . magit-diff-mode)
2618 (mode . magit-refs-mode)
2619 (mode . magit-revision-mode)
2620 (mode . vc-annotate-mode)))
2622 (name . "^\\*\\(tramp/.*\\)\\*$")))
2624 (mode . emacs-lisp-mode)
2625 (mode . python-mode)
2627 (mode . coffee-mode)
2630 (mode . actionscript-mode)
2633 (mode . haskell-mode)
2640 (mode . magit-log-edit-mode)
2641 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
2643 ;; -------------------------------------------------
2644 ;; programming languages #1
2646 (mode . emacs-lisp-mode)
2647 (mode . python-mode)
2649 (mode . coffee-mode)
2652 (mode . actionscript-mode)
2655 (mode . haskell-mode)
2661 ;; -------------------------------------------------
2662 ;; configuration/data files
2666 (mode . conf-mode)))
2667 ;; -------------------------------------------------
2668 ;; text/notetaking/org
2669 ("org agenda" (mode . org-agenda-mode))
2672 (name . "^\\*Calendar\\*$")
2673 (name . "^diary$")))
2677 (mode . markdown-mode)))
2678 ;; -------------------------------------------------
2681 (mode . image-mode)))
2682 ;; -------------------------------------------------
2684 ("w3m" (mode . w3m-mode))
2686 (mode . magit-status-mode)
2687 (mode . magit-log-mode)
2688 (mode . vc-annotate-mode)))
2689 ("dired" (mode . dired-mode))
2694 (name . "^\\*Personal Keybindings\\*$")))
2696 (name . "^\\*\\(tramp/.*\\)\\*$")))
2697 ;; -------------------------------------------------
2699 ("MORE" (or (mode . magit-log-edit-mode)
2700 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2701 (name . "^\\*Pymacs\\*$")
2702 (name . "^\\*Compile-log\\*$")
2703 (name . "^\\*Completions\\*$")
2704 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
2706 ("*buffer*" (name . "\\*.*\\*"))))))
2708 (add-hook 'ibuffer-mode-hook
2710 (ibuffer-auto-mode 1)
2711 (ibuffer-switch-to-saved-filter-groups "default")))
2713 ;; Unless you turn this variable on you will be prompted every time
2714 ;; you want to delete a buffer, even unmodified ones, which is way
2715 ;; too cautious for most people. You’ll still be prompted for
2716 ;; confirmation when deleting modified buffers after the option has
2718 (setq ibuffer-expert t)
2723 [2015-10-16 Fri 16:28]
2724 #+BEGIN_SRC emacs-lisp
2727 :bind (("C-s" . swiper)
2729 ("C-c C-r" . ivy-resume)
2730 ("<f7>" . ivy-resume))
2734 (setq ivy-use-virtual-buffers t)
2735 ;;advise swiper to recenter on exit
2736 (defun bjm-swiper-recenter (&rest args)
2737 "recenter display after swiper"
2740 (advice-add 'swiper :after #'bjm-swiper-recenter)
2744 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
2745 ‘TAB’ completion is to typing things manually every time.”]]
2746 #+BEGIN_SRC emacs-lisp
2747 (use-package icicles
2753 Incremental mini-buffer completion preview: Type in the minibuffer,
2754 list of matching commands is echoed
2755 #+BEGIN_SRC emacs-lisp
2759 [2014-05-26 Mon 22:49]
2760 #+BEGIN_SRC emacs-lisp
2763 :commands (iedit-mode)
2765 :bind (("C-;" . iedit-mode)
2766 ("C-," . iedit-mode-toggle-on-function))
2771 [2014-05-20 Tue 23:35]
2772 #+BEGIN_SRC emacs-lisp
2774 :bind ("C-h C-i" . info-lookup-symbol)
2775 :commands info-lookup-symbol
2778 ;; (defadvice info-setup (after load-info+ activate)
2779 ;; (use-package info+))
2781 (defadvice Info-exit (after remove-info-window activate)
2782 "When info mode is quit, remove the window."
2783 (if (> (length (window-list)) 1)
2786 (use-package info-look
2787 :commands info-lookup-add-help)
2789 ** linum (line number)
2790 Various modes should have line numbers in front of each line.
2792 But then there are some where it would just be deadly - like org-mode,
2793 gnus, so we have a list of modes where we don't want to see it.
2794 #+BEGIN_SRC emacs-lisp
2796 :diminish linum-mode
2799 (setq linum-format "%3d ")
2800 (setq linum-mode-inhibit-modes-list '(org-mode
2807 (defadvice linum-on (around linum-on-inhibit-for-modes)
2808 "Stop the load of linum-mode for some major modes."
2809 (unless (member major-mode linum-mode-inhibit-modes-list)
2812 (ad-activate 'linum-on)
2814 (use-package linum-relative
2815 :ensure linum-relative
2818 (setq linum-format 'dynamic)
2821 (global-linum-mode 1))
2829 ** lisp editing stuff
2831 [2013-04-21 So 21:00]
2832 I'm not doing much of it, except for my emacs and gnus configs, but
2833 then I like it nice too...
2834 #+BEGIN_SRC emacs-lisp
2835 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
2837 (defun remove-elc-on-save ()
2838 "If you're saving an elisp file, likely the .elc is no longer valid."
2839 (make-local-variable 'after-save-hook)
2840 (add-hook 'after-save-hook
2842 (if (file-exists-p (concat buffer-file-name "c"))
2843 (delete-file (concat buffer-file-name "c"))))))
2845 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2846 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2848 (use-package paredit
2850 :diminish paredit-mode " π")
2852 (setq lisp-coding-hook 'lisp-coding-defaults)
2853 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
2855 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
2856 (add-hook 'emacs-lisp-mode-hook (lambda ()
2857 (run-hooks 'prelude-emacs-lisp-mode-hook)))
2859 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
2861 (after "elisp-slime-nav"
2862 '(diminish 'elisp-slime-nav-mode))
2863 (after "rainbow-mode"
2864 '(diminish 'rainbow-mode))
2866 '(diminish 'eldoc-mode))
2869 [2013-04-21 So 20:48]
2870 magit is a mode for interacting with git.
2871 #+BEGIN_SRC emacs-lisp
2874 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
2875 magit-git-repo-p magit-list-repos)
2877 :bind (("C-x g" . magit-status)
2878 ("C-x G" . magit-status-with-prefix))
2881 (setq magit-commit-signoff t
2882 magit-repository-directories '("~/git"
2887 magit-repository-directories-depth 4
2888 magit-log-auto-more t)
2890 (use-package magit-blame
2891 :commands magit-blame-mode
2894 ; (use-package magit-svn
2896 ; :commands (magit-svn-mode
2897 ; turn-on-magit-svn)
2900 (add-hook 'magit-mode-hook 'hl-line-mode)
2901 (defun magit-status-with-prefix ()
2903 (let ((current-prefix-arg '(4)))
2904 (call-interactively 'magit-status)))
2908 (setenv "GIT_PAGER" "")
2910 (unbind-key "M-h" magit-mode-map)
2911 (unbind-key "M-s" magit-mode-map)
2912 (add-to-list 'magit-no-confirm 'stage-all-changes)
2913 (setq magit-push-always-verify nil)
2914 (setq magit-last-seen-setup-instructions "2.1.0")
2915 ; (use-package magit-find-file
2916 ; :ensure magit-find-file
2917 ; :commands (magit-find-file-completing-read)
2921 ; (bind-key "C-x C-f" 'magit-find-file-completing-read magit-mode-map)))
2923 (add-hook 'magit-log-edit-mode-hook
2925 (set-fill-column 72)
2928 (add-hook 'git-rebase-mode-hook
2932 (defadvice magit-status (around magit-fullscreen activate)
2933 (window-configuration-to-register :magit-fullscreen)
2935 (delete-other-windows))
2937 (defun magit-quit-session ()
2938 "Restores the previous window configuration and kills the magit buffer"
2941 (jump-to-register :magit-fullscreen))
2943 (bind-key "q" 'magit-quit-session magit-status-mode-map)
2945 (defun magit-rebase-unpushed (commit &optional args)
2946 "Start an interactive rebase sequence over all unpushed commits."
2947 (interactive (list (magit-get-tracked-branch)
2948 (magit-rebase-arguments)))
2949 (if (setq commit (magit-rebase-interactive-assert commit))
2950 (magit-run-git-sequencer "rebase" "-i" commit args)
2953 (magit-rebase-interactive (concat commit "^") (list ,@args))))))
2955 (magit-define-popup-action 'magit-rebase-popup ?l "Rebase unpushed" 'magit-rebase-unpushed)
2959 [2014-05-20 Tue 23:04]
2960 #+BEGIN_SRC emacs-lisp
2961 (use-package markdown-mode
2962 :mode (("\\.md\\'" . markdown-mode)
2963 ("\\.mdwn\\'" . markdown-mode))
2967 #+BEGIN_SRC emacs-lisp
2968 (use-package message
2971 (setq message-kill-buffer-on-exit t)))
2974 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
2976 I want to access it from anywhere using =F6=.
2977 #+BEGIN_SRC emacs-lisp
2978 (use-package mingus-stays-home
2979 :bind ( "<f6>" . mingus)
2983 (setq mingus-dired-add-keys t)
2984 (setq mingus-mode-always-modeline nil)
2985 (setq mingus-mode-line-show-elapsed-percentage nil)
2986 (setq mingus-mode-line-show-volume nil)
2987 (setq mingus-mpd-config-file "/etc/mpd.conf")
2988 (setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
2989 (setq mingus-mpd-root "/share/music/")))
2993 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
2994 #+BEGIN_SRC emacs-lisp
2995 (use-package miniedit
3000 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
3001 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
3002 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
3003 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
3008 [2013-05-21 Tue 23:39]
3009 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
3010 coexist in one buffer.
3011 #+BEGIN_SRC emacs-lisp :tangle no
3012 (use-package mmm-auto
3016 (setq mmm-global-mode 'buffers-with-submode-classes)
3017 (setq mmm-submode-decoration-level 2)
3018 (eval-after-load 'mmm-vars
3024 :face mmm-code-submode-face
3025 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
3026 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
3027 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
3028 @ "\n" _ "\n" @ "</script>" @)))
3031 :face mmm-code-submode-face
3032 :front "<style[^>]*>[ \t]*\n?"
3033 :back "[ \t]*</style>"
3034 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
3035 @ "\n" _ "\n" @ "</style>" @)))
3038 :face mmm-code-submode-face
3041 (dolist (mode (list 'html-mode 'nxml-mode))
3042 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
3043 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
3048 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
3050 #+BEGIN_SRC emacs-lisp
3051 (use-package mo-git-blame
3052 :ensure mo-git-blame
3053 :commands (mo-git-blame-current
3057 (setq mo-git-blame-blame-window-width 25)))
3061 [2013-04-08 Mon 23:57]
3062 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
3063 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
3064 #+BEGIN_SRC emacs-lisp tangle no
3065 (use-package multiple-cursors
3066 :ensure multiple-cursors
3068 :commands (mc/remove-fake-cursors
3069 mc/create-fake-cursor-at-point
3070 mc/pop-state-from-overlay
3071 mc/maybe-multiple-cursors-mode)
3072 :defines (multiple-cursors-mode
3074 mc--read-quoted-char
3075 rectangular-region-mode)
3076 :bind (("C-S-c C-S-c" . mc/edit-lines)
3077 ("C->" . mc/mark-next-like-this)
3078 ("C-<" . mc/mark-previous-like-this)
3079 ("C-c C-<" . mc/mark-all-like-this)
3080 ("C-c i" . mc/insert-numbers))
3083 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
3084 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
3085 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
3086 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
3087 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
3088 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
3091 [2014-08-27 Wed 17:15]
3093 #+BEGIN_SRC emacs-lisp
3094 (use-package neotree
3097 :bind (("<f8>" . neotree-toggle))
3098 :commands (neotree-find
3103 (bind-key "^" 'neotree-select-up-node neotree-mode-map)
3104 (setq neo-smart-open t)))
3108 [2013-05-22 Wed 22:02]
3109 nxml-mode is a major mode for editing XML.
3110 #+BEGIN_SRC emacs-lisp
3115 '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
3118 (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
3119 (fset 'xml-mode 'nxml-mode)
3120 (setq nxml-slash-auto-complete-flag t)
3122 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
3123 (defun pp-xml-region (begin end)
3124 "Pretty format XML markup in region. The function inserts
3125 linebreaks to separate tags that have nothing but whitespace
3126 between them. It then indents the markup by using nxml's
3132 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
3133 (backward-char) (insert "\n"))
3134 (indent-region begin end)))
3136 ;;----------------------------------------------------------------------------
3137 ;; Integration with tidy for html + xml
3138 ;;----------------------------------------------------------------------------
3139 ;; tidy is autoloaded
3140 (eval-after-load 'tidy
3142 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
3143 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
3148 *** General settings
3149 [2013-04-28 So 17:06]
3151 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
3152 it is quite extensive. Nevertheless, it starts out small, loading it.
3153 #+BEGIN_SRC emacs-lisp
3157 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
3158 that we need org-protocol.
3159 #+BEGIN_SRC emacs-lisp
3160 (require 'org-protocol)
3165 My current =org-agenda-files= variable only includes a set of
3167 #+BEGIN_SRC emacs-lisp
3168 (setq org-agenda-files (quote ("~/org/"
3171 (setq org-default-notes-file "~/org/notes.org")
3173 =org-mode= manages the =org-agenda-files= variable automatically using
3174 =C-c [= and =C-c ]= to add and remove files respectively. However,
3175 this replaces my directory list with a list of explicit filenames
3176 instead and is not what I want. If this occurs then adding a new org
3177 file to any of the above directories will not contribute to my agenda
3178 and I will probably miss something important.
3180 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
3181 prevent messing up my list of directories in the =org-agenda-files=
3182 variable. I just add and remove directories manually here. Changing
3183 the list of directories in =org-agenda-files= happens very rarely
3184 since new files in existing directories are automatically picked up.
3186 #+BEGIN_SRC emacs-lisp
3187 ;; Keep tasks with dates on the global todo lists
3188 (setq org-agenda-todo-ignore-with-date nil)
3190 ;; Keep tasks with deadlines on the global todo lists
3191 (setq org-agenda-todo-ignore-deadlines nil)
3193 ;; Keep tasks with scheduled dates on the global todo lists
3194 (setq org-agenda-todo-ignore-scheduled nil)
3196 ;; Keep tasks with timestamps on the global todo lists
3197 (setq org-agenda-todo-ignore-timestamp nil)
3199 ;; Remove completed deadline tasks from the agenda view
3200 (setq org-agenda-skip-deadline-if-done t)
3202 ;; Remove completed scheduled tasks from the agenda view
3203 (setq org-agenda-skip-scheduled-if-done t)
3205 ;; Remove completed items from search results
3206 (setq org-agenda-skip-timestamp-if-done t)
3208 ;; Include agenda archive files when searching for things
3209 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
3211 ;; Show all future entries for repeating tasks
3212 (setq org-agenda-repeating-timestamp-show-all t)
3214 ;; Show all agenda dates - even if they are empty
3215 (setq org-agenda-show-all-dates t)
3217 ;; Sorting order for tasks on the agenda
3218 (setq org-agenda-sorting-strategy
3219 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
3220 (todo category-up priority-down effort-up)
3221 (tags category-up priority-down effort-up)
3222 (search category-up))))
3224 ;; Start the weekly agenda on Monday
3225 (setq org-agenda-start-on-weekday 1)
3227 ;; Enable display of the time grid so we can see the marker for the current time
3228 (setq org-agenda-time-grid (quote ((daily today remove-match)
3229 #("----------------" 0 16 (org-heading t))
3230 (0800 1000 1200 1400 1500 1700 1900 2100))))
3232 ;; Display tags farther right
3233 (setq org-agenda-tags-column -102)
3235 ; position the habit graph on the agenda to the right of the default
3236 (setq org-habit-graph-column 50)
3238 ; turn habits back on
3239 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
3242 ;; Agenda sorting functions
3244 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
3247 (setq org-deadline-warning-days 30)
3249 ;; Always hilight the current agenda line
3250 (add-hook 'org-agenda-mode-hook
3251 '(lambda () (hl-line-mode 1))
3255 #+BEGIN_SRC emacs-lisp
3256 (setq org-agenda-persistent-filter t)
3257 (add-hook 'org-agenda-mode-hook
3258 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
3261 (add-hook 'org-agenda-mode-hook
3262 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
3265 (add-hook 'org-agenda-mode-hook
3266 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
3269 (add-hook 'org-agenda-mode-hook
3270 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
3273 (add-hook 'org-agenda-mode-hook
3274 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
3277 ; Rebuild the reminders everytime the agenda is displayed
3278 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
3280 ;(if (file-exists-p "~/org/refile.org")
3281 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
3283 ; Activate appointments so we get notifications
3286 (setq org-agenda-log-mode-items (quote (closed clock state)))
3287 (if (> emacs-major-version 23)
3288 (setq org-agenda-span 3)
3289 (setq org-agenda-ndays 3))
3291 (setq org-agenda-show-all-dates t)
3292 (setq org-agenda-start-on-weekday nil)
3293 (setq org-deadline-warning-days 14)
3296 *** Global keybindings.
3297 Start off by defining a series of keybindings.
3299 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
3300 setup manually, not by org-mode. Also turn off =C-c ;=, which
3301 comments headlines - a function never used.
3302 #+BEGIN_SRC emacs-lisp
3303 (add-hook 'org-mode-hook
3305 (org-defkey org-mode-map "\C-c[" 'undefined)
3306 (org-defkey org-mode-map "\C-c]" 'undefined)
3307 (org-defkey org-mode-map "\C-c;" 'undefined))
3311 And now a largish set of keybindings...
3312 #+BEGIN_SRC emacs-lisp
3313 (bind-key "C-c l" 'org-store-link)
3314 (bind-key "C-c a" 'org-agenda)
3315 ;(bind-key "C-c b" 'org-iswitchb)
3316 (define-key mode-specific-map [?a] 'org-agenda)
3318 (bind-key "<f12>" 'org-agenda)
3319 (bind-key "<f5>" 'bh/org-todo)
3320 (bind-key "<S-f5>" 'bh/widen)
3321 ;(bind-key "<f7>" 'bh/set-truncate-lines)
3322 ;(bind-key "<f8>" 'org-cycle-agenda-files)
3324 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
3325 (bind-key "<f9> b" 'bbdb)
3326 (bind-key "<f9> c" 'calendar)
3327 (bind-key "<f9> f" 'boxquote-insert-file)
3328 (bind-key "<f9> h" 'bh/hide-other)
3329 (bind-key "<f9> n" 'org-narrow-to-subtree)
3330 (bind-key "<f9> w" 'widen)
3331 (bind-key "<f9> u" 'bh/narrow-up-one-level)
3332 (bind-key "<f9> I" 'bh/punch-in)
3333 (bind-key "<f9> O" 'bh/punch-out)
3334 (bind-key "<f9> H" 'jj/punch-in-hw)
3335 (bind-key "<f9> W" 'jj/punch-out-hw)
3336 (bind-key "<f9> o" 'bh/make-org-scratch)
3337 (bind-key "<f9> p" 'bh/phone-call)
3338 (bind-key "<f9> r" 'boxquote-region)
3339 (bind-key "<f9> s" 'bh/switch-to-scratch)
3340 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
3341 (bind-key "<f9> T" 'tabify)
3342 (bind-key "<f9> U" 'untabify)
3343 (bind-key "<f9> v" 'visible-mode)
3344 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
3345 (bind-key "C-<f9>" 'previous-buffer)
3346 (bind-key "C-<f10>" 'next-buffer)
3347 (bind-key "M-<f9>" 'org-toggle-inline-images)
3348 ;(bind-key "C-x n r" 'narrow-to-region)
3349 (bind-key "<f11>" 'org-clock-goto)
3350 (bind-key "C-<f11>" 'org-clock-in)
3351 (bind-key "C-M-r" 'org-capture)
3352 (bind-key "C-c r" 'org-capture)
3353 (bind-key "C-S-<f12>" 'bh/save-then-publish)
3354 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
3358 *** Tasks, States, Todo fun
3360 First we define the global todo keywords.
3361 #+BEGIN_SRC emacs-lisp
3362 (setq org-todo-keywords
3363 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
3364 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
3366 (setq org-todo-keyword-faces
3367 (quote (("TODO" :foreground "red" :weight bold)
3368 ("NEXT" :foreground "light blue" :weight bold)
3369 ("DONE" :foreground "forest green" :weight bold)
3370 ("WAITING" :foreground "orange" :weight bold)
3371 ("HOLD" :foreground "orange" :weight bold)
3372 ("DELEGATED" :foreground "yellow" :weight bold)
3373 ("CANCELLED" :foreground "dark green" :weight bold)
3374 ("PHONE" :foreground "dark green" :weight bold))))
3377 **** Fast Todo Selection
3378 Fast todo selection allows changing from any task todo state to any
3379 other state directly by selecting the appropriate key from the fast
3380 todo selection key menu.
3381 #+BEGIN_SRC emacs-lisp
3382 (setq org-use-fast-todo-selection t)
3384 Changing a task state is done with =C-c C-t KEY=
3386 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
3389 #+BEGIN_SRC emacs-lisp
3390 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
3392 allows changing todo states with S-left and S-right skipping all of
3393 the normal processing when entering or leaving a todo state. This
3394 cycles through the todo states but skips setting timestamps and
3395 entering notes which is very convenient when all you want to do is fix
3396 up the status of an entry.
3398 **** Todo State Triggers
3399 I have a few triggers that automatically assign tags to tasks based on
3400 state changes. If a task moves to =CANCELLED= state then it gets a
3401 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
3402 =CANCELLED= tag. These are used for filtering tasks in agenda views
3403 which I'll talk about later.
3405 The triggers break down to the following rules:
3407 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
3408 - Moving a task to =WAITING= adds a =WAITING= tag
3409 - Moving a task to =HOLD= adds a =WAITING= tag
3410 - Moving a task to a done state removes a =WAITING= tag
3411 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
3412 - Moving a task to =NEXT= removes a =WAITING= tag
3413 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
3415 The tags are used to filter tasks in the agenda views conveniently.
3416 #+BEGIN_SRC emacs-lisp
3417 (setq org-todo-state-tags-triggers
3418 (quote (("CANCELLED" ("CANCELLED" . t))
3419 ("WAITING" ("WAITING" . t))
3420 ("HOLD" ("WAITING" . t) ("HOLD" . t))
3421 (done ("WAITING") ("HOLD"))
3422 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
3423 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
3424 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
3427 *** Capturing new tasks
3428 Org capture replaces the old remember mode.
3429 #+BEGIN_SRC emacs-lisp
3430 (setq org-directory "~/org")
3431 (setq org-default-notes-file "~/org/refile.org")
3433 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
3434 ;; see http://orgmode.org/manual/Template-elements.html
3435 (setq org-capture-templates
3436 (quote (("t" "todo" entry (file "~/org/refile.org")
3437 "* TODO %?\nAdded: %U\n"
3438 :clock-in t :clock-resume t)
3439 ("l" "linktodo" entry (file "~/org/refile.org")
3440 "* TODO %?\nAdded: %U\n%a\n"
3441 :clock-in t :clock-resume t)
3442 ("r" "respond" entry (file "~/org/refile.org")
3443 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
3444 :clock-in t :clock-resume t :immediate-finish t)
3445 ("n" "note" entry (file "~/org/refile.org")
3446 "* %? :NOTE:\nAdded: %U\n%a\n"
3447 :clock-in t :clock-resume t)
3448 ("d" "Delegated" entry (file "~/org/refile.org")
3449 "* DELEGATED %?\nAdded: %U\n%a\n"
3450 :clock-in t :clock-resume t)
3451 ("j" "Journal" entry (file+datetree "~/org/diary.org")
3453 :clock-in t :clock-resume t)
3454 ("w" "org-protocol" entry (file "~/org/refile.org")
3455 "* TODO Review %c\nAdded: %U\n"
3456 :immediate-finish t)
3457 ("p" "Phone call" entry (file "~/org/refile.org")
3458 "* PHONE %? :PHONE:\nAdded: %U"
3459 :clock-in t :clock-resume t)
3460 ("x" "Bookmark link" entry (file "~/org/refile.org")
3461 "* Bookmark: %c\n%i\nAdded: %U\n"
3462 :immediate-finish t)
3463 ("h" "Habit" entry (file "~/org/refile.org")
3464 "* 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")
3468 Capture mode now handles automatically clocking in and out of a
3469 capture task. This all works out of the box now without special hooks.
3470 When I start a capture mode task the task is clocked in as specified
3471 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
3472 resumes on the original clocking task.
3474 The quick clocking in and out of capture mode tasks (often it takes
3475 less than a minute to capture some new task details) can leave
3476 empty clock drawers in my tasks which aren't really useful.
3477 The following prevents this.
3478 #+BEGIN_SRC emacs-lisp :tangle no
3479 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
3483 All my newly captured entries end up in =refile.org= and want to be
3484 moved over to the right place. The following is the setup for it.
3485 #+BEGIN_SRC emacs-lisp
3486 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
3487 (setq org-refile-targets (quote ((nil :maxlevel . 9)
3488 (org-agenda-files :maxlevel . 9))))
3490 ; Use full outline paths for refile targets - we file directly with IDO
3491 (setq org-refile-use-outline-path t)
3493 ; Targets complete directly with IDO
3494 (setq org-outline-path-complete-in-steps nil)
3496 ; Allow refile to create parent tasks with confirmation
3497 (setq org-refile-allow-creating-parent-nodes (quote confirm))
3499 ; Use IDO for both buffer and file completion and ido-everywhere to t
3500 (setq org-completion-use-ido t)
3501 (setq org-completion-use-iswitchb nil)
3502 :; Use IDO for both buffer and file completion and ido-everywhere to t
3503 ;(setq ido-everywhere t)
3504 ;(setq ido-max-directory-size 100000)
3505 ;(ido-mode (quote both))
3506 ; Use the current window when visiting files and buffers with ido
3507 (setq ido-default-file-method 'selected-window)
3508 (setq ido-default-buffer-method 'selected-window)
3510 ;;;; Refile settings
3511 (setq org-refile-target-verify-function 'bh/verify-refile-target)
3515 Agenda view is the central place for org-mode interaction...
3516 #+BEGIN_SRC emacs-lisp
3517 ;; Do not dim blocked tasks
3518 (setq org-agenda-dim-blocked-tasks nil)
3519 ;; Compact the block agenda view
3520 (setq org-agenda-compact-blocks t)
3522 ;; Custom agenda command definitions
3523 (setq org-agenda-custom-commands
3524 (quote (("N" "Notes" tags "NOTE"
3525 ((org-agenda-overriding-header "Notes")
3526 (org-tags-match-list-sublevels t)))
3527 ("h" "Habits" tags-todo "STYLE=\"habit\""
3528 ((org-agenda-overriding-header "Habits")
3529 (org-agenda-sorting-strategy
3530 '(todo-state-down effort-up category-keep))))
3534 ((org-agenda-overriding-header "Tasks to Refile")
3535 (org-tags-match-list-sublevels nil)))
3536 (tags-todo "-HOLD-CANCELLED/!"
3537 ((org-agenda-overriding-header "Projects")
3538 (org-agenda-skip-function 'bh/skip-non-projects)
3539 (org-agenda-sorting-strategy
3541 (tags-todo "-CANCELLED/!"
3542 ((org-agenda-overriding-header "Stuck Projects")
3543 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3544 (tags-todo "-WAITING-CANCELLED/!NEXT"
3545 ((org-agenda-overriding-header "Next Tasks")
3546 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3547 (org-agenda-todo-ignore-scheduled t)
3548 (org-agenda-todo-ignore-deadlines t)
3549 (org-agenda-todo-ignore-with-date t)
3550 (org-tags-match-list-sublevels t)
3551 (org-agenda-sorting-strategy
3552 '(todo-state-down effort-up category-keep))))
3553 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3554 ((org-agenda-overriding-header "Tasks")
3555 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3556 (org-agenda-todo-ignore-scheduled t)
3557 (org-agenda-todo-ignore-deadlines t)
3558 (org-agenda-todo-ignore-with-date t)
3559 (org-agenda-sorting-strategy
3561 (tags-todo "-CANCELLED+WAITING/!"
3562 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
3563 (org-agenda-skip-function 'bh/skip-stuck-projects)
3564 (org-tags-match-list-sublevels nil)
3565 (org-agenda-todo-ignore-scheduled 'future)
3566 (org-agenda-todo-ignore-deadlines 'future)))
3568 ((org-agenda-overriding-header "Tasks to Archive")
3569 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3570 (org-tags-match-list-sublevels nil))))
3572 ("r" "Tasks to Refile" tags "REFILE"
3573 ((org-agenda-overriding-header "Tasks to Refile")
3574 (org-tags-match-list-sublevels nil)))
3575 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
3576 ((org-agenda-overriding-header "Stuck Projects")
3577 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3578 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
3579 ((org-agenda-overriding-header "Next Tasks")
3580 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3581 (org-agenda-todo-ignore-scheduled t)
3582 (org-agenda-todo-ignore-deadlines t)
3583 (org-agenda-todo-ignore-with-date t)
3584 (org-tags-match-list-sublevels t)
3585 (org-agenda-sorting-strategy
3586 '(todo-state-down effort-up category-keep))))
3587 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3588 ((org-agenda-overriding-header "Tasks")
3589 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3590 (org-agenda-sorting-strategy
3592 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
3593 ((org-agenda-overriding-header "Projects")
3594 (org-agenda-skip-function 'bh/skip-non-projects)
3595 (org-agenda-sorting-strategy
3597 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
3598 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
3599 (org-tags-match-list-sublevels nil))
3600 ("A" "Tasks to Archive" tags "-REFILE/"
3601 ((org-agenda-overriding-header "Tasks to Archive")
3602 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3603 (org-tags-match-list-sublevels nil))))))
3605 ; Overwrite the current window with the agenda
3606 (setq org-agenda-window-setup 'current-window)
3611 #+BEGIN_SRC emacs-lisp
3613 ;; Resume clocking task when emacs is restarted
3614 (org-clock-persistence-insinuate)
3616 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
3617 (setq org-clock-history-length 36)
3618 ;; Resume clocking task on clock-in if the clock is open
3619 (setq org-clock-in-resume t)
3620 ;; Change tasks to NEXT when clocking in
3621 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
3622 ;; Separate drawers for clocking and logs
3623 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
3624 ;; Save clock data and state changes and notes in the LOGBOOK drawer
3625 (setq org-clock-into-drawer t)
3626 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
3627 (setq org-clock-out-remove-zero-time-clocks t)
3628 ;; Clock out when moving task to a done state
3629 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
3630 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
3631 (setq org-clock-persist t)
3632 ;; Do not prompt to resume an active clock
3633 (setq org-clock-persist-query-resume nil)
3634 ;; Enable auto clock resolution for finding open clocks
3635 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
3636 ;; Include current clocking task in clock reports
3637 (setq org-clock-report-include-clocking-task t)
3639 ; use discrete minute intervals (no rounding) increments
3640 (setq org-time-stamp-rounding-minutes (quote (1 1)))
3642 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
3644 (setq bh/keep-clock-running nil)
3646 (setq org-agenda-clock-consistency-checks
3647 (quote (:max-duration "4:00"
3650 :gap-ok-around ("4:00"))))
3654 **** Setting a default clock task
3655 Per default the =** Organization= task in my tasks.org file receives
3656 misc clock time. This is the task I clock in on when I punch in at the
3657 start of my work day with =F9-I=. Punching-in anywhere clocks in this
3658 Organization task as the default task.
3660 If I want to change the default clocking task I just visit the
3661 new task in any org buffer and clock it in with =C-u C-u C-c C-x
3662 C-i=. Now this new task that collects miscellaneous clock
3663 minutes when the clock would normally stop.
3665 You can quickly clock in the default clocking task with =C-u C-c
3666 C-x C-i d=. Another option is to repeatedly clock out so the
3667 clock moves up the project tree until you clock out the
3668 top-level task and the clock moves to the default task.
3671 #+BEGIN_SRC emacs-lisp
3672 ;; Agenda clock report parameters
3673 (setq org-agenda-clockreport-parameter-plist
3674 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3676 ;; Agenda log mode items to display (closed and state changes by default)
3677 (setq org-agenda-log-mode-items (quote (closed state)))
3679 **** Task estimates, column view
3680 Setup column view globally with the following headlines
3681 #+BEGIN_SRC emacs-lisp
3682 ; Set default column view headings: Task Effort Clock_Summary
3683 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
3685 Setup the estimate for effort values.
3686 #+BEGIN_SRC emacs-lisp
3687 ; global Effort estimate values
3688 ; global STYLE property values for completion
3689 (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")
3690 ("STYLE_ALL" . "habit"))))
3694 Tags are mostly used for filtering inside the agenda.
3695 #+BEGIN_SRC emacs-lisp
3696 ; Tags with fast selection keys
3697 (setq org-tag-alist (quote ((:startgroup)
3715 ; Allow setting single tags without the menu
3716 (setq org-fast-tag-selection-single-key (quote expert))
3718 ; For tag searches ignore tasks with scheduled and deadline dates
3719 (setq org-agenda-tags-todo-honor-ignore-options t)
3723 #+BEGIN_SRC emacs-lisp
3724 (setq org-archive-mark-done nil)
3725 (setq org-archive-location "%s_archive::* Archived Tasks")
3729 #+BEGIN_SRC emacs-lisp
3730 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
3731 (setq org-plantuml-jar-path "~/java/plantuml.jar")
3733 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
3735 ; Make babel results blocks lowercase
3736 (setq org-babel-results-keyword "results")
3738 (org-babel-do-load-languages
3739 (quote org-babel-load-languages)
3740 (quote ((emacs-lisp . t)
3759 ; Do not prompt to confirm evaluation
3760 ; This may be dangerous - make sure you understand the consequences
3761 ; of setting this -- see the docstring for details
3762 (setq org-confirm-babel-evaluate nil)
3764 ; Use fundamental mode when editing plantuml blocks with C-c '
3765 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
3768 #+BEGIN_SRC emacs-lisp
3769 ;; Don't have images visible on startup, breaks on console
3770 (setq org-startup-with-inline-images nil)
3773 #+BEGIN_SRC emacs-lisp
3774 (add-to-list 'org-structure-template-alist
3775 '("n" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"
3776 "<comment>\n?\n</comment>"))
3778 **** ditaa, graphviz, etc
3779 Those are all nice tools. Look at
3780 http://doc.norang.ca/org-mode.html#playingwithditaa for a nice intro
3783 *** Publishing and exporting
3786 Org-mode can export to a variety of publishing formats including (but not limited to)
3789 (plain text - but not the original org-mode file)
3793 which enables getting to lots of other formats like ODF, XML, etc
3795 via LaTeX or Docbook
3798 A new exporter created by Nicolas Goaziou was introduced in org 8.0.
3800 #+BEGIN_SRC emacs-lisp
3801 ;; Explicitly load required exporters
3805 ;(require 'ox-reveal)
3806 ;; FIXME, check the following two
3807 ;(require 'ox-icalendar)
3810 ; experimenting with docbook exports - not finished
3811 (setq org-export-docbook-xsl-fo-proc-command "fop %s %s")
3812 (setq org-export-docbook-xslt-proc-command "xsltproc --output %s /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl %s")
3814 (setq org-reveal-root "file:///home/joerg/devel/ganeticon2015/reveal.js/reveal.js")
3816 ;; define categories that should be excluded
3817 (setq org-export-exclude-category (list "google" "google"))
3818 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
3820 ; define how the date strings look
3821 (setq org-export-date-timestamp-format "%Y-%m-%d")
3822 ; Inline images in HTML instead of producting links to the image
3823 (setq org-html-inline-images t)
3824 ; Do not use sub or superscripts - I currently don't need this functionality in my documents
3825 (setq org-export-with-sub-superscripts nil)
3827 (setq org-html-head-extra (concat
3828 "<link rel=\"stylesheet\" href=\"https://ganneff.de/stylesheet.css\" type=\"text/css\" />\n"
3830 (setq org-html-head-include-default-style nil)
3831 ; Do not generate internal css formatting for HTML exports
3832 (setq org-export-htmlize-output-type (quote css))
3833 ; Export with LaTeX fragments
3834 (setq org-export-with-LaTeX-fragments t)
3835 ; Increase default number of headings to export
3836 (setq org-export-headline-levels 6)
3839 (setq org-publish-project-alist
3842 :base-directory "~/.emacs.d/"
3843 :base-extension "org"
3845 :publishing-directory "/develop/www/emacs"
3847 :publishing-function org-html-publish-to-html
3848 :headline-levels 4 ; Just the default for this project.
3854 :base-directory "~/.emacs.d/"
3855 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
3856 :publishing-directory "/develop/www/emacs"
3857 :exclude "elisp\\|elpa\\|elpa.off\\|auto-save-list\\|cache\\|eshell\\|image-dired\\|themes\\|url"
3859 :publishing-function org-publish-attachment
3861 ("inherit-org-info-js"
3862 :base-directory "/develop/vcs/org-info-js/"
3864 :base-extension "js"
3865 :publishing-directory "/develop/www/"
3866 :publishing-function org-publish-attachment
3868 ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
3873 (setq org-export-with-timestamps nil)
3878 #+BEGIN_SRC emacs-lisp
3879 (setq org-latex-to-pdf-process
3880 '("xelatex -interaction nonstopmode %f"
3881 "xelatex -interaction nonstopmode %f")) ;; for multiple passes
3882 (setq org-export-latex-listings 'minted)
3883 (setq org-latex-listings t)
3885 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3886 ;; but adapted to use latexmk 4.20 or higher.
3887 (defun my-auto-tex-cmd ()
3888 "When exporting from .org with latex, automatically run latex,
3889 pdflatex, or xelatex as appropriate, using latexmk."
3891 ;; default command: oldstyle latex via dvi
3892 (setq texcmd "latexmk -dvi -pdfps -quiet %f")
3894 (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3895 (setq texcmd "latexmk -pdf -quiet %f"))
3897 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3898 (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
3899 ;; LaTeX compilation command
3900 (setq org-latex-to-pdf-process (list texcmd)))
3902 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3904 ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3905 (setq org-export-latex-packages-alist
3907 ("" "longtable" nil)
3912 (defun my-auto-tex-parameters ()
3913 "Automatically select the tex packages to include."
3914 ;; default packages for ordinary latex or pdflatex export
3915 (setq org-export-latex-default-packages-alist
3916 '(("AUTO" "inputenc" t)
3926 ("" "hyperref" nil)))
3928 ;; Packages to include when xelatex is used
3929 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3930 (setq org-export-latex-default-packages-alist
3935 ("german" "babel" t)
3936 ("babel" "csquotes" t)
3938 ("xetex" "hyperref" nil)
3941 (if (string-match "#+LATEX_CMD: xelatex" (buffer-string))
3942 (setq org-export-latex-classes
3944 "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
3945 ("\\section{%s}" . "\\section*{%s}")
3946 ("\\subsection{%s}" . "\\subsection*{%s}")
3947 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3948 ("\\paragraph{%s}" . "\\paragraph*{%s}")
3949 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3950 org-export-latex-classes))))
3952 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
3955 *** Prevent editing invisible text
3956 The following setting prevents accidentally editing hidden text when
3957 the point is inside a folded region. This can happen if you are in
3958 the body of a heading and globally fold the org-file with =S-TAB=
3960 I find invisible edits (and undo's) hard to deal with so now I can't
3961 edit invisible text. =C-c C-r= (org-reveal) will display where the
3962 point is if it is buried in invisible text to allow editing again.
3964 #+BEGIN_SRC emacs-lisp
3965 (setq org-catch-invisible-edits 'error)
3969 #+BEGIN_SRC emacs-lisp
3970 ;; disable the default org-mode stuck projects agenda view
3971 (setq org-stuck-projects (quote ("" nil nil "")))
3973 ; force showing the next headline.
3974 (setq org-show-entry-below (quote ((default))))
3976 (setq org-show-following-heading t)
3977 (setq org-show-hierarchy-above t)
3978 (setq org-show-siblings (quote ((default))))
3980 (setq org-special-ctrl-a/e t)
3981 (setq org-special-ctrl-k t)
3982 (setq org-yank-adjusted-subtrees t)
3984 (setq org-table-export-default-format "orgtbl-to-csv")
3988 The following setting adds alphabetical lists like
3992 #+BEGIN_SRC emacs-lisp
3993 (if (> emacs-major-version 23)
3994 (setq org-list-allow-alphabetical t)
3995 (setq org-alphabetical-lists t))
3998 #+BEGIN_SRC emacs-lisp
3999 (setq org-remove-highlights-with-change nil)
4001 (setq org-list-demote-modify-bullet (quote (("+" . "-")
4008 (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
4011 ; If we leave Emacs running overnight - reset the appointments one minute after midnight
4012 (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
4017 #+BEGIN_SRC emacs-lisp
4018 ;; Enable abbrev-mode
4019 (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
4020 (setq org-startup-indented t)
4021 (setq org-startup-folded t)
4022 (setq org-cycle-separator-lines 0)
4025 I find extra blank lines in lists and headings a bit of a nuisance.
4026 To get a body after a list you need to include a blank line between
4027 the list entry and the body -- and indent the body appropriately.
4028 Most of my lists have no body detail so I like the look of collapsed
4029 lists with no blank lines better.
4031 The following setting prevents creating blank lines before headings
4032 but allows list items to adapt to existing blank lines around the items:
4033 #+BEGIN_SRC emacs-lisp
4034 (setq org-blank-before-new-entry (quote ((heading)
4035 (plain-list-item . auto))))
4038 #+BEGIN_SRC emacs-lisp
4039 (setq org-reverse-note-order nil)
4040 (setq org-default-notes-file "~/notes.org")
4043 Enforce task blocking. Tasks can't go done when there is any subtask
4044 still open. Unless they have a property of =NOBLOCKING: t=
4045 #+BEGIN_SRC emacs-lisp
4046 (setq org-enforce-todo-checkbox-dependencies t)
4047 (setq org-enforce-todo-dependencies t)
4050 #+BEGIN_SRC emacs-lisp
4051 (setq org-fast-tag-selection-single-key (quote expert))
4052 (setq org-footnote-auto-adjust t)
4053 (setq org-hide-block-startup t)
4054 (setq org-icalendar-alarm-time 15)
4055 (setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
4056 (setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
4057 (setq org-icalendar-honor-noexport-tag t)
4058 (setq org-icalendar-include-bbdb-anniversaries nil)
4059 (setq org-icalendar-include-body 200)
4060 (setq org-icalendar-include-todo nil)
4061 (setq org-icalendar-store-UID t)
4062 (setq org-icalendar-timezone "Europe/Berlin")
4063 (setq org-insert-mode-line-in-empty-file t)
4064 (setq org-log-done (quote note))
4065 (setq org-log-into-drawer t)
4066 (setq org-log-state-notes-insert-after-drawers nil)
4067 (setq org-log-reschedule (quote time))
4068 (setq org-log-states-order-reversed t)
4069 (setq org-mobile-agendas (quote all))
4070 (setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
4071 (setq org-mobile-inbox-for-pull "~/org/refile.org")
4072 (setq org-remember-store-without-prompt t)
4073 (setq org-return-follows-link t)
4074 (setq org-reverse-note-order t)
4076 ; regularly save our org-mode buffers
4077 (run-at-time "00:59" 3600 'org-save-all-org-buffers)
4079 (setq org-log-done t)
4081 (setq org-enable-priority-commands t)
4082 (setq org-default-priority ?E)
4083 (setq org-lowest-priority ?E)
4088 Speed commands enable single-letter commands in Org-mode files when
4089 the point is at the beginning of a headline, or at the beginning of a
4092 See the `=org-speed-commands-default=' variable for a list of the keys
4093 and commands enabled at the beginning of headlines. All code blocks
4094 are available at the beginning of a code block, the following key
4095 sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
4096 display a list of the code blocks commands and their related keys.
4098 #+BEGIN_SRC emacs-lisp
4099 (setq org-use-speed-commands nil)
4100 (setq org-speed-commands-user (quote (("0" . ignore)
4113 ("h" . bh/hide-other)
4116 (call-interactively 'org-insert-heading-respect-content))
4117 ("k" . org-kill-note-or-show-branches)
4120 ("q" . bh/show-org-agenda)
4122 ("s" . org-save-all-org-buffers)
4126 ("z" . org-add-note)
4131 ("F" . bh/restrict-to-file-or-follow)
4134 ("J" . org-clock-goto)
4138 ("N" . bh/narrow-to-org-subtree)
4139 ("P" . bh/narrow-to-org-project)
4144 ("U" . bh/narrow-up-one-org-level)
4151 (add-hook 'org-agenda-mode-hook
4153 (define-key org-agenda-mode-map "q" 'bury-buffer))
4156 (defvar bh/current-view-project nil)
4157 (add-hook 'org-agenda-mode-hook
4158 '(lambda () (org-defkey org-agenda-mode-map "V" 'bh/view-next-project))
4163 The following displays the contents of code blocks in Org-mode files
4164 using the major-mode of the code. It also changes the behavior of
4165 =TAB= to as if it were used in the appropriate major mode. This means
4166 that reading and editing code form inside of your Org-mode files is
4167 much more like reading and editing of code using its major mode.
4169 #+BEGIN_SRC emacs-lisp
4170 (setq org-src-fontify-natively t)
4171 (setq org-src-tab-acts-natively t)
4174 #+BEGIN_SRC emacs-lisp
4175 (setq org-src-preserve-indentation nil)
4176 (setq org-edit-src-content-indentation 0)
4180 #+BEGIN_SRC emacs-lisp
4181 (setq org-attach-directory "~/org/data/")
4183 #+BEGIN_SRC emacs-lisp
4184 (setq org-agenda-sticky t)
4187 **** Checklist handling
4188 [2013-05-11 Sat 22:15]
4190 #+BEGIN_SRC emacs-lisp
4191 (require 'org-checklist)
4194 I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
4196 #+BEGIN_SRC emacs-lisp