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 Disabled, see ivy-mode.
1712 #+begin_src emacs-lisp :tangle no
1713 (bind-key "C-s" 'isearch-forward-regexp)
1714 (bind-key "C-r" 'isearch-backward-regexp)
1715 (bind-key "C-M-s" 'isearch-forward)
1716 (bind-key "C-M-r" 'isearch-backward)
1719 Rgrep is infinitely useful in multi-file projects.
1720 #+begin_src emacs-lisp
1721 (bind-key "C-x C-g" 'rgrep)
1724 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
1725 AKA transpose lines.
1726 #+BEGIN_SRC emacs-lisp
1727 (bind-key "<M-S-up>" 'move-line-up)
1728 (bind-key "<M-S-down>" 'move-line-down)
1731 "Pull" lines up, join them
1732 #+BEGIN_SRC emacs-lisp
1733 (defun join-line-or-lines-in-region ()
1734 "Join this line or the lines in the selected region.
1735 Joins single lines in reverse order to the default, ie. pulls the next one up."
1737 (cond ((region-active-p)
1738 (let ((min (line-number-at-pos (region-beginning))))
1739 (goto-char (region-end))
1740 (while (> (line-number-at-pos) min)
1742 (t (let ((current-prefix-arg '(4)))
1743 (call-interactively 'join-line)))))
1744 (bind-key "M-j" 'join-line-or-lines-in-region)
1747 When I press Enter I almost always want to go to the right indentation on the next line.
1748 #+BEGIN_SRC emacs-lisp
1749 (bind-key "RET" 'newline-and-indent)
1752 Easier undo, and i don't need suspend-frame
1753 #+BEGIN_SRC emacs-lisp
1754 (bind-key "C-z" 'undo)
1757 Window switching, go backwards. (C-x o goes to the next window)
1758 #+BEGIN_SRC emacs-lisp
1759 (bind-key "C-x O" (lambda ()
1765 #+BEGIN_SRC emacs-lisp
1766 (bind-key "C-x C-r" 'prelude-sudo-edit)
1769 M-space is bound to just-one-space, which is great for programming. What
1770 it does is remove all spaces around the cursor, except for one. But to
1771 be really useful, it also should include newlines. It doesn’t do this by
1772 default. Rather, you have to call it with a negative argument. Sure
1774 #+BEGIN_SRC emacs-lisp
1775 (bind-key "M-SPC" 'just-one-space-with-newline)
1778 Count which commands I use how often.
1779 #+BEGIN_SRC emacs-lisp
1780 (use-package keyfreq
1784 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
1785 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
1787 (keyfreq-autosave-mode 1)))
1790 Duplicate current line
1791 #+BEGIN_SRC emacs-lisp
1792 (defun duplicate-line ()
1793 "Insert a copy of the current line after the current line."
1796 (let ((line-text (buffer-substring-no-properties
1797 (line-beginning-position)
1798 (line-end-position))))
1799 (move-end-of-line 1)
1801 (insert line-text))))
1803 (bind-key "C-c p" 'duplicate-line)
1806 Smarter move to the beginning of the line. That is, it first moves to
1807 the beginning of the line - and on second keypress it goes to the
1808 first character on line.
1809 #+BEGIN_SRC emacs-lisp
1810 (defun smarter-move-beginning-of-line (arg)
1811 "Move point back to indentation of beginning of line.
1813 Move point to the first non-whitespace character on this line.
1814 If point is already there, move to the beginning of the line.
1815 Effectively toggle between the first non-whitespace character and
1816 the beginning of the line.
1818 If ARG is not nil or 1, move forward ARG - 1 lines first. If
1819 point reaches the beginning or end of the buffer, stop there."
1821 (setq arg (or arg 1))
1825 (let ((line-move-visual nil))
1826 (forward-line (1- arg))))
1828 (let ((orig-point (point)))
1829 (back-to-indentation)
1830 (when (= orig-point (point))
1831 (move-beginning-of-line 1))))
1833 ;; remap C-a to `smarter-move-beginning-of-line'
1834 (global-set-key [remap move-beginning-of-line]
1835 'smarter-move-beginning-of-line)
1839 Easily copy characters from the previous nonblank line, starting just
1840 above point. With a prefix argument, only copy ARG characters (never
1841 past EOL), no argument copies rest of line.
1842 #+BEGIN_SRC emacs-lisp
1844 (bind-key "H-y" 'copy-from-above-command)
1847 Open a new X Terminal pointing to the directory of the current
1849 #+BEGIN_SRC emacs-lisp
1850 (bind-key "H-t" 'jj-open-shell)
1854 #+BEGIN_SRC emacs-lisp
1855 (bind-key "H-a" 'align-code)
1859 #+BEGIN_SRC emacs-lisp
1860 (bind-key "C-c d" 'insert-date)
1863 Another key for indenting
1864 #+BEGIN_SRC emacs-lisp
1865 (bind-key "H-i" 'indent-region)
1868 Clean all whitespace stuff
1869 #+BEGIN_SRC emacs-lisp
1870 (bind-key "H-w" 'whitespace-cleanup)
1874 #+BEGIN_SRC emacs-lisp
1875 (bind-key "H-c" 'comment-dwim)
1878 Show keystrokes in progress
1879 #+BEGIN_SRC emacs-lisp
1880 (setq echo-keystrokes 0.1)
1883 Usually you can press the *Ins*ert key, to get into overwrite mode. I
1884 don't like that, have broken much with it and so just forbid it by
1886 #+BEGIN_SRC emacs-lisp
1887 (unbind-key "<insert>")
1888 (unbind-key "<kp-insert>")
1891 *** Easily navigate sillyCased words
1892 #+BEGIN_SRC emacs-lisp
1893 (global-subword-mode 1)
1895 *** Delete file of current buffer, then kill buffer
1896 [2014-06-14 Sat 23:03]
1897 #+BEGIN_SRC emacs-lisp
1898 (defun delete-current-buffer-file ()
1899 "Removes file connected to current buffer and kills buffer."
1901 (let ((filename (buffer-file-name))
1902 (buffer (current-buffer))
1903 (name (buffer-name)))
1904 (if (not (and filename (file-exists-p filename)))
1906 (when (yes-or-no-p "Are you sure you want to remove this file? ")
1907 (delete-file filename)
1908 (kill-buffer buffer)
1909 (message "File '%s' successfully removed" filename)))))
1911 (global-set-key (kbd "C-x C-k") 'delete-current-buffer-file)
1913 *** Rename file of current buffer
1914 [2014-06-14 Sat 23:04]
1915 #+BEGIN_SRC emacs-lisp
1916 (defun rename-current-buffer-file ()
1917 "Renames current buffer and file it is visiting."
1919 (let ((name (buffer-name))
1920 (filename (buffer-file-name)))
1921 (if (not (and filename (file-exists-p filename)))
1922 (error "Buffer '%s' is not visiting a file!" name)
1923 (let ((new-name (read-file-name "New name: " filename)))
1924 (if (get-buffer new-name)
1925 (error "A buffer named '%s' already exists!" new-name)
1926 (rename-file filename new-name 1)
1927 (rename-buffer new-name)
1928 (set-visited-file-name new-name)
1929 (set-buffer-modified-p nil)
1930 (message "File '%s' successfully renamed to '%s'"
1931 name (file-name-nondirectory new-name)))))))
1933 (global-set-key (kbd "C-x C-S-r") 'rename-current-buffer-file)
1935 *** Quickly find emacs lisp sources
1936 [2014-06-22 Sun 23:05]
1937 #+BEGIN_SRC emacs-lisp
1938 (bind-key "C-l" 'find-library 'help-command)
1939 (bind-key "C-f" 'find-function 'help-command)
1940 (bind-key "C-k" 'find-function-on-key 'help-command)
1941 (bind-key "C-v" 'find-variable 'help-command)
1944 [2015-01-26 Mon 16:01]
1945 #+BEGIN_SRC emacs-lisp
1946 (bind-key "M-s o" 'occur-dwim)
1950 [2014-06-01 Sun 15:00]
1951 Proper whitespace handling
1952 #+BEGIN_SRC emacs-lisp :tangle no
1953 (use-package ethan-wspace
1954 :ensure ethan-wspace
1955 :diminish (ethan-wspace-mode . "ew")
1957 (global-ethan-wspace-mode 1))
1961 [2014-06-01 Sun 15:16]
1962 #+BEGIN_SRC emacs-lisp
1963 (use-package expand-region
1964 :ensure expand-region
1965 :bind ("C-M-+" . er/expand-region)
1966 :commands er/expand-region)
1969 [2013-05-02 Thu 00:04]
1970 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
1971 fill prefix, such as a comment sequence in program code, and handling
1972 bullet points like “1.” or “*”.
1973 #+BEGIN_SRC emacs-lisp
1974 (use-package filladapt
1975 :diminish filladapt-mode
1977 (setq-default filladapt-mode t))
1980 [2013-04-28 So 22:21]
1981 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
1982 As the one time I tried Flymake i wasn't happy, thats easy to
1984 #+BEGIN_SRC emacs-lisp
1985 (use-package flycheck
1987 :diminish flycheck-mode
1988 :bind (("M-n" . next-error)
1989 ("M-p" . previous-error))
1992 (add-hook 'find-file-hook
1994 (when (not (equal 'emacs-lisp-mode major-mode))
1998 (use-package flycheck-color-mode-line
1999 :ensure flycheck-color-mode-line)
2000 (setq flycheck-highlighting-mode 'nil)
2001 (setq flycheck-flake8-maximum-line-length '150)
2002 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
2006 Obviously emacs can do syntax hilighting. For more things than you ever
2008 And I want to have it everywhere.
2009 #+BEGIN_SRC emacs-lisp
2010 (use-package font-lock
2013 (global-font-lock-mode 1)
2014 (setq font-lock-maximum-decoration t)))
2017 [2015-08-31 Mon 11:27]
2018 Display nice lines instead of page breaks
2019 #+BEGIN_SRC emacs-lisp
2020 (use-package form-feed
2025 #+BEGIN_SRC emacs-lisp :tangle no
2026 (use-package git-commit
2027 :commands git-commit
2028 :mode ("COMMIT_EDITMSG" . git-commit-mode))
2032 #+BEGIN_SRC emacs-lisp :tangle no
2033 (use-package git-rebase
2034 :commands git-rebase
2035 :mode ("git-rebase-todo" . git-rebase-mode))
2038 [2014-05-21 Wed 22:56]
2039 #+BEGIN_SRC emacs-lisp
2040 (use-package git-gutter+
2042 :diminish git-gutter+-mode
2043 :bind (("C-x n" . git-gutter+-next-hunk)
2044 ("C-x p" . git-gutter+-previous-hunk)
2045 ("C-x v =" . git-gutter+-show-hunk)
2046 ("C-x r" . git-gutter+-revert-hunks)
2047 ("C-x s" . git-gutter+-stage-hunks)
2048 ("C-x c" . git-gutter+-commit)
2052 (setq git-gutter+-disabled-modes '(org-mode))
2053 (global-git-gutter+-mode 1))
2056 (use-package git-gutter-fringe+
2057 :ensure git-gutter-fringe+
2060 (setq git-gutter-fr+-side 'right-fringe)
2061 ;(git-gutter-fr+-minimal)
2066 [2015-02-22 Sun 14:00]
2067 Provides function that popup commit message at current line. This is
2068 useful when you want to know why this line was changed.
2069 #+BEGIN_SRC emacs-lisp
2070 (use-package git-messenger
2071 :ensure git-messenger
2072 :commands (git-messenger:popup-message)
2073 :bind (("C-x v p" . git-messenger:popup-message))
2076 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
2077 (add-hook 'git-messenger:popup-buffer-hook 'magit-commit-mode)
2078 (setq git-messenger:show-detail t)))
2081 [2014-07-23 Mi 12:57]
2082 Browse historic versions of a file with p (previous) and n (next).
2083 #+BEGIN_SRC emacs-lisp
2084 (use-package git-timemachine
2085 :ensure git-timemachine
2086 :commands git-timemachine)
2089 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
2090 what I want every emacs to know.
2091 #+BEGIN_SRC emacs-lisp
2092 (bind-key "C-c g" 'gnus) ; Start gnus with M-n
2098 [2015-02-20 Fri 16:27]
2099 When working with many windows at the same time, each window has a
2100 size that is not convenient for editing.
2102 golden-ratio helps on this issue by resizing automatically the windows
2103 you are working on to the size specified in the "Golden Ratio". The
2104 window that has the main focus will have the perfect size for editing,
2105 while the ones that are not being actively edited will be re-sized to
2106 a smaller size that doesn't get in the way, but at the same time will
2107 be readable enough to know it's content.
2108 #+BEGIN_SRC emacs-lisp
2109 (use-package golden-ratio
2110 :ensure golden-ratio
2111 :diminish golden-ratio-mode
2114 (golden-ratio-mode 1)
2115 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*"))
2116 (setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
2117 "gnus-article-mode" "calc-mode" "calc-trail-mode"
2122 [2015-02-22 Sun 13:28]
2123 Move point through buffer-undo-list positions.
2124 #+BEGIN_SRC emacs-lisp
2125 (use-package goto-last-change
2126 :commands (goto-last-change)
2127 :bind (("M-g l" . goto-last-change))
2131 [2014-06-11 Wed 22:27]
2132 guide-key.el displays the available key bindings automatically and
2135 For whatever reason I like this more than icicles <backtab> completion
2137 #+BEGIN_SRC emacs-lisp
2138 (use-package guide-key
2140 :diminish guide-key-mode
2143 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
2145 (setq guide-key/recursive-key-sequence-flag t)
2146 (setq guide-key/popup-window-position 'bottom)
2147 (setq guide-key/idle-delay 0.5)))
2152 [2014-05-21 Wed 23:51]
2153 #+BEGIN_SRC emacs-lisp
2154 (use-package hi-lock
2155 :bind (("M-o l" . highlight-lines-matching-regexp)
2156 ("M-o r" . highlight-regexp)
2157 ("M-o w" . highlight-phrase)))
2159 (use-package hilit-chg
2160 :bind ("M-o C" . highlight-changes-mode))
2164 Crazy way of completion. It looks at the word before point and then
2165 tries to expand it in various ways.
2166 #+BEGIN_SRC emacs-lisp
2167 (use-package hippie-exp
2168 :bind ("M-/" . hippie-expand)
2169 :commands hippie-expand
2172 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2173 try-expand-dabbrev-all-buffers
2174 try-expand-dabbrev-from-kill
2175 try-complete-file-name-partially
2176 try-complete-file-name
2177 try-expand-all-abbrevs try-expand-list
2179 try-complete-lisp-symbol-partially
2180 try-complete-lisp-symbol))))
2183 Replaced by web-mode [[*web-mode][web-mode]]
2184 #+BEGIN_SRC emacs-lisp :tangle no
2185 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
2186 (add-auto-mode 'html-helper-mode "\\.html$")
2187 (add-auto-mode 'html-helper-mode "\\.asp$")
2188 (add-auto-mode 'html-helper-mode "\\.phtml$")
2189 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
2190 (defalias 'html-mode 'html-helper-mode)
2193 [2015-01-26 Mon 15:50]
2194 This is a package for GNU Emacs that can be used to tie related
2195 commands into a family of short bindings with a common prefix - a
2198 Once you summon the Hydra through the prefixed binding (the body + any
2199 one head), all heads can be called in succession with only a short
2202 The Hydra is vanquished once Hercules, any binding that isn't the
2203 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2204 Hydra, will still serve his orignal purpose, calling his proper
2205 command. This makes the Hydra very seamless, it's like a minor mode
2206 that disables itself auto-magically.
2207 #+BEGIN_SRC emacs-lisp
2212 (setq hydra-is-helpful t)
2215 (defhydra hydra-zoom (:color red)
2217 ("g" text-scale-increase "in")
2218 ("l" text-scale-decrease "out")
2220 (bind-key "<F2>" 'hydra-zoom/toggle)
2222 (defhydra hydra-error (:color red)
2224 ("h" first-error "first")
2225 ("j" next-error "next")
2226 ("k" previous-error "prev")
2227 ("v" recenter-top-bottom "recenter")
2229 (bind-key "M-g e" 'hydra-error/body)
2231 (defhydra hydra-gnus (:color red)
2233 ("m" gnus-uu-mark-thread "mark thread")
2234 ("d" gnus-summary-delete-article "delete article(s)")
2235 ("r" gnus-summary-mark-as-read-forward "mark read")
2236 ("n" gnus-summary-next-thread "next thread")
2237 ("p" gnus-summary-prev-thread "previous thread")
2238 ("g" gnus-summary-next-group "next group")
2239 ("l" gnus-recenter "recenter")
2240 ("x" gnus-summary-limit-to-unread "unread")
2242 (bind-key "C-c h" 'hydra-gnus/body)
2244 (defhydra hydra-launcher (:color blue)
2247 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2248 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
2251 (bind-key "C-c r" 'hydra-launcher/body)
2253 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
2254 (defvar whitespace-mode nil)
2255 (defhydra hydra-toggle (:color pink)
2257 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
2258 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
2259 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
2260 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
2261 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
2264 ("a" abbrev-mode nil)
2265 ("c" auto-complete-mode nil)
2266 ("i" aggressive-indent-mode nil)
2267 ("d" toggle-debug-on-error nil)
2268 ("f" auto-fill-mode nil)
2269 ("g" golden-ratio-mode nil)
2270 ("t" toggle-truncate-lines nil)
2271 ("w" whitespace-mode nil)
2272 ("r" auto-revert-mode nil)
2273 ("l" linum-mode nil)
2274 ("k" linum-relative-toggle nil)
2276 (bind-key "C-c C-v" 'hydra-toggle/body)
2282 [2014-05-21 Wed 23:54]
2283 #+BEGIN_SRC emacs-lisp
2284 (use-package ibuffer
2286 :bind (("C-h h" . ibuffer)
2287 ("C-x C-b" . ibuffer)
2288 ("<XF86WebCam>" . ibuffer)
2291 :defines (ibuffer-filtering-alist
2292 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
2293 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
2296 (defvar my-ibufffer-separator " • ")
2297 (setq ibuffer-filter-group-name-face 'variable-pitch
2298 ibuffer-use-header-line t
2299 ibuffer-old-time 12)
2300 (unbind-key "M-o" ibuffer-mode-map)
2301 (bind-key "s" 'isearch-forward-regexp ibuffer-mode-map)
2302 (bind-key "." 'ibuffer-invert-sorting ibuffer-mode-map)
2307 (use-package ibuffer-vc
2310 (ibuffer-vc-set-filter-groups-by-vc-root
2311 ibuffer-vc-generate-filter-groups-by-vc-root))
2313 (use-package ibuffer-tramp
2315 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
2316 ibuffer-tramp-set-filter-groups-by-tramp-connection))
2317 ;; Switching to ibuffer puts the cursor on the most recent buffer
2318 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
2319 "Open ibuffer with cursor pointed to most recent buffer name"
2320 (let ((recent-buffer-name (buffer-name)))
2322 (ibuffer-update nil t)
2323 (unless (string= recent-buffer-name "*Ibuffer*")
2324 (ibuffer-jump-to-buffer recent-buffer-name))))
2326 (defun ibuffer-magit-status ()
2328 (--when-let (get-buffer "*Ibuffer*")
2329 (with-current-buffer it
2330 (let* ((selected-buffer (ibuffer-current-buffer))
2331 (buffer-path (with-current-buffer
2333 (or (buffer-file-name)
2334 list-buffers-directory
2335 default-directory)))
2337 (if (file-regular-p buffer-path)
2338 (file-name-directory buffer-path)
2340 (magit-status default-directory)))))
2341 (bind-key "i" 'ibuffer-magit-status ibuffer-mode-map)
2342 (bind-key "G" 'ibuffer-magit-status ibuffer-mode-map)
2344 (setq ibuffer-directory-abbrev-alist
2349 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
2350 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
2352 ("dak" . "/develop/dak/")
2354 ("config" . "~/.emacs.d/config/")
2356 ("systmp" . "/tmp/")
2357 ("puppet" . "~/git/puppet")
2361 (use-package ibuffer-git
2363 (use-package ibuffer-vc
2366 (define-ibuffer-column size-h
2367 (:name "Size" :inline t)
2369 ((> (buffer-size) 1000)
2370 (format "%7.1fk" (/ (buffer-size) 1000.0)))
2371 ((> (buffer-size) 1000000)
2372 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
2374 (format "%8d" (buffer-size)))))
2376 (use-package ibuf-ext)
2377 (define-ibuffer-filter filename2
2378 "Toggle current view to buffers with filename matching QUALIFIER."
2379 (:description "filename2"
2380 :reader (read-from-minibuffer "Filter by filename (regexp): "))
2381 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
2382 (ibuffer-awhen (with-current-buffer buf
2383 (or buffer-file-name
2385 (string-match qualifier it)))
2387 (defvar ibuffer-magit-filter-groups nil)
2388 (defun ibuffer-magit-define-filter-groups ()
2389 (when (and (not ibuffer-magit-filter-groups)
2390 (boundp 'magit-repo-dirs))
2391 (setq ibuffer-magit-filter-groups
2394 (file-name-nondirectory (directory-file-name it)))
2396 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
2398 (defun ibuffer-set-filter-groups-by-root ()
2400 ;; (ibuffer-projectile-define-filter-groups)
2401 ;; (ibuffer-magit-define-filter-groups)
2402 (setq ibuffer-filter-groups
2404 ;; ibuffer-projectile-filter-groups
2405 ibuffer-magit-filter-groups
2408 (or (mode . magit-log-edit-mode)
2409 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2410 (name . "^\\*Pymacs\\*$")
2411 (name . "^\\*helm.*\\*")
2412 (name . "^\\*Compile-log\\*$")
2413 (name . "^\\*Ido Completions\\*$")
2414 (name . "^\\*magit-\\(process\\)\\*$")
2418 (name . "^\\*scratch")
2419 (name . "^\\*Messages")
2422 (ibuffer-vc-generate-filter-groups-by-vc-root)
2423 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
2425 (defun toggle-ibuffer-filter-groups ()
2428 (let ((ibuf (get-buffer "*Ibuffer*")))
2430 (with-current-buffer ibuf
2431 (let ((selected-buffer (ibuffer-current-buffer)))
2432 (if (not ibuffer-filter-groups)
2433 (ibuffer-set-filter-groups-by-root)
2434 (setq ibuffer-filter-groups nil))
2435 (pop-to-buffer ibuf)
2436 (ibuffer-update nil t)
2437 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
2439 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
2441 (defun ibuffer-back-to-top ()
2443 (beginning-of-buffer)
2446 (defun ibuffer-jump-to-bottom ()
2452 (define-key ibuffer-mode-map
2453 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
2454 (define-key ibuffer-mode-map
2455 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
2457 (setq ibuffer-default-sorting-mode 'recency
2458 ibuffer-eliding-string "…"
2459 ibuffer-compile-formats t
2460 ibuffer-git-column-length 6
2461 ibuffer-show-empty-filter-groups nil
2462 ibuffer-default-directory "~/"
2465 (setq ibuffer-formats '((mark vc-status-mini
2467 (git-status 8 8 :left)
2471 (name 18 18 :left :elide)
2473 (size-h 9 -1 :right)
2475 (mode 16 16 :left :elide)
2476 " " filename-and-process)
2478 (git-status 8 8 :left)
2484 (setq ibuffer-saved-filter-groups
2487 ("dired" (mode . dired-mode))
2488 ("perl" (mode . cperl-mode))
2490 (mode . puppet-mode)
2491 (mode . yaml-mode)))
2492 ("ruby" (mode . ruby-mode))
2494 (name . "^\\*scratch\\*$")
2495 (name . "^\\*Compile-log\\*$")
2496 (name . "^\\*Completions\\*$")
2497 (name . "^\\*Messages\\*$")
2498 (name . "^\\*Backtrace\\*$")
2499 (name . "^\\*Packages*\\*$")
2500 (name . "^\\*Help*\\*$")
2503 (mode . message-mode)
2506 (mode . gnus-group-mode)
2507 (mode . gnus-summary-mode)
2508 (mode . gnus-article-mode)
2509 (name . "^\\.bbdb$")
2510 (name . "^\\.newsrc-dribble")))
2512 (filename . ".*/org/.*")
2513 (mode . org-agenda-mode)
2514 (name . "^diary$")))
2516 (mode . magit-log-edit-mode)
2517 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
2519 ;; -------------------------------------------------
2520 ;; programming languages #1
2522 (mode . emacs-lisp-mode)
2523 (mode . python-mode)
2525 (mode . coffee-mode)
2528 (mode . actionscript-mode)
2531 (mode . haskell-mode)
2537 ;; -------------------------------------------------
2538 ;; configuration/data files
2542 (mode . conf-mode)))
2543 ;; -------------------------------------------------
2544 ;; text/notetaking/org
2545 ("org agenda" (mode . org-agenda-mode))
2548 (name . "^\\*Calendar\\*$")
2549 (name . "^diary$")))
2553 (mode . markdown-mode)))
2554 ;; -------------------------------------------------
2557 (mode . image-mode)))
2558 ;; -------------------------------------------------
2560 ("w3m" (mode . w3m-mode))
2562 (mode . magit-status-mode)
2563 (mode . magit-log-mode)
2564 (mode . vc-annotate-mode)))
2565 ("dired" (mode . dired-mode))
2570 (name . "^\\*Personal Keybindings\\*$")))
2571 ;; -------------------------------------------------
2573 ("MORE" (or (mode . magit-log-edit-mode)
2574 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
2575 (name . "^\\*Pymacs\\*$")
2576 (name . "^\\*Compile-log\\*$")
2577 (name . "^\\*Completions\\*$")
2578 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
2580 ("*buffer*" (name . "\\*.*\\*"))))))
2582 (add-hook 'ibuffer-mode-hook
2584 (ibuffer-auto-mode 1)
2585 (ibuffer-switch-to-saved-filter-groups "default")))
2587 ;; Unless you turn this variable on you will be prompted every time
2588 ;; you want to delete a buffer, even unmodified ones, which is way
2589 ;; too cautious for most people. You’ll still be prompted for
2590 ;; confirmation when deleting modified buffers after the option has
2592 (setq ibuffer-expert t)
2597 [2015-10-16 Fri 16:28]
2598 #+BEGIN_SRC emacs-lisp
2601 :bind (("C-s" . swiper)
2603 ("C-c C-r" . ivy-resume)
2604 ("<f7>" . ivy-resume))
2608 (setq ivy-use-virtual-buffers t)))
2611 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
2612 ‘TAB’ completion is to typing things manually every time.”]]
2613 #+BEGIN_SRC emacs-lisp
2614 (use-package icicles
2615 :load-path "elisp/icicle/"
2620 Incremental mini-buffer completion preview: Type in the minibuffer,
2621 list of matching commands is echoed
2622 #+BEGIN_SRC emacs-lisp
2626 [2014-05-26 Mon 22:49]
2627 #+BEGIN_SRC emacs-lisp
2630 :commands (iedit-mode)
2632 :bind (("C-;" . iedit-mode)
2633 ("C-," . iedit-mode-toggle-on-function))
2638 [2014-05-20 Tue 23:35]
2639 #+BEGIN_SRC emacs-lisp
2641 :bind ("C-h C-i" . info-lookup-symbol)
2642 :commands info-lookup-symbol
2645 ;; (defadvice info-setup (after load-info+ activate)
2646 ;; (use-package info+))
2648 (defadvice Info-exit (after remove-info-window activate)
2649 "When info mode is quit, remove the window."
2650 (if (> (length (window-list)) 1)
2653 (use-package info-look
2654 :commands info-lookup-add-help)
2656 ** linum (line number)
2657 Various modes should have line numbers in front of each line.
2659 But then there are some where it would just be deadly - like org-mode,
2660 gnus, so we have a list of modes where we don't want to see it.
2661 #+BEGIN_SRC emacs-lisp
2663 :diminish linum-mode
2666 (setq linum-format "%3d ")
2667 (setq linum-mode-inhibit-modes-list '(org-mode
2674 (defadvice linum-on (around linum-on-inhibit-for-modes)
2675 "Stop the load of linum-mode for some major modes."
2676 (unless (member major-mode linum-mode-inhibit-modes-list)
2679 (ad-activate 'linum-on)
2681 (use-package linum-relative
2682 :ensure linum-relative
2685 (setq linum-format 'dynamic)
2688 (global-linum-mode 1))
2691 ** lisp editing stuff
2693 [2013-04-21 So 21:00]
2694 I'm not doing much of it, except for my emacs and gnus configs, but
2695 then I like it nice too...
2696 #+BEGIN_SRC emacs-lisp
2697 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
2699 (defun remove-elc-on-save ()
2700 "If you're saving an elisp file, likely the .elc is no longer valid."
2701 (make-local-variable 'after-save-hook)
2702 (add-hook 'after-save-hook
2704 (if (file-exists-p (concat buffer-file-name "c"))
2705 (delete-file (concat buffer-file-name "c"))))))
2707 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
2708 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
2710 (use-package paredit
2712 :diminish paredit-mode " π")
2714 (setq lisp-coding-hook 'lisp-coding-defaults)
2715 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
2717 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
2718 (add-hook 'emacs-lisp-mode-hook (lambda ()
2719 (run-hooks 'prelude-emacs-lisp-mode-hook)))
2721 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
2723 (after "elisp-slime-nav"
2724 '(diminish 'elisp-slime-nav-mode))
2725 (after "rainbow-mode"
2726 '(diminish 'rainbow-mode))
2728 '(diminish 'eldoc-mode))
2731 [2013-04-21 So 20:48]
2732 magit is a mode for interacting with git.
2733 #+BEGIN_SRC emacs-lisp
2736 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
2737 magit-git-repo-p magit-list-repos)
2739 :bind (("C-x g" . magit-status)
2740 ("C-x G" . magit-status-with-prefix))
2743 (setq magit-commit-signoff t
2744 magit-repo-dirs '("~/git"
2748 magit-repo-dirs-depth 4
2749 magit-log-auto-more t)
2751 (use-package magit-blame
2752 :commands magit-blame-mode
2755 ; (use-package magit-svn
2757 ; :commands (magit-svn-mode
2758 ; turn-on-magit-svn)
2761 (add-hook 'magit-mode-hook 'hl-line-mode)
2762 (defun magit-status-with-prefix ()
2764 (let ((current-prefix-arg '(4)))
2765 (call-interactively 'magit-status)))
2769 (setenv "GIT_PAGER" "")
2771 (unbind-key "M-h" magit-mode-map)
2772 (unbind-key "M-s" magit-mode-map)
2773 (add-to-list 'magit-no-confirm 'stage-all-changes)
2774 (setq magit-push-always-verify nil)
2775 (setq magit-last-seen-setup-instructions "2.1.0")
2776 ; (use-package magit-find-file
2777 ; :ensure magit-find-file
2778 ; :commands (magit-find-file-completing-read)
2782 ; (bind-key "C-x C-f" 'magit-find-file-completing-read magit-mode-map)))
2784 (add-hook 'magit-log-edit-mode-hook
2786 (set-fill-column 72)
2789 (add-hook 'git-rebase-mode-hook
2793 (defadvice magit-status (around magit-fullscreen activate)
2794 (window-configuration-to-register :magit-fullscreen)
2796 (delete-other-windows))
2798 (defun magit-quit-session ()
2799 "Restores the previous window configuration and kills the magit buffer"
2802 (jump-to-register :magit-fullscreen))
2804 (bind-key "q" 'magit-quit-session magit-status-mode-map)
2806 (defun magit-rebase-unpushed (commit &optional args)
2807 "Start an interactive rebase sequence over all unpushed commits."
2808 (interactive (list (magit-get-tracked-branch)
2809 (magit-rebase-arguments)))
2810 (if (setq commit (magit-rebase-interactive-assert commit))
2811 (magit-run-git-sequencer "rebase" "-i" commit args)
2814 (magit-rebase-interactive (concat commit "^") (list ,@args))))))
2816 (magit-define-popup-action 'magit-rebase-popup ?l "Rebase unpushed" 'magit-rebase-unpushed)
2820 [2014-05-20 Tue 23:04]
2821 #+BEGIN_SRC emacs-lisp
2822 (use-package markdown-mode
2823 :mode (("\\.md\\'" . markdown-mode)
2824 ("\\.mdwn\\'" . markdown-mode))
2828 #+BEGIN_SRC emacs-lisp
2829 (use-package message
2832 (setq message-kill-buffer-on-exit t)))
2835 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
2837 I want to access it from anywhere using =F6=.
2838 #+BEGIN_SRC emacs-lisp
2839 (use-package mingus-stays-home
2840 :bind ( "<f6>" . mingus)
2844 (setq mingus-dired-add-keys t)
2845 (setq mingus-mode-always-modeline nil)
2846 (setq mingus-mode-line-show-elapsed-percentage nil)
2847 (setq mingus-mode-line-show-volume nil)
2848 (setq mingus-mpd-config-file "/etc/mpd.conf")
2849 (setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
2850 (setq mingus-mpd-root "/share/music/")))
2854 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
2855 #+BEGIN_SRC emacs-lisp
2856 (use-package miniedit
2861 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
2862 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
2863 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
2864 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
2869 [2013-05-21 Tue 23:39]
2870 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
2871 coexist in one buffer.
2872 #+BEGIN_SRC emacs-lisp :tangle no
2873 (use-package mmm-auto
2877 (setq mmm-global-mode 'buffers-with-submode-classes)
2878 (setq mmm-submode-decoration-level 2)
2879 (eval-after-load 'mmm-vars
2885 :face mmm-code-submode-face
2886 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
2887 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
2888 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2889 @ "\n" _ "\n" @ "</script>" @)))
2892 :face mmm-code-submode-face
2893 :front "<style[^>]*>[ \t]*\n?"
2894 :back "[ \t]*</style>"
2895 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
2896 @ "\n" _ "\n" @ "</style>" @)))
2899 :face mmm-code-submode-face
2902 (dolist (mode (list 'html-mode 'nxml-mode))
2903 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
2904 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
2909 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
2911 #+BEGIN_SRC emacs-lisp
2912 (use-package mo-git-blame
2913 :ensure mo-git-blame
2914 :commands (mo-git-blame-current
2918 (setq mo-git-blame-blame-window-width 25)))
2922 [2013-04-08 Mon 23:57]
2923 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
2924 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
2925 #+BEGIN_SRC emacs-lisp
2926 (use-package multiple-cursors
2927 :ensure multiple-cursors
2929 :commands (mc/remove-fake-cursors
2930 mc/create-fake-cursor-at-point
2931 mc/pop-state-from-overlay
2932 mc/maybe-multiple-cursors-mode)
2933 :defines (multiple-cursors-mode
2935 mc--read-quoted-char
2936 rectangular-region-mode)
2937 :bind (("C-S-c C-S-c" . mc/edit-lines)
2938 ("C->" . mc/mark-next-like-this)
2939 ("C-<" . mc/mark-previous-like-this)
2940 ("C-c C-<" . mc/mark-all-like-this)
2941 ("C-c i" . mc/insert-numbers))
2944 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
2945 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
2946 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
2947 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
2948 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
2949 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
2952 [2014-08-27 Wed 17:15]
2954 #+BEGIN_SRC emacs-lisp
2955 (use-package neotree
2958 :bind (("<f8>" . neotree-toggle))
2959 :commands (neotree-find
2964 (setq neo-smart-open t))
2967 (bind-key "^" 'neotree-select-up-node neotree-mode-map)))
2970 [2013-05-22 Wed 22:02]
2971 nxml-mode is a major mode for editing XML.
2972 #+BEGIN_SRC emacs-lisp
2977 '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss"
2980 (setq magic-mode-alist (cons '("<\\?xml " . nxml-mode) magic-mode-alist))
2981 (fset 'xml-mode 'nxml-mode)
2982 (setq nxml-slash-auto-complete-flag t)
2984 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
2985 (defun pp-xml-region (begin end)
2986 "Pretty format XML markup in region. The function inserts
2987 linebreaks to separate tags that have nothing but whitespace
2988 between them. It then indents the markup by using nxml's
2994 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
2995 (backward-char) (insert "\n"))
2996 (indent-region begin end)))
2998 ;;----------------------------------------------------------------------------
2999 ;; Integration with tidy for html + xml
3000 ;;----------------------------------------------------------------------------
3001 ;; tidy is autoloaded
3002 (eval-after-load 'tidy
3004 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
3005 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
3010 *** General settings
3011 [2013-04-28 So 17:06]
3013 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
3014 it is quite extensive. Nevertheless, it starts out small, loading it.
3015 #+BEGIN_SRC emacs-lisp
3019 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
3020 that we need org-protocol.
3021 #+BEGIN_SRC emacs-lisp
3022 (require 'org-protocol)
3027 My current =org-agenda-files= variable only includes a set of
3029 #+BEGIN_SRC emacs-lisp
3030 (setq org-agenda-files (quote ("~/org/"
3036 (setq org-default-notes-file "~/org/notes.org")
3038 =org-mode= manages the =org-agenda-files= variable automatically using
3039 =C-c [= and =C-c ]= to add and remove files respectively. However,
3040 this replaces my directory list with a list of explicit filenames
3041 instead and is not what I want. If this occurs then adding a new org
3042 file to any of the above directories will not contribute to my agenda
3043 and I will probably miss something important.
3045 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
3046 prevent messing up my list of directories in the =org-agenda-files=
3047 variable. I just add and remove directories manually here. Changing
3048 the list of directories in =org-agenda-files= happens very rarely
3049 since new files in existing directories are automatically picked up.
3051 #+BEGIN_SRC emacs-lisp
3052 ;; Keep tasks with dates on the global todo lists
3053 (setq org-agenda-todo-ignore-with-date nil)
3055 ;; Keep tasks with deadlines on the global todo lists
3056 (setq org-agenda-todo-ignore-deadlines nil)
3058 ;; Keep tasks with scheduled dates on the global todo lists
3059 (setq org-agenda-todo-ignore-scheduled nil)
3061 ;; Keep tasks with timestamps on the global todo lists
3062 (setq org-agenda-todo-ignore-timestamp nil)
3064 ;; Remove completed deadline tasks from the agenda view
3065 (setq org-agenda-skip-deadline-if-done t)
3067 ;; Remove completed scheduled tasks from the agenda view
3068 (setq org-agenda-skip-scheduled-if-done t)
3070 ;; Remove completed items from search results
3071 (setq org-agenda-skip-timestamp-if-done t)
3073 ;; Include agenda archive files when searching for things
3074 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
3076 ;; Show all future entries for repeating tasks
3077 (setq org-agenda-repeating-timestamp-show-all t)
3079 ;; Show all agenda dates - even if they are empty
3080 (setq org-agenda-show-all-dates t)
3082 ;; Sorting order for tasks on the agenda
3083 (setq org-agenda-sorting-strategy
3084 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
3085 (todo category-up priority-down effort-up)
3086 (tags category-up priority-down effort-up)
3087 (search category-up))))
3089 ;; Start the weekly agenda on Monday
3090 (setq org-agenda-start-on-weekday 1)
3092 ;; Enable display of the time grid so we can see the marker for the current time
3093 (setq org-agenda-time-grid (quote ((daily today remove-match)
3094 #("----------------" 0 16 (org-heading t))
3095 (0800 1000 1200 1400 1500 1700 1900 2100))))
3097 ;; Display tags farther right
3098 (setq org-agenda-tags-column -102)
3100 ; position the habit graph on the agenda to the right of the default
3101 (setq org-habit-graph-column 50)
3103 ; turn habits back on
3104 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
3107 ;; Agenda sorting functions
3109 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
3112 (setq org-deadline-warning-days 30)
3114 ;; Always hilight the current agenda line
3115 (add-hook 'org-agenda-mode-hook
3116 '(lambda () (hl-line-mode 1))
3120 #+BEGIN_SRC emacs-lisp
3121 (setq org-agenda-persistent-filter t)
3122 (add-hook 'org-agenda-mode-hook
3123 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
3126 (add-hook 'org-agenda-mode-hook
3127 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
3130 (add-hook 'org-agenda-mode-hook
3131 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
3134 (add-hook 'org-agenda-mode-hook
3135 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
3138 (add-hook 'org-agenda-mode-hook
3139 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
3142 ; Rebuild the reminders everytime the agenda is displayed
3143 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
3145 ;(if (file-exists-p "~/org/refile.org")
3146 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
3148 ; Activate appointments so we get notifications
3151 (setq org-agenda-log-mode-items (quote (closed clock state)))
3152 (if (> emacs-major-version 23)
3153 (setq org-agenda-span 3)
3154 (setq org-agenda-ndays 3))
3156 (setq org-agenda-show-all-dates t)
3157 (setq org-agenda-start-on-weekday nil)
3158 (setq org-deadline-warning-days 14)
3161 *** Global keybindings.
3162 Start off by defining a series of keybindings.
3164 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
3165 setup manually, not by org-mode. Also turn off =C-c ;=, which
3166 comments headlines - a function never used.
3167 #+BEGIN_SRC emacs-lisp
3168 (add-hook 'org-mode-hook
3170 (org-defkey org-mode-map "\C-c[" 'undefined)
3171 (org-defkey org-mode-map "\C-c]" 'undefined)
3172 (org-defkey org-mode-map "\C-c;" 'undefined))
3176 And now a largish set of keybindings...
3177 #+BEGIN_SRC emacs-lisp
3178 (bind-key "C-c l" 'org-store-link)
3179 (bind-key "C-c a" 'org-agenda)
3180 ;(bind-key "C-c b" 'org-iswitchb)
3181 (define-key mode-specific-map [?a] 'org-agenda)
3183 (bind-key "<f12>" 'org-agenda)
3184 (bind-key "<f5>" 'bh/org-todo)
3185 (bind-key "<S-f5>" 'bh/widen)
3186 ;(bind-key "<f7>" 'bh/set-truncate-lines)
3187 ;(bind-key "<f8>" 'org-cycle-agenda-files)
3189 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
3190 (bind-key "<f9> b" 'bbdb)
3191 (bind-key "<f9> c" 'calendar)
3192 (bind-key "<f9> f" 'boxquote-insert-file)
3193 (bind-key "<f9> h" 'bh/hide-other)
3194 (bind-key "<f9> n" 'org-narrow-to-subtree)
3195 (bind-key "<f9> w" 'widen)
3196 (bind-key "<f9> u" 'bh/narrow-up-one-level)
3197 (bind-key "<f9> I" 'bh/punch-in)
3198 (bind-key "<f9> O" 'bh/punch-out)
3199 (bind-key "<f9> H" 'jj/punch-in-hw)
3200 (bind-key "<f9> W" 'jj/punch-out-hw)
3201 (bind-key "<f9> o" 'bh/make-org-scratch)
3202 (bind-key "<f9> p" 'bh/phone-call)
3203 (bind-key "<f9> r" 'boxquote-region)
3204 (bind-key "<f9> s" 'bh/switch-to-scratch)
3205 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
3206 (bind-key "<f9> T" 'tabify)
3207 (bind-key "<f9> U" 'untabify)
3208 (bind-key "<f9> v" 'visible-mode)
3209 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
3210 (bind-key "C-<f9>" 'previous-buffer)
3211 (bind-key "C-<f10>" 'next-buffer)
3212 (bind-key "M-<f9>" 'org-toggle-inline-images)
3213 ;(bind-key "C-x n r" 'narrow-to-region)
3214 (bind-key "<f11>" 'org-clock-goto)
3215 (bind-key "C-<f11>" 'org-clock-in)
3216 (bind-key "C-M-r" 'org-capture)
3217 (bind-key "C-c r" 'org-capture)
3218 (bind-key "C-S-<f12>" 'bh/save-then-publish)
3219 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
3223 *** Tasks, States, Todo fun
3225 First we define the global todo keywords.
3226 #+BEGIN_SRC emacs-lisp
3227 (setq org-todo-keywords
3228 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
3229 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
3231 (setq org-todo-keyword-faces
3232 (quote (("TODO" :foreground "red" :weight bold)
3233 ("NEXT" :foreground "light blue" :weight bold)
3234 ("DONE" :foreground "forest green" :weight bold)
3235 ("WAITING" :foreground "orange" :weight bold)
3236 ("HOLD" :foreground "orange" :weight bold)
3237 ("DELEGATED" :foreground "yellow" :weight bold)
3238 ("CANCELLED" :foreground "dark green" :weight bold)
3239 ("PHONE" :foreground "dark green" :weight bold))))
3242 **** Fast Todo Selection
3243 Fast todo selection allows changing from any task todo state to any
3244 other state directly by selecting the appropriate key from the fast
3245 todo selection key menu.
3246 #+BEGIN_SRC emacs-lisp
3247 (setq org-use-fast-todo-selection t)
3249 Changing a task state is done with =C-c C-t KEY=
3251 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
3254 #+BEGIN_SRC emacs-lisp
3255 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
3257 allows changing todo states with S-left and S-right skipping all of
3258 the normal processing when entering or leaving a todo state. This
3259 cycles through the todo states but skips setting timestamps and
3260 entering notes which is very convenient when all you want to do is fix
3261 up the status of an entry.
3263 **** Todo State Triggers
3264 I have a few triggers that automatically assign tags to tasks based on
3265 state changes. If a task moves to =CANCELLED= state then it gets a
3266 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
3267 =CANCELLED= tag. These are used for filtering tasks in agenda views
3268 which I'll talk about later.
3270 The triggers break down to the following rules:
3272 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
3273 - Moving a task to =WAITING= adds a =WAITING= tag
3274 - Moving a task to =HOLD= adds a =WAITING= tag
3275 - Moving a task to a done state removes a =WAITING= tag
3276 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
3277 - Moving a task to =NEXT= removes a =WAITING= tag
3278 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
3280 The tags are used to filter tasks in the agenda views conveniently.
3281 #+BEGIN_SRC emacs-lisp
3282 (setq org-todo-state-tags-triggers
3283 (quote (("CANCELLED" ("CANCELLED" . t))
3284 ("WAITING" ("WAITING" . t))
3285 ("HOLD" ("WAITING" . t) ("HOLD" . t))
3286 (done ("WAITING") ("HOLD"))
3287 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
3288 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
3289 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
3292 *** Capturing new tasks
3293 Org capture replaces the old remember mode.
3294 #+BEGIN_SRC emacs-lisp
3295 (setq org-directory "~/org")
3296 (setq org-default-notes-file "~/org/refile.org")
3298 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
3299 ;; see http://orgmode.org/manual/Template-elements.html
3300 (setq org-capture-templates
3301 (quote (("t" "todo" entry (file "~/org/refile.org")
3302 "* TODO %?\nAdded: %U\n"
3303 :clock-in t :clock-resume t)
3304 ("l" "linktodo" entry (file "~/org/refile.org")
3305 "* TODO %?\nAdded: %U\n%a\n"
3306 :clock-in t :clock-resume t)
3307 ("r" "respond" entry (file "~/org/refile.org")
3308 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
3309 :clock-in t :clock-resume t :immediate-finish t)
3310 ("n" "note" entry (file "~/org/refile.org")
3311 "* %? :NOTE:\nAdded: %U\n%a\n"
3312 :clock-in t :clock-resume t)
3313 ("d" "Delegated" entry (file "~/org/refile.org")
3314 "* DELEGATED %?\nAdded: %U\n%a\n"
3315 :clock-in t :clock-resume t)
3316 ("j" "Journal" entry (file+datetree "~/org/diary.org")
3318 :clock-in t :clock-resume t)
3319 ("w" "org-protocol" entry (file "~/org/refile.org")
3320 "* TODO Review %c\nAdded: %U\n"
3321 :immediate-finish t)
3322 ("p" "Phone call" entry (file "~/org/refile.org")
3323 "* PHONE %? :PHONE:\nAdded: %U"
3324 :clock-in t :clock-resume t)
3325 ("x" "Bookmark link" entry (file "~/org/refile.org")
3326 "* Bookmark: %c\n%i\nAdded: %U\n"
3327 :immediate-finish t)
3328 ("h" "Habit" entry (file "~/org/refile.org")
3329 "* 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")
3333 Capture mode now handles automatically clocking in and out of a
3334 capture task. This all works out of the box now without special hooks.
3335 When I start a capture mode task the task is clocked in as specified
3336 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
3337 resumes on the original clocking task.
3339 The quick clocking in and out of capture mode tasks (often it takes
3340 less than a minute to capture some new task details) can leave
3341 empty clock drawers in my tasks which aren't really useful.
3342 The following prevents this.
3343 #+BEGIN_SRC emacs-lisp
3344 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
3348 All my newly captured entries end up in =refile.org= and want to be
3349 moved over to the right place. The following is the setup for it.
3350 #+BEGIN_SRC emacs-lisp
3351 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
3352 (setq org-refile-targets (quote ((nil :maxlevel . 9)
3353 (org-agenda-files :maxlevel . 9))))
3355 ; Use full outline paths for refile targets - we file directly with IDO
3356 (setq org-refile-use-outline-path t)
3358 ; Targets complete directly with IDO
3359 (setq org-outline-path-complete-in-steps nil)
3361 ; Allow refile to create parent tasks with confirmation
3362 (setq org-refile-allow-creating-parent-nodes (quote confirm))
3364 ; Use IDO for both buffer and file completion and ido-everywhere to t
3365 (setq org-completion-use-ido t)
3366 (setq org-completion-use-iswitchb nil)
3367 :; Use IDO for both buffer and file completion and ido-everywhere to t
3368 ;(setq ido-everywhere t)
3369 ;(setq ido-max-directory-size 100000)
3370 ;(ido-mode (quote both))
3371 ; Use the current window when visiting files and buffers with ido
3372 (setq ido-default-file-method 'selected-window)
3373 (setq ido-default-buffer-method 'selected-window)
3375 ;;;; Refile settings
3376 (setq org-refile-target-verify-function 'bh/verify-refile-target)
3380 Agenda view is the central place for org-mode interaction...
3381 #+BEGIN_SRC emacs-lisp
3382 ;; Do not dim blocked tasks
3383 (setq org-agenda-dim-blocked-tasks nil)
3384 ;; Compact the block agenda view
3385 (setq org-agenda-compact-blocks t)
3387 ;; Custom agenda command definitions
3388 (setq org-agenda-custom-commands
3389 (quote (("N" "Notes" tags "NOTE"
3390 ((org-agenda-overriding-header "Notes")
3391 (org-tags-match-list-sublevels t)))
3392 ("h" "Habits" tags-todo "STYLE=\"habit\""
3393 ((org-agenda-overriding-header "Habits")
3394 (org-agenda-sorting-strategy
3395 '(todo-state-down effort-up category-keep))))
3399 ((org-agenda-overriding-header "Tasks to Refile")
3400 (org-tags-match-list-sublevels nil)))
3401 (tags-todo "-HOLD-CANCELLED/!"
3402 ((org-agenda-overriding-header "Projects")
3403 (org-agenda-skip-function 'bh/skip-non-projects)
3404 (org-agenda-sorting-strategy
3406 (tags-todo "-CANCELLED/!"
3407 ((org-agenda-overriding-header "Stuck Projects")
3408 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3409 (tags-todo "-WAITING-CANCELLED/!NEXT"
3410 ((org-agenda-overriding-header "Next Tasks")
3411 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3412 (org-agenda-todo-ignore-scheduled t)
3413 (org-agenda-todo-ignore-deadlines t)
3414 (org-agenda-todo-ignore-with-date t)
3415 (org-tags-match-list-sublevels t)
3416 (org-agenda-sorting-strategy
3417 '(todo-state-down effort-up category-keep))))
3418 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3419 ((org-agenda-overriding-header "Tasks")
3420 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3421 (org-agenda-todo-ignore-scheduled t)
3422 (org-agenda-todo-ignore-deadlines t)
3423 (org-agenda-todo-ignore-with-date t)
3424 (org-agenda-sorting-strategy
3426 (tags-todo "-CANCELLED+WAITING/!"
3427 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
3428 (org-agenda-skip-function 'bh/skip-stuck-projects)
3429 (org-tags-match-list-sublevels nil)
3430 (org-agenda-todo-ignore-scheduled 'future)
3431 (org-agenda-todo-ignore-deadlines 'future)))
3433 ((org-agenda-overriding-header "Tasks to Archive")
3434 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3435 (org-tags-match-list-sublevels nil))))
3437 ("r" "Tasks to Refile" tags "REFILE"
3438 ((org-agenda-overriding-header "Tasks to Refile")
3439 (org-tags-match-list-sublevels nil)))
3440 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
3441 ((org-agenda-overriding-header "Stuck Projects")
3442 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
3443 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
3444 ((org-agenda-overriding-header "Next Tasks")
3445 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
3446 (org-agenda-todo-ignore-scheduled t)
3447 (org-agenda-todo-ignore-deadlines t)
3448 (org-agenda-todo-ignore-with-date t)
3449 (org-tags-match-list-sublevels t)
3450 (org-agenda-sorting-strategy
3451 '(todo-state-down effort-up category-keep))))
3452 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
3453 ((org-agenda-overriding-header "Tasks")
3454 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
3455 (org-agenda-sorting-strategy
3457 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
3458 ((org-agenda-overriding-header "Projects")
3459 (org-agenda-skip-function 'bh/skip-non-projects)
3460 (org-agenda-sorting-strategy
3462 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
3463 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
3464 (org-tags-match-list-sublevels nil))
3465 ("A" "Tasks to Archive" tags "-REFILE/"
3466 ((org-agenda-overriding-header "Tasks to Archive")
3467 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
3468 (org-tags-match-list-sublevels nil))))))
3470 ; Overwrite the current window with the agenda
3471 (setq org-agenda-window-setup 'current-window)
3476 #+BEGIN_SRC emacs-lisp
3478 ;; Resume clocking task when emacs is restarted
3479 (org-clock-persistence-insinuate)
3481 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
3482 (setq org-clock-history-length 36)
3483 ;; Resume clocking task on clock-in if the clock is open
3484 (setq org-clock-in-resume t)
3485 ;; Change tasks to NEXT when clocking in
3486 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
3487 ;; Separate drawers for clocking and logs
3488 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
3489 ;; Save clock data and state changes and notes in the LOGBOOK drawer
3490 (setq org-clock-into-drawer t)
3491 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
3492 (setq org-clock-out-remove-zero-time-clocks t)
3493 ;; Clock out when moving task to a done state
3494 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
3495 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
3496 (setq org-clock-persist t)
3497 ;; Do not prompt to resume an active clock
3498 (setq org-clock-persist-query-resume nil)
3499 ;; Enable auto clock resolution for finding open clocks
3500 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
3501 ;; Include current clocking task in clock reports
3502 (setq org-clock-report-include-clocking-task t)
3504 ; use discrete minute intervals (no rounding) increments
3505 (setq org-time-stamp-rounding-minutes (quote (1 1)))
3507 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
3509 (setq bh/keep-clock-running nil)
3511 (setq org-agenda-clock-consistency-checks
3512 (quote (:max-duration "4:00"
3515 :gap-ok-around ("4:00"))))
3519 **** Setting a default clock task
3520 Per default the =** Organization= task in my tasks.org file receives
3521 misc clock time. This is the task I clock in on when I punch in at the
3522 start of my work day with =F9-I=. Punching-in anywhere clocks in this
3523 Organization task as the default task.
3525 If I want to change the default clocking task I just visit the
3526 new task in any org buffer and clock it in with =C-u C-u C-c C-x
3527 C-i=. Now this new task that collects miscellaneous clock
3528 minutes when the clock would normally stop.
3530 You can quickly clock in the default clocking task with =C-u C-c
3531 C-x C-i d=. Another option is to repeatedly clock out so the
3532 clock moves up the project tree until you clock out the
3533 top-level task and the clock moves to the default task.
3536 #+BEGIN_SRC emacs-lisp
3537 ;; Agenda clock report parameters
3538 (setq org-agenda-clockreport-parameter-plist
3539 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
3541 ;; Agenda log mode items to display (closed and state changes by default)
3542 (setq org-agenda-log-mode-items (quote (closed state)))
3544 **** Task estimates, column view
3545 Setup column view globally with the following headlines
3546 #+BEGIN_SRC emacs-lisp
3547 ; Set default column view headings: Task Effort Clock_Summary
3548 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
3550 Setup the estimate for effort values.
3551 #+BEGIN_SRC emacs-lisp
3552 ; global Effort estimate values
3553 ; global STYLE property values for completion
3554 (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")
3555 ("STYLE_ALL" . "habit"))))
3559 Tags are mostly used for filtering inside the agenda.
3560 #+BEGIN_SRC emacs-lisp
3561 ; Tags with fast selection keys
3562 (setq org-tag-alist (quote ((:startgroup)
3580 ; Allow setting single tags without the menu
3581 (setq org-fast-tag-selection-single-key (quote expert))
3583 ; For tag searches ignore tasks with scheduled and deadline dates
3584 (setq org-agenda-tags-todo-honor-ignore-options t)
3588 #+BEGIN_SRC emacs-lisp
3589 (setq org-archive-mark-done nil)
3590 (setq org-archive-location "%s_archive::* Archived Tasks")
3594 #+BEGIN_SRC emacs-lisp
3595 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
3596 (setq org-plantuml-jar-path "~/java/plantuml.jar")
3598 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
3600 ; Make babel results blocks lowercase
3601 (setq org-babel-results-keyword "results")
3603 (org-babel-do-load-languages
3604 (quote org-babel-load-languages)
3605 (quote ((emacs-lisp . t)
3624 ; Do not prompt to confirm evaluation
3625 ; This may be dangerous - make sure you understand the consequences
3626 ; of setting this -- see the docstring for details
3627 (setq org-confirm-babel-evaluate nil)
3629 ; Use fundamental mode when editing plantuml blocks with C-c '
3630 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
3633 #+BEGIN_SRC emacs-lisp
3634 ;; Don't have images visible on startup, breaks on console
3635 (setq org-startup-with-inline-images nil)
3638 #+BEGIN_SRC emacs-lisp
3639 (add-to-list 'org-structure-template-alist
3640 '("n" "#+BEGIN_COMMENT\n?\n#+END_COMMENT"
3641 "<comment>\n?\n</comment>"))
3643 **** ditaa, graphviz, etc
3644 Those are all nice tools. Look at
3645 http://doc.norang.ca/org-mode.html#playingwithditaa for a nice intro
3648 *** Publishing and exporting
3651 Org-mode can export to a variety of publishing formats including (but not limited to)
3654 (plain text - but not the original org-mode file)
3658 which enables getting to lots of other formats like ODF, XML, etc
3660 via LaTeX or Docbook
3663 A new exporter created by Nicolas Goaziou was introduced in org 8.0.
3665 #+BEGIN_SRC emacs-lisp
3666 ;; Explicitly load required exporters
3670 (require 'ox-reveal)
3671 ;; FIXME, check the following two
3672 ;(require 'ox-icalendar)
3675 ; experimenting with docbook exports - not finished
3676 (setq org-export-docbook-xsl-fo-proc-command "fop %s %s")
3677 (setq org-export-docbook-xslt-proc-command "xsltproc --output %s /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl %s")
3679 (setq org-reveal-root "file:///home/joerg/devel/ganeticon2015/reveal.js/reveal.js")
3681 ;; define categories that should be excluded
3682 (setq org-export-exclude-category (list "google" "google"))
3683 (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
3685 ; define how the date strings look
3686 (setq org-export-date-timestamp-format "%Y-%m-%d")
3687 ; Inline images in HTML instead of producting links to the image
3688 (setq org-html-inline-images t)
3689 ; Do not use sub or superscripts - I currently don't need this functionality in my documents
3690 (setq org-export-with-sub-superscripts nil)
3692 (setq org-html-head-extra (concat
3693 "<link rel=\"stylesheet\" href=\"https://ganneff.de/stylesheet.css\" type=\"text/css\" />\n"
3695 (setq org-html-head-include-default-style nil)
3696 ; Do not generate internal css formatting for HTML exports
3697 (setq org-export-htmlize-output-type (quote css))
3698 ; Export with LaTeX fragments
3699 (setq org-export-with-LaTeX-fragments t)
3700 ; Increase default number of headings to export
3701 (setq org-export-headline-levels 6)
3704 (setq org-publish-project-alist
3707 :base-directory "~/.emacs.d/"
3708 :base-extension "org"
3710 :publishing-directory "/develop/www/emacs"
3712 :publishing-function org-html-publish-to-html
3713 :headline-levels 4 ; Just the default for this project.
3719 :base-directory "~/.emacs.d/"
3720 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
3721 :publishing-directory "/develop/www/emacs"
3722 :exclude "elisp\\|elpa\\|elpa.off\\|auto-save-list\\|cache\\|eshell\\|image-dired\\|themes\\|url"
3724 :publishing-function org-publish-attachment
3726 ("inherit-org-info-js"
3727 :base-directory "/develop/vcs/org-info-js/"
3729 :base-extension "js"
3730 :publishing-directory "/develop/www/"
3731 :publishing-function org-publish-attachment
3733 ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
3738 (setq org-export-with-timestamps nil)
3743 #+BEGIN_SRC emacs-lisp
3744 (setq org-latex-to-pdf-process
3745 '("xelatex -interaction nonstopmode %f"
3746 "xelatex -interaction nonstopmode %f")) ;; for multiple passes
3747 (setq org-export-latex-listings 'minted)
3748 (setq org-latex-listings t)
3750 ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
3751 ;; but adapted to use latexmk 4.20 or higher.
3752 (defun my-auto-tex-cmd ()
3753 "When exporting from .org with latex, automatically run latex,
3754 pdflatex, or xelatex as appropriate, using latexmk."
3756 ;; default command: oldstyle latex via dvi
3757 (setq texcmd "latexmk -dvi -pdfps -quiet %f")
3759 (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
3760 (setq texcmd "latexmk -pdf -quiet %f"))
3762 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3763 (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
3764 ;; LaTeX compilation command
3765 (setq org-latex-to-pdf-process (list texcmd)))
3767 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
3769 ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
3770 (setq org-export-latex-packages-alist
3772 ("" "longtable" nil)
3777 (defun my-auto-tex-parameters ()
3778 "Automatically select the tex packages to include."
3779 ;; default packages for ordinary latex or pdflatex export
3780 (setq org-export-latex-default-packages-alist
3781 '(("AUTO" "inputenc" t)
3791 ("" "hyperref" nil)))
3793 ;; Packages to include when xelatex is used
3794 (if (string-match "LATEX_CMD: xelatex" (buffer-string))
3795 (setq org-export-latex-default-packages-alist
3800 ("german" "babel" t)
3801 ("babel" "csquotes" t)
3803 ("xetex" "hyperref" nil)
3806 (if (string-match "#+LATEX_CMD: xelatex" (buffer-string))
3807 (setq org-export-latex-classes
3809 "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
3810 ("\\section{%s}" . "\\section*{%s}")
3811 ("\\subsection{%s}" . "\\subsection*{%s}")
3812 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
3813 ("\\paragraph{%s}" . "\\paragraph*{%s}")
3814 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
3815 org-export-latex-classes))))
3817 (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
3820 *** Prevent editing invisible text
3821 The following setting prevents accidentally editing hidden text when
3822 the point is inside a folded region. This can happen if you are in
3823 the body of a heading and globally fold the org-file with =S-TAB=
3825 I find invisible edits (and undo's) hard to deal with so now I can't
3826 edit invisible text. =C-c C-r= (org-reveal) will display where the
3827 point is if it is buried in invisible text to allow editing again.
3829 #+BEGIN_SRC emacs-lisp
3830 (setq org-catch-invisible-edits 'error)
3834 #+BEGIN_SRC emacs-lisp
3835 ;; disable the default org-mode stuck projects agenda view
3836 (setq org-stuck-projects (quote ("" nil nil "")))
3838 ; force showing the next headline.
3839 (setq org-show-entry-below (quote ((default))))
3841 (setq org-show-following-heading t)
3842 (setq org-show-hierarchy-above t)
3843 (setq org-show-siblings (quote ((default))))
3845 (setq org-special-ctrl-a/e t)
3846 (setq org-special-ctrl-k t)
3847 (setq org-yank-adjusted-subtrees t)
3849 (setq org-table-export-default-format "orgtbl-to-csv")
3853 The following setting adds alphabetical lists like
3857 #+BEGIN_SRC emacs-lisp
3858 (if (> emacs-major-version 23)
3859 (setq org-list-allow-alphabetical t)
3860 (setq org-alphabetical-lists t))
3863 #+BEGIN_SRC emacs-lisp
3864 (setq org-remove-highlights-with-change nil)
3866 (setq org-list-demote-modify-bullet (quote (("+" . "-")
3873 (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
3876 ; If we leave Emacs running overnight - reset the appointments one minute after midnight
3877 (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
3882 #+BEGIN_SRC emacs-lisp
3883 ;; Enable abbrev-mode
3884 (add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
3885 (setq org-startup-indented t)
3886 (setq org-startup-folded t)
3887 (setq org-cycle-separator-lines 0)
3890 I find extra blank lines in lists and headings a bit of a nuisance.
3891 To get a body after a list you need to include a blank line between
3892 the list entry and the body -- and indent the body appropriately.
3893 Most of my lists have no body detail so I like the look of collapsed
3894 lists with no blank lines better.
3896 The following setting prevents creating blank lines before headings
3897 but allows list items to adapt to existing blank lines around the items:
3898 #+BEGIN_SRC emacs-lisp
3899 (setq org-blank-before-new-entry (quote ((heading)
3900 (plain-list-item . auto))))
3903 #+BEGIN_SRC emacs-lisp
3904 (setq org-reverse-note-order nil)
3905 (setq org-default-notes-file "~/notes.org")
3908 Enforce task blocking. Tasks can't go done when there is any subtask
3909 still open. Unless they have a property of =NOBLOCKING: t=
3910 #+BEGIN_SRC emacs-lisp
3911 (setq org-enforce-todo-checkbox-dependencies t)
3912 (setq org-enforce-todo-dependencies t)
3915 #+BEGIN_SRC emacs-lisp
3916 (setq org-fast-tag-selection-single-key (quote expert))
3917 (setq org-footnote-auto-adjust t)
3918 (setq org-hide-block-startup t)
3919 (setq org-icalendar-alarm-time 15)
3920 (setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
3921 (setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
3922 (setq org-icalendar-honor-noexport-tag t)
3923 (setq org-icalendar-include-bbdb-anniversaries nil)
3924 (setq org-icalendar-include-body 200)
3925 (setq org-icalendar-include-todo nil)
3926 (setq org-icalendar-store-UID t)
3927 (setq org-icalendar-timezone "Europe/Berlin")
3928 (setq org-insert-mode-line-in-empty-file t)
3929 (setq org-log-done (quote note))
3930 (setq org-log-into-drawer t)
3931 (setq org-log-state-notes-insert-after-drawers nil)
3932 (setq org-log-reschedule (quote time))
3933 (setq org-log-states-order-reversed t)
3934 (setq org-mobile-agendas (quote all))
3935 (setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
3936 (setq org-mobile-inbox-for-pull "~/org/refile.org")
3937 (setq org-remember-store-without-prompt t)
3938 (setq org-return-follows-link t)
3939 (setq org-reverse-note-order t)
3941 ; regularly save our org-mode buffers
3942 (run-at-time "00:59" 3600 'org-save-all-org-buffers)
3944 (setq org-log-done t)
3946 (setq org-enable-priority-commands t)
3947 (setq org-default-priority ?E)
3948 (setq org-lowest-priority ?E)
3953 Speed commands enable single-letter commands in Org-mode files when
3954 the point is at the beginning of a headline, or at the beginning of a
3957 See the `=org-speed-commands-default=' variable for a list of the keys
3958 and commands enabled at the beginning of headlines. All code blocks
3959 are available at the beginning of a code block, the following key
3960 sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
3961 display a list of the code blocks commands and their related keys.
3963 #+BEGIN_SRC emacs-lisp
3964 (setq org-use-speed-commands nil)
3965 (setq org-speed-commands-user (quote (("0" . ignore)
3978 ("h" . bh/hide-other)
3981 (call-interactively 'org-insert-heading-respect-content))
3982 ("k" . org-kill-note-or-show-branches)
3985 ("q" . bh/show-org-agenda)
3987 ("s" . org-save-all-org-buffers)
3991 ("z" . org-add-note)
3996 ("F" . bh/restrict-to-file-or-follow)
3999 ("J" . org-clock-goto)
4003 ("N" . bh/narrow-to-org-subtree)
4004 ("P" . bh/narrow-to-org-project)
4009 ("U" . bh/narrow-up-one-org-level)
4016 (add-hook 'org-agenda-mode-hook
4018 (define-key org-agenda-mode-map "q" 'bury-buffer))
4021 (defvar bh/current-view-project nil)
4022 (add-hook 'org-agenda-mode-hook
4023 '(lambda () (org-defkey org-agenda-mode-map "V" 'bh/view-next-project))
4028 The following displays the contents of code blocks in Org-mode files
4029 using the major-mode of the code. It also changes the behavior of
4030 =TAB= to as if it were used in the appropriate major mode. This means
4031 that reading and editing code form inside of your Org-mode files is
4032 much more like reading and editing of code using its major mode.
4034 #+BEGIN_SRC emacs-lisp
4035 (setq org-src-fontify-natively t)
4036 (setq org-src-tab-acts-natively t)
4039 #+BEGIN_SRC emacs-lisp
4040 (setq org-src-preserve-indentation nil)
4041 (setq org-edit-src-content-indentation 0)
4045 #+BEGIN_SRC emacs-lisp
4046 (setq org-attach-directory "~/org/data/")
4048 #+BEGIN_SRC emacs-lisp
4049 (setq org-agenda-sticky t)
4052 **** Checklist handling
4053 [2013-05-11 Sat 22:15]
4055 #+BEGIN_SRC emacs-lisp
4056 ;(require 'org-checklist)
4059 I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
4061 #+BEGIN_SRC emacs-lisp
4062 (use-package cperl-mode
4063 :commands cperl-mode
4066 (defalias 'perl-mode 'cperl-mode)
4067 (add-auto-mode 'cperl-mode "\\.\\([pP][Llm]\\|al\\)\\'")
4068 (add-auto-mode 'pod-mode "\\.pod$")
4069 (add-auto-mode 'tt-mode "\\.tt$")
4070 (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
4071 (add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
4072 (add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
4076 (setq cperl-invalid-face nil
4077 cperl-close-paren-offset -4
4078 cperl-continued-statement-offset 0
4079 cperl-indent-level 4
4080 cperl-indent-parens-as-block t
4082 cperl-electric-keywords t
4083 cperl-electric-lbrace-space t
4084 cperl-electric-parens nil
4085 cperl-highlight-variables-indiscriminately t
4086 cperl-imenu-addback t
4087 cperl-invalid-face (quote underline)
4088 cperl-lazy-help-time 5
4089 cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$"
4090 cperl-syntaxify-by-font-lock t
4091 cperl-use-syntax-table-text-property-for-tags t)
4093 ;; And have cperl mode give ElDoc a useful string
4094 (defun my-cperl-eldoc-documentation-function ()
4095 "Return meaningful doc string for `eldoc-mode'."
4097 (let ((cperl-message-on-help-error nil))
4099 (add-hook 'cperl-mode-hook
4101 (set (make-local-variable 'eldoc-documentation-function)
4102 'my-cperl-eldoc-documentation-function)
4107 [2014-05-22 Thu 00:05]
4108 #+BEGIN_SRC emacs-lisp
4109 (use-package puppet-mode
4110 :mode ("\\.pp\\'" . puppet-mode)
4111 :commands puppet-mode
4114 (defun my-puppet-mode-hook ()
4115 (setq require-final-newline nil))
4116 (add-hook 'puppet-mode-hook 'my-puppet-mode-hook))
4119 (use-package puppet-ext
4122 (bind-key "C-x ?" 'puppet-set-anchor puppet-mode-map)
4123 (bind-key "C-c C-r" 'puppet-create-require puppet-mode-map)))))
4127 Use elpy for the emacs python fun, but dont let it initialize all the
4128 various variables. Elpy author may like them, but I'm not him...
4129 #+BEGIN_SRC emacs-lisp
4132 :mode ("\.py" . python-mode)
4135 (safe-load (concat jj-elisp-dir "/elpy/elpy-autoloads.el"))
4142 :commands (nosetests-all nosetests-module nosetests-one
4143 nosetests-failed nosetests-pdb-all
4144 nosetests-pdb-module nosetests-pdb-one)
4149 :commands (pyvenv-activate pyvenv-deactivate pyvenv-mode pyvenv-restart-python)
4152 (use-package idomenu
4157 (use-package highlight-indentation
4159 :commands (highlight-indentation-mode))
4161 (use-package find-file-in-project
4163 :commands (find-file-in-project ffip-project-files ffip ))
4168 ;; Local variables in `python-mode'. This is not removed when Elpy
4169 ;; is disabled, which can cause some confusion.
4170 (add-hook 'python-mode-hook 'elpy-initialize-local-variables)
4172 (defun my-python-mode-hook ()
4173 (setq require-final-newline nil)
4174 (setq mode-require-final-newline))
4175 (add-hook 'python-mode-hook 'my-python-mode-hook)
4177 ;; Flymake support using flake8, including warning faces.
4178 (when (and (executable-find "flake8")
4179 (not (executable-find python-check-command)))
4180 (setq python-check-command "flake8"))
4182 ;; `flymake-no-changes-timeout': The original value of 0.5 is too
4183 ;; short for Python code, as that will result in the current line to
4184 ;; be highlighted most of the time, and that's annoying. This value
4185 ;; might be on the long side, but at least it does not, in general,
4186 ;; interfere with normal interaction.
4187 (setq flymake-no-changes-timeout 60)
4189 ;; `flymake-start-syntax-check-on-newline': This should be nil for
4190 ;; Python, as;; most lines with a colon at the end will mean the next
4191 ;; line is always highlighted as error, which is not helpful and
4193 (setq flymake-start-syntax-check-on-newline nil)
4195 ;; `ac-auto-show-menu': Short timeout because the menu is great.
4196 (setq ac-auto-show-menu 0.4)
4198 ;; `ac-quick-help-delay': I'd like to show the menu right with the
4199 ;; completions, but this value should be greater than
4200 ;; `ac-auto-show-menu' to show help for the first entry as well.
4201 (setq ac-quick-help-delay 0.5)
4203 ;; `yas-trigger-key': TAB, as is the default, conflicts with the
4204 ;; autocompletion. We also need to tell yasnippet about the new
4205 ;; binding. This is a bad interface to set the trigger key. Stop