1 #+TITLE: emacs.org - Ganneffs emacs configuration
2 #+DESCRIPTION: My current Emacs configuration
3 #+KEYWORDS: org-mode Emacs configuration
4 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
5 #+SETUPFILE: ~/.emacs.d/elisp/org-templates/level-0.org
11 :ID: b6e6cf73-9802-4a7b-bd65-fdb6f9745319
13 The following functions are used throughout my config, and so I load
16 safe-load does not break emacs initialization, should a file be
17 unreadable while emacs boots up.
18 #+BEGIN_SRC emacs-lisp
19 (defvar safe-load-error-list ""
20 "*List of files that reported errors when loaded via safe-load")
22 (defun safe-load (file &optional noerror nomessage nosuffix)
23 "Load a file. If error on load, report back, wait for
24 a key stroke then continue on"
26 (condition-case nil (load file noerror nomessage nosuffix)
29 (setq safe-load-error-list (concat safe-load-error-list " " file))
30 (message "****** [Return to continue] Error loading %s" safe-load-error-list )
34 (defun safe-load-check ()
35 "Check for any previous safe-load loading errors. (safe-load.el)"
37 (if (string-equal safe-load-error-list "") ()
38 (message (concat "****** error loading: " safe-load-error-list))))
41 I have some stuff put away in my local dir. I don't want to load it all
42 at startup time, so it is using the autoload feature. For that to work
43 load the loaddefs, so autoload knows where to grab stuff
44 #+BEGIN_SRC emacs-lisp
45 (safe-load (concat jj-elisp-dir "/tiny/loaddefs.el"))
46 (safe-load (concat jj-elisp-local-dir "/loaddefs.el"))
49 Handier way to add modes to auto-mode-alist
50 #+BEGIN_SRC emacs-lisp
51 (defun add-auto-mode (mode &rest patterns)
52 "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
53 (dolist (pattern patterns)
54 (add-to-list 'auto-mode-alist (cons pattern mode))))
56 *** config helpers use-package/bind-key
57 Helpers for the config
58 https://github.com/jwiegley/use-package
59 #+BEGIN_SRC emacs-lisp
60 (require 'use-package)
64 [2014-05-20 Tue 22:36]
65 #+BEGIN_SRC emacs-lisp
66 (defmacro hook-into-modes (func modes)
67 `(dolist (mode-hook ,modes)
68 (add-hook mode-hook ,func)))
72 The Emacs Lisp Package Archive contains things I want.
73 #+BEGIN_SRC emacs-lisp
74 (when (> emacs-major-version 23)
76 (setq package-user-dir (expand-file-name "elpa" jj-elisp-dir))
77 (dolist (source '(("melpa" . "http://melpa.org/packages/")
78 ("melpa-stable" . "http://stable.melpa.org/packages/")
79 ("marmalade" . "http://marmalade-repo.org/packages/")
80 ("elpy" . "http://jorgenschaefer.github.io/packages/")
81 ("elpa" . "http://elpa.gnu.org/packages/")
83 (add-to-list 'package-archives source t))
87 And Paradox is a nicer interface for it
88 #+BEGIN_SRC emacs-lisp
91 :commands (paradox-list-packages paradox-install paradox-upgrade-packages)
95 (setq paradox-github-token t)
100 We need to define the load-path. As I have lots of things I add
101 locally, its getting a few entries. I disliked the repeated
102 /add-to-list/ lines, so I now just take all subdirectories of
103 jj-elisp-dir and add them.
105 #+BEGIN_SRC emacs-lisp
107 (project (directory-files jj-elisp-dir t "\\w+"))
108 (when (file-directory-p project)
109 (if (string= project "emacs23")
110 (when (version< emacs-version "24")
111 (add-to-list 'load-path project))
112 (add-to-list 'load-path project))
113 ;(byte-recompile-directory project 0)
118 Help emacs to find the info files
119 #+BEGIN_SRC emacs-lisp :tangle yes
120 (setq Info-directory-list (cons jj-info-dir
121 '("/usr/local/share/info/"
123 "/usr/local/gnu/info/"
124 "/usr/local/gnu/lib/info/"
125 "/usr/local/gnu/lib/emacs/info/"
126 "/usr/local/emacs/info/"
127 "/usr/local/lib/info/"
128 "/usr/local/lib/emacs/info/"
129 "/usr/share/info/emacs-23"
131 "/usr/share/info/")))
132 (setq Info-default-directory-list
133 (cons jj-info-dir Info-default-directory-list))
139 :ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
141 I dislike the startup message
142 #+BEGIN_SRC emacs-lisp
143 (setq inhibit-splash-screen t)
144 (setq inhibit-startup-message t)
147 Usually I want the lines to break at 72 characters.
148 #+BEGIN_SRC emacs-lisp
149 (setq fill-column 72)
152 And it is nice to have a final newline in files.
153 (Now off, ethan-wspace is doing it better).
154 #+BEGIN_SRC emacs-lisp
155 (setq require-final-newline nil)
156 (setq mode-require-final-newline nil)
159 After I typed 300 characters or took a break for more than a minute it
160 would be nice of emacs to save whatever I am on in one of its auto-save
161 backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
162 #+BEGIN_SRC emacs-lisp
163 (setq auto-save-interval 300)
164 (setq auto-save-timeout 60)
167 Set my full name and my default mail address - for whatever wants to use
168 it later. Also, I am using gnus.
169 #+BEGIN_SRC emacs-lisp
170 (setq user-full-name "Joerg Jaspert")
171 (setq user-mail-address "joerg@ganneff.de")
172 (setq mail-user-agent (quote gnus-user-agent))
175 My default mail server. Well, simply a localhost, I have a forwarder that
176 puts mail off the right way, no need for emacs to have any further
178 #+BEGIN_SRC emacs-lisp
179 (setq smtpmail-default-smtp-server "localhost")
180 (setq smtpmail-smtp-server "localhost")
183 Enable automatic handling of compressed files.
184 #+BEGIN_SRC emacs-lisp
185 (auto-compression-mode 1)
188 Emacs forbids a certain set of commands, as they can be very confusing
189 for new users. Enable them.
190 #+BEGIN_SRC emacs-lisp
191 (put 'narrow-to-region 'disabled nil)
192 (put 'narrow-to-page 'disabled nil)
193 (put 'narrow-to-defun 'disabled nil)
194 (put 'upcase-region 'disabled nil)
195 (put 'downcase-region 'disabled nil)
199 I've tried various different fonts and while I like the Terminus font
200 most for my shells, in Emacs Inconsolata clearly wins.
201 #+BEGIN_SRC emacs-lisp
202 (set-frame-font "Inconsolata-14")
205 I always use dark backgrounds, so tell Emacs about it. No need to
207 #+BEGIN_SRC emacs-lisp
208 (setq-default frame-background-mode jj-color-style)
211 And I always liked dark backgrounds with colors setup for them. So I
212 switched through multiple themes doing it in emacs too, but never
213 entirely liked it. Until I found solarized, which is now not only my
214 emacs theme, but also for most of my other software too, especially my
215 shell. Consistent look is great.
216 #+BEGIN_SRC emacs-lisp :tangle no
217 (if (or (> emacs-major-version 23) (boundp 'custom-theme-load-path))
219 (defun jj-init-theme ()
221 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
222 (load-theme 'solarized-light t))
223 (set-face-attribute 'org-date nil :underline nil)
224 (message "Initializing theme solarized-dark")
226 (add-to-list 'custom-theme-load-path jj-theme-dir)
227 (add-hook 'after-init-hook 'jj-init-theme)
229 (add-to-list 'load-path (expand-file-name "emacs-color-theme-solarized" jj-elisp-dir))
230 (require 'color-theme-solarized)
231 (color-theme-solarized-dark)
234 #+BEGIN_SRC emacs-lisp
235 (use-package solarized
236 :load-path "elisp/solarized-emacs"
239 (defun jj-init-theme ()
241 ;; ;; make the fringe stand out from the background
242 (setq solarized-distinct-fringe-background t)
244 ;; ;; Don't change the font for some headings and titles
245 ;; (setq solarized-use-variable-pitch nil)
247 ;; ;; make the modeline high contrast
248 ;; (setq solarized-high-contrast-mode-line t)
250 ;; ;; Use less bolding
251 ;; (setq solarized-use-less-bold t)
253 ;; ;; Use more italics
254 ;; (setq solarized-use-more-italic t)
256 ;; ;; Use less colors for indicators such as git:gutter, flycheck and similar
257 ;; (setq solarized-emphasize-indicators nil)
259 ;; ;; Don't change size of org-mode headlines (but keep other size-changes)
260 ;; (setq solarized-scale-org-headlines nil)
262 ;; ;; Avoid all font-size changes
263 ;; (setq solarized-height-minus-1 1)
264 ;; (setq solarized-height-plus-1 1)
265 ;; (setq solarized-height-plus-2 1)
266 ;; (setq solarized-height-plus-3 1)
267 ;; (setq solarized-height-plus-4 1)
268 (setq x-underline-at-descent-line t)
270 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
271 (load-theme 'solarized-light t))
272 (set-face-attribute 'org-date nil :underline nil)
273 (message "Initializing theme solarized-dark")
275 (add-to-list 'custom-theme-load-path jj-theme-dir)
276 (add-hook 'after-init-hook 'jj-init-theme)
280 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
281 #+BEGIN_SRC emacs-lisp
282 (if (fboundp 'fringe-mode)
286 A bit more spacing between buffer lines
287 #+BEGIN_SRC emacs-lisp
288 (setq-default line-spacing 0.1)
291 [2013-04-21 So 20:54]
292 I do not want my cursor to blink.
293 #+BEGIN_SRC emacs-lisp
294 (blink-cursor-mode -1)
296 *** Menu, Tool and Scrollbar
297 I don't want to see the menu-bar, tool-bar or scrollbar.
298 #+BEGIN_SRC emacs-lisp
300 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
301 (when (fboundp mode) (funcall mode -1))))
303 **** When using emacs in daemon mode
304 Emacs has a very nice mode where it detaches itself and runs as daemon -
305 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
306 Client]]. It's fast, it's nice, it's convinient.
308 Except that Emacs behaves stupid when you do that and ignores your
309 menu/tool/scrollbar settings. Sucks.
311 For them to work even then, we have to do two things.
312 1. We have to set the frame alist. We simple set both,
313 =initial-frame-alist= and =default-frame-alist= to the same value here.
314 #+BEGIN_SRC emacs-lisp
315 (setq initial-frame-alist '(
316 (horizontal-scroll-bars . nil)
317 (vertical-scroll-bars . nil)
320 (setq default-frame-alist (copy-alist initial-frame-alist))
322 2. We have to disable the toolbar using the customize interface, so you
323 can find that in the [[id:0102208d-fdf6-4928-9e40-7e341bd3aa3a][Customized variables]] section.
325 *** Hilight current line in buffer
326 As it says, it does a hilight of the current line.
327 #+BEGIN_SRC emacs-lisp
328 (global-hl-line-mode +1)
330 *** Allow recursive minibuffers
331 This allows (additional) minibuffer commands while in the minibuffer.
332 #+BEGIN_SRC emacs-lisp
333 (setq enable-recursive-minibuffers 't)
336 *** Modeline related changes
337 I want to see line and column numbers, so turn them on.
338 Size indication lets me know how far I am in a buffer.
340 And modeline-posn is great. It will hilight the column number in the
341 modeline in red as soon as you are over the defined limit.
342 #+BEGIN_SRC emacs-lisp
344 (column-number-mode 1)
345 (size-indication-mode 1)
346 (display-time-mode 1)
347 (setq display-time-day-and-date nil)
348 (setq display-time-default-load-average nil)
349 (setq display-time-24hr-format t)
350 (setq modelinepos-column-limit 72)
352 (use-package modeline-posn
356 (set-face-foreground 'modelinepos-column-warning "grey20")
357 (set-face-background 'modelinepos-column-warning "red")
358 (setq modelinepos-column-limit 72))
363 [2013-04-22 Mon 11:27]
364 The modeline is easily cluttered up with stuff I don't really need to
365 see. So lets hide those. There are two ways, one of them uses diminish
366 to get entirely rid of some modes, the other is a function taken from
367 "Mastering Emacs" which replaces the modes text with an own (set of)
369 #+BEGIN_SRC emacs-lisp
371 (diminish 'auto-fill-function)
372 (defvar mode-line-cleaner-alist
373 `((auto-complete-mode . " α")
374 (yas-minor-mode . " y")
375 (paredit-mode . " π")
379 (lisp-interaction-mode . "λ")
382 (emacs-lisp-mode . "EL")
384 (org-indent-mode . "")
389 "Alist for `clean-mode-line'.
391 When you add a new element to the alist, keep in mind that you
392 must pass the correct minor/major mode symbol and a string you
393 want to use in the modeline *in lieu of* the original.
395 Want some symbols? Go:
397 ;ςερτζθιοπασδφγηξκλυχψωβνμ
398 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
399 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
403 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
406 Unfortunately icicles breaks this with the way it adds/removes itself,
407 so take it our for now...
410 Back when I started with text-mode. But nowadays I want default mode to
411 be org-mode - it is just so much better to use. And does sensible things
412 with many README files out there, and various other "crap" you get to
414 #+BEGIN_SRC emacs-lisp :tangle yes
415 (setq-default major-mode 'org-mode)
417 #+BEGIN_SRC emacs-lisp :tangle no
418 (setq initial-major-mode 'org-mode)
422 [2013-04-23 Tue 16:43]
423 Shell. zsh in my case.
424 #+BEGIN_SRC emacs-lisp
425 (setq shell-file-name "zsh")
426 (setq shell-command-switch "-c")
427 (setq explicit-shell-file-name shell-file-name)
428 (setenv "SHELL" shell-file-name)
429 (setq explicit-sh-args '("-login" "-i"))
430 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
431 (setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
432 (setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
433 (setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
434 (setq comint-completion-autolist t) ; show completion list when ambiguous
435 (setq comint-input-ignoredups t) ; no duplicates in command history
436 (setq comint-completion-addsuffix t) ; insert space/slash after file completion
437 (setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
438 (setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
440 *** Keyboard related changes
442 This lets M-SPC cycle through spacing, that is
443 1. replace all spaces with a single space
445 3. restore the original spacing
446 #+BEGIN_SRC emacs-lisp :tangle yes
447 (bind-key "M-SPC" 'cycle-spacing)
449 **** Toggle/Cycle letter case
450 [2015-05-22 Fri 22:42]
452 This is from [[http://ergoemacs.org/emacs/modernization_upcase-word.html][Emacs: Toggle/Cycle Letter Case]]
454 Emacs has several user level commands for changing letter case. They
455 are: upcase-word 【Alt+u】, downcase-word 【Alt+l】, capitalize-word
458 There are also “region” versions for each: upcase-region 【Ctrl+x
459 Ctrl+u】, downcase-region 【Ctrl+x Ctrl+l】, capitalize-region, and
460 also upcase-initials-region. (Note: for elisp programing, there are
461 also these functions: upcase, capitalize, downcase, upcase-initials.)
463 One problem with these commands is that you need to move your cursor
464 to the beginning of the word first. For example, if you have the text
465 “THat”, and your cursor is on the “a”, and you call downcase-word, but
466 it doesn't do anything because it only start at the cursor point to
467 end of word. It would be nice if it'll just automatically perform the
468 operation on the whole word.
470 Another problem is that it does not consider the final result. For
471 example, if you have “oncE upon a time …”, and you select the whole
472 sentence and call upcase-initials-region, it becomes “OncE Upon A Time
473 …”. Note the capital E is not automatically lowered. For elisp
474 programing, the orthogonal precision is nice, but as user commands, it
475 is better to change the whole sentence.
477 Also, these commands have a “-word” and “-region” variants, great for
478 precision in elisp programing but not smart as user commands. It would
479 be nice if emacs automatically choose the right command depending
480 whether there is text selection.
481 #+BEGIN_SRC emacs-lisp :tangle yes
482 (bind-key "M-c" 'toggle-letter-case)
484 ** Miscellaneous stuff
485 Searches and matches should ignore case.
486 #+BEGIN_SRC emacs-lisp
487 (setq-default case-fold-search t)
490 Which buffers to get rid off at midnight.
491 #+BEGIN_SRC emacs-lisp
492 (setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
493 "*Man " "*Buffer List*"
499 "*magit" "*Calendar")))
502 Don't display a cursor in non-selected windows.
503 #+BEGIN_SRC emacs-lisp
504 (setq-default cursor-in-non-selected-windows nil)
507 What should be displayed in the mode-line for files with those types
509 #+BEGIN_SRC emacs-lisp
510 (setq eol-mnemonic-dos "(DOS)")
511 (setq eol-mnemonic-mac "(Mac)")
514 #+BEGIN_SRC emacs-lisp
515 (setq max-lisp-eval-depth 1000)
516 (setq max-specpdl-size 3000)
520 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
521 #+BEGIN_SRC emacs-lisp
522 (defun unfill-paragraph ()
523 "Takes a multi-line paragraph and makes it into a single line of text."
525 (let ((fill-column (point-max)))
526 (fill-paragraph nil)))
527 (bind-key "H-u" 'unfill-paragraph)
530 #+BEGIN_SRC emacs-lisp
531 (setq-default indicate-empty-lines t)
532 (setq sentence-end-double-space nil)
535 Hilight annotations in comments, like FIXME/TODO/...
536 #+BEGIN_SRC emacs-lisp
537 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
541 #+BEGIN_SRC emacs-lisp
542 (setq browse-url-browser-function (quote browse-url-generic))
543 (setq browse-url-generic-program "/usr/bin/x-www-browser")
546 *** When saving a script - make it executable
547 #+BEGIN_SRC emacs-lisp
548 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
552 #+BEGIN_SRC emacs-lisp
556 (add-hook 'after-init-hook 'server-start)))
558 **** Edit-server for chromium extension "Edit with emacs"
559 [2015-10-15 Thu 22:32]
560 #+BEGIN_SRC emacs-lisp
561 (use-package edit-server
564 (setq edit-server-new-frame nil)
565 (edit-server-start)))
567 ** Customized variables
568 [2013-05-02 Thu 22:14]
569 The following contains a set of variables i may reasonably want to
570 change on other systems - which don't affect the init file loading
571 process. So I *can* use the customization interface for it...
572 #+BEGIN_SRC emacs-lisp
573 (defgroup ganneff nil
574 "Modify ganneffs settings"
577 (defgroup ganneff-org-mode nil
578 "Ganneffs org-mode settings"
579 :tag "Ganneffs org-mode settings"
581 :link '(custom-group-link "ganneff"))
583 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
584 "ID of the organization task."
585 :tag "Organization Task ID"
587 :group 'ganneff-org-mode)
589 (defcustom org-my-archive-expiry-days 2
590 "The number of days after which a completed task should be auto-archived.
591 This can be 0 for immediate, or a floating point value."
592 :tag "Archive expiry days"
594 :group 'ganneff-org-mode)
599 [2013-05-21 Tue 23:22]
600 Restore removed var alias, used by ruby-electric-brace and others
601 #+BEGIN_SRC emacs-lisp
602 (unless (boundp 'last-command-char)
603 (defvaralias 'last-command-char 'last-command-event))
605 * Customized variables
607 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
609 Of course I want to be able to use the customize interface, and some
610 things can only be set via it (or so they say). I usually prefer to put
611 things I keep for a long while into statements somewhere else, not just
612 custom-set here, but we need it anyways.
614 #+BEGIN_SRC emacs-lisp
615 (setq custom-file jj-custom-file)
616 (safe-load custom-file)
619 The source of this is:
620 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
621 * Extra modes and their configuration
623 A defined abbrev is a word which expands, if you insert it, into some
624 different text. Abbrevs are defined by the user to expand in specific
626 #+BEGIN_SRC emacs-lisp
628 :commands abbrev-mode
629 :diminish abbrev-mode
631 (hook-into-modes #'abbrev-mode '(text-mode-hook))
634 (setq save-abbrevs 'silently)
635 (setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
636 (if (file-exists-p abbrev-file-name)
637 (quietly-read-abbrev-file))
639 (add-hook 'expand-load-hook
641 (add-hook 'expand-expand-hook 'indent-according-to-mode)
642 (add-hook 'expand-jump-hook 'indent-according-to-mode)))))
645 [2013-04-28 So 11:26]
646 avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.
647 #+BEGIN_SRC emacs-lisp
650 :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)
651 :bind (("H-SPC" . avy-goto-char-2)
652 ("M-g g" . avy-goto-line)
656 (setq avy-all-windows 'all-frames)
657 (setq avi-keys '(?a ?s ?d ?e ?f ?h ?j ?k ?l ?n ?m ?v ?r ?u) )
661 (bind-key "C-y" 'avy-isearch isearch-mode-map)
666 [2013-04-21 So 20:27]
667 Use H-w to switch windows
668 #+BEGIN_SRC emacs-lisp
669 (use-package ace-window
672 :bind ("H-w" . ace-window)
675 (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))
679 [2014-10-27 Mon 13:08]
680 electric-indent-mode is enough to keep your code nicely aligned when
681 all you do is type. However, once you start shifting blocks around,
682 transposing lines, or slurping and barfing sexps, indentation is bound
685 aggressive-indent-mode is a minor mode that keeps your code always
686 indented. It reindents after every command, making it more reliable
687 than electric-indent-mode.
688 #+BEGIN_SRC emacs-lisp
689 (use-package aggressive-indent
690 :ensure aggressive-indent
691 :commands (aggressive-indent-mode global-aggressive-indent-mode)
694 (global-aggressive-indent-mode 0)
695 (setq aggressive-indent-comments-too 0)
696 (add-to-list 'aggressive-indent-excluded-modes 'html-mode)
700 [2014-06-01 Sun 23:02]
701 Provides a minor mode which displays current match and total matches
702 information in the mode-line in various search modes.
703 #+BEGIN_SRC emacs-lisp
710 (global-anzu-mode 1))
713 (setq anzu-search-threshold 1000)
714 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
717 [2014-05-21 Wed 00:33]
718 #+BEGIN_SRC emacs-lisp
720 :commands (ascii-on ascii-toggle ascii-display)
721 :bind (("C-c e A" . ascii-toggle))
724 (defun ascii-toggle ()
726 (defvar ascii-display nil)
731 (bind-key "C-c e A" 'ascii-toggle)))
734 #+BEGIN_SRC emacs-lisp
735 (setq auto-mode-alist (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
736 (setq TeX-auto-save t)
737 (setq TeX-parse-self t)
738 (setq TeX-PDF-mode t)
740 ** auto-complete mode
741 [2013-04-27 Sa 16:33]
742 And aren't we all lazy? I definitely am, and I like my emacs doing as
743 much possible work for me as it can.
744 So here, auto-complete-mode, which lets emacs do this, based on what I
746 #+BEGIN_SRC emacs-lisp
747 (use-package auto-complete-config
748 :ensure auto-complete
753 ;; hook AC into completion-at-point
754 (defun sanityinc/auto-complete-at-point ()
755 (when (and (not (minibufferp))
756 (fboundp 'auto-complete-mode)
759 (defun set-auto-complete-as-completion-at-point-function ()
760 (add-to-list 'completion-at-point-functions 'sanityinc/auto-complete-at-point))
761 ;; Exclude very large buffers from dabbrev
762 (defun sanityinc/dabbrev-friend-buffer (other-buffer)
763 (< (buffer-size other-buffer) (* 1 1024 1024)))
768 ;; custom keybindings to use tab, enter and up and down arrows
769 (bind-key "\t" 'ac-expand ac-complete-mode-map)
770 (bind-key "\r" 'ac-complete ac-complete-mode-map)
771 (bind-key "M-n" 'ac-next ac-complete-mode-map)
772 (bind-key "M-p" 'ac-previous ac-complete-mode-map)
773 (bind-key "C-s" 'ac-isearch ac-completing-map)
774 (bind-key "M-TAB" 'auto-complete ac-mode-map)
776 (setq ac-comphist-file (expand-file-name "ac-comphist.dat" jj-cache-dir))
777 (setq ac-use-comphist t)
778 (setq ac-expand-on-auto-complete nil)
780 (setq ac-auto-start 3)
782 (setq ac-menu-height 15)
783 (setq ac-quick-help-delay 0.5)
784 (setq ac-use-fuzzy t)
786 (ac-flyspell-workaround)
788 ;; use 't when auto-complete is disabled
789 (setq tab-always-indent 'complete)
790 (add-to-list 'completion-styles 'initials t)
792 ;; Use space and punctuation to accept the current the most likely completion.
793 (setq auto-completion-syntax-alist (quote (global accept . word)))
794 ;; Avoid completion for short trivial words.
795 (setq auto-completion-min-chars (quote (global . 3)))
796 (setq completion-use-dynamic t)
798 (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
800 ;; Exclude very large buffers from dabbrev
801 (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
803 (use-package ac-dabbrev
806 (set-default 'ac-sources
809 ac-source-words-in-buffer
810 ac-source-words-in-same-mode-buffers
811 ; ac-source-words-in-all-buffer
814 (dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
815 sass-mode yaml-mode csv-mode espresso-mode haskell-mode
816 html-mode nxml-mode sh-mode smarty-mode clojure-mode
817 lisp-mode textile-mode markdown-mode tuareg-mode python-mode
818 js3-mode css-mode less-css-mode sql-mode ielm-mode))
819 (add-to-list 'ac-modes mode))
821 (add-hook 'latex-mode-hook 'auto-complete-mode)
822 (add-hook 'LaTeX-mode-hook 'auto-complete-mode)
823 (add-hook 'prog-mode-hook 'auto-complete-mode)
824 (add-hook 'org-mode-hook 'auto-complete-mode)))
829 When files change outside emacs for whatever reason I want emacs to deal
830 with it. Not to have to revert buffers myself
831 #+BEGIN_SRC emacs-lisp
832 (use-package autorevert
833 :commands auto-revert-mode
834 :diminish auto-revert-mode
837 (setq global-auto-revert-mode t)
838 (setq global-auto-revert-non-file-buffers t)
839 (global-auto-revert-mode)))
843 Emacs should keep backup copies of files I edit, but I do not want them
844 to clutter up the filesystem everywhere. So I put them into one defined
845 place, backup-directory, which even contains my username (for systems
846 where =temporary-file-directory= is not inside my home).
847 #+BEGIN_SRC emacs-lisp
848 (use-package backups-mode
849 :load-path "elisp/backups-mode"
850 :bind (("\C-cv" . save-version)
851 ("\C-cb" . list-backups)
852 ("\C-ck" . kill-buffer-prompt)
853 ("\C-cw" . backup-walker-start))
856 (setq backup-directory jj-backup-directory)
857 (setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
858 (if (not (file-exists-p tramp-backup-directory))
859 (make-directory tramp-backup-directory))
860 (setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
861 (setq backup-directory-alist `(("." . ,jj-backup-directory)))
862 (setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
863 (setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
865 (setq version-control t) ;; Use version numbers for backups
866 (setq kept-new-versions 10) ;; Number of newest versions to keep
867 (setq kept-old-versions 2) ;; Number of oldest versions to keep
868 (setq delete-old-versions t) ;; Ask to delete excess backup versions?
869 (setq backup-by-copying t)
870 (setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
871 (setq make-backup-files t)
873 (defadvice kill-buffer (around kill-buffer)
874 "Always save before killing a file buffer"
875 (when (and (buffer-modified-p)
877 (file-exists-p (buffer-file-name)))
880 (ad-activate 'kill-buffer)
882 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
883 "Always save before killing emacs"
884 (save-some-buffers t)
886 (ad-activate 'save-buffers-kill-emacs)
888 (defun kill-buffer-prompt ()
889 "Allows one to kill a buffer without saving it.
890 This is necessary since once you start backups-mode all file based buffers
891 are saved automatically when they are killed"
893 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
895 (set-buffer-modified-p nil))
898 (setq backup-enable-predicate
900 (and (normal-backup-enable-predicate name)
902 (let ((method (file-remote-p name 'method)))
903 (when (stringp method)
904 (member method '("su" "sudo"))))))))))
908 [2014-12-11 Thu 11:31]
909 #+BEGIN_SRC emacs-lisp
910 (use-package browse-kill-ring
911 :commands (browse-kill-ring browse-kill-ring-mode)
912 :bind ("M-y" . browse-kill-ring)
916 [2014-06-10 Tue 22:20]
917 #+BEGIN_SRC emacs-lisp
919 :commands (cal/insert)
920 :bind ("C-c c" . cal/insert)
923 ; Weeks start on Monday, not sunday.
924 (setq calendar-week-start-day 1)
926 ; Display ISO week numbers in Calendar Mode
927 (copy-face font-lock-constant-face 'calendar-iso-week-face)
928 (set-face-attribute 'calendar-iso-week-face nil :height 0.7)
929 (setq calendar-intermonth-text
933 (calendar-iso-from-absolute
934 (calendar-absolute-from-gregorian (list month day year)))))
935 'font-lock-face 'calendar-iso-week-face))
936 (copy-face 'default 'calendar-iso-week-header-face)
937 (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7)
938 (setq calendar-intermonth-header
939 (propertize "Wk" ; or e.g. "KW" in Germany
940 'font-lock-face 'calendar-iso-week-header-face))))
944 [2015-10-15 Thu 11:34]
945 Corral is a lightweight package that lets you quickly wrap parentheses
946 and other delimiters around text, intuitively surrounding what you
947 want it to using just two commands.
948 #+BEGIN_SRC emacs-lisp
953 ; Interpret # and * as part of the word
954 (setq corral-syntax-entries '((?# "_")
956 (defhydra hydra-corral (:columns 4)
958 ("(" corral-parentheses-backward "Back")
959 (")" corral-parentheses-forward "Forward")
960 ("[" corral-brackets-backward "Back")
961 ("]" corral-brackets-forward "Forward")
962 ("{" corral-braces-backward "Back")
963 ("}" corral-braces-forward "Forward")
964 ("\"" corral-double-quotes-backward "Back")
965 ("2" corral-double-quotes-forward "Forward")
966 ("'" corral-single-quotes-backward "Back")
967 ("#" corral-single-quotes-forward "Forward")
968 ("." hydra-repeat "Repeat"))
969 (bind-key "C-c c" 'hydra-corral/body)
973 [2013-05-21 Tue 23:18]
974 #+BEGIN_SRC emacs-lisp
975 (use-package crontab-mode
977 :commands crontab-mode
978 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
982 web-mode takes over, see [[*web-mode][web-mode]]
983 #+BEGIN_SRC emacs-lisp :tangle no
984 (use-package css-mode
985 :mode ("\\.css\\'" . css-mode)
990 (use-package flymake-css
994 (defun maybe-flymake-css-load ()
995 "Activate flymake-css as necessary, but not in derived modes."
996 (when (eq major-mode 'css-mode)
998 (add-hook 'css-mode-hook 'maybe-flymake-css-load)))
999 ;;; Auto-complete CSS keywords
1000 (eval-after-load 'auto-complete
1002 (dolist (hook '(css-mode-hook sass-mode-hook scss-mode-hook))
1003 (add-hook hook 'ac-css-mode-setup))))))
1007 I know that this lets it look "more like windows", but I don't much care
1008 about its paste/copy/cut keybindings, the really nice part is the great
1009 support for rectangular regions, which I started to use a lot since I
1010 know this mode. The normal keybindings for those are just to useless.
1011 #+BEGIN_SRC emacs-lisp
1013 (setq cua-enable-cua-keys (quote shift))
1016 Luckily cua-mode easily supports this, with the following line I just
1017 get the CUA selection and rectangle stuff, not the keybindings. Yes,
1018 even though the above =cua-enable-cua-keys= setting would only enable
1019 them if the selection is done when the region was marked with a shifted
1021 #+BEGIN_SRC emacs-lisp
1022 (cua-selection-mode t)
1026 #+BEGIN_SRC emacs-lisp
1027 (require 'dpkg-dev-el-loaddefs nil 'noerror)
1028 (require 'debian-el-loaddefs nil 'noerror)
1030 (setq debian-changelog-full-name "Joerg Jaspert")
1031 (setq debian-changelog-mailing-address "joerg@debian.org")
1035 #+BEGIN_SRC emacs-lisp
1036 (use-package diff-mode
1038 :mode (("\\.diff" . diff-mode))
1040 (use-package diff-mode-))
1044 #+BEGIN_SRC emacs-lisp
1046 :commands (dired dired-other-window dired-other-frame dired-noselect
1047 dired-mode dired-jump)
1048 :defines (dired-omit-regexp-orig)
1051 (setq diredp-hide-details-initially-flag nil))
1054 (setq dired-auto-revert-buffer (quote dired-directory-changed-p))
1055 (setq dired-dwim-target t)
1056 (setq dired-listing-switches "-alh")
1057 (setq dired-listing-switches "-alXh --group-directories-first")
1058 (setq dired-recursive-copies (quote top))
1059 (setq dired-recursive-deletes (quote top))
1060 (setq dired-guess-shell-alist-user
1061 '(("\\.pdf\\'" "mupdf")
1062 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
1063 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
1064 ("\\.\\(?:xcf\\)\\'" "gimp")
1065 ("\\.csv\\'" "libreoffice")
1066 ("\\.tex\\'" "pdflatex" "latex")
1067 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
1068 ("\\.html?\\'" "conkeror")))
1070 (bind-key "F" 'find-name-dired dired-mode-map)
1075 (use-package dired-x)
1077 (use-package dired-single
1078 :ensure dired-single
1081 (bind-key "<return>" 'dired-single-buffer dired-mode-map)
1082 (bind-key "<mouse-1>" 'dired-single-buffer-mouse dired-mode-map)
1085 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
1091 (setq wdired-allow-to-change-permissions t)
1092 (bind-key "r" 'wdired-change-to-wdired-mode dired-mode-map)))
1094 (use-package gnus-dired
1095 :commands (gnus-dired-attach gnus-dired-mode)
1098 ;;(add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
1099 (bind-key "a" 'gnus-dired-attach dired-mode-map)))
1104 (defvar mark-files-cache (make-hash-table :test #'equal))
1106 (defun mark-similar-versions (name)
1108 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
1109 (setq pat (match-string 1 pat)))
1110 (or (gethash pat mark-files-cache)
1111 (ignore (puthash pat t mark-files-cache)))))
1113 (defun dired-mark-similar-version ()
1115 (setq mark-files-cache (make-hash-table :test #'equal))
1116 (dired-mark-sexp '(mark-similar-versions name)))
1118 (defun dired-package-initialize ()
1119 (unless (featurep 'runner)
1120 (bind-key "M-!" 'async-shell-command dired-mode-map)
1121 (unbind-key "M-s f" dired-mode-map)
1123 (defadvice dired-omit-startup (after diminish-dired-omit activate)
1124 "Make sure to remove \"Omit\" from the modeline."
1125 (diminish 'dired-omit-mode) dired-mode-map)
1127 ;; Omit files that Git would ignore
1128 (defun dired-omit-regexp ()
1129 (let ((file (expand-file-name ".git"))
1131 (while (and (not (file-exists-p file))
1134 (file-name-directory
1135 (directory-file-name
1136 (file-name-directory file))))
1137 ;; Give up if we are already at the root dir.
1138 (not (string= (file-name-directory file)
1140 ;; Move up to the parent dir and try again.
1141 (setq file (expand-file-name ".git" parent-dir)))
1142 ;; If we found a change log in a parent, use that.
1143 (if (file-exists-p file)
1144 (let ((regexp (funcall dired-omit-regexp-orig))
1146 (shell-command-to-string "git clean -d -x -n")))
1147 (if (= 0 (length omitted-files))
1151 (if (> (length regexp) 0)
1160 (if (= ?/ (aref str (1- (length str))))
1164 (split-string omitted-files "\n" t)
1167 (funcall dired-omit-regexp-orig))))))
1169 (add-hook 'dired-mode-hook 'dired-package-initialize)
1171 (defun dired-double-jump (first-dir second-dir)
1173 (list (read-directory-name "First directory: "
1174 (expand-file-name "~")
1175 nil nil "/Downloads/")
1176 (read-directory-name "Second directory: "
1177 (expand-file-name "~")
1180 (dired-other-window second-dir))
1181 (bind-key "C-c J" 'dired-double-jump)
1183 (defun dired-back-to-top ()
1185 (goto-char (point-min))
1186 (dired-next-line 4))
1188 (define-key dired-mode-map
1189 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
1191 (defun dired-jump-to-bottom ()
1193 (goto-char (point-max))
1194 (dired-next-line -1))
1196 (define-key dired-mode-map
1197 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
1200 ** discover-my-major
1201 [2014-06-01 Sun 23:32]
1202 Discover key bindings and their meaning for the current Emacs major mode.
1203 #+BEGIN_SRC emacs-lisp
1204 (use-package discover-my-major
1205 :ensure discover-my-major
1206 :commands discover-my-major
1207 :bind ("C-h C-m" . discover-my-major))
1210 EasyPG is a GnuPG interface for Emacs.
1211 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1212 #+BEGIN_SRC emacs-lisp
1213 (use-package epa-file
1217 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1218 (defadvice epg--start (around advice-epg-disable-agent disable)
1219 "Don't allow epg--start to use gpg-agent in plain text
1221 (if (display-graphic-p)
1223 (let ((agent (getenv "GPG_AGENT_INFO")))
1224 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
1226 (setenv "GPG_AGENT_INFO" agent))))
1227 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
1228 (ad-activate 'epg--start)
1232 [2013-04-21 So 20:36]
1233 ediff - don't start another frame
1234 #+BEGIN_SRC emacs-lisp
1238 (defvar ctl-period-equals-map)
1239 (define-prefix-command 'ctl-period-equals-map)
1240 (bind-key "C-. =" 'ctl-period-equals-map)
1241 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
1243 :bind (("C-. = b" . ediff-buffers)
1244 ("C-. = B" . ediff-buffers3)
1245 ("C-. = =" . ediff-files)
1246 ("C-. = f" . ediff-files)
1247 ("C-. = F" . ediff-files3)
1248 ("C-. = r" . ediff-revision)
1249 ("C-. = p" . ediff-patch-file)
1250 ("C-. = P" . ediff-patch-buffer)
1251 ("C-. = l" . ediff-regions-linewise)
1252 ("C-. = w" . ediff-regions-wordwise))
1254 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
1255 (setq ediff-split-window-function 'split-window-horizontally)
1261 EMMS is the Emacs Multimedia System.
1262 #+BEGIN_SRC emacs-lisp :tangle no
1263 (require 'emms-source-file)
1264 (require 'emms-source-playlist)
1265 (require 'emms-info)
1266 (require 'emms-cache)
1267 (require 'emms-playlist-mode)
1268 (require 'emms-playing-time)
1269 (require 'emms-player-mpd)
1270 (require 'emms-playlist-sort)
1271 (require 'emms-mark)
1272 (require 'emms-browser)
1273 (require 'emms-lyrics)
1274 (require 'emms-last-played)
1275 (require 'emms-score)
1276 (require 'emms-tag-editor)
1277 (require 'emms-history)
1278 (require 'emms-i18n)
1280 (setq emms-playlist-default-major-mode 'emms-playlist-mode)
1281 (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track)
1282 (emms-playing-time 1)
1284 (add-hook 'emms-player-started-hook 'emms-last-played-update-current)
1285 ;(add-hook 'emms-player-started-hook 'emms-player-mpd-sync-from-emms)
1287 (when (fboundp 'emms-cache) ; work around compiler warning
1289 (setq emms-score-default-score 3)
1291 (defun emms-mpd-init ()
1292 "Connect Emms to mpd."
1294 (emms-player-mpd-connect))
1297 (require 'emms-player-mpd)
1298 (setq emms-player-mpd-server-name "localhost")
1299 (setq emms-player-mpd-server-port "6600")
1300 (add-to-list 'emms-info-functions 'emms-info-mpd)
1301 (add-to-list 'emms-player-list 'emms-player-mpd)
1302 (setq emms-volume-change-function 'emms-volume-mpd-change)
1303 (setq emms-player-mpd-sync-playlist t)
1305 (setq emms-source-file-default-directory "/var/lib/mpd/music")
1306 (setq emms-player-mpd-music-directory "/var/lib/mpd/music")
1307 (setq emms-info-auto-update t)
1308 (setq emms-lyrics-scroll-p t)
1309 (setq emms-lyrics-display-on-minibuffer t)
1310 (setq emms-lyrics-display-on-modeline nil)
1311 (setq emms-lyrics-dir "~/.emacs.d/var/lyrics")
1313 (setq emms-last-played-format-alist
1314 '(((emms-last-played-seconds-today) . "%H:%M")
1315 (604800 . "%a %H:%M") ; this week
1316 ((emms-last-played-seconds-month) . "%d.%m.%Y")
1317 ((emms-last-played-seconds-year) . "%d.%m.%Y")
1318 (t . "Never played")))
1321 (defun my-describe (track)
1322 (let* ((empty "...")
1323 (name (emms-track-name track))
1324 (type (emms-track-type track))
1325 (short-name (file-name-nondirectory name))
1326 (play-count (or (emms-track-get track 'play-count) 0))
1327 (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
1328 (artist (or (emms-track-get track 'info-artist) empty))
1329 (year (emms-track-get track 'info-year))
1330 (playing-time (or (emms-track-get track 'info-playing-time) 0))
1331 (min (/ playing-time 60))
1332 (sec (% playing-time 60))
1333 (album (or (emms-track-get track 'info-album) empty))
1334 (tracknumber (emms-track-get track 'info-tracknumber))
1335 (short-name (file-name-sans-extension
1336 (file-name-nondirectory name)))
1337 (title (or (emms-track-get track 'info-title) short-name))
1338 (rating (emms-score-get-score name))
1341 (format "%12s %20s (%.4s) [%-20s] - %2s. %-30s | %2d %s"
1342 (emms-last-played-format-date last-played)
1346 (if (and tracknumber ; tracknumber
1347 (not (zerop (string-to-number tracknumber))))
1348 (format "%02d" (string-to-number tracknumber))
1352 (make-string rating rate-char)))
1355 (setq emms-track-description-function 'my-describe)
1357 ;; (global-set-key (kbd "C-<f9> t") 'emms-play-directory-tree)
1358 ;; (global-set-key (kbd "H-<f9> e") 'emms-play-file)
1359 (global-set-key (kbd "H-<f9> <f9>") 'emms-mpd-init)
1360 (global-set-key (kbd "H-<f9> d") 'emms-play-dired)
1361 (global-set-key (kbd "H-<f9> x") 'emms-start)
1362 (global-set-key (kbd "H-<f9> v") 'emms-stop)
1363 (global-set-key (kbd "H-<f9> n") 'emms-next)
1364 (global-set-key (kbd "H-<f9> p") 'emms-previous)
1365 (global-set-key (kbd "H-<f9> o") 'emms-show)
1366 (global-set-key (kbd "H-<f9> h") 'emms-shuffle)
1367 (global-set-key (kbd "H-<f9> SPC") 'emms-pause)
1368 (global-set-key (kbd "H-<f9> a") 'emms-add-directory-tree)
1369 (global-set-key (kbd "H-<f9> b") 'emms-smart-browse)
1370 (global-set-key (kbd "H-<f9> l") 'emms-playlist-mode-go)
1372 (global-set-key (kbd "H-<f9> r") 'emms-toggle-repeat-track)
1373 (global-set-key (kbd "H-<f9> R") 'emms-toggle-repeat-playlist)
1374 (global-set-key (kbd "H-<f9> m") 'emms-lyrics-toggle-display-on-minibuffer)
1375 (global-set-key (kbd "H-<f9> M") 'emms-lyrics-toggle-display-on-modeline)
1377 (global-set-key (kbd "H-<f9> <left>") (lambda () (interactive) (emms-seek -10)))
1378 (global-set-key (kbd "H-<f9> <right>") (lambda () (interactive) (emms-seek +10)))
1379 (global-set-key (kbd "H-<f9> <down>") (lambda () (interactive) (emms-seek -60)))
1380 (global-set-key (kbd "H-<f9> <up>") (lambda () (interactive) (emms-seek +60)))
1382 (global-set-key (kbd "H-<f9> s u") 'emms-score-up-playing)
1383 (global-set-key (kbd "H-<f9> s d") 'emms-score-down-playing)
1384 (global-set-key (kbd "H-<f9> s o") 'emms-score-show-playing)
1385 (global-set-key (kbd "H-<f9> s s") 'emms-score-set-playing)
1387 (define-key emms-playlist-mode-map "u" 'emms-score-up-playing)
1388 (define-key emms-playlist-mode-map "d" 'emms-score-down-playing)
1389 (define-key emms-playlist-mode-map "o" 'emms-score-show-playing)
1390 (define-key emms-playlist-mode-map "s" 'emms-score-set-playing)
1391 (define-key emms-playlist-mode-map "r" 'emms-mpd-init)
1392 (define-key emms-playlist-mode-map "N" 'emms-playlist-new)
1394 (define-key emms-playlist-mode-map "x" 'emms-start)
1395 (define-key emms-playlist-mode-map "v" 'emms-stop)
1396 (define-key emms-playlist-mode-map "n" 'emms-next)
1397 (define-key emms-playlist-mode-map "p" 'emms-previous)
1399 (setq emms-playlist-buffer-name "*EMMS Playlist*"
1400 emms-playlist-mode-open-playlists t)
1406 'emms-browser-artist-face nil
1411 (setq emms-player-mpd-supported-regexp
1412 (or (emms-player-mpd-get-supported-regexp)
1413 (concat "\\`http://\\|"
1414 (emms-player-simple-regexp
1415 "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff"))))
1416 (emms-player-set emms-player-mpd 'regex emms-player-mpd-supported-regexp)
1420 Basic settings for emacs integrated shell
1421 #+BEGIN_SRC emacs-lisp :tangle no
1427 (defun eshell-initialize ()
1428 (defun eshell-spawn-external-command (beg end)
1429 "Parse and expand any history references in current input."
1432 (when (looking-back "&!" beg)
1433 (delete-region (match-beginning 0) (match-end 0))
1435 (insert "spawn "))))
1436 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1437 (eval-after-load "em-unix"
1439 (unintern 'eshell/su)
1440 (unintern 'eshell/sudo))))
1441 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1445 (defalias 'emacs 'find-file)
1446 (defalias 'ec 'find-file)
1447 (defalias 'e 'find-file)
1451 (use-package 'em-cmpl)
1452 (use-package 'em-prompt)
1453 (use-package 'em-term)
1455 (setq eshell-cmpl-cycle-completions nil
1456 eshell-save-history-on-exit t
1457 eshell-buffer-maximum-lines 20000
1458 eshell-history-size 350
1459 eshell-buffer-shorthand t
1460 eshell-highlight-prompt t
1461 eshell-plain-echo-behavior t
1462 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1464 (setenv "PAGER" "cat")
1465 (setq eshell-visual-commands
1466 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1467 (setq eshell-visual-subcommands
1468 '(("git" "log" "l" "diff" "show")))
1470 (add-to-list 'eshell-command-completions-alist
1471 '("gunzip" "gz\\'"))
1472 (add-to-list 'eshell-command-completions-alist
1473 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1475 (when (not (functionp 'eshell/rgrep))
1476 (defun eshell/rgrep (&rest args)
1477 "Use Emacs grep facility instead of calling external grep."
1478 (eshell-grep "rgrep" args t)))
1480 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1481 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1482 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1483 (add-hook 'eshell-preoutput-filter-functions
1484 'ansi-color-filter-apply)
1485 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1487 (defmacro with-face (str &rest properties)
1488 `(propertize ,str 'face (list ,@properties)))
1490 (defun eshell/abbr-pwd ()
1491 (let ((home (getenv "HOME"))
1492 (path (eshell/pwd)))
1494 ((string-equal home path) "~")
1495 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1498 (defun eshell/my-prompt ()
1499 (let ((header-bg "#161616"))
1501 (with-face user-login-name :foreground "cyan")
1502 (with-face (concat "@" hostname) :foreground "white")
1504 (with-face (eshell/abbr-pwd) :foreground "#009900")
1505 (if (= (user-uid) 0)
1506 (with-face "#" :foreground "red")
1507 (with-face "$" :foreground "#69b7f0"))
1510 (use-package eshell-prompt-extras
1514 (setq eshell-highlight-prompt nil
1515 ;; epe-git-dirty-char "Ϟ"
1516 epe-git-dirty-char "*"
1517 eshell-prompt-function 'epe-theme-dakrone)))
1519 (defun eshell/magit ()
1520 "Function to open magit-status for the current directory"
1522 (magit-status default-directory)
1525 (setq eshell-prompt-function 'eshell/my-prompt)
1526 (setq eshell-highlight-prompt nil)
1527 (setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1532 Incremental search is great, but annoyingly you need to type whatever
1533 you want. If you want to search for just the next (or previous)
1534 occurence of what is at your cursor position use the following.
1535 *C-x* will insert the current word while *M-up* and *M-down* will just
1536 jump to the next/previous occurence of it.
1537 #+BEGIN_SRC emacs-lisp
1538 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
1539 (bind-key* "<M-up>" 'sacha/search-word-backward)
1540 (bind-key* "<M-down>" 'sacha/search-word-forward)
1543 *** Frame configuration
1544 I want to see the buffername and its size, not the host I am on in my
1546 #+BEGIN_SRC emacs-lisp
1547 (setq frame-title-format "%b (%i)")
1550 *** Protect some buffers
1551 I don't want some buffers to be killed, **scratch** for example.
1552 In the past I had a long function that just recreated them, but the
1553 =keep-buffers= package is easier.
1554 #+BEGIN_SRC emacs-lisp
1555 (use-package keep-buffers
1558 (keep-buffers-mode 1)
1559 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1560 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1565 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
1567 #+BEGIN_SRC emacs-lisp
1568 (defalias 'yes-or-no-p 'y-or-n-p)
1571 *** Language/i18n stuff
1572 In this day and age, UTF-8 is the way to go.
1573 #+BEGIN_SRC emacs-lisp
1574 (set-language-environment 'utf-8)
1575 (set-default-coding-systems 'utf-8)
1576 (set-terminal-coding-system 'utf-8)
1577 (set-keyboard-coding-system 'utf-8)
1578 (set-clipboard-coding-system 'utf-8)
1579 (prefer-coding-system 'utf-8)
1580 (set-charset-priority 'unicode)
1581 (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
1582 (when (display-graphic-p)
1583 (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
1586 *** Hilight matching parentheses
1587 While I do have the nifty shortcut to jump to the other parentheses,
1588 hilighting them makes it obvious where they are.
1589 #+BEGIN_SRC emacs-lisp
1590 (use-package mic-paren
1594 *** Kill other buffers
1595 While many editors allow you to close "all the other files, not the one
1596 you are in", emacs doesn't have this... Except, now it will.
1597 (Update 30.05.2014: Not used ever, deactivated)
1598 #+BEGIN_SRC emacs-lisp :tangle no
1599 (bind-key "C-c k" 'prelude-kill-other-buffers)
1602 Default scrolling behaviour in emacs is a bit annoying, who wants to
1604 #+BEGIN_SRC emacs-lisp
1605 (setq scroll-margin 0)
1606 (setq scroll-conservatively 100000)
1607 (setq scroll-up-aggressively 0.0)
1608 (setq scroll-down-aggressively 0.0)
1609 (setq scroll-preserve-screen-position 'always)
1612 *** Copy/Paste with X
1613 [2013-04-09 Di 23:31]
1614 The default how emacs handles cutting/pasting with the primary selection
1615 changed in emacs24. I am used to the old way, so get it back.
1616 #+BEGIN_SRC emacs-lisp
1617 (setq select-enable-primary t)
1618 (setq select-enable-clipboard nil)
1619 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
1620 (setq mouse-drag-copy-region t)
1622 *** Global keyboard changes not directly related to a mode
1623 Disable /suspend_frame/ function, I dislike it.
1624 #+BEGIN_SRC emacs-lisp
1626 (unbind-key "C-x C-z")
1629 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
1630 #+BEGIN_SRC emacs-lisp
1631 (defmacro bol-with-prefix (function)
1632 "Define a new function which calls FUNCTION.
1633 Except it moves to beginning of line before calling FUNCTION when
1634 called with a prefix argument. The FUNCTION still receives the
1636 (let ((name (intern (format "endless/%s-BOL" function))))
1640 "Call `%s', but move to BOL when called with a prefix argument."
1645 (call-interactively ',function))
1648 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
1649 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
1650 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
1653 Default of *C-k* is to kill from the point to the end of line. If
1654 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
1655 set, including newline. But to kill the entire line, one still needs a
1656 *C-a* in front of it. So I change it, by defining a function to do just this for
1658 #+BEGIN_SRC emacs-lisp :tangle no
1659 (defun kill-entire-line ()
1660 "Kill this entire line (including newline), regardless of where point is within the line."
1664 (back-to-indentation))
1666 (bind-key* "C-k" 'kill-entire-line)
1667 (global-set-key [remap kill-whole-line] 'kill-entire-line)
1670 And the same is true when I'm in org-mode, which has an own kill function...
1671 (the keybinding happens later, after org-mode is loaded fully)
1672 #+BEGIN_SRC emacs-lisp :tangle no
1673 (defun jj-org-kill-line (&optional arg)
1674 "Kill the entire line, regardless of where point is within the line, org-mode-version"
1678 (back-to-indentation)
1682 I really hate tabs, so I don't want any indentation to try using them.
1683 And in case a project really needs them, I can change it just for that
1684 file/project, but luckily none of those I work in is as broken.
1685 #+BEGIN_SRC emacs-lisp
1686 (setq-default indent-tabs-mode nil)
1689 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
1690 #+BEGIN_SRC emacs-lisp
1691 (bind-key* "M-5" 'match-paren)
1694 Instead of the default "mark-defun" I want a more readline-like setting.
1695 #+BEGIN_SRC emacs-lisp
1696 (bind-key "C-M-h" 'backward-kill-word)
1699 Align whatever with a regexp.
1700 #+BEGIN_SRC emacs-lisp
1701 (bind-key "C-x \\" 'align-regexp)
1705 #+BEGIN_SRC emacs-lisp
1706 (bind-key "C-+" 'text-scale-increase)
1707 (bind-key "C--" 'text-scale-decrease)
1710 Regexes are too useful, so use the regex search by default.
1711 #+begin_src emacs-lisp
1712 (bind-key "C-s" 'isearch-forward-regexp)
1713 (bind-key "C-r" 'isearch-backward-regexp)
1714 (bind-key "C-M-s" 'isearch-forward)
1715 (bind-key "C-M-r" 'isearch-backward)
1718 Rgrep is infinitely useful in multi-file projects.
1719 #+begin_src emacs-lisp
1720 (bind-key "C-x C-g" 'rgrep)
1723 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
1724 AKA transpose lines.
1725 #+BEGIN_SRC emacs-lisp
1726 (bind-key "<M-S-up>" 'move-line-up)
1727 (bind-key "<M-S-down>" 'move-line-down)
1730 "Pull" lines up, join them
1731 #+BEGIN_SRC emacs-lisp
1732 (defun join-line-or-lines-in-region ()
1733 "Join this line or the lines in the selected region.
1734 Joins single lines in reverse order to the default, ie. pulls the next one up."
1736 (cond ((region-active-p)
1737 (let ((min (line-number-at-pos (region-beginning))))
1738 (goto-char (region-end))
1739 (while (> (line-number-at-pos) min)
1741 (t (let ((current-prefix-arg '(4)))
1742 (call-interactively 'join-line)))))
1743 (bind-key "M-j" 'join-line-or-lines-in-region)
1746 When I press Enter I almost always want to go to the right indentation on the next line.
1747 #+BEGIN_SRC emacs-lisp
1748 (bind-key "RET" 'newline-and-indent)
1751 Easier undo, and i don't need suspend-frame
1752 #+BEGIN_SRC emacs-lisp
1753 (bind-key "C-z" 'undo)
1756 Window switching, go backwards. (C-x o goes to the next window)
1757 #+BEGIN_SRC emacs-lisp
1758 (bind-key "C-x O" (lambda ()
1764 #+BEGIN_SRC emacs-lisp
1765 (bind-key "C-x C-r" 'prelude-sudo-edit)
1768 M-space is bound to just-one-space, which is great for programming. What
1769 it does is remove all spaces around the cursor, except for one. But to
1770 be really useful, it also should include newlines. It doesn’t do this by
1771 default. Rather, you have to call it with a negative argument. Sure
1773 #+BEGIN_SRC emacs-lisp
1774 (bind-key "M-SPC" 'just-one-space-with-newline)
1777 Count which commands I use how often.
1778 #+BEGIN_SRC emacs-lisp
1779 (use-package keyfreq
1783 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
1784 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
1786 (keyfreq-autosave-mode 1)))
1789 Duplicate current line
1790 #+BEGIN_SRC emacs-lisp
1791 (defun duplicate-line ()
1792 "Insert a copy of the current line after the current line."
1795 (let ((line-text (buffer-substring-no-properties
1796 (line-beginning-position)
1797 (line-end-position))))
1798 (move-end-of-line 1)
1800 (insert line-text))))
1802 (bind-key "C-c p" 'duplicate-line)
1805 Smarter move to the beginning of the line. That is, it first moves to
1806 the beginning of the line - and on second keypress it goes to the
1807 first character on line.
1808 #+BEGIN_SRC emacs-lisp
1809 (defun smarter-move-beginning-of-line (arg)
1810 "Move point back to indentation of beginning of line.
1812 Move point to the first non-whitespace character on this line.
1813 If point is already there, move to the beginning of the line.
1814 Effectively toggle between the first non-whitespace character and
1815 the beginning of the line.
1817 If ARG is not nil or 1, move forward ARG - 1 lines first. If
1818 point reaches the beginning or end of the buffer, stop there."
1820 (setq arg (or arg 1))
1824 (let ((line-move-visual nil))
1825 (forward-line (1- arg))))
1827 (let ((orig-point (point)))
1828 (back-to-indentation)
1829 (when (= orig-point (point))
1830 (move-beginning-of-line 1))))
1832 ;; remap C-a to `smarter-move-beginning-of-line'
1833 (global-set-key [remap move-beginning-of-line]
1834 'smarter-move-beginning-of-line)
1838 Easily copy characters from the previous nonblank line, starting just
1839 above point. With a prefix argument, only copy ARG characters (never
1840 past EOL), no argument copies rest of line.
1841 #+BEGIN_SRC emacs-lisp
1843 (bind-key "H-y" 'copy-from-above-command)
1846 Open a new X Terminal pointing to the directory of the current
1848 #+BEGIN_SRC emacs-lisp
1849 (bind-key "H-t" 'jj-open-shell)
1853 #+BEGIN_SRC emacs-lisp
1854 (bind-key "H-a" 'align-code)
1858 #+BEGIN_SRC emacs-lisp
1859 (bind-key "C-c d" 'insert-date)
1862 Another key for indenting
1863 #+BEGIN_SRC emacs-lisp
1864 (bind-key "H-i" 'indent-region)
1867 Clean all whitespace stuff
1868 #+BEGIN_SRC emacs-lisp
1869 (bind-key "H-w" 'whitespace-cleanup)
1873 #+BEGIN_SRC emacs-lisp
1874 (bind-key "H-c" 'comment-dwim)
1877 Show keystrokes in progress
1878 #+BEGIN_SRC emacs-lisp
1879 (setq echo-keystrokes 0.1)
1882 Usually you can press the *Ins*ert key, to get into overwrite mode. I
1883 don't like that, have broken much with it and so just forbid it by
1885 #+BEGIN_SRC emacs-lisp
1886 (unbind-key "<insert>")
1887 (unbind-key "<kp-insert>")
1890 *** Easily navigate sillyCased words
1891 #+BEGIN_SRC emacs-lisp
1892 (global-subword-mode 1)
1894 *** Delete file of current buffer, then kill buffer
1895 [2014-06-14 Sat 23:03]
1896 #+BEGIN_SRC emacs-lisp
1897 (defun delete-current-buffer-file ()
1898 "Removes file connected to current buffer and kills buffer."
1900 (let ((filename (buffer-file-name))
1901 (buffer (current-buffer))
1902 (name (buffer-name)))
1903 (if (not (and filename (file-exists-p filename)))
1905 (when (yes-or-no-p "Are you sure you want to remove this file? ")
1906 (delete-file filename)
1907 (kill-buffer buffer)
1908 (message "File '%s' successfully removed" filename)))))
1910 (global-set-key (kbd "C-x C-k") 'delete-current-buffer-file)
1912 *** Rename file of current buffer
1913 [2014-06-14 Sat 23:04]
1914 #+BEGIN_SRC emacs-lisp
1915 (defun rename-current-buffer-file ()
1916 "Renames current buffer and file it is visiting."
1918 (let ((name (buffer-name))
1919 (filename (buffer-file-name)))
1920 (if (not (and filename (file-exists-p filename)))
1921 (error "Buffer '%s' is not visiting a file!" name)
1922 (let ((new-name (read-file-name "New name: " filename)))
1923 (if (get-buffer new-name)
1924 (error "A buffer named '%s' already exists!" new-name)
1925 (rename-file filename new-name 1)
1926 (rename-buffer new-name)
1927 (set-visited-file-name new-name)
1928 (set-buffer-modified-p nil)
1929 (message "File '%s' successfully renamed to '%s'"
1930 name (file-name-nondirectory new-name)))))))
1932 (global-set-key (kbd "C-x C-S-r") 'rename-current-buffer-file)
1934 *** Quickly find emacs lisp sources
1935 [2014-06-22 Sun 23:05]
1936 #+BEGIN_SRC emacs-lisp
1937 (bind-key "C-l" 'find-library 'help-command)
1938 (bind-key "C-f" 'find-function 'help-command)
1939 (bind-key "C-k" 'find-function-on-key 'help-command)
1940 (bind-key "C-v" 'find-variable 'help-command)
1943 [2015-01-26 Mon 16:01]
1944 #+BEGIN_SRC emacs-lisp
1945 (bind-key "M-s o" 'occur-dwim)
1949 [2014-06-01 Sun 15:00]
1950 Proper whitespace handling
1951 #+BEGIN_SRC emacs-lisp :tangle no
1952 (use-package ethan-wspace
1953 :ensure ethan-wspace
1954 :diminish (ethan-wspace-mode . "ew")
1956 (global-ethan-wspace-mode 1))
1960 [2014-06-01 Sun 15:16]
1961 #+BEGIN_SRC emacs-lisp
1962 (use-package expand-region
1963 :ensure expand-region
1964 :bind ("C-M-+" . er/expand-region)
1965 :commands er/expand-region)
1968 [2013-05-02 Thu 00:04]
1969 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
1970 fill prefix, such as a comment sequence in program code, and handling
1971 bullet points like “1.” or “*”.
1972 #+BEGIN_SRC emacs-lisp
1973 (use-package filladapt
1974 :diminish filladapt-mode
1976 (setq-default filladapt-mode t))
1979 [2013-04-28 So 22:21]
1980 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
1981 As the one time I tried Flymake i wasn't happy, thats easy to
1983 #+BEGIN_SRC emacs-lisp
1984 (use-package flycheck
1986 :diminish flycheck-mode
1987 :bind (("M-n" . next-error)
1988 ("M-p" . previous-error))
1991 (add-hook 'find-file-hook
1993 (when (not (equal 'emacs-lisp-mode major-mode))
1997 (use-package flycheck-color-mode-line
1998 :ensure flycheck-color-mode-line)
1999 (setq flycheck-highlighting-mode 'nil)
2000 (setq flycheck-flake8-maximum-line-length '150)
2001 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
2005 Obviously emacs can do syntax hilighting. For more things than you ever
2007 And I want to have it everywhere.
2008 #+BEGIN_SRC emacs-lisp
2009 (use-package font-lock
2012 (global-font-lock-mode 1)
2013 (setq font-lock-maximum-decoration t)))
2016 [2015-08-31 Mon 11:27]
2017 Display nice lines instead of page breaks
2018 #+BEGIN_SRC emacs-lisp
2019 (use-package form-feed
2024 #+BEGIN_SRC emacs-lisp :tangle no
2025 (use-package git-commit
2026 :commands git-commit
2027 :mode ("COMMIT_EDITMSG" . git-commit-mode))
2031 #+BEGIN_SRC emacs-lisp :tangle no
2032 (use-package git-rebase
2033 :commands git-rebase
2034 :mode ("git-rebase-todo" . git-rebase-mode))
2037 [2014-05-21 Wed 22:56]
2038 #+BEGIN_SRC emacs-lisp
2039 (use-package git-gutter+
2041 :diminish git-gutter+-mode
2042 :bind (("C-x n" . git-gutter+-next-hunk)
2043 ("C-x p" . git-gutter+-previous-hunk)
2044 ("C-x v =" . git-gutter+-show-hunk)
2045 ("C-x r" . git-gutter+-revert-hunks)
2046 ("C-x s" . git-gutter+-stage-hunks)
2047 ("C-x c" . git-gutter+-commit)
2051 (setq git-gutter+-disabled-modes '(org-mode))
2052 (global-git-gutter+-mode 1))
2055 (use-package git-gutter-fringe+
2056 :ensure git-gutter-fringe+
2059 (setq git-gutter-fr+-side 'right-fringe)
2060 ;(git-gutter-fr+-minimal)
2065 [2015-02-22 Sun 14:00]
2066 Provides function that popup commit message at current line. This is
2067 useful when you want to know why this line was changed.
2068 #+BEGIN_SRC emacs-lisp
2069 (use-package git-messenger
2070 :ensure git-messenger
2071 :commands (git-messenger:popup-message)
2072 :bind (("C-x v p" . git-messenger:popup-message))
2075 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
2076 (add-hook 'git-messenger:popup-buffer-hook 'magit-commit-mode)
2077 (setq git-messenger:show-detail t)))
2080 [2014-07-23 Mi 12:57]
2081 Browse historic versions of a file with p (previous) and n (next).
2082 #+BEGIN_SRC emacs-lisp
2083 (use-package git-timemachine
2084 :ensure git-timemachine
2085 :commands git-timemachine)
2088 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
2089 what I want every emacs to know.
2090 #+BEGIN_SRC emacs-lisp
2091 (bind-key "C-c g" 'gnus) ; Start gnus with M-n
2097 [2015-02-20 Fri 16:27]
2098 When working with many windows at the same time, each window has a
2099 size that is not convenient for editing.
2101 golden-ratio helps on this issue by resizing automatically the windows
2102 you are working on to the size specified in the "Golden Ratio". The
2103 window that has the main focus will have the perfect size for editing,
2104 while the ones that are not being actively edited will be re-sized to
2105 a smaller size that doesn't get in the way, but at the same time will
2106 be readable enough to know it's content.
2107 #+BEGIN_SRC emacs-lisp
2108 (use-package golden-ratio
2109 :ensure golden-ratio
2110 :diminish golden-ratio-mode
2113 (golden-ratio-mode 1)
2114 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*"))
2115 (setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
2116 "gnus-article-mode" "calc-mode" "calc-trail-mode"
2121 [2015-02-22 Sun 13:28]
2122 Move point through buffer-undo-list positions.
2123 #+BEGIN_SRC emacs-lisp
2124 (use-package goto-last-change
2125 :commands (goto-last-change)
2126 :bind (("M-g l" . goto-last-change))
2130 [2014-06-11 Wed 22:27]
2131 guide-key.el displays the available key bindings automatically and
2134 For whatever reason I like this more than icicles <backtab> completion
2136 #+BEGIN_SRC emacs-lisp
2137 (use-package guide-key
2139 :diminish guide-key-mode
2142 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
2144 (setq guide-key/recursive-key-sequence-flag t)
2145 (setq guide-key/popup-window-position 'bottom)
2146 (setq guide-key/idle-delay 0.5)))
2151 [2014-05-21 Wed 23:51]
2152 #+BEGIN_SRC emacs-lisp
2153 (use-package hi-lock
2154 :bind (("M-o l" . highlight-lines-matching-regexp)
2155 ("M-o r" . highlight-regexp)
2156 ("M-o w" . highlight-phrase)))
2158 (use-package hilit-chg
2159 :bind ("M-o C" . highlight-changes-mode))
2163 Crazy way of completion. It looks at the word before point and then
2164 tries to expand it in various ways.
2165 #+BEGIN_SRC emacs-lisp
2166 (use-package hippie-exp
2167 :bind ("M-/" . hippie-expand)
2168 :commands hippie-expand
2171 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2172 try-expand-dabbrev-all-buffers
2173 try-expand-dabbrev-from-kill
2174 try-complete-file-name-partially
2175 try-complete-file-name
2176 try-expand-all-abbrevs try-expand-list
2178 try-complete-lisp-symbol-partially
2179 try-complete-lisp-symbol))))
2182 Replaced by web-mode [[*web-mode][web-mode]]
2183 #+BEGIN_SRC emacs-lisp :tangle no
2184 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
2185 (add-auto-mode 'html-helper-mode "\\.html$")
2186 (add-auto-mode 'html-helper-mode "\\.asp$")
2187 (add-auto-mode 'html-helper-mode "\\.phtml$")
2188 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
2189 (defalias 'html-mode 'html-helper-mode)
2192 [2015-01-26 Mon 15:50]
2193 This is a package for GNU Emacs that can be used to tie related
2194 commands into a family of short bindings with a common prefix - a
2197 Once you summon the Hydra through the prefixed binding (the body + any
2198 one head), all heads can be called in succession with only a short
2201 The Hydra is vanquished once Hercules, any binding that isn't the
2202 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2203 Hydra, will still serve his orignal purpose, calling his proper
2204 command. This makes the Hydra very seamless, it's like a minor mode
2205 that disables itself auto-magically.
2206 #+BEGIN_SRC emacs-lisp
2211 (setq hydra-is-helpful t)
2214 (defhydra hydra-zoom (:color red)
2216 ("g" text-scale-increase "in")
2217 ("l" text-scale-decrease "out")
2219 (bind-key "<F2>" 'hydra-zoom/toggle)
2221 (defhydra hydra-error (:color red)
2223 ("h" first-error "first")
2224 ("j" next-error "next")
2225 ("k" previous-error "prev")
2226 ("v" recenter-top-bottom "recenter")
2228 (bind-key "M-g e" 'hydra-error/body)
2230 (defhydra hydra-gnus (:color red)
2232 ("m" gnus-uu-mark-thread "mark thread")
2233 ("d" gnus-summary-delete-article "delete article(s)")
2234 ("r" gnus-summary-mark-as-read-forward "mark read")
2235 ("n" gnus-summary-next-thread "next thread")
2236 ("p" gnus-summary-prev-thread "previous thread")
2237 ("g" gnus-summary-next-group "next group")
2238 ("l" gnus-recenter "recenter")
2239 ("x" gnus-summary-limit-to-unread "unread")
2241 (bind-key "C-c h" 'hydra-gnus/body)
2243 (defhydra hydra-launcher (:color blue)
2246 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2247 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
2250 (bind-key "C-c r" 'hydra-launcher/body)
2252 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
2253 (defvar whitespace-mode nil)
2254 (defhydra hydra-toggle (:color pink)
2256 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
2257 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
2258 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
2259 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
2260 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
2263 ("a" abbrev-mode nil)
2264 ("c" auto-complete-mode nil)
2265 ("i" aggressive-indent-mode nil)
2266 ("d" toggle-debug-on-error nil)
2267 ("f" auto-fill-mode nil)
2268 ("g" golden-ratio-mode nil)
2269 ("t" toggle-truncate-lines nil)
2270 ("w" whitespace-mode nil)
2271 ("r" auto-revert-mode nil)
2272 ("l" linum-mode nil)
2273 ("k" linum-relative-toggle nil)
2275 (bind-key "C-c C-v" 'hydra-toggle/body)
2281 [2014-05-21 Wed 23:54]
2282 #+BEGIN_SRC emacs-lisp
2283 (use-package ibuffer
2285 :bind (("C-h h" . ibuffer)
2286 ("C-x C-b" . ibuffer)
2287 ("<XF86WebCam>" . ibuffer)
2290 :defines (ibuffer-filtering-alist
2291 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
2292 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
2295 (defvar my-ibufffer-separator " • ")
2296 (setq ibuffer-filter-group-name-face 'variable-pitch
2297 ibuffer-use-header-line t
2298 ibuffer-old-time 12)
2299 (unbind-key "M-o" ibuffer-mode-map)
2300 (bind-key "s" 'isearch-forward-regexp ibuffer-mode-map)
2301 (bind-key "." 'ibuffer-invert-sorting ibuffer-mode-map)
2306 (use-package ibuffer-vc
2309 (ibuffer-vc-set-filter-groups-by-vc-root
2310 ibuffer-vc-generate-filter-groups-by-vc-root))
2312 (use-package ibuffer-tramp
2314 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
2315 ibuffer-tramp-set-filter-groups-by-tramp-connection))
2316 ;; Switching to ibuffer puts the cursor on the most recent buffer
2317 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
2318 "Open ibuffer with cursor pointed to most recent buffer name"
2319 (let ((recent-buffer-name (buffer-name)))
2321 (ibuffer-update nil t)
2322 (unless (string= recent-buffer-name "*Ibuffer*")
2323 (ibuffer-jump-to-buffer recent-buffer-name))))
2325 (defun ibuffer-magit-status ()
2327 (--when-let (get-buffer "*Ibuffer*")
2328 (with-current-buffer it
2329 (let* ((selected-buffer (ibuffer-current-buffer))
2330 (buffer-path (with-current-buffer
2332 (or (buffer-file-name)
2333 list-buffers-directory
2334 default-directory)))
2336 (if (file-regular-p buffer-path)
2337 (file-name-directory buffer-path)
2339 (magit-status default-directory)))))
2340 (bind-key "i" 'ibuffer-magit-status ibuffer-mode-map)
2341 (bind-key "G" 'ibuffer-magit-status ibuffer-mode-map)
2343 (setq ibuffer-directory-abbrev-alist
2348 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
2349 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
2351 ("dak" . "/develop/dak/")
2353 ("config" . "~/.emacs.d/config/")
2355 ("systmp" . "/tmp/")
2356 ("puppet" . "~/git/puppet")
2360 (use-package ibuffer-git
2362 (use-package ibuffer-vc
2365 (define-ibuffer-column size-h
2366 (:name "Size" :inline t)
2368 ((> (buffer-size) 1000)
2369 (format "%7.1fk" (/ (buffer-size) 1000.0)))
2370 ((> (buffer-size) 1000000)
2371 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
2373 (format "%8d" (buffer-size)))))
2375 (use-package ibuf-ext)
2376 (define-ibuffer-filter filename2
2377 "Toggle current view to buffers with filename matching QUALIFIER."
2378 (:description "filename2"
2379 :reader (read-from-minibuffer "Filter by filename (regexp): "))
2380 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
2381 (ibuffer-awhen (with-current-buffer buf
2382 (or buffer-file-name
2384 (string-match qualifier it)))
2386 (defvar ibuffer-magit-filter-groups nil)
2387 (defun ibuffer-magit-define-filter-groups ()
2388 (when (and (not ibuffer-magit-filter-groups)
2389 (boundp 'magit-repo-dirs))
2390 (setq ibuffer-magit-filter-groups
2393 (file-name-nondirectory (directory-file-name it)))
2395 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
2397 (defun ibuffer-set-filter-groups-by-root ()
2399 ;; (ibuffer-projectile-define-filter-groups)
2400 ;; (ibuffer-magit-define-filter-groups)
2401 (setq ibuffer-filter-groups
2403 ;; ibuffer-projectile-filter-groups
2404 ibuffer-magit-filter-groups
2407 (or (mode . magit-log-edit-mode)
2408 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2409 (name . "^\\*Pymacs\\*$")
2410 (name . "^\\*helm.*\\*")
2411 (name . "^\\*Compile-log\\*$")
2412 (name . "^\\*Ido Completions\\*$")
2413 (name . "^\\*magit-\\(process\\)\\*$")
2417 (name . "^\\*scratch")
2418 (name . "^\\*Messages")
2421 (ibuffer-vc-generate-filter-groups-by-vc-root)
2422 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
2424 (defun toggle-ibuffer-filter-groups ()
2427 (let ((ibuf (get-buffer "*Ibuffer*")))
2429 (with-current-buffer ibuf
2430 (let ((selected-buffer (ibuffer-current-buffer)))
2431 (if (not ibuffer-filter-groups)
2432 (ibuffer-set-filter-groups-by-root)
2433 (setq ibuffer-filter-groups nil))
2434 (pop-to-buffer ibuf)
2435 (ibuffer-update nil t)
2436 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
2438 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
2440 (defun ibuffer-back-to-top ()
2442 (beginning-of-buffer)
2445 (defun ibuffer-jump-to-bottom ()
2451 (define-key ibuffer-mode-map
2452 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
2453 (define-key ibuffer-mode-map
2454 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
2456 (setq ibuffer-default-sorting-mode 'recency
2457 ibuffer-eliding-string "…"
2458 ibuffer-compile-formats t
2459 ibuffer-git-column-length 6
2460 ibuffer-show-empty-filter-groups nil
2461 ibuffer-default-directory "~/"
2464 (setq ibuffer-formats '((mark vc-status-mini
2466 (git-status 8 8 :left)
2470 (name 18 18 :left :elide)
2472 (size-h 9 -1 :right)
2474 (mode 16 16 :left :elide)
2475 " " filename-and-process)
2477 (git-status 8 8 :left)
2483 (setq ibuffer-saved-filter-groups
2486 ("dired" (mode . dired-mode))
2487 ("perl" (mode . cperl-mode))
2489 (mode . puppet-mode)
2490 (mode . yaml-mode)))
2491 ("ruby" (mode . ruby-mode))
2493 (name . "^\\*scratch\\*$")
2494 (name . "^\\*Compile-log\\*$")
2495 (name . "^\\*Completions\\*$")
2496 (name . "^\\*Messages\\*$")
2497 (name . "^\\*Backtrace\\*$")
2498 (name . "^\\*Packages*\\*$")
2499 (name . "^\\*Help*\\*$")
2502 (mode . message-mode)
2505 (mode . gnus-group-mode)
2506 (mode . gnus-summary-mode)
2507 (mode . gnus-article-mode)
2508 (name . "^\\.bbdb$")
2509 (name . "^\\.newsrc-dribble")))
2511 (filename . ".*/org/.*")
2512 (mode . org-agenda-mode)
2513 (name . "^diary$")))
2515 (mode . magit-log-edit-mode)
2516 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
2518 ;; -------------------------------------------------
2519 ;; programming languages #1
2521 (mode . emacs-lisp-mode)
2522 (mode . python-mode)
2524 (mode . coffee-mode)
2527 (mode . actionscript-mode)
2530 (mode . haskell-mode)
2536 ;; -------------------------------------------------
2537 ;; configuration/data files
2541 (mode . conf-mode)))
2542 ;; -------------------------------------------------
2543 ;; text/notetaking/org
2544 ("org agenda" (mode . org-agenda-mode))
2547 (name . "^\\*Calendar\\*$")
2548 (name . "^diary$")))
2552 (mode . markdown-mode)))
2553 ;; -------------------------------------------------
2556 (mode . image-mode)))
2557 ;; -------------------------------------------------
2559 ("w3m" (mode . w3m-mode))
2561 (mode . magit-status-mode)
2562 (mode . magit-log-mode)
2563 (mode . vc-annotate-mode)))
2564 ("dired" (mode . dired-mode))
2569 (name . "^\\*Personal Keybindings\\*$")))
2570 ;; -------------------------------------------------
2572 ("MORE" (or (mode . magit-log-edit-mode)
2573 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2574 (name . "^\\*Pymacs\\*$")
2575 (name . "^\\*Compile-log\\*$")
2576 (name . "^\\*Completions\\*$")
2577 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
2579 ("*buffer*" (name . "\\*.*\\*"))))))
2581 (add-hook 'ibuffer-mode-hook
2583 (ibuffer-auto-mode 1)
2584 (ibuffer-switch-to-saved-filter-groups "default")))
2586 ;; Unless you turn this variable on you will be prompted every time
2587 ;; you want to delete a buffer, even unmodified ones, which is way
2588 ;; too cautious for most people. You’ll still be prompted for
2589 ;; confirmation when deleting modified buffers after the option has
2591 (setq ibuffer-expert t)
2596 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
2597 ‘TAB’ completion is to typing things manually every time.”]]
2598 #+BEGIN_SRC emacs-lisp
2599 (use-package icicles
2600 :load-path "elisp/icicle/"
2605 Incremental mini-buffer completion preview: Type in the minibuffer,
2606 list of matching commands is echoed
2607 #+BEGIN_SRC emacs-lisp
2611 [2014-05-26 Mon 22:49]
2612 #+BEGIN_SRC emacs-lisp
2615 :commands (iedit-mode)
2617 :bind (("C-;" . iedit-mode)
2618 ("C-," . iedit-mode-toggle-on-function))
2623 [2014-05-20 Tue 23:35]
2624 #+BEGIN_SRC emacs-lisp
2626 :bind ("C-h C-i" . info-lookup-symbol)
2627 :commands info-lookup-symbol
2630 ;; (defadvice info-setup (after load-info+ activate)
2631 ;; (use-package info+))
2633 (defadvice Info-exit (after remove-info-window activate)
2634 "When info mode is quit, remove the window."
2635 (if (> (length (window-list)) 1)
2638 (use-package info-look
2639 :commands info-lookup-add-help)
2641 ** linum (line number)
2642 Various modes should have line numbers in front of each line.
2644 But then there are some where it would just be deadly - like org-mode,
2645 gnus, so we have a list of modes where we don't want to see it.
2646 #+BEGIN_SRC emacs-lisp
2648 :diminish linum-mode
2651 (setq linum-format "%3d ")
2652 (setq linum-mode-inhibit-modes-list '(org-mode
2659 (defadvice linum-on (around linum-on-inhibit-for-modes)
2660 "Stop the load of linum-mode for some major modes."
2661 (unless (member major-mode linum-mode-inhibit-modes-list)
2664 (ad-activate 'linum-on)
2666 (use-package linum-relative
2667 :ensure linum-relative
2670 (setq linum-format 'dynamic)
2673 (global-linum-mode 1))
2676 ** lisp editing stuff
2678 [2013-04-21 So 21:00]
2679 I'm not doing much of it, except for my emacs and gnus configs, but
2680 then I like it nice too...
2681 #+BEGIN_SRC emacs-lisp
2682 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
2684 (defun remove-elc-on-save ()
2685 "If you're saving an elisp file, likely the .elc is no longer valid."
2686 (make-local-variable 'after-save-hook)
2687 (add-hook 'after-save-hook
2689 (if (file-exists-p (concat buffer-file-name "c"))
2690 (delete-file (concat buffer-file-name "c"))))))
2692 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2693 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2695 (use-package paredit
2697 :diminish paredit-mode " π")
2699 (setq lisp-coding-hook 'lisp-coding-defaults)
2700 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
2702 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
2703 (add-hook 'emacs-lisp-mode-hook (lambda ()
2704 (run-hooks 'prelude-emacs-lisp-mode-hook)))
2706 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
2708 (after "elisp-slime-nav"
2709 '(diminish 'elisp-slime-nav-mode))
2710 (after "rainbow-mode"
2711 '(diminish 'rainbow-mode))
2713 '(diminish 'eldoc-mode))
2716 [2013-04-21 So 20:48]
2717 magit is a mode for interacting with git.
2718 #+BEGIN_SRC emacs-lisp
2721 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
2722 magit-git-repo-p magit-list-repos)
2724 :bind (("C-x g" . magit-status)
2725 ("C-x G" . magit-status-with-prefix))
2728 (setq magit-commit-signoff t
2729 magit-repo-dirs '("~/git"
2733 magit-repo-dirs-depth 4
2734 magit-log-auto-more t)
2736 (use-package magit-blame
2737 :commands magit-blame-mode
2740 ; (use-package magit-svn
2742 ; :commands (magit-svn-mode
2743 ; turn-on-magit-svn)
2746 (add-hook 'magit-mode-hook 'hl-line-mode)
2747 (defun magit-status-with-prefix ()
2749 (let ((current-prefix-arg '(4)))
2750 (call-interactively 'magit-status)))
2754 (setenv "GIT_PAGER" "")
2756 (unbind-key "M-h" magit-mode-map)
2757 (unbind-key "M-s" magit-mode-map)
2758 (add-to-list 'magit-no-confirm 'stage-all-changes)
2759 (setq magit-push-always-verify nil)
2760 (setq magit-last-seen-setup-instructions "2.1.0")
2761 ; (use-package magit-find-file
2762 ; :ensure magit-find-file
2763 ; :commands (magit-find-file-completing-read)
2767 ; (bind-key "C-x C-f" 'magit-find-file-completing-read magit-mode-map)))
2769 (add-hook 'magit-log-edit-mode-hook
2771 (set-fill-column 72)
2774 (add-hook 'git-rebase-mode-hook
2778 (defadvice magit-status (around magit-fullscreen activate)
2779 (window-configuration-to-register :magit-fullscreen)
2781 (delete-other-windows))
2783 (defun magit-quit-session ()
2784 "Restores the previous window configuration and kills the magit buffer"
2787 (jump-to-register :magit-fullscreen))
2789 (bind-key "q" 'magit-quit-session magit-status-mode-map)
2791 (defun magit-rebase-unpushed (commit &optional args)
2792 "Start an interactive rebase sequence over all unpushed commits."
2793 (interactive (list (magit-get-tracked-branch)
2794 (magit-rebase-arguments)))
2795 (if (setq commit (magit-rebase-interactive-assert commit))
2796 (magit-run-git-sequencer "rebase" "-i" commit args)
2799 (magit-rebase-interactive (concat commit "^") (list ,@args))))))
2801 (magit-define-popup-action 'magit-rebase-popup ?l "Rebase unpushed" 'magit-rebase-unpushed)
2805 [2014-05-20 Tue 23:04]
2806 #+BEGIN_SRC emacs-lisp
2807 (use-package markdown-mode
2808 :mode (("\\.md\\'" . markdown-mode)
2809 ("\\.mdwn\\'" . markdown-mode))
2813 #+BEGIN_SRC emacs-lisp
2814 (use-package message
2817 (setq message-kill-buffer-on-exit t)))
2820 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
2822 I want to access it from anywhere using =F6=.
2823 #+BEGIN_SRC emacs-lisp
2824 (use-package mingus-stays-home
2825 :bind ( "<f6>" . mingus)
2829 (setq mingus-dired-add-keys t)
2830 (setq mingus-mode-always-modeline nil)
2831 (setq mingus-mode-line-show-elapsed-percentage nil)
2832 (setq mingus-mode-line-show-volume nil)
2833 (setq mingus-mpd-config-file "/etc/mpd.conf")
2834 (setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
2835 (setq mingus-mpd-root "/share/music/")))
2839 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
2840 #+BEGIN_SRC emacs-lisp
2841 (use-package miniedit
2846 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
2847 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
2848 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
2849 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
2854 [2013-05-21 Tue 23:39]
2855 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
2856 coexist in one buffer.
2857 #+BEGIN_SRC emacs-lisp :tangle no
2858 (use-package mmm-auto
2862 (setq mmm-global-mode 'buffers-with-submode-classes)
2863 (setq mmm-submode-decoration-level 2)
2864 (eval-after-load 'mmm-vars
2870 :face mmm-code-submode-face
2871 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
2872 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
2873 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2874 @ "\n" _ "\n" @ "</script>" @)))
2877 :face mmm-code-submode-face
2878 :front "<style[^>]*>[ \t]*\n?"
2879 :back "[ \t]*</style>"
2880 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2881 @ "\n" _ "\n" @ "</style>" @)))
2884 :face mmm-code-submode-face
2887 (dolist (mode (list 'html-mode 'nxml-mode))
2888 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
2889 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
2894 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
2896 #+BEGIN_SRC emacs-lisp
2897 (use-package mo-git-blame
2898 :ensure mo-git-blame
2899 :commands (mo-git-blame-current
2903 (setq mo-git-blame-blame-window-width 25)))
2907 [2013-04-08 Mon 23:57]
2908 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
2909 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
2910 #+BEGIN_SRC emacs-lisp
2911 (use-package multiple-cursors
2912 :ensure multiple-cursors
2914 :commands (mc/remove-fake-cursors
2915 mc/create-fake-cursor-at-point
2916 mc/pop-state-from-overlay
2917 mc/maybe-multiple-cursors-mode)
2918 :defines (multiple-cursors-mode
2920 mc--read-quoted-char
2921 rectangular-region-mode)
2922 :bind (("C-S-c C-S-c" . mc/edit-lines)
2923 ("C->" . mc/mark-next-like-this)
2924 ("C-<" . mc/mark-previous-like-this)
2925 ("C-c C-<" . mc/mark-all-like-this)
2926 ("C-c i" . mc/insert-numbers))
2929 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
2930 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
2931 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
2932 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
2933 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
2934 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
2937 [2014-08-27 Wed 17:15]
2939 #+BEGIN_SRC emacs-lisp
2940 (use-package neotree
2943 :bind (("<f8>" . neotree-toggle))
2944 :commands (neotree-find
2949 (setq neo-smart-open t))
2952 (bind-key "^" 'neotree-select-up-node neotree-mode-map)))
2955 [2013-05-22 Wed 22:02]
2956 nxml-mode is a major mode for editing XML.
2957 #+BEGIN_SRC emacs-lisp
2962 '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
2965 (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
2966 (fset 'xml-mode 'nxml-mode)
2967 (setq nxml-slash-auto-complete-flag t)
2969 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
2970 (defun pp-xml-region (begin end)
2971 "Pretty format XML markup in region. The function inserts
2972 linebreaks to separate tags that have nothing but whitespace
2973 between them. It then indents the markup by using nxml's
2979 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
2980 (backward-char) (insert "\n"))
2981 (indent-region begin end)))
2983 ;;----------------------------------------------------------------------------
2984 ;; Integration with tidy for html + xml
2985 ;;----------------------------------------------------------------------------
2986 ;; tidy is autoloaded
2987 (eval-after-load 'tidy
2989 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
2990 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
2995 *** General settings
2996 [2013-04-28 So 17:06]
2998 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
2999 it is quite extensive. Nevertheless, it starts out small, loading it.
3000 #+BEGIN_SRC emacs-lisp
3004 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
3005 that we need org-protocol.
3006 #+BEGIN_SRC emacs-lisp
3007 (require 'org-protocol)
3012 My current =org-agenda-files= variable only includes a set of
3014 #+BEGIN_SRC emacs-lisp
3015 (setq org-agenda-files (quote ("~/org/"
3021 (setq org-default-notes-file "~/org/notes.org")
3023 =org-mode= manages the =org-agenda-files= variable automatically using
3024 =C-c [= and =C-c ]= to add and remove files respectively. However,
3025 this replaces my directory list with a list of explicit filenames
3026 instead and is not what I want. If this occurs then adding a new org
3027 file to any of the above directories will not contribute to my agenda
3028 and I will probably miss something important.
3030 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
3031 prevent messing up my list of directories in the =org-agenda-files=
3032 variable. I just add and remove directories manually here. Changing
3033 the list of directories in =org-agenda-files= happens very rarely
3034 since new files in existing directories are automatically picked up.
3036 #+BEGIN_SRC emacs-lisp
3037 ;; Keep tasks with dates on the global todo lists
3038 (setq org-agenda-todo-ignore-with-date nil)
3040 ;; Keep tasks with deadlines on the global todo lists
3041 (setq org-agenda-todo-ignore-deadlines nil)
3043 ;; Keep tasks with scheduled dates on the global todo lists
3044 (setq org-agenda-todo-ignore-scheduled nil)
3046 ;; Keep tasks with timestamps on the global todo lists
3047 (setq org-agenda-todo-ignore-timestamp nil)
3049 ;; Remove completed deadline tasks from the agenda view
3050 (setq org-agenda-skip-deadline-if-done t)
3052 ;; Remove completed scheduled tasks from the agenda view
3053 (setq org-agenda-skip-scheduled-if-done t)
3055 ;; Remove completed items from search results
3056 (setq org-agenda-skip-timestamp-if-done t)
3058 ;; Include agenda archive files when searching for things
3059 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
3061 ;; Show all future entries for repeating tasks
3062 (setq org-agenda-repeating-timestamp-show-all t)
3064 ;; Show all agenda dates - even if they are empty
3065 (setq org-agenda-show-all-dates t)
3067 ;; Sorting order for tasks on the agenda
3068 (setq org-agenda-sorting-strategy
3069 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
3070 (todo category-up priority-down effort-up)
3071 (tags category-up priority-down effort-up)
3072 (search category-up))))
3074 ;; Start the weekly agenda on Monday
3075 (setq org-agenda-start-on-weekday 1)
3077 ;; Enable display of the time grid so we can see the marker for the current time
3078 (setq org-agenda-time-grid (quote ((daily today remove-match)
3079 #("----------------" 0 16 (org-heading t))
3080 (0800 1000 1200 1400 1500 1700 1900 2100))))
3082 ;; Display tags farther right
3083 (setq org-agenda-tags-column -102)
3085 ; position the habit graph on the agenda to the right of the default
3086 (setq org-habit-graph-column 50)
3088 ; turn habits back on
3089 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
3092 ;; Agenda sorting functions
3094 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
3097 (setq org-deadline-warning-days 30)
3099 ;; Always hilight the current agenda line
3100 (add-hook 'org-agenda-mode-hook
3101 '(lambda () (hl-line-mode 1))
3105 #+BEGIN_SRC emacs-lisp
3106 (setq org-agenda-persistent-filter t)
3107 (add-hook 'org-agenda-mode-hook
3108 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
3111 (add-hook 'org-agenda-mode-hook
3112 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
3115 (add-hook 'org-agenda-mode-hook
3116 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
3119 (add-hook 'org-agenda-mode-hook
3120 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
3123 (add-hook 'org-agenda-mode-hook
3124 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
3127 ; Rebuild the reminders everytime the agenda is displayed
3128 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
3130 ;(if (file-exists-p "~/org/refile.org")
3131 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
3133 ; Activate appointments so we get notifications
3136 (setq org-agenda-log-mode-items (quote (closed clock state)))
3137 (if (> emacs-major-version 23)
3138 (setq org-agenda-span 3)
3139 (setq org-agenda-ndays 3))
3141 (setq org-agenda-show-all-dates t)
3142 (setq org-agenda-start-on-weekday nil)
3143 (setq org-deadline-warning-days 14)
3146 *** Global keybindings.
3147 Start off by defining a series of keybindings.
3149 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
3150 setup manually, not by org-mode. Also turn off =C-c ;=, which
3151 comments headlines - a function never used.
3152 #+BEGIN_SRC emacs-lisp
3153 (add-hook 'org-mode-hook
3155 (org-defkey org-mode-map "\C-c[" 'undefined)
3156 (org-defkey org-mode-map "\C-c]" 'undefined)
3157 (org-defkey org-mode-map "\C-c;" 'undefined))
3161 And now a largish set of keybindings...
3162 #+BEGIN_SRC emacs-lisp
3163 (bind-key "C-c l" 'org-store-link)
3164 (bind-key "C-c a" 'org-agenda)
3165 ;(bind-key "C-c b" 'org-iswitchb)
3166 (define-key mode-specific-map [?a] 'org-agenda)
3168 (bind-key "<f12>" 'org-agenda)
3169 (bind-key "<f5>" 'bh/org-todo)
3170 (bind-key "<S-f5>" 'bh/widen)
3171 (bind-key "<f7>" 'bh/set-truncate-lines)
3172 ;(bind-key "<f8>" 'org-cycle-agenda-files)
3174 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
3175 (bind-key "<f9> b" 'bbdb)
3176 (bind-key "<f9> c" 'calendar)
3177 (bind-key "<f9> f" 'boxquote-insert-file)
3178 (bind-key "<f9> h" 'bh/hide-other)
3179 (bind-key "<f9> n" 'org-narrow-to-subtree)
3180 (bind-key "<f9> w" 'widen)
3181 (bind-key "<f9> u" 'bh/narrow-up-one-level)
3182 (bind-key "<f9> I" 'bh/punch-in)
3183 (bind-key "<f9> O" 'bh/punch-out)
3184 (bind-key "<f9> H" 'jj/punch-in-hw)
3185 (bind-key "<f9> W" 'jj/punch-out-hw)
3186 (bind-key "<f9> o" 'bh/make-org-scratch)
3187 (bind-key "<f9> p" 'bh/phone-call)
3188 (bind-key "<f9> r" 'boxquote-region)
3189 (bind-key "<f9> s" 'bh/switch-to-scratch)
3190 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
3191 (bind-key "<f9> T" 'tabify)
3192 (bind-key "<f9> U" 'untabify)
3193 (bind-key "<f9> v" 'visible-mode)
3194 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
3195 (bind-key "C-<f9>" 'previous-buffer)
3196 (bind-key "C-<f10>" 'next-buffer)
3197 (bind-key "M-<f9>" 'org-toggle-inline-images)
3198 ;(bind-key "C-x n r" 'narrow-to-region)
3199 (bind-key "<f11>" 'org-clock-goto)
3200 (bind-key "C-<f11>" 'org-clock-in)
3201 (bind-key "C-M-r" 'org-capture)
3202 (bind-key "C-c r" 'org-capture)
3203 (bind-key "C-S-<f12>" 'bh/save-then-publish)
3204 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
3208 *** Tasks, States, Todo fun
3210 First we define the global todo keywords.
3211 #+BEGIN_SRC emacs-lisp
3212 (setq org-todo-keywords
3213 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
3214 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
3216 (setq org-todo-keyword-faces
3217 (quote (("TODO" :foreground "red" :weight bold)
3218 ("NEXT" :foreground "light blue" :weight bold)
3219 ("DONE" :foreground "forest green" :weight bold)
3220 ("WAITING" :foreground "orange" :weight bold)
3221 ("HOLD" :foreground "orange" :weight bold)
3222 ("DELEGATED" :foreground "yellow" :weight bold)
3223 ("CANCELLED" :foreground "dark green" :weight bold)
3224 ("PHONE" :foreground "dark green" :weight bold))))
3227 **** Fast Todo Selection
3228 Fast todo selection allows changing from any task todo state to any
3229 other state directly by selecting the appropriate key from the fast
3230 todo selection key menu.
3231 #+BEGIN_SRC emacs-lisp
3232 (setq org-use-fast-todo-selection t)
3234 Changing a task state is done with =C-c C-t KEY=
3236 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
3239 #+BEGIN_SRC emacs-lisp
3240 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
3242 allows changing todo states with S-left and S-right skipping all of
3243 the normal processing when entering or leaving a todo state. This
3244 cycles through the todo states but skips setting timestamps and
3245 entering notes which is very convenient when all you want to do is fix
3246 up the status of an entry.
3248 **** Todo State Triggers
3249 I have a few triggers that automatically assign tags to tasks based on
3250 state changes. If a task moves to =CANCELLED= state then it gets a
3251 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
3252 =CANCELLED= tag. These are used for filtering tasks in agenda views
3253 which I'll talk about later.
3255 The triggers break down to the following rules:
3257 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
3258 - Moving a task to =WAITING= adds a =WAITING= tag
3259 - Moving a task to =HOLD= adds a =WAITING= tag
3260 - Moving a task to a done state removes a =WAITING= tag
3261 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
3262 - Moving a task to =NEXT= removes a =WAITING= tag
3263 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
3265 The tags are used to filter tasks in the agenda views conveniently.
3266 #+BEGIN_SRC emacs-lisp
3267 (setq org-todo-state-tags-triggers
3268 (quote (("CANCELLED" ("CANCELLED" . t))
3269 ("WAITING" ("WAITING" . t))
3270 ("HOLD" ("WAITING" . t) ("HOLD" . t))
3271 (done ("WAITING") ("HOLD"))
3272 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
3273 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
3274 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
3277 *** Capturing new tasks
3278 Org capture replaces the old remember mode.
3279 #+BEGIN_SRC emacs-lisp
3280 (setq org-directory "~/org")
3281 (setq org-default-notes-file "~/org/refile.org")
3283 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
3284 ;; see http://orgmode.org/manual/Template-elements.html
3285 (setq org-capture-templates
3286 (quote (("t" "todo" entry (file "~/org/refile.org")
3287 "* TODO %?\nAdded: %U\n"
3288 :clock-in t :clock-resume t)
3289 ("l" "linktodo" entry (file "~/org/refile.org")
3290 "* TODO %?\nAdded: %U\n%a\n"
3291 :clock-in t :clock-resume t)
3292 ("r" "respond" entry (file "~/org/refile.org")
3293 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
3294 :clock-in t :clock-resume t :immediate-finish t)
3295 ("n" "note" entry (file "~/org/refile.org")
3296 "* %? :NOTE:\nAdded: %U\n%a\n"
3297 :clock-in t :clock-resume t)
3298 ("d" "Delegated" entry (file "~/org/refile.org")
3299 "* DELEGATED %?\nAdded: %U\n%a\n"
3300 :clock-in t :clock-resume t)
3301 ("j" "Journal" entry (file+datetree "~/org/diary.org")
3303 :clock-in t :clock-resume t)
3304 ("w" "org-protocol" entry (file "~/org/refile.org")
3305 "* TODO Review %c\nAdded: %U\n"
3306 :immediate-finish t)
3307 ("p" "Phone call" entry (file "~/org/refile.org")
3308 "* PHONE %? :PHONE:\nAdded: %U"
3309 :clock-in t :clock-resume t)
3310 ("x" "Bookmark link" entry (file "~/org/refile.org")
3311 "* Bookmark: %c\n%i\nAdded: %U\n"
3312 :immediate-finish t)
3313 ("h" "Habit" entry (file "~/org/refile.org")
3314 "* 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")
3318 Capture mode now handles automatically clocking in and out of a
3319 capture task. This all works out of the box now without special hooks.
3320 When I start a capture mode task the task is clocked in as specified
3321 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
3322 resumes on the original clocking task.
3324 The quick clocking in and out of capture mode tasks (often it takes
3325 less than a minute to capture some new task details) can leave
3326 empty clock drawers in my tasks which aren't really useful.
3327 The following prevents this.
3328 #+BEGIN_SRC emacs-lisp
3329 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
3333 All my newly captured entries end up in =refile.org= and want to be
3334 moved over to the right place. The following is the setup for it.
3335 #+BEGIN_SRC emacs-lisp
3336 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
3337 (setq org-refile-targets (quote ((nil :maxlevel . 9)
3338 (org-agenda-files :maxlevel . 9))))
3340 ; Use full outline paths for refile targets - we file directly with IDO
3341 (setq org-refile-use-outline-path t)
3343 ; Targets complete directly with IDO
3344 (setq org-outline-path-complete-in-steps nil)
3346 ; Allow refile to create parent tasks with confirmation
3347 (setq org-refile-allow-creating-parent-nodes (quote confirm))
3349 ; Use IDO for both buffer and file completion and ido-everywhere to t
3350 (setq org-completion-use-ido t)
3351 (setq org-completion-use-iswitchb nil)
3352 :; Use IDO for both buffer and file completion and ido-everywhere to t
3353 ;(setq ido-everywhere t)
3354 ;(setq ido-max-directory-size 100000)
3355 ;(ido-mode (quote both))
3356 ; Use the current window when visiting files and buffers with ido
3357 (setq ido-default-file-method 'selected-window)
3358 (setq ido-default-buffer-method 'selected-window)
3360 ;;;; Refile settings
3361 (setq org-refile-target-verify-function 'bh/verify-refile-target)
3365 Agenda view is the central place for org-mode interaction...
3366 #+BEGIN_SRC emacs-lisp
3367 ;; Do not dim blocked tasks
3368 (setq org-agenda-dim-blocked-tasks nil)
3369 ;; Compact the block agenda view
3370 (setq org-agenda-compact-blocks t)
3372 ;; Custom agenda command definitions
3373 (setq org-agenda-custom-commands
3374 (quote (("N" "Notes" tags "NOTE"
3375 ((org-agenda-overriding-header "Notes")
3376 (org-tags-match-list-sublevels t)))
3377 ("h" "Habits" tags-todo "STYLE=\"habit\""
3378 ((org-agenda-overriding-header "Habits")
3379 (org-agenda-sorting-strategy
3380 '(todo-state-down effort-up category-keep))))
3384 ((org-agenda-overriding-header "Tasks to Refile")
3385 (org-tags-match-list-sublevels nil)))
3386 (tags-todo "-HOLD-CANCELLED/!"
3387 ((org-agenda-overriding-header "Projects")
3388 (org-agenda-skip-function 'bh/skip-non-projects)
3389 (org-agenda-sorting-strategy
3391 (tags-todo "-CANCELLED/!"
3392 ((org-agenda-overriding-header "Stuck Projects")
3393 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3394 (tags-todo "-WAITING-CANCELLED/!NEXT"
3395 ((org-agenda-overriding-header "Next Tasks")
3396 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3397 (org-agenda-todo-ignore-scheduled t)
3398 (org-agenda-todo-ignore-deadlines t)
3399 (org-agenda-todo-ignore-with-date t)
3400 (org-tags-match-list-sublevels t)
3401 (org-agenda-sorting-strategy
3402 '(todo-state-down effort-up category-keep))))
3403 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3404 ((org-agenda-overriding-header "Tasks")
3405 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3406 (org-agenda-todo-ignore-scheduled t)
3407 (org-agenda-todo-ignore-deadlines t)
3408 (org-agenda-todo-ignore-with-date t)
3409 (org-agenda-sorting-strategy
3411 (tags-todo "-CANCELLED+WAITING/!"
3412 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
3413 (org-agenda-skip-function 'bh/skip-stuck-projects)
3414 (org-tags-match-list-sublevels nil)
3415 (org-agenda-todo-ignore-scheduled 'future)
3416 (org-agenda-todo-ignore-deadlines 'future)))
3418 ((org-agenda-overriding-header "Tasks to Archive")
3419 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3420 (org-tags-match-list-sublevels nil))))
3422 ("r" "Tasks to Refile" tags "REFILE"
3423 ((org-agenda-overriding-header "Tasks to Refile")
3424 (org-tags-match-list-sublevels nil)))
3425 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
3426 ((org-agenda-overriding-header "Stuck Projects")
3427 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3428 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
3429 ((org-agenda-overriding-header "Next Tasks")
3430 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3431 (org-agenda-todo-ignore-scheduled t)
3432 (org-agenda-todo-ignore-deadlines t)
3433 (org-agenda-todo-ignore-with-date t)
3434 (org-tags-match-list-sublevels t)
3435 (org-agenda-sorting-strategy
3436 '(todo-state-down effort-up category-keep))))
3437 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3438 ((org-agenda-overriding-header "Tasks")
3439 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3440 (org-agenda-sorting-strategy
3442 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
3443 ((org-agenda-overriding-header "Projects")
3444 (org-agenda-skip-function 'bh/skip-non-projects)
3445 (org-agenda-sorting-strategy
3447 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
3448 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
3449 (org-tags-match-list-sublevels nil))
3450 ("A" "Tasks to Archive" tags "-REFILE/"
3451 ((org-agenda-overriding-header "Tasks to Archive")
3452 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3453 (org-tags-match-list-sublevels nil))))))
3455 ; Overwrite the current window with the agenda
3456 (setq org-agenda-window-setup 'current-window)
3461 #+BEGIN_SRC emacs-lisp
3463 ;; Resume clocking task when emacs is restarted
3464 (org-clock-persistence-insinuate)
3466 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
3467 (setq org-clock-history-length 36)
3468 ;; Resume clocking task on clock-in if the clock is open
3469 (setq org-clock-in-resume t)
3470 ;; Change tasks to NEXT when clocking in
3471 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
3472 ;; Separate drawers for clocking and logs
3473 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
3474 ;; Save clock data and state changes and notes in the LOGBOOK drawer
3475 (setq org-clock-into-drawer t)
3476 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
3477 (setq org-clock-out-remove-zero-time-clocks t)
3478 ;; Clock out when moving task to a done state
3479 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
3480 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
3481 (setq org-clock-persist t)
3482 ;; Do not prompt to resume an active clock
3483 (setq org-clock-persist-query-resume nil)
3484 ;; Enable auto clock resolution for finding open clocks
3485 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
3486 ;; Include current clocking task in clock reports
3487 (setq org-clock-report-include-clocking-task t)
3489 ; use discrete minute intervals (no rounding) increments
3490 (setq org-time-stamp-rounding-minutes (quote (1 1)))
3492 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
3494 (setq bh/keep-clock-running nil)
3496 (setq org-agenda-clock-consistency-checks
3497 (quote (:max-duration "4:00"
3500 :gap-ok-around ("4:00"))))
3504 **** Setting a default clock task
3505 Per default the =** Organization= task in my tasks.org file receives
3506 misc clock time. This is the task I clock in on when I punch in at the
3507 start of my work day with =F9-I=. Punching-in anywhere clocks in this
3508 Organization task as the default task.
3510 If I want to change the default clocking task I just visit the
3511 new task in any org buffer and clock it in with =C-u C-u C-c C-x
3512 C-i=. Now this new task that collects miscellaneous clock
3513 minutes when the clock would normally stop.
3515 You can quickly clock in the default clocking task with =C-u C-c
3516 C-x C-i d=. Another option is to repeatedly clock out so the
3517 clock moves up the project tree until you clock out the
3518 top-level task and the clock moves to the default task.
3521 #+BEGIN_SRC emacs-lisp
3522 ;; Agenda clock report parameters
3523 (setq org-agenda-clockreport-parameter-plist
3524 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3526 ;; Agenda log mode items to display (closed and state changes by default)
3527 (setq org-agenda-log-mode-items (quote (closed state)))
3529 **** Task estimates, column view
3530 Setup column view globally with the following headlines
3531 #+BEGIN_SRC emacs-lisp
3532 ; Set default column view headings: Task Effort Clock_Summary
3533 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
3535 Setup the estimate for effort values.
3536 #+BEGIN_SRC emacs-lisp
3537 ; global Effort estimate values
3538 ; global STYLE property values for completion
3539 (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")
3540 ("STYLE_ALL" . "habit"))))
3544 Tags are mostly used for filtering inside the agenda.
3545 #+BEGIN_SRC emacs-lisp
3546 ; Tags with fast selection keys
3547 (setq org-tag-alist (quote ((:startgroup)
3565 ; Allow setting single tags without the menu
3566 (setq org-fast-tag-selection-single-key (quote expert))
3568 ; For tag searches ignore tasks with scheduled and deadline dates
3569 (setq org-agenda-tags-todo-honor-ignore-options t)
3573 #+BEGIN_SRC emacs-lisp
3574 (setq org-archive-mark-done nil)
3575 (setq org-archive-location "%s_archive::* Archived Tasks")
3579 #+BEGIN_SRC emacs-lisp
3580 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
3581 (setq org-plantuml-jar-path "~/java/plantuml.jar")
3583 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
3585 ; Make babel results blocks lowercase
3586 (setq org-babel-results-keyword "results")
3588 (org-babel-do-load-languages
3589 (quote org-babel-load-languages)
3590 (quote ((emacs-lisp . t)
3609 ; Do not prompt to confirm evaluation
3610 ; This may be dangerous - make sure you understand the consequences
3611 ; of setting this -- see the docstring for details
3612 (setq org-confirm-babel-evaluate nil)
3614 ; Use fundamental mode when editing plantuml blocks with C-c '
3615 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
3618 #+BEGIN_SRC emacs-lisp
3619 ;; Don't have images visible on startup, breaks on console
3620 (setq org-startup-with-inline-images nil)
3623 #+BEGIN_SRC emacs-lisp
3624 (add-to-list 'org-structure-template-alist
3625 '("n" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"
3626 "<comment>\n?\n</comment>"))
3628 **** ditaa, graphviz, etc
3629 Those are all nice tools. Look at
3630 http://doc.norang.ca/org-mode.html#playingwithditaa for a nice intro
3633 *** Publishing and exporting
3636 Org-mode can export to a variety of publishing formats including (but not limited to)
3639 (plain text - but not the original org-mode file)
3643 which enables getting to lots of other formats like ODF, XML, etc
3645 via LaTeX or Docbook
3648 A new exporter created by Nicolas Goaziou was introduced in org 8.0.
3650 #+BEGIN_SRC emacs-lisp
3651 ;; Explicitly load required exporters
3655 (require 'ox-reveal)
3656 ;; FIXME, check the following two
3657 ;(require 'ox-icalendar)
3660 ; experimenting with docbook exports - not finished
3661 (setq org-export-docbook-xsl-fo-proc-command "fop %s %s")
3662 (setq org-export-docbook-xslt-proc-command "xsltproc --output %s /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl %s")
3664 (setq org-reveal-root "file:///home/joerg/devel/ganeticon2015/reveal.js/reveal.js")
3666 ;; define categories that should be excluded
3667 (setq org-export-exclude-category (list "google" "google"))
3668 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
3670 ; define how the date strings look
3671 (setq org-export-date-timestamp-format "%Y-%m-%d")
3672 ; Inline images in HTML instead of producting links to the image
3673 (setq org-html-inline-images t)
3674 ; Do not use sub or superscripts - I currently don't need this functionality in my documents
3675 (setq org-export-with-sub-superscripts nil)
3677 (setq org-html-head-extra (concat
3678 "<link rel=\"stylesheet\" href=\"https://ganneff.de/stylesheet.css\" type=\"text/css\" />\n"
3680 (setq org-html-head-include-default-style nil)
3681 ; Do not generate internal css formatting for HTML exports
3682 (setq org-export-htmlize-output-type (quote css))
3683 ; Export with LaTeX fragments
3684 (setq org-export-with-LaTeX-fragments t)
3685 ; Increase default number of headings to export
3686 (setq org-export-headline-levels 6)
3689 (setq org-publish-project-alist
3692 :base-directory "~/.emacs.d/"
3693 :base-extension "org"
3695 :publishing-directory "/develop/www/emacs"
3697 :publishing-function org-html-publish-to-html
3698 :headline-levels 4 ; Just the default for this project.
3704 :base-directory "~/.emacs.d/"
3705 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
3706 :publishing-directory "/develop/www/emacs"
3707 :exclude "elisp\\|elpa\\|elpa.off\\|auto-save-list\\|cache\\|eshell\\|image-dired\\|themes\\|url"
3709 :publishing-function org-publish-attachment
3711 ("inherit-org-info-js"
3712 :base-directory "/develop/vcs/org-info-js/"
3714 :base-extension "js"
3715 :publishing-directory "/develop/www/"
3716 :publishing-function org-publish-attachment
3718 ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
3723 (setq org-export-with-timestamps nil)
3728 #+BEGIN_SRC emacs-lisp
3729 (setq org-latex-to-pdf-process
3730 '("xelatex -interaction nonstopmode %f"
3731 "xelatex -interaction nonstopmode %f")) ;; for multiple passes
3732 (setq org-export-latex-listings 'minted)
3733 (setq org-latex-listings t)
3735 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3736 ;; but adapted to use latexmk 4.20 or higher.
3737 (defun my-auto-tex-cmd ()
3738 "When exporting from .org with latex, automatically run latex,
3739 pdflatex, or xelatex as appropriate, using latexmk."
3741 ;; default command: oldstyle latex via dvi
3742 (setq texcmd "latexmk -dvi -pdfps -quiet %f")
3744 (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3745 (setq texcmd "latexmk -pdf -quiet %f"))
3747 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3748 (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
3749 ;; LaTeX compilation command
3750 (setq org-latex-to-pdf-process (list texcmd)))
3752 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3754 ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3755 (setq org-export-latex-packages-alist
3757 ("" "longtable" nil)
3762 (defun my-auto-tex-parameters ()
3763 "Automatically select the tex packages to include."
3764 ;; default packages for ordinary latex or pdflatex export
3765 (setq org-export-latex-default-packages-alist
3766 '(("AUTO" "inputenc" t)
3776 ("" "hyperref" nil)))
3778 ;; Packages to include when xelatex is used
3779 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3780 (setq org-export-latex-default-packages-alist
3785 ("german" "babel" t)
3786 ("babel" "csquotes" t)
3788 ("xetex" "hyperref" nil)
3791 (if (string-match "#+LATEX_CMD: xelatex" (buffer-string))
3792 (setq org-export-latex-classes
3794 "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
3795 ("\\section{%s}" . "\\section*{%s}")
3796 ("\\subsection{%s}" . "\\subsection*{%s}")
3797 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3798 ("\\paragraph{%s}" . "\\paragraph*{%s}")
3799 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3800 org-export-latex-classes))))
3802 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
3805 *** Prevent editing invisible text
3806 The following setting prevents accidentally editing hidden text when
3807 the point is inside a folded region. This can happen if you are in
3808 the body of a heading and globally fold the org-file with =S-TAB=
3810 I find invisible edits (and undo's) hard to deal with so now I can't
3811 edit invisible text. =C-c C-r= (org-reveal) will display where the
3812 point is if it is buried in invisible text to allow editing again.
3814 #+BEGIN_SRC emacs-lisp
3815 (setq org-catch-invisible-edits 'error)
3819 #+BEGIN_SRC emacs-lisp
3820 ;; disable the default org-mode stuck projects agenda view
3821 (setq org-stuck-projects (quote ("" nil nil "")))
3823 ; force showing the next headline.
3824 (setq org-show-entry-below (quote ((default))))
3826 (setq org-show-following-heading t)
3827 (setq org-show-hierarchy-above t)
3828 (setq org-show-siblings (quote ((default))))
3830 (setq org-special-ctrl-a/e t)
3831 (setq org-special-ctrl-k t)
3832 (setq org-yank-adjusted-subtrees t)
3834 (setq org-table-export-default-format "orgtbl-to-csv")
3838 The following setting adds alphabetical lists like
3842 #+BEGIN_SRC emacs-lisp
3843 (if (> emacs-major-version 23)
3844 (setq org-list-allow-alphabetical t)
3845 (setq org-alphabetical-lists t))
3848 #+BEGIN_SRC emacs-lisp
3849 (setq org-remove-highlights-with-change nil)
3851 (setq org-list-demote-modify-bullet (quote (("+" . "-")
3858 (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
3861 ; If we leave Emacs running overnight - reset the appointments one minute after midnight
3862 (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
3867 #+BEGIN_SRC emacs-lisp
3868 ;; Enable abbrev-mode
3869 (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
3870 (setq org-startup-indented t)
3871 (setq org-startup-folded t)
3872 (setq org-cycle-separator-lines 0)
3875 I find extra blank lines in lists and headings a bit of a nuisance.
3876 To get a body after a list you need to include a blank line between
3877 the list entry and the body -- and indent the body appropriately.
3878 Most of my lists have no body detail so I like the look of collapsed
3879 lists with no blank lines better.
3881 The following setting prevents creating blank lines before headings
3882 but allows list items to adapt to existing blank lines around the items:
3883 #+BEGIN_SRC emacs-lisp
3884 (setq org-blank-before-new-entry (quote ((heading)
3885 (plain-list-item . auto))))
3888 #+BEGIN_SRC emacs-lisp
3889 (setq org-reverse-note-order nil)
3890 (setq org-default-notes-file "~/notes.org")
3893 Enforce task blocking. Tasks can't go done when there is any subtask
3894 still open. Unless they have a property of =NOBLOCKING: t=
3895 #+BEGIN_SRC emacs-lisp
3896 (setq org-enforce-todo-checkbox-dependencies t)
3897 (setq org-enforce-todo-dependencies t)
3900 #+BEGIN_SRC emacs-lisp
3901 (setq org-fast-tag-selection-single-key (quote expert))
3902 (setq org-footnote-auto-adjust t)
3903 (setq org-hide-block-startup t)
3904 (setq org-icalendar-alarm-time 15)
3905 (setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
3906 (setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
3907 (setq org-icalendar-honor-noexport-tag t)
3908 (setq org-icalendar-include-bbdb-anniversaries nil)
3909 (setq org-icalendar-include-body 200)
3910 (setq org-icalendar-include-todo nil)
3911 (setq org-icalendar-store-UID t)
3912 (setq org-icalendar-timezone "Europe/Berlin")
3913 (setq org-insert-mode-line-in-empty-file t)
3914 (setq org-log-done (quote note))
3915 (setq org-log-into-drawer t)
3916 (setq org-log-state-notes-insert-after-drawers nil)
3917 (setq org-log-reschedule (quote time))
3918 (setq org-log-states-order-reversed t)
3919 (setq org-mobile-agendas (quote all))
3920 (setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
3921 (setq org-mobile-inbox-for-pull "~/org/refile.org")
3922 (setq org-remember-store-without-prompt t)
3923 (setq org-return-follows-link t)
3924 (setq org-reverse-note-order t)
3926 ; regularly save our org-mode buffers
3927 (run-at-time "00:59" 3600 'org-save-all-org-buffers)
3929 (setq org-log-done t)
3931 (setq org-enable-priority-commands t)
3932 (setq org-default-priority ?E)
3933 (setq org-lowest-priority ?E)
3938 Speed commands enable single-letter commands in Org-mode files when
3939 the point is at the beginning of a headline, or at the beginning of a
3942 See the `=org-speed-commands-default=' variable for a list of the keys
3943 and commands enabled at the beginning of headlines. All code blocks
3944 are available at the beginning of a code block, the following key
3945 sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
3946 display a list of the code blocks commands and their related keys.
3948 #+BEGIN_SRC emacs-lisp
3949 (setq org-use-speed-commands nil)
3950 (setq org-speed-commands-user (quote (("0" . ignore)
3963 ("h" . bh/hide-other)
3966 (call-interactively 'org-insert-heading-respect-content))
3967 ("k" . org-kill-note-or-show-branches)
3970 ("q" . bh/show-org-agenda)
3972 ("s" . org-save-all-org-buffers)
3976 ("z" . org-add-note)
3981 ("F" . bh/restrict-to-file-or-follow)
3984 ("J" . org-clock-goto)
3988 ("N" . bh/narrow-to-org-subtree)
3989 ("P" . bh/narrow-to-org-project)
3994 ("U" . bh/narrow-up-one-org-level)
4001 (add-hook 'org-agenda-mode-hook
4003 (define-key org-agenda-mode-map "q" 'bury-buffer))
4006 (defvar bh/current-view-project nil)
4007 (add-hook 'org-agenda-mode-hook
4008 '(lambda () (org-defkey org-agenda-mode-map "V" 'bh/view-next-project))
4013 The following displays the contents of code blocks in Org-mode files
4014 using the major-mode of the code. It also changes the behavior of
4015 =TAB= to as if it were used in the appropriate major mode. This means
4016 that reading and editing code form inside of your Org-mode files is
4017 much more like reading and editing of code using its major mode.
4019 #+BEGIN_SRC emacs-lisp
4020 (setq org-src-fontify-natively t)
4021 (setq org-src-tab-acts-natively t)
4024 #+BEGIN_SRC emacs-lisp
4025 (setq org-src-preserve-indentation nil)
4026 (setq org-edit-src-content-indentation 0)
4030 #+BEGIN_SRC emacs-lisp
4031 (setq org-attach-directory "~/org/data/")
4033 #+BEGIN_SRC emacs-lisp
4034 (setq org-agenda-sticky t)
4037 **** Checklist handling
4038 [2013-05-11 Sat 22:15]
4040 #+BEGIN_SRC emacs-lisp
4041 ;(require 'org-checklist)
4044 I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
4046 #+BEGIN_SRC emacs-lisp
4047 (use-package cperl-mode
4048 :commands cperl-mode
4051 (defalias 'perl-mode 'cperl-mode)
4052 (add-auto-mode 'cperl-mode "\\.\\([pP][Llm]\\|al\\)\\'")
4053 (add-auto-mode 'pod-mode "\\.pod$")
4054 (add-auto-mode 'tt-mode "\\.tt$")
4055 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
4056 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
4057 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
4061 (setq cperl-invalid-face nil
4062 cperl-close-paren-offset -4
4063 cperl-continued-statement-offset 0
4064 cperl-indent-level 4
4065 cperl-indent-parens-as-block t
4067 cperl-electric-keywords t
4068 cperl-electric-lbrace-space t
4069 cperl-electric-parens nil
4070 cperl-highlight-variables-indiscriminately t
4071 cperl-imenu-addback t
4072 cperl-invalid-face (quote underline)
4073 cperl-lazy-help-time 5
4074 cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$"
4075 cperl-syntaxify-by-font-lock t
4076 cperl-use-syntax-table-text-property-for-tags t)
4078 ;; And have cperl mode give ElDoc a useful string
4079 (defun my-cperl-eldoc-documentation-function ()
4080 "Return meaningful doc string for `eldoc-mode'."
4082 (let ((cperl-message-on-help-error nil))
4084 (add-hook 'cperl-mode-hook
4086 (set (make-local-variable 'eldoc-documentation-function)
4087 'my-cperl-eldoc-documentation-function)
4092 [2014-05-22 Thu 00:05]
4093 #+BEGIN_SRC emacs-lisp
4094 (use-package puppet-mode
4095 :mode ("\\.pp\\'" . puppet-mode)
4096 :commands puppet-mode
4099 (defun my-puppet-mode-hook ()
4100 (setq require-final-newline nil))
4101 (add-hook 'puppet-mode-hook 'my-puppet-mode-hook))
4104 (use-package puppet-ext
4107 (bind-key "C-x ?" 'puppet-set-anchor puppet-mode-map)
4108 (bind-key "C-c C-r" 'puppet-create-require puppet-mode-map)))))
4112 Use elpy for the emacs python fun, but dont let it initialize all the
4113 various variables. Elpy author may like them, but I'm not him...
4114 #+BEGIN_SRC emacs-lisp
4117 :mode ("\.py" . python-mode)
4120 (safe-load (concat jj-elisp-dir "/elpy/elpy-autoloads.el"))
4127 :commands (nosetests-all nosetests-module nosetests-one
4128 nosetests-failed nosetests-pdb-all
4129 nosetests-pdb-module nosetests-pdb-one)
4134 :commands (pyvenv-activate pyvenv-deactivate pyvenv-mode pyvenv-restart-python)
4137 (use-package idomenu
4142 (use-package highlight-indentation
4144 :commands (highlight-indentation-mode))
4146 (use-package find-file-in-project
4148 :commands (find-file-in-project ffip-project-files ffip ))
4153 ;; Local variables in `python-mode'. This is not removed when Elpy
4154 ;; is disabled, which can cause some confusion.
4155 (add-hook 'python-mode-hook 'elpy-initialize-local-variables)
4157 (defun my-python-mode-hook ()
4158 (setq require-final-newline nil)
4159 (setq mode-require-final-newline))
4160 (add-hook 'python-mode-hook 'my-python-mode-hook)
4162 ;; Flymake support using flake8, including warning faces.
4163 (when (and (executable-find "flake8")
4164 (not (executable-find python-check-command)))
4165 (setq python-check-command "flake8"))
4167 ;; `flymake-no-changes-timeout': The original value of 0.5 is too
4168 ;; short for Python code, as that will result in the current line to
4169 ;; be highlighted most of the time, and that's annoying. This value
4170 ;; might be on the long side, but at least it does not, in general,
4171 ;; interfere with normal interaction.
4172 (setq flymake-no-changes-timeout 60)
4174 ;; `flymake-start-syntax-check-on-newline': This should be nil for
4175 ;; Python, as;; most lines with a colon at the end will mean the next
4176 ;; line is always highlighted as error, which is not helpful and
4178 (setq flymake-start-syntax-check-on-newline nil)
4180 ;; `ac-auto-show-menu': Short timeout because the menu is great.
4181 (setq ac-auto-show-menu 0.4)
4183 ;; `ac-quick-help-delay': I'd like to show the menu right with the
4184 ;; completions, but this value should be greater than
4185 ;; `ac-auto-show-menu' to show help for the first entry as well.
4186 (setq ac-quick-help-delay 0.5)
4188 ;; `yas-trigger-key': TAB, as is the default, conflicts with the
4189 ;; autocompletion. We also need to tell yasnippet about the new
4190 ;; binding. This is a bad interface to set the trigger key. Stop
4192 (let ((old (when (boundp 'yas-trigger-key)
4194 (setq yas-trigger-key "C-c C-i")
4195 (when (fboundp 'yas--trigger-key-reload)
4196 (yas--trigger-key-reload old)))
4198 ;; yas-snippet-dirs can be a string for a single directory. Make
4199 ;; sure it's a list in that case so we can add our own entry.
4200 (when (not (listp yas-snippet-dirs))