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
7 #+PROPERTY: header-args :tangle yes
9 * Base settings, Stuff without an extra package
10 ** Configure package loading
11 That is, most of my emacs packages are taken from Melpa/Elpa/Marmalade, so configure
12 emacs that it can fetch them if needed.
13 And while compiling the .emacs.el we need use-package, but we don't want it during
15 #+BEGIN_SRC emacs-lisp
16 ;; Disable package initialize after us. We either initialize it
17 ;; anyway in case of interpreted .emacs, or we don't want slow
18 ;; initizlization in case of byte-compiled .emacs.elc.
19 (setq package-enable-at-startup nil)
21 ;; Ask package.el to not add (package-initialize) to .emacs.
22 (setq package--init-file-ensured t)
25 (setq package-user-dir (expand-file-name "elpa" jj-elisp-dir))
26 (dolist (source '(("melpa" . "http://melpa.org/packages/")
27 ("melpa-stable" . "http://stable.melpa.org/packages/")
28 ("marmalade" . "http://marmalade-repo.org/packages/")
29 ;("elpy" . "http://jorgenschaefer.github.io/packages/")
30 ("elpa" . "http://elpa.gnu.org/packages/")
32 (add-to-list 'package-archives source t))
36 ;; set use-package-verbose to t for interpreted .emacs,
37 ;; and to nil for byte-compiled .emacs.elc
39 (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
41 ;; Add the macro generated list of package.el loadpaths to load-path.
42 (mapc #'(lambda (add) (add-to-list 'load-path add))
45 ;; Install use-package if not installed yet.
46 (unless (package-installed-p 'use-package)
47 (package-refresh-contents)
48 (package-install 'use-package))
49 (let ((package-user-dir-real (file-truename package-user-dir)))
50 ;; The reverse is necessary, because outside we mapc
51 ;; add-to-list element-by-element, which reverses.
52 (nreverse (apply #'nconc
53 ;; Only keep package.el provided loadpaths
54 (mapcar #'(lambda (path)
55 (if (string-prefix-p package-user-dir-real path)
61 (require 'use-package))
68 Tangle my config on save, so next startup shouldn't need to do it.
70 #+BEGIN_SRC emacs-lisp
71 ;; This is GPLv2. If you still don't know the details, read
72 ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
73 ;; Taken from https://bitbucket.org/holgerschurig/emacsconf/src/588093924ef8c1d44e7c11b9612f5aad7f6558ce/config.org?at=master
74 (defun my-tangle-config-org-hook-func ()
75 (when (string-prefix-p "emacs.org" (buffer-name))
76 (let ((orgfile (expand-file-name "emacs.org" (file-name-directory (or load-file-name (buffer-file-name)))))
77 (elfile (expand-file-name "emacs.el" (file-name-directory (or load-file-name (buffer-file-name))))))
78 (my-tangle-config-org orgfile elfile))))
79 (add-hook 'after-save-hook #'my-tangle-config-org-hook-func)
83 safe-load does not break emacs initialization, should a file be
84 unreadable while emacs boots up.
85 #+BEGIN_SRC emacs-lisp
86 (defvar safe-load-error-list ""
87 "*List of files that reported errors when loaded via safe-load")
89 (defun safe-load (file &optional noerror nomessage nosuffix)
90 "Load a file. If error on load, report back, wait for
91 a key stroke then continue on"
93 (condition-case nil (load file noerror nomessage nosuffix)
96 (setq safe-load-error-list (concat safe-load-error-list " " file))
97 (message "****** [Return to continue] Error loading %s" safe-load-error-list )
101 (defun safe-load-check ()
102 "Check for any previous safe-load loading errors. (safe-load.el)"
104 (if (string-equal safe-load-error-list "") ()
105 (message (concat "****** error loading: " safe-load-error-list))))
108 I have some stuff put away in my local dir. I don't want to load it all
109 at startup time, so it is using the autoload feature. For that to work
110 load the loaddefs, so autoload knows where to grab stuff
111 #+BEGIN_SRC emacs-lisp
112 ;(safe-load (concat jj-elisp-dir "/tiny/loaddefs.el"))
113 (safe-load (concat jj-elisp-local-dir "/loaddefs.el"))
116 [2014-05-20 Tue 22:36]
117 #+BEGIN_SRC emacs-lisp
118 ;; (defmacro hook-into-modes (func modes)
119 ;; `(dolist (mode-hook ,modes)
120 ;; (add-hook mode-hook ,func)))
122 (defmacro hook-into-modes (function mode-hooks)
123 "Add FUNCTION to hooks in MODE-HOOKS."
124 `(dolist (hook ,mode-hooks)
125 (add-hook hook ,function)))
128 Handier way to add modes to auto-mode-alist
129 #+BEGIN_SRC emacs-lisp
130 (defun add-auto-mode (mode &rest patterns)
131 "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
132 (dolist (pattern patterns)
133 (add-to-list 'auto-mode-alist (cons pattern mode))))
137 We need to define the load-path. As I have lots of things I add
138 locally, its getting a few entries. I disliked the repeated
139 /add-to-list/ lines, so I now just take all subdirectories of
140 jj-elisp-dir and add them.
142 #+BEGIN_SRC emacs-lisp
144 (project (directory-files jj-elisp-dir t "\\w+"))
145 (when (file-directory-p project)
146 (if (string= project "emacs23")
147 (when (version< emacs-version "24")
148 (add-to-list 'load-path project))
149 (add-to-list 'load-path project))
150 ;(byte-recompile-directory project 0)
155 Help emacs to find the info files
156 #+BEGIN_SRC emacs-lisp :tangle yes
157 (setq Info-directory-list (cons jj-info-dir
158 '("/usr/local/share/info/"
160 "/usr/local/gnu/info/"
161 "/usr/local/gnu/lib/info/"
162 "/usr/local/gnu/lib/emacs/info/"
163 "/usr/local/emacs/info/"
164 "/usr/local/lib/info/"
165 "/usr/local/lib/emacs/info/"
166 "/usr/share/info/emacs-23"
168 "/usr/share/info/")))
169 (setq Info-default-directory-list
170 (cons jj-info-dir Info-default-directory-list))
172 ** Exec path from PATH Environment
173 [2017-03-11 Sat 20:08]
174 #+BEGIN_SRC emacs-lisp
175 (defun set-exec-path-from-shell-PATH ()
176 (let ((path-from-shell (replace-regexp-in-string
179 (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
180 (setenv "PATH" path-from-shell)
181 (setq exec-path (split-string path-from-shell path-separator))))
183 (when window-system (set-exec-path-from-shell-PATH))
188 :ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
191 *** Hide Startup message
192 I dislike the startup message
193 #+BEGIN_SRC emacs-lisp
194 (setq inhibit-splash-screen t)
195 (setq inhibit-startup-message t)
199 Usually I want the lines to break at 72 characters.
200 #+BEGIN_SRC emacs-lisp
201 (setq fill-column 72)
204 *** Require final newline
205 And it is nice to have a final newline in files.
206 #+BEGIN_SRC emacs-lisp
207 (setq require-final-newline nil)
208 (setq mode-require-final-newline nil)
212 After I typed 300 characters or took a break for more than a minute it
213 would be nice of emacs to save whatever I am on in one of its auto-save
214 backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
215 #+BEGIN_SRC emacs-lisp
216 (setq auto-save-interval 300)
217 (setq auto-save-timeout 60)
220 *** Name and mail settings
221 Set my full name and my default mail address - for whatever wants to use
222 it later. Also, I am using gnus.
223 #+BEGIN_SRC emacs-lisp
224 (setq user-full-name "Joerg Jaspert")
225 (setq user-mail-address "joerg@ganneff.de")
226 (setq mail-user-agent (quote gnus-user-agent))
230 My default mail server. Well, simply a localhost, I have a forwarder that
231 puts mail off the right way, no need for emacs to have any further
233 #+BEGIN_SRC emacs-lisp
234 (use-package smtpmail
238 (setq smtpmail-default-smtp-server "localhost")
239 (setq smtpmail-smtp-server "localhost")))
243 Enable automatic handling of compressed files.
244 #+BEGIN_SRC emacs-lisp
245 (auto-compression-mode 1)
248 *** Advanced commands
249 Emacs forbids a certain set of commands, as they can be very confusing
250 for new users. Enable them.
251 #+BEGIN_SRC emacs-lisp
252 (put 'narrow-to-region 'disabled nil)
253 (put 'narrow-to-page 'disabled nil)
254 (put 'narrow-to-defun 'disabled nil)
255 (put 'upcase-region 'disabled nil)
256 (put 'downcase-region 'disabled nil)
260 Recenter in a different order - first go to top, then middle, then
262 #+BEGIN_SRC emacs-lisp
263 (setq recenter-positions '(top middle bottom))
268 I've tried various different fonts and while I like the Terminus font
269 most for my shells, in Emacs Inconsolata clearly wins.
270 #+BEGIN_SRC emacs-lisp
271 ; (set-frame-font "Inconsolata-14")
272 (set-frame-font "Hack-10")
273 (add-to-list 'default-frame-alist
278 I always use dark backgrounds, so tell Emacs about it. No need to
280 #+BEGIN_SRC emacs-lisp
281 (setq-default frame-background-mode jj-color-style)
285 And I always liked dark backgrounds with colors setup for them. So I
286 switched through multiple themes doing it in emacs too, but never
287 entirely liked it. Until I found solarized, which is now not only my
288 emacs theme, but also for most of my other software too, especially my
289 shell. Consistent look is great.
290 #+BEGIN_SRC emacs-lisp
291 (use-package solarized-theme
292 :ensure solarized-theme
295 (defun jj-init-theme ()
298 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
299 (load-theme 'solarized-light t))
300 (set-face-attribute 'org-date nil :underline nil)
301 (message "Initializing theme solarized-dark")
304 ;; ;; make the fringe stand out from the background
305 (setq solarized-distinct-fringe-background t)
307 ;; ;; Don't change the font for some headings and titles
308 ;; (setq solarized-use-variable-pitch nil)
310 ;; ;; make the modeline high contrast
311 ;; (setq solarized-high-contrast-mode-line nil)
313 ;; ;; Use less bolding
314 ;; (setq solarized-use-less-bold t)
316 ;; ;; Use more italics
317 ;; (setq solarized-use-more-italic t)
319 ;; ;; Use less colors for indicators such as git:gutter, flycheck and similar
320 ;; (setq solarized-emphasize-indicators nil)
322 ;; ;; Don't change size of org-mode headlines (but keep other size-changes)
323 ;; (setq solarized-scale-org-headlines nil)
325 ;; ;; Avoid all font-size changes
326 ;; (setq solarized-height-minus-1 1)
327 ;; (setq solarized-height-plus-1 1)
328 ;; (setq solarized-height-plus-2 1)
329 ;; (setq solarized-height-plus-3 1)
330 ;; (setq solarized-height-plus-4 1)
331 (setq x-underline-at-descent-line t)
333 (add-to-list 'custom-theme-load-path jj-theme-dir)
334 (add-hook 'after-init-hook 'jj-init-theme)
339 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
340 #+BEGIN_SRC emacs-lisp
341 (if (fboundp 'fringe-mode)
346 A bit more spacing between buffer lines
347 #+BEGIN_SRC emacs-lisp
348 (setq-default line-spacing 0.1)
351 [2013-04-21 So 20:54]
352 I do not want my cursor to blink.
353 #+BEGIN_SRC emacs-lisp
354 (blink-cursor-mode -1)
356 *** Menu, Tool and Scrollbar, File/Dialog boxes
357 I don't want to see the menu-bar, tool-bar or scrollbar.
358 And I don't want silly graphic file dialog or boxes.
359 #+BEGIN_SRC emacs-lisp
361 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
362 (when (fboundp mode) (funcall mode -1)))
363 (if (fboundp 'use-file-dialog) (setq use-file-dialog nil))
364 (if (fboundp 'use-dialog-box) (setq use-dialog-box nil))
367 **** When using emacs in daemon mode
368 Emacs has a very nice mode where it detaches itself and runs as daemon -
369 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
370 Client]]. It's fast, it's nice, it's convinient.
372 Except that Emacs behaves stupid when you do that and ignores your
373 menu/tool/scrollbar settings. Sucks.
375 For them to work even then, we have to do two things.
376 1. We have to set the frame alist. We simple set both,
377 =initial-frame-alist= and =default-frame-alist= to the same value here.
378 #+BEGIN_SRC emacs-lisp
379 (setq initial-frame-alist '(
380 (horizontal-scroll-bars . nil)
381 (vertical-scroll-bars . nil)
385 (setq default-frame-alist (copy-alist initial-frame-alist))
388 *** Hilight current line in buffer
389 As it says, it does a hilight of the current line.
390 #+BEGIN_SRC emacs-lisp
391 (global-hl-line-mode +1)
393 *** Allow recursive minibuffers
394 This allows (additional) minibuffer commands while in the minibuffer.
395 #+BEGIN_SRC emacs-lisp
396 (setq enable-recursive-minibuffers 't)
398 *** No GC during minibuffer action
399 [2016-02-15 Mon 22:09]
400 See [[https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/][Why are you changing gc cons threshold?]] for more details.
401 #+BEGIN_SRC emacs-lisp
402 (defun my-minibuffer-setup-hook ()
403 (setq gc-cons-threshold most-positive-fixnum))
405 (defun my-minibuffer-exit-hook ()
406 (setq gc-cons-threshold 16777216))
408 (add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook)
409 (add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook)
411 *** Modeline related changes
412 I want to see line and column numbers, so turn them on.
413 Size indication lets me know how far I am in a buffer.
415 And modeline-posn is great. It will hilight the column number in the
416 modeline in red as soon as you are over the defined limit.
417 #+BEGIN_SRC emacs-lisp
419 (column-number-mode 1)
420 (size-indication-mode 1)
421 (display-time-mode 1)
422 (setq display-time-day-and-date nil)
423 (setq display-time-default-load-average nil)
424 (setq display-time-24hr-format t)
425 (setq display-time-mail-string "")
426 (setq display-time-default-load-average nil)
427 (setq display-time-interval 15)
428 (setq modelinepos-column-limit 72)
430 (use-package modeline-posn
434 (set-face-foreground 'modelinepos-column-warning "grey20")
435 (set-face-background 'modelinepos-column-warning "red")
436 (setq modelinepos-column-limit 72))
441 [2013-04-22 Mon 11:27]
442 The modeline is easily cluttered up with stuff I don't really need to
443 see. So lets hide those. There are two ways, one of them uses diminish
444 to get entirely rid of some modes, the other is a function taken from
445 "Mastering Emacs" which replaces the modes text with an own (set of)
447 #+BEGIN_SRC emacs-lisp
449 (diminish 'auto-fill-function)
450 (defvar mode-line-cleaner-alist
451 `((auto-complete-mode . " α")
452 (yas-minor-mode . " y")
453 (paredit-mode . " π")
456 (golden-ratio-mode . "")
458 (lisp-interaction-mode . "λ")
461 (emacs-lisp-mode . "EL")
463 (org-indent-mode . "")
468 "Alist for `clean-mode-line'.
470 When you add a new element to the alist, keep in mind that you
471 must pass the correct minor/major mode symbol and a string you
472 want to use in the modeline *in lieu of* the original.
474 Want some symbols? Go:
476 ;ςερτζθιοπασδφγηξκλυχψωβνμ
477 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
478 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
482 (add-hook 'after-change-major-mode-hook 'clean-mode-line)
484 Unfortunately icicles breaks this with the way it adds/removes itself,
485 so take it our for now...
488 Back when I started with text-mode. But nowadays I want default mode to
489 be org-mode - it is just so much better to use. And does sensible things
490 with many README files out there, and various other "crap" you get to
492 #+BEGIN_SRC emacs-lisp :tangle yes
493 (setq-default major-mode 'org-mode)
496 *** Don't query to kill processes at exit
497 [2016-10-03 Mo 14:05]
498 The variable at t (its default) lets emacs query before killing
499 processes when exiting.
500 #+BEGIN_SRC emacs-lisp :tangle yes
501 ;;(setq confirm-kill-processes nil)
502 (setq kill-buffer-query-functions
503 (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
505 ** Keyboard related changes
507 This lets M-SPC cycle through spacing, that is
508 1. replace all spaces with a single space
510 3. restore the original spacing
511 #+BEGIN_SRC emacs-lisp :tangle yes
512 (bind-key "M-SPC" 'cycle-spacing)
514 *** Toggle/Cycle letter case
515 [2015-05-22 Fri 22:42]
517 This is from [[http://ergoemacs.org/emacs/modernization_upcase-word.html][Emacs: Toggle/Cycle Letter Case]]
519 Emacs has several user level commands for changing letter case. They
520 are: upcase-word 【Alt+u】, downcase-word 【Alt+l】, capitalize-word
523 There are also “region” versions for each: upcase-region 【Ctrl+x
524 Ctrl+u】, downcase-region 【Ctrl+x Ctrl+l】, capitalize-region, and
525 also upcase-initials-region. (Note: for elisp programing, there are
526 also these functions: upcase, capitalize, downcase, upcase-initials.)
528 One problem with these commands is that you need to move your cursor
529 to the beginning of the word first. For example, if you have the text
530 “THat”, and your cursor is on the “a”, and you call downcase-word, but
531 it doesn't do anything because it only start at the cursor point to
532 end of word. It would be nice if it'll just automatically perform the
533 operation on the whole word.
535 Another problem is that it does not consider the final result. For
536 example, if you have “oncE upon a time …”, and you select the whole
537 sentence and call upcase-initials-region, it becomes “OncE Upon A Time
538 …”. Note the capital E is not automatically lowered. For elisp
539 programing, the orthogonal precision is nice, but as user commands, it
540 is better to change the whole sentence.
542 Also, these commands have a “-word” and “-region” variants, great for
543 precision in elisp programing but not smart as user commands. It would
544 be nice if emacs automatically choose the right command depending
545 whether there is text selection.
546 #+BEGIN_SRC emacs-lisp :tangle yes
547 (bind-key "M-c" 'toggle-letter-case)
549 *** Faster pop-to-mark command
550 [2015-12-22 Di 14:56]
551 From [[http://endlessparentheses.com/faster-pop-to-mark-command.html?source=rss][Endless Parentheses]], a nice way to pop back in the marks.
552 #+BEGIN_SRC emacs-lisp :tangle yes
553 ;; When popping the mark, continue popping until the cursor
555 (defadvice pop-to-mark-command (around ensure-new-position activate)
558 (when (= p (point)) ad-do-it))))
559 (setq set-mark-command-repeat-pop t)
561 *** Don't kill-buffer, kill-this-buffer instead
562 From [[http://pragmaticemacs.com/emacs/dont-kill-buffer-kill-this-buffer-instead/][Pragmatic Emacs]]: By default C-x k runs the command kill-buffer
563 which prompts you for which buffer you want to kill, defaulting to the
564 current active buffer. I don’t know about you, but I rarely want to
565 kill a different buffer than the one I am looking at, so I rebind C-x
566 k to kill-this-buffer which just kills the current buffer without
567 prompting (unless there are unsaved changes).
568 #+BEGIN_SRC emacs-lisp :tangle yes
569 (global-set-key (kbd "C-x k") 'kill-this-buffer)
572 [2016-10-25 Di 13:38]
573 Its really helpful, but doesn't seem to have a default keybinding, so
575 #+BEGIN_SRC emacs-lisp
576 (bind-key "C-c C-s" 'sort-lines)
578 *** Bind mark-sexp to an easier to reach combo
579 [2017-09-01 Fri 09:14]
580 #+BEGIN_SRC emacs-lisp
581 (bind-key "C-c C-q" 'mark-sexp)
583 *** Make it easy to edit this config
584 [2018-12-30 Sun 16:54]
585 #+BEGIN_SRC emacs-lisp
586 (defun find-config ()
589 (find-file "~/.emacs.d/config/emacs.org"))
591 (bind-key "C-c I" 'find-config)
593 ** Miscellaneous stuff
595 Incremental search is great, but annoyingly you need to type whatever
596 you want. If you want to search for just the next (or previous)
597 occurence of what is at your cursor position use the following.
598 *C-x* will insert the current word while *M-up* and *M-down* will just
599 jump to the next/previous occurence of it.
600 #+BEGIN_SRC emacs-lisp
601 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
602 (bind-key* "<M-up>" 'sacha/search-word-backward)
603 (bind-key* "<M-down>" 'sacha/search-word-forward)
606 *** Frame configuration
607 I want to see the buffername and its size, not the host I am on in my
609 #+BEGIN_SRC emacs-lisp
610 (setq frame-title-format "%b (%I/%i)")
614 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
616 #+BEGIN_SRC emacs-lisp
617 (defalias 'yes-or-no-p 'y-or-n-p)
620 *** Language/i18n stuff
621 In this day and age, UTF-8 is the way to go.
622 #+BEGIN_SRC emacs-lisp
623 (set-language-environment 'utf-8)
624 (set-default-coding-systems 'utf-8)
625 (set-terminal-coding-system 'utf-8)
626 (set-keyboard-coding-system 'utf-8)
627 (set-clipboard-coding-system 'utf-8)
628 (prefer-coding-system 'utf-8)
629 (set-charset-priority 'unicode)
630 (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
631 (when (display-graphic-p)
632 (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
635 *** Kill other buffers
636 While many editors allow you to close "all the other files, not the one
637 you are in", emacs doesn't have this... Except, now it will.
638 (Update 30.05.2014: Not used ever, deactivated)
639 #+BEGIN_SRC emacs-lisp :tangle no
640 (bind-key "C-c k" 'prelude-kill-other-buffers)
643 Default scrolling behaviour in emacs is a bit annoying, who wants to
645 #+BEGIN_SRC emacs-lisp
646 (setq scroll-margin 3)
647 (setq scroll-conservatively 100000)
648 (setq scroll-up-aggressively 0.0)
649 (setq scroll-down-aggressively 0.0)
650 (setq scroll-preserve-screen-position 'always)
653 *** Copy/Paste with X
654 [2013-04-09 Di 23:31]
655 The default how emacs handles cutting/pasting with the primary selection
656 changed in emacs24. I am used to the old way, so get it back.
657 #+BEGIN_SRC emacs-lisp
658 (setq select-enable-primary t)
659 (setq select-enable-clipboard nil)
660 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
661 (setq mouse-drag-copy-region t)
663 *** Global keyboard changes not directly related to a mode
664 **** disable suspend frame
665 Disable /suspend_frame/ function, I dislike it.
666 #+BEGIN_SRC emacs-lisp
668 (unbind-key "C-x C-z")
670 **** kill line but move to beginning of it first
671 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
672 #+BEGIN_SRC emacs-lisp :tangle no
673 (defmacro bol-with-prefix (function)
674 "Define a new function which calls FUNCTION.
675 Except it moves to beginning of line before calling FUNCTION when
676 called with a prefix argument. The FUNCTION still receives the
678 (let ((name (intern (format "endless/%s-BOL" function))))
682 "Call `%s', but move to BOL when called with a prefix argument."
687 (call-interactively ',function))
690 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
691 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
692 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
694 **** kill entire line
695 Default of *C-k* is to kill from the point to the end of line. If
696 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
697 set, including newline. But to kill the entire line, one still needs a
698 *C-a* in front of it. So I change it, by defining a function to do just this for
700 #+BEGIN_SRC emacs-lisp :tangle no
701 (defun kill-entire-line ()
702 "Kill this entire line (including newline), regardless of where point is within the line."
706 (back-to-indentation))
708 (bind-key* "C-k" 'kill-entire-line)
709 (global-set-key [remap kill-whole-line] 'kill-entire-line)
712 And the same is true when I'm in org-mode, which has an own kill function...
713 (the keybinding happens later, after org-mode is loaded fully)
714 #+BEGIN_SRC emacs-lisp :tangle no
715 (defun jj-org-kill-line (&optional arg)
716 "Kill the entire line, regardless of where point is within the line, org-mode-version"
720 (back-to-indentation)
724 I really hate tabs, so I don't want any indentation to try using them.
725 And in case a project really needs them, I can change it just for that
726 file/project, but luckily none of those I work in is as broken.
727 #+BEGIN_SRC emacs-lisp
728 (setq-default indent-tabs-mode nil)
731 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
732 #+BEGIN_SRC emacs-lisp
733 (bind-key* "M-5" 'match-paren)
735 **** backward-kill-word
736 Instead of the default "mark-defun" I want a more readline-like setting.
737 #+BEGIN_SRC emacs-lisp
738 (bind-key "C-M-h" 'backward-kill-word)
740 **** Align with regexp
741 Align whatever with a regexp.
742 #+BEGIN_SRC emacs-lisp
743 (bind-key "C-x \\" 'align-regexp)
745 **** Font size changes
746 #+BEGIN_SRC emacs-lisp
747 (bind-key "C-+" 'text-scale-increase)
748 (bind-key "C--" 'text-scale-decrease)
751 Rgrep is infinitely useful in multi-file projects.
752 #+begin_src emacs-lisp
753 ; (bind-key "C-x C-g" 'rgrep)
754 (bind-key "C-x C-g" 'counsel-ag)
757 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
759 #+BEGIN_SRC emacs-lisp
760 (bind-key "<M-S-up>" 'move-line-up)
761 (bind-key "<M-S-down>" 'move-line-down)
763 **** "Pull" lines up, join them
764 #+BEGIN_SRC emacs-lisp
765 (defun join-line-or-lines-in-region ()
766 "Join this line or the lines in the selected region.
767 Joins single lines in reverse order to the default, ie. pulls the next one up."
769 (cond ((region-active-p)
770 (let ((min (line-number-at-pos (region-beginning))))
771 (goto-char (region-end))
772 (while (> (line-number-at-pos) min)
774 (t (let ((current-prefix-arg '(4)))
775 (call-interactively 'join-line)))))
776 (bind-key "M-j" 'join-line-or-lines-in-region)
778 **** Let enter indent next line
779 When I press Enter I almost always want to go to the right indentation on the next line.
780 #+BEGIN_SRC emacs-lisp
781 (bind-key "RET" 'newline-and-indent)
784 and i don't need suspend-frame
785 #+BEGIN_SRC emacs-lisp
786 (bind-key "C-z" 'undo)
788 **** Window switching, go backwards. (C-x o goes to the next window)
789 #+BEGIN_SRC emacs-lisp
790 (bind-key "C-x O" (lambda ()
794 **** Edit file as root
795 #+BEGIN_SRC emacs-lisp
796 (bind-key "C-x C-r" 'prelude-sudo-edit)
798 **** Just one space with newline
799 M-space is bound to just-one-space, which is great for programming. What
800 it does is remove all spaces around the cursor, except for one. But to
801 be really useful, it also should include newlines. It doesn’t do this by
802 default. Rather, you have to call it with a negative argument. Sure
804 #+BEGIN_SRC emacs-lisp
805 (bind-key "M-SPC" 'just-one-space-with-newline)
807 **** Count which commands I use how often.
808 #+BEGIN_SRC emacs-lisp :tangle no
813 (setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
814 (setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
816 (keyfreq-autosave-mode 1)))
818 **** Duplicate current line
819 #+BEGIN_SRC emacs-lisp
820 (defun duplicate-line ()
821 "Insert a copy of the current line after the current line."
824 (let ((line-text (buffer-substring-no-properties
825 (line-beginning-position)
826 (line-end-position))))
829 (insert line-text))))
831 (bind-key "C-x d" 'duplicate-line)
833 **** Smarter move to the beginning of the line.
834 That is, it first moves to the beginning of the line - and on second
835 keypress it goes to the first character on line.
836 #+BEGIN_SRC emacs-lisp
837 (defun smarter-move-beginning-of-line (arg)
838 "Move point back to indentation of beginning of line.
840 Move point to the first non-whitespace character on this line.
841 If point is already there, move to the beginning of the line.
842 Effectively toggle between the first non-whitespace character and
843 the beginning of the line.
845 If ARG is not nil or 1, move forward ARG - 1 lines first. If
846 point reaches the beginning or end of the buffer, stop there."
848 (setq arg (or arg 1))
852 (let ((line-move-visual nil))
853 (forward-line (1- arg))))
855 (let ((orig-point (point)))
856 (back-to-indentation)
857 (when (= orig-point (point))
858 (move-beginning-of-line 1))))
860 ;; remap C-a to `smarter-move-beginning-of-line'
861 (global-set-key [remap move-beginning-of-line]
862 'smarter-move-beginning-of-line)
865 **** Copy characters from previous line
866 Easily copy characters from the previous nonblank line, starting just
867 above point. With a prefix argument, only copy ARG characters (never
868 past EOL), no argument copies rest of line.
869 #+BEGIN_SRC emacs-lisp
871 :bind ("H-y" . copy-from-above-command))
873 **** Misc keybindings
874 Open a new X Terminal pointing to the directory of the current
876 #+BEGIN_SRC emacs-lisp
877 (bind-key "H-t" 'jj-open-shell)
881 #+BEGIN_SRC emacs-lisp
882 (bind-key "H-a" 'align-code)
886 #+BEGIN_SRC emacs-lisp
887 (bind-key "C-c d" 'insert-date)
890 Another key for indenting
891 #+BEGIN_SRC emacs-lisp
892 (bind-key "H-i" 'indent-region)
895 Clean all whitespace stuff
896 #+BEGIN_SRC emacs-lisp
897 (bind-key "H-w" 'whitespace-cleanup)
901 #+BEGIN_SRC emacs-lisp
902 (bind-key "H-c" 'comment-dwim)
905 Show keystrokes in progress
906 #+BEGIN_SRC emacs-lisp
907 (setq echo-keystrokes 0.1)
910 Usually you can press the *Ins*ert key, to get into overwrite mode. I
911 don't like that, have broken much with it and so just forbid it by
913 #+BEGIN_SRC emacs-lisp
914 (unbind-key "<insert>")
915 (unbind-key "<kp-insert>")
918 **** Easily navigate sillyCased words
919 #+BEGIN_SRC emacs-lisp
920 (global-subword-mode 1)
922 **** Delete file of current buffer, then kill buffer
923 [2014-06-14 Sat 23:03]
924 #+BEGIN_SRC emacs-lisp
925 (defun delete-current-buffer-file ()
926 "Removes file connected to current buffer and kills buffer."
928 (let ((filename (buffer-file-name))
929 (buffer (current-buffer))
930 (name (buffer-name)))
931 (if (not (and filename (file-exists-p filename)))
933 (when (yes-or-no-p "Are you sure you want to remove this file? ")
934 (delete-file filename)
936 (message "File '%s' successfully removed" filename)))))
938 (bind-key "C-x C-k" 'delete-current-buffer-file)
940 **** Rename file of current buffer
941 [2014-06-14 Sat 23:04]
942 #+BEGIN_SRC emacs-lisp
943 (defun rename-current-buffer-file ()
944 "Renames current buffer and file it is visiting."
946 (let ((name (buffer-name))
947 (filename (buffer-file-name)))
948 (if (not (and filename (file-exists-p filename)))
949 (error "Buffer '%s' is not visiting a file!" name)
950 (let ((new-name (read-file-name "New name: " filename)))
951 (if (get-buffer new-name)
952 (error "A buffer named '%s' already exists!" new-name)
953 (rename-file filename new-name 1)
954 (rename-buffer new-name)
955 (set-visited-file-name new-name)
956 (set-buffer-modified-p nil)
957 (message "File '%s' successfully renamed to '%s'"
958 name (file-name-nondirectory new-name)))))))
960 (bind-key "C-x C-S-r" 'rename-current-buffer-file)
962 **** Quickly find emacs lisp sources
963 [2014-06-22 Sun 23:05]
964 #+BEGIN_SRC emacs-lisp :tangle no
965 (bind-key "C-l" 'find-library 'help-command)
966 (bind-key "C-f" 'find-function 'help-command)
967 (bind-key "C-k" 'find-function-on-key 'help-command)
968 (bind-key "C-v" 'find-variable 'help-command)
971 [2015-01-26 Mon 16:01]
972 #+BEGIN_SRC emacs-lisp
973 (bind-key "M-s o" 'occur-dwim)
975 *** Searches and matches should ignore case.
976 #+BEGIN_SRC emacs-lisp
977 (setq-default case-fold-search t)
979 *** Don't display a cursor in non-selected windows.
980 #+BEGIN_SRC emacs-lisp
981 (setq-default cursor-in-non-selected-windows nil)
983 *** Modeline filetype endings display
984 What should be displayed in the mode-line for files with those types
986 #+BEGIN_SRC emacs-lisp
987 (setq eol-mnemonic-dos "(DOS)")
988 (setq eol-mnemonic-mac "(Mac)")
991 #+BEGIN_SRC emacs-lisp
992 (setq max-lisp-eval-depth 1000)
993 (setq max-specpdl-size 3000)
996 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
997 #+BEGIN_SRC emacs-lisp
998 (defun unfill-paragraph ()
999 "Takes a multi-line paragraph and makes it into a single line of text."
1001 (let ((fill-column (point-max)))
1002 (fill-paragraph nil)))
1003 (bind-key "H-u" 'unfill-paragraph)
1006 #+BEGIN_SRC emacs-lisp
1007 (setq-default indicate-empty-lines t)
1008 (setq sentence-end-double-space nil)
1010 *** Hilight annotations in comments, like FIXME/TODO/...
1011 #+BEGIN_SRC emacs-lisp :tangle yes
1012 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
1014 *** Wait a bit longer before considering emacs idle
1015 #+BEGIN_SRC emacs-lisp :tangle yes
1016 (setq idle-update-delay 2)
1018 *** Make gnutls a bit safer, the default is an absurdly low 256
1019 #+BEGIN_SRC emacs-lisp :tangle yes
1020 (setq gnutls-min-prime-bits 4096)
1022 *** Emacs defaults to using --insecure - and supporting ssl3. No thanks.
1023 #+BEGIN_SRC emacs-lisp :tangle yes
1026 ;; '("gnutls-cli --insecure -p %p %h"
1027 ;; "gnutls-cli --insecure -p %p %h --protocols ssl3"
1028 ;; "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")
1029 '("gnutls-cli -p %p %h"
1030 "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof"))
1032 *** Resolve symlinks without asking
1033 #+BEGIN_SRC emacs-lisp :tangle no
1034 (setq-default find-file-visit-truename t)
1037 #+BEGIN_SRC emacs-lisp :tangle yes
1038 (setq-default bidi-display-reordering nil)
1041 *** When saving a script - make it executable
1042 #+BEGIN_SRC emacs-lisp
1043 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
1047 #+BEGIN_SRC emacs-lisp
1051 (add-hook 'after-init-hook 'server-start)))
1053 **** Edit-server for chromium extension "Edit with emacs"
1054 [2015-10-15 Thu 22:32]
1055 #+BEGIN_SRC emacs-lisp :tangle yes
1056 (use-package edit-server
1060 (setq edit-server-new-frame nil)
1061 (edit-server-start)))
1063 *** Adjust buffer mode for zsh commandline editing buffers
1064 [2017-03-17 Fr 13:35]
1065 I got a handy zsh setup, using edit-command-line widget, so typing C-x
1066 C-e I end up in emacs with whatever is in my commandline. Save, exit -
1067 and commandline is changed to it. Very nice.
1068 Now I want the buffers of it appear in sh-mode by default
1069 #+BEGIN_SRC emacs-lisp
1070 (add-auto-mode 'sh-mode "zshe.*$")
1072 *** No need for lockfiles (foo~)
1073 [2017-12-08 Fri 09:29]
1074 #+BEGIN_SRC emacs-lisp
1075 (setq create-lockfiles nil)
1076 (setq make-backup-files nil)
1078 *** Always kick trailing whitespace
1079 [2018-12-30 Sun 16:58]
1080 #+BEGIN_SRC emacs-lisp
1081 (add-hook 'before-save-hook 'delete-trailing-whitespace)
1083 *** kill ring settings
1084 [2018-12-30 Sun 23:06]
1085 #+BEGIN_SRC emacs-lisp
1086 (setq kill-ring-max 200 ; More killed items
1087 kill-do-not-save-duplicates t ; No duplicates in kill ring
1088 ;; Save the contents of the clipboard to kill ring before killing
1089 save-interprogram-paste-before-kill t)
1092 *** Fold anything more indented than current line
1093 [2018-02-14 Mi 12:39]
1094 Taken from [[https://stackoverflow.com/questions/1587972/how-to-display-indentation-guides-in-emacs/4459159#4459159][stackoverflow]]
1095 #+BEGIN_SRC emacs-lisp
1096 (defun aj-toggle-fold ()
1097 "Toggle fold all lines larger than indentation on current line"
1101 (back-to-indentation)
1102 (setq col (+ 1 (current-column)))
1103 (set-selective-display
1104 (if selective-display nil (or col 1))))))
1105 ;(bind-key "C-i" 'aj-toggle-fold)
1107 * Customized variables
1108 [2013-05-02 Thu 22:14]
1109 The following contains a set of variables i may reasonably want to
1110 change on other systems - which don't affect the init file loading
1111 process. So I *can* use the customization interface for it...
1112 #+BEGIN_SRC emacs-lisp
1113 (defgroup ganneff nil
1114 "Modify ganneffs settings"
1115 :group 'environment)
1117 (defgroup ganneff-org-mode nil
1118 "Ganneffs org-mode settings"
1119 :tag "Ganneffs org-mode settings"
1121 :link '(custom-group-link "ganneff"))
1123 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
1124 "ID of the organization task."
1125 :tag "Organization Task ID"
1127 :group 'ganneff-org-mode)
1129 (defcustom org-my-archive-expiry-days 2
1130 "The number of days after which a completed task should be auto-archived.
1131 This can be 0 for immediate, or a floating point value."
1132 :tag "Archive expiry days"
1134 :group 'ganneff-org-mode)
1137 ** Customized variables
1139 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
1141 Of course I want to be able to use the customize interface, and some
1142 things can only be set via it (or so they say). I usually prefer to put
1143 things I keep for a long while into statements somewhere else, not just
1144 custom-set here, but we need it anyways.
1146 #+BEGIN_SRC emacs-lisp
1147 (setq custom-file jj-custom-file)
1148 (safe-load custom-file)
1151 The source of this is:
1152 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
1155 * Extra modes, additions, thingies, fun
1157 A defined abbrev is a word which expands, if you insert it, into some
1158 different text. Abbrevs are defined by the user to expand in specific
1160 Also see [[http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html][Ispell and Abbrev, the Perfect Auto-Correct]].
1161 #+BEGIN_SRC emacs-lisp :tangle yes
1163 :commands abbrev-mode
1164 :diminish abbrev-mode
1165 :bind (:map ctl-x-map
1166 ("C-i" . endless/ispell-word-then-abbrev))
1169 (setq-default abbrev-mode t)
1170 (hook-into-modes #'abbrev-mode '(text-mode-hook)))
1173 (setq save-abbrevs 'silently)
1174 (setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
1175 (if (file-exists-p abbrev-file-name)
1176 (quietly-read-abbrev-file))
1178 (add-hook 'expand-load-hook
1180 (add-hook 'expand-expand-hook 'indent-according-to-mode)
1181 (add-hook 'expand-jump-hook 'indent-according-to-mode)))
1183 (defun endless/ispell-word-then-abbrev (p)
1184 "Call `ispell-word', then create an abbrev for it.
1185 With prefix P, create local abbrev. Otherwise it will
1187 If there's nothing wrong with the word at point, keep
1188 looking for a typo until the beginning of buffer. You can
1189 skip typos you don't want to fix with `SPC', and you can
1190 abort completely with `C-g'."
1194 (while (if (setq bef (thing-at-point 'word))
1195 ;; Word was corrected or used quit.
1196 (if (ispell-word nil 'quiet)
1198 ;; Also end if we reach `bob'.
1200 ;; If there's no word at point, keep looking
1204 (setq aft (thing-at-point 'word)))
1205 (if (and aft bef (not (equal aft bef)))
1206 (let ((aft (downcase aft))
1207 (bef (downcase bef)))
1209 (if p local-abbrev-table global-abbrev-table)
1211 (message "\"%s\" now expands to \"%s\" %sally"
1212 bef aft (if p "loc" "glob")))
1213 (user-error "No typo at or before point"))))
1214 (setq save-abbrevs 'silently)))
1216 ** Atomic chrome, edit text from Chrome in Emacs
1217 [2017-03-09 Do 14:56]
1218 #+BEGIN_SRC emacs-lisp
1219 (use-package atomic-chrome
1224 (atomic-chrome-start-server)
1225 (setq atomic-chrome-buffer-open-style 'full)
1229 [2013-04-21 So 20:27]
1230 Use H-w to switch windows
1231 #+BEGIN_SRC emacs-lisp
1232 (use-package ace-window
1234 :commands ace-window
1235 :bind ("H-w" . ace-window)
1238 (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))
1242 [2014-06-01 Sun 23:02]
1243 Provides a minor mode which displays current match and total matches
1244 information in the mode-line in various search modes.
1245 #+BEGIN_SRC emacs-lisp
1251 (global-anzu-mode 1)
1254 (setq anzu-search-threshold 1000)
1255 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
1257 ** CANCELLED ansible :CANCELLED:
1258 CLOSED: [2017-08-27 So 15:16]
1260 - State "CANCELLED" from [2017-08-27 So 15:16]
1262 [2017-08-26 Sa 14:24]
1263 Something for that horrible tool
1264 #+BEGIN_SRC emacs-lisp :tangle no
1265 (use-package ansible
1269 [2013-04-28 So 11:26]
1270 avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.
1271 #+BEGIN_SRC emacs-lisp
1274 :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)
1275 :bind (("H-SPC" . avy-goto-char-2)
1276 ("M-g g" . avy-goto-line)
1277 :map isearch-mode-map
1278 ("C-y" . avy-isearch)
1282 (setq avy-all-windows 'all-frames)
1283 (setq avi-keys '(?a ?s ?d ?e ?f ?h ?j ?k ?l ?n ?m ?v ?r ?u) )
1287 #+BEGIN_SRC emacs-lisp
1288 (use-package browse-url
1290 :commands (browse-url)
1293 (setq browse-url-browser-function (quote browse-url-generic))
1294 (setq browse-url-generic-program "/usr/bin/x-www-browser")))
1297 ** CANCELLED Emacs shell :CANCELLED:
1298 CLOSED: [2017-08-26 Sa 13:55]
1300 - State "CANCELLED" from [2017-08-26 Sa 13:55] \\
1301 Not using it at the moment
1303 Basic settings for emacs integrated shell
1304 #+BEGIN_SRC emacs-lisp
1307 :defines eshell-path-env
1311 (defun eshell-initialize ()
1312 (defun eshell-spawn-external-command (beg end)
1313 "Parse and expand any history references in current input."
1316 (when (looking-back "&!" beg)
1317 (delete-region (match-beginning 0) (match-end 0))
1319 (insert "spawn "))))
1320 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1321 (eval-after-load "em-unix"
1323 (unintern 'eshell/su)
1324 (unintern 'eshell/sudo))))
1325 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1329 (setq eshell-path-env path-from-shell) ; for eshell users
1330 (defalias 'emacs 'find-file)
1331 (defalias 'ec 'find-file)
1332 (defalias 'e 'find-file)
1336 (use-package 'em-cmpl)
1337 (use-package 'em-prompt)
1338 (use-package 'em-term)
1340 (setq eshell-cmpl-cycle-completions nil
1341 eshell-save-history-on-exit t
1342 eshell-buffer-maximum-lines 20000
1343 eshell-history-size 350
1344 eshell-buffer-shorthand t
1345 eshell-highlight-prompt t
1346 eshell-plain-echo-behavior t
1347 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1349 (setenv "PAGER" "cat")
1350 (setq eshell-visual-commands
1351 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1352 (setq eshell-visual-subcommands
1353 '(("git" "log" "l" "diff" "show")))
1355 (add-to-list 'eshell-command-completions-alist
1356 '("gunzip" "gz\\'"))
1357 (add-to-list 'eshell-command-completions-alist
1358 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1360 (when (not (functionp 'eshell/rgrep))
1361 (defun eshell/rgrep (&rest args)
1362 "Use Emacs grep facility instead of calling external grep."
1363 (eshell-grep "rgrep" args t)))
1365 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1366 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1367 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1368 (add-hook 'eshell-preoutput-filter-functions
1369 'ansi-color-filter-apply)
1370 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1372 (defmacro with-face (str &rest properties)
1373 `(propertize ,str 'face (list ,@properties)))
1375 (defun eshell/abbr-pwd ()
1376 (let ((home (getenv "HOME"))
1377 (path (eshell/pwd)))
1379 ((string-equal home path) "~")
1380 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1383 (defun eshell/my-prompt ()
1384 (let ((header-bg "#161616"))
1386 (with-face user-login-name :foreground "cyan")
1387 (with-face (concat "@" hostname) :foreground "white")
1389 (with-face (eshell/abbr-pwd) :foreground "#009900")
1390 (if (= (user-uid) 0)
1391 (with-face "#" :foreground "red")
1392 (with-face "$" :foreground "#69b7f0"))
1395 (use-package eshell-prompt-extras
1399 (setq eshell-highlight-prompt nil
1400 ;; epe-git-dirty-char "Ϟ"
1401 epe-git-dirty-char "*"
1402 eshell-prompt-function 'epe-theme-dakrone)))
1404 (defun eshell/magit ()
1405 "Function to open magit-status for the current directory"
1407 (magit-status-internal default-directory)
1410 (setq eshell-prompt-function 'eshell/my-prompt)
1411 (setq eshell-highlight-prompt nil)
1412 (setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1416 I don't want some buffers to be killed, **scratch** for example.
1417 In the past I had a long function that just recreated them, but the
1418 =keep-buffers= package is easier.
1419 #+BEGIN_SRC emacs-lisp
1420 (use-package keep-buffers
1423 (keep-buffers-mode 1)
1424 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1425 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1430 #+BEGIN_SRC emacs-lisp
1431 (use-package midnight
1437 (setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
1438 "*Man " "*Buffer List*"
1441 "*vc-diff*" "*diff*"
1444 "*magit" "*Calendar"
1446 (midnight-delay-set 'midnight-delay (* 14 60 60))
1450 While I do have the nifty shortcut to jump to the other parentheses,
1451 hilighting them makes it obvious where they are.
1452 #+BEGIN_SRC emacs-lisp
1453 (use-package mic-paren
1460 Paradox is a nicer interface to the package system
1461 #+BEGIN_SRC emacs-lisp
1462 (use-package paradox
1464 :commands (paradox-list-packages paradox-install paradox-upgrade-packages paradox-enable)
1467 (setq paradox-github-token t)
1475 [2013-04-23 Tue 16:43]
1476 Shell. zsh in my case.
1477 #+BEGIN_SRC emacs-lisp
1481 :hook (shell-mode . ansi-color-for-comint-mode-on)
1484 (setq shell-file-name "zsh")
1485 (setq shell-command-switch "-c")
1486 (setq explicit-shell-file-name shell-file-name)
1487 (setenv "SHELL" shell-file-name)
1488 (setq explicit-sh-args '("-login" "-i"))
1489 (setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
1490 (setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
1491 (setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
1492 (setq comint-completion-autolist t) ; show completion list when ambiguous
1493 (setq comint-input-ignoredups t) ; no duplicates in command history
1494 (setq comint-completion-addsuffix t) ; insert space/slash after file completion
1495 (setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
1496 (setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
1501 [2014-05-21 Wed 00:33]
1502 #+BEGIN_SRC emacs-lisp
1505 :commands (ascii-on ascii-toggle ascii-display)
1506 :bind (("C-c e A" . ascii-toggle))
1509 (defun ascii-toggle ()
1511 (defvar ascii-display nil)
1517 #+BEGIN_SRC emacs-lisp
1520 :mode ("\\.tex\\'" . latex-mode)
1521 :commands (latex-mode LaTeX-mode plain-tex-mode)
1524 (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
1525 (add-hook 'LaTeX-mode-hook #'flyspell-mode)
1526 (add-hook 'LaTeX-mode-hook #'turn-on-reftex)
1527 (setq TeX-auto-save t
1531 (setq-default TeX-master nil)
1533 ;; Compilation command
1534 (add-hook 'LaTeX-mode-hook (lambda () (setq compile-command "latexmk -pdf")))))
1537 [2017-12-08 Fri 09:42]
1538 Auto-completion comp any mode.
1539 #+BEGIN_SRC emacs-lisp
1540 (use-package company
1543 :diminish company-mode
1544 :init (global-company-mode)
1547 ;; Use Company for completion
1548 (bind-key [remap completion-at-point] #'company-complete company-mode-map)
1549 (global-company-mode)
1551 (setq company-dabbrev-downcase nil)
1552 (setq company-echo-delay 0)
1553 (setq company-idle-delay 0.2)
1554 (setq company-minimum-prefix-length 2)
1555 (setq company-require-match nil)
1556 (setq company-selection-wrap-around t)
1557 (setq company-show-numbers t)
1558 (setq company-tooltip-align-annotations t)
1559 (setq company-tooltip-flip-when-above t)
1560 (setq company-tooltip-limit 10)
1561 (setq company-transformers '(company-sort-by-occurrence)) ; weight by frequency
1564 (use-package company-quickhelp ; Documentation popups for Company
1567 :init (add-hook 'global-company-mode-hook #'company-quickhelp-mode))
1569 (use-package company-statistics
1572 (add-hook 'after-init-hook 'company-statistics-mode))
1574 (use-package company-go
1578 (with-eval-after-load 'company
1579 (add-to-list 'company-backends 'company-go)))
1581 (use-package company-auctex
1584 (use-package company-jedi
1589 When files change outside emacs for whatever reason I want emacs to deal
1590 with it. Not to have to revert buffers myself
1591 #+BEGIN_SRC emacs-lisp
1592 (use-package autorevert
1593 :commands auto-revert-mode
1594 :diminish auto-revert-mode
1597 (setq global-auto-revert-mode t)
1598 (setq global-auto-revert-non-file-buffers t)
1599 (global-auto-revert-mode)))
1602 ** CANCELLED backups :CANCELLED:
1603 CLOSED: [2017-08-26 Sa 14:41]
1604 Emacs should keep backup copies of files I edit, but I do not want them
1605 to clutter up the filesystem everywhere. So I put them into one defined
1606 place, backup-directory, which even contains my username (for systems
1607 where =temporary-file-directory= is not inside my home).
1608 #+BEGIN_SRC emacs-lisp :tangle no
1609 (use-package backups-mode
1610 :load-path "elisp/backups-mode"
1612 :bind (("\C-cv" . save-version)
1613 ("\C-cb" . list-backups)
1614 ("\C-ck" . kill-buffer-prompt)
1615 ("\C-cw" . backup-walker-start))
1618 (setq backup-directory jj-backup-directory)
1619 ; (setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
1620 ; (if (not (file-exists-p tramp-backup-directory))
1621 ; (make-directory tramp-backup-directory))
1622 ; (setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
1623 (setq backup-directory-alist `(("." . ,jj-backup-directory)))
1624 (setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
1625 (setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
1627 (setq version-control t) ;; Use version numbers for backups
1628 (setq kept-new-versions 10) ;; Number of newest versions to keep
1629 (setq kept-old-versions 2) ;; Number of oldest versions to keep
1630 (setq delete-old-versions t) ;; Ask to delete excess backup versions?
1631 (setq backup-by-copying t)
1632 (setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
1633 (setq make-backup-files t)
1635 (defadvice kill-buffer (around kill-buffer)
1636 "Always save before killing a file buffer"
1637 (when (and (buffer-modified-p)
1639 (file-exists-p (buffer-file-name)))
1642 (ad-activate 'kill-buffer)
1644 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
1645 "Always save before killing emacs"
1646 (save-some-buffers t)
1648 (ad-activate 'save-buffers-kill-emacs)
1650 (defun kill-buffer-prompt ()
1651 "Allows one to kill a buffer without saving it.
1652 This is necessary since once you start backups-mode all file based buffers
1653 are saved automatically when they are killed"
1655 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
1657 (set-buffer-modified-p nil))
1660 (setq backup-enable-predicate
1662 (and (normal-backup-enable-predicate name)
1664 (let ((method (file-remote-p name 'method)))
1665 (when (stringp method)
1666 (member method '("su" "sudo"))))))))))
1670 [2019-01-25 Fr 14:40]
1671 #+BEGIN_SRC emacs-lisp
1672 (use-package cc-mode
1674 :mode (("\\.pc\\'" . c-mode)
1675 ("\\.awk\\'" . awk-mode)
1676 ("\\.c\\'" . c-mode))
1677 :commands (c-mode awk-mode))
1681 [2015-10-15 Thu 11:34]
1682 Corral is a lightweight package that lets you quickly wrap parentheses
1683 and other delimiters around text, intuitively surrounding what you
1684 want it to using just two commands.
1685 #+BEGIN_SRC emacs-lisp
1688 :bind (("C-c c" . hydra-corral/body))
1691 ; Interpret # and * as part of the word
1692 (setq corral-syntax-entries '((?# "_")
1696 (defhydra hydra-corral (:columns 4)
1698 ("(" corral-parentheses-backward "Back")
1699 (")" corral-parentheses-forward "Forward")
1700 ("[" corral-brackets-backward "Back")
1701 ("]" corral-brackets-forward "Forward")
1702 ("{" corral-braces-backward "Back")
1703 ("}" corral-braces-forward "Forward")
1704 ("\"" corral-double-quotes-backward "Back")
1705 ("2" corral-double-quotes-forward "Forward")
1706 ("'" corral-single-quotes-backward "Back")
1707 ("#" corral-single-quotes-forward "Forward")
1708 ("." hydra-repeat "Repeat"))
1712 [2013-05-21 Tue 23:18]
1713 #+BEGIN_SRC emacs-lisp
1714 (use-package crontab-mode
1715 :ensure crontab-mode
1716 :commands crontab-mode
1717 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
1721 I know that this lets it look "more like windows", but I don't much care
1722 about its paste/copy/cut keybindings, the really nice part is the great
1723 support for rectangular regions, which I started to use a lot since I
1724 know this mode. The normal keybindings for those are just to useless.
1725 #+BEGIN_SRC emacs-lisp
1727 (setq cua-enable-cua-keys (quote shift))
1730 Luckily cua-mode easily supports this, with the following line I just
1731 get the CUA selection and rectangle stuff, not the keybindings. Yes,
1732 even though the above =cua-enable-cua-keys= setting would only enable
1733 them if the selection is done when the region was marked with a shifted
1735 #+BEGIN_SRC emacs-lisp
1736 (cua-selection-mode t)
1740 #+BEGIN_SRC emacs-lisp
1741 (require 'dpkg-dev-el-loaddefs nil 'noerror)
1742 (require 'debian-el-loaddefs nil 'noerror)
1744 (setq debian-changelog-full-name "Joerg Jaspert")
1745 (setq debian-changelog-mailing-address "joerg@debian.org")
1749 #+BEGIN_SRC emacs-lisp
1750 (use-package diff-mode
1752 :mode (("\\.diff" . diff-mode)))
1756 #+BEGIN_SRC emacs-lisp
1758 :commands (dired dired-other-window dired-other-frame dired-noselect
1759 dired-mode dired-jump)
1760 :defines (dired-omit-regexp-orig)
1761 :bind (:map dired-mode-map
1762 ("F" . find-name-dired)
1763 ("/" . dired-narrow)
1764 ("r" . wdired-change-to-wdired-mode))
1768 (setq diredp-hide-details-initially-flag nil))
1771 (setq dired-auto-revert-buffer (quote dired-directory-changed-p))
1772 (setq dired-dwim-target t)
1773 (setq dired-listing-switches "-alh")
1774 (setq dired-listing-switches "-alXh --group-directories-first")
1775 (setq dired-recursive-copies (quote top))
1776 (setq dired-recursive-deletes (quote top))
1779 :load-path "elisp/local")
1781 (use-package dired-x
1784 (setq dired-guess-shell-alist-user
1785 '(("\\.pdf\\'" "mupdf")
1786 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
1787 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
1788 ("\\.\\(?:xcf\\)\\'" "gimp")
1789 ("\\.csv\\'" "libreoffice")
1790 ("\\.tex\\'" "pdflatex" "latex")
1791 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
1792 ("\\.html?\\'" "conkeror")))))
1794 (use-package dired-single
1795 :ensure dired-single
1796 :bind (:map dired-mode-map
1797 ("<return>" . dired-single-buffer)
1798 ("<mouse-1>" . dired-single-buffer))
1803 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
1807 :commands (wdired-change-to-wdired-mode)
1810 (setq wdired-allow-to-change-permissions t)))
1812 (use-package dired-narrow
1814 :diminish dired-narrow-mode
1815 :bind (:map dired-mode-map
1816 ("/" . dired-narrow)))
1818 (use-package gnus-dired
1819 :commands (gnus-dired-attach gnus-dired-mode)
1820 :bind (:map dired-mode-map
1821 ("a" . gnus-dired-attach)))
1826 (defvar mark-files-cache (make-hash-table :test #'equal))
1828 (defun mark-similar-versions (name)
1830 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
1831 (setq pat (match-string 1 pat)))
1832 (or (gethash pat mark-files-cache)
1833 (ignore (puthash pat t mark-files-cache)))))
1835 (defun dired-mark-similar-version ()
1837 (setq mark-files-cache (make-hash-table :test #'equal))
1838 (dired-mark-sexp '(mark-similar-versions name)))
1840 (defun dired-package-initialize ()
1841 (unless (featurep 'runner)
1842 (bind-key "M-!" 'async-shell-command dired-mode-map)
1843 (unbind-key "M-s f" dired-mode-map)
1845 (defadvice dired-omit-startup (after diminish-dired-omit activate)
1846 "Make sure to remove \"Omit\" from the modeline."
1847 (diminish 'dired-omit-mode) dired-mode-map)
1849 ;; Omit files that Git would ignore
1850 (defun dired-omit-regexp ()
1851 (let ((file (expand-file-name ".git"))
1853 (while (and (not (file-exists-p file))
1856 (file-name-directory
1857 (directory-file-name
1858 (file-name-directory file))))
1859 ;; Give up if we are already at the root dir.
1860 (not (string= (file-name-directory file)
1862 ;; Move up to the parent dir and try again.
1863 (setq file (expand-file-name ".git" parent-dir)))
1864 ;; If we found a change log in a parent, use that.
1865 (if (file-exists-p file)
1866 (let ((regexp (funcall dired-omit-regexp-orig))
1868 (shell-command-to-string "git clean -d -x -n")))
1869 (if (= 0 (length omitted-files))
1873 (if (> (length regexp) 0)
1882 (if (= ?/ (aref str (1- (length str))))
1886 (split-string omitted-files "\n" t)
1889 (funcall dired-omit-regexp-orig))))))
1891 (add-hook 'dired-mode-hook 'dired-package-initialize)
1893 ;; (defun dired-double-jump (first-dir second-dir)
1895 ;; (list (read-directory-name "First directory: "
1896 ;; (expand-file-name "~")
1897 ;; nil nil "~/Downloads/")
1898 ;; (read-directory-name "Second directory: "
1899 ;; (expand-file-name "~")
1901 ;; (dired first-dir)
1902 ;; (dired-other-window second-dir))
1903 ;; (bind-key "C-c J" 'dired-double-jump)
1905 (defun dired-back-to-top ()
1907 (goto-char (point-min))
1908 (dired-next-line 4))
1910 (define-key dired-mode-map
1911 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
1913 (defun dired-jump-to-bottom ()
1915 (goto-char (point-max))
1916 (dired-next-line -1))
1918 (define-key dired-mode-map
1919 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
1922 ** discover-my-major
1923 [2014-06-01 Sun 23:32]
1924 Discover key bindings and their meaning for the current Emacs major mode.
1925 #+BEGIN_SRC emacs-lisp
1926 (use-package discover-my-major
1927 :ensure discover-my-major
1928 :commands discover-my-major
1929 :bind ("C-h C-m" . discover-my-major))
1932 EasyPG is a GnuPG interface for Emacs.
1933 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1934 #+BEGIN_SRC emacs-lisp
1935 (use-package epa-file
1939 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
1940 (defadvice epg--start (around advice-epg-disable-agent disable)
1941 "Don't allow epg--start to use gpg-agent in plain text
1943 (if (display-graphic-p)
1945 (let ((agent (getenv "GPG_AGENT_INFO")))
1946 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
1948 (setenv "GPG_AGENT_INFO" agent))))
1949 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
1950 (ad-activate 'epg--start)
1954 [2013-04-21 So 20:36]
1955 ediff - don't start another frame
1956 #+BEGIN_SRC emacs-lisp
1960 (defvar ctl-period-equals-map)
1961 (define-prefix-command 'ctl-period-equals-map)
1962 (bind-key "C-. =" 'ctl-period-equals-map)
1963 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
1965 :bind (("C-. = b" . ediff-buffers)
1966 ("C-. = B" . ediff-buffers3)
1967 ("C-. = =" . ediff-files)
1968 ("C-. = f" . ediff-files)
1969 ("C-. = F" . ediff-files3)
1970 ("C-. = r" . ediff-revision)
1971 ("C-. = p" . ediff-patch-file)
1972 ("C-. = P" . ediff-patch-buffer)
1973 ("C-. = l" . ediff-regions-linewise)
1974 ("C-. = w" . ediff-regions-wordwise))
1976 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
1977 (setq ediff-split-window-function 'split-window-horizontally)
1981 ** Eww - Emacs browser
1982 [2016-10-03 Mo 21:30]
1983 Eww - Emacs browser (needs emacs 24.4 or higher)
1984 #+BEGIN_SRC emacs-lisp
1986 :bind (("M-s M-w" . eww-search-words)
1988 (":" . eww) ; Go to URL
1989 ("h" . eww-list-histories) ; View history
1990 :map eww-text-map ; For single line text fields
1991 ("<backtab>" . shr-previous-link) ; S-TAB Jump to previous link on the page
1992 ("<C-return>" . eww-submit)
1993 :map eww-textarea-map ; For multi-line text boxes
1994 ("<backtab>" . shr-previous-link)
1995 ("<C-return>" . eww-submit)
1996 :map eww-checkbox-map
1997 ("<down-mouse-1>" . eww-toggle-checkbox)
1999 ("w" . modi/eww-copy-url-dwim)
2000 :map eww-link-keymap
2001 ("w" . modi/eww-copy-url-dwim))
2005 ;; Make the binding for `revert-buffer' do `eww-reload' in eww-mode
2006 (define-key eww-mode-map [remap revert-buffer] #'eww-reload)
2008 ;; (setq eww-search-prefix "https://duckduckgo.com/html/?q=")
2009 (setq eww-search-prefix "https://www.google.com/search?q=")
2010 (setq eww-download-directory "~/Downloads")
2011 ;; (setq eww-form-checkbox-symbol "[ ]")
2012 (setq eww-form-checkbox-symbol "☐") ; Unicode hex 2610
2013 ;; (setq eww-form-checkbox-selected-symbol "[X]")
2014 (setq eww-form-checkbox-selected-symbol "☑") ; Unicode hex 2611
2015 ;; Improve the contract of pages like Google results
2016 ;; http://emacs.stackexchange.com/q/2955/115
2017 (setq shr-color-visible-luminance-min 80) ; default = 40
2019 ;; Auto-rename new eww buffers
2020 ;; http://ergoemacs.org/emacs/emacs_eww_web_browser.html
2021 (defun xah-rename-eww-hook ()
2022 "Rename eww browser's buffer so sites open in new page."
2023 (rename-buffer "eww" t))
2024 (add-hook 'eww-mode-hook #'xah-rename-eww-hook)
2026 ;; If the current buffer is an eww buffer, "M-x eww" will always reuse the
2027 ;; current buffer to load the new page. Below advice will make "C-u M-x eww"
2028 ;; force a new eww buffer even when the current buffer is an eww buffer.
2029 ;; The above `xah-rename-eww-hook' fix is still needed in order to create
2030 ;; uniquely named eww buffers.
2031 ;; http://emacs.stackexchange.com/a/24477/115
2032 (defun modi/force-new-eww-buffer (orig-fun &rest args)
2033 "When prefix argument is used, a new eww buffer will be created.
2034 This is regardless of whether the current buffer is an eww buffer. "
2035 (if current-prefix-arg
2037 (apply orig-fun args))
2038 (apply orig-fun args)))
2039 (advice-add 'eww :around #'modi/force-new-eww-buffer)
2041 ;; Override the default definition of `eww-search-words'
2042 (defun eww-search-words (&optional beg end)
2043 "Search the web for the text between the point and marker.
2044 See the `eww-search-prefix' variable for the search engine used."
2047 (eww (buffer-substring beg end))
2048 (eww (modi/get-symbol-at-point))))
2051 ;; https://github.com/m00natic/eww-lnum
2052 (use-package eww-lnum
2054 :bind (:map eww-mode-map
2055 ("f" . eww-lnum-follow)
2056 ("U" . eww-lnum-universal)))
2059 ;; Copy text from html page for pasting in org mode file/buffer
2060 ;; e.g. Copied HTML hyperlinks get converted to [[link][desc]] for org mode.
2061 ;; http://emacs.stackexchange.com/a/8191/115
2062 (use-package org-eww
2063 :bind (:map eww-mode-map
2064 ("o" . org-eww-copy-for-org-mode)))
2066 ;; Auto-refreshing eww buffer whenever the html file it's showing changes
2067 ;; http://emacs.stackexchange.com/a/2566/115
2068 (defvar modi/eww--file-notify-descriptors-list ()
2069 "List to store file-notify descriptor for all files that have an
2070 associated auto-reloading eww buffer.")
2072 (defun modi/advice-eww-open-file-to-auto-reload (orig-fun &rest args)
2073 "When `eww-open-file' is called with \\[universal-argument], open
2074 the file in eww and also add `file-notify' watch for it so that the eww
2075 buffer auto-reloads when the HTML file changes."
2077 (apply orig-fun args)
2078 (when current-prefix-arg ; C-u M-x eww-open-file
2079 (require 'filenotify)
2080 (let ((file-name (car args)))
2081 (file-notify-add-watch file-name
2082 '(change attribute-change)
2083 #'modi/file-notify-callback-eww-reload)
2084 ;; Show the HTML file and its rendered form in eww side-by-side
2085 (find-file-other-window file-name))
2086 ;; Redefine the `q' binding in `eww-mode-map'
2087 (bind-key "q" #'modi/eww-quit-and-update-fn-descriptors eww-mode-map))))
2088 (advice-add 'eww-open-file :around #'modi/advice-eww-open-file-to-auto-reload)
2090 (defun modi/file-notify-callback-eww-reload (event)
2091 "On getting triggered, switch to the eww buffer, reload and switch
2092 back to the working buffer. Also save the `file-notify-descriptor' of the
2094 (let* ((working-buffer (buffer-name)))
2095 (switch-to-buffer-other-window "eww")
2097 (switch-to-buffer-other-window working-buffer))
2098 ;; `(car event)' will return the event descriptor
2099 (add-to-list 'modi/eww--file-notify-descriptors-list (car event)))
2101 (defun modi/eww-quit-and-update-fn-descriptors ()
2102 "When quitting `eww', first remove any saved file-notify descriptors
2103 specific to eww, while also updating `modi/eww--file-notify-descriptors-list'."
2105 (dotimes (index (safe-length modi/eww--file-notify-descriptors-list))
2106 (file-notify-rm-watch (pop modi/eww--file-notify-descriptors-list)))
2107 (quit-window :kill))))
2109 ;; Default eww key bindings
2110 ;; |-----------+---------------------------------------------------------------------|
2111 ;; | Key | Function |
2112 ;; |-----------+---------------------------------------------------------------------|
2113 ;; | & | Browse the current URL with an external browser. |
2114 ;; | - | Begin a negative numeric argument for the next command. |
2115 ;; | 0 .. 9 | Part of the numeric argument for the next command. |
2116 ;; | C | Display a buffer listing the current URL cookies, if there are any. |
2117 ;; | H | List the eww-histories. |
2118 ;; | F | Toggle font between variable-width and fixed-width. |
2119 ;; | G | Go to a URL |
2120 ;; | R | Readable mode |
2121 ;; | S | List eww buffers |
2122 ;; | d | Download URL under point to `eww-download-directory'. |
2123 ;; | g | Reload the current page. |
2124 ;; | q | Quit WINDOW and bury its buffer. |
2125 ;; | v | `eww-view-source' |
2126 ;; | w | `eww-copy-page-url' |
2127 ;; |-----------+---------------------------------------------------------------------|
2128 ;; | b | Add the current page to the bookmarks. |
2129 ;; | B | Display the bookmark list. |
2130 ;; | M-n | Visit the next bookmark |
2131 ;; | M-p | Visit the previous bookmark |
2132 ;; |-----------+---------------------------------------------------------------------|
2133 ;; | t | Go to the page marked `top'. |
2134 ;; | u | Go to the page marked `up'. |
2135 ;; |-----------+---------------------------------------------------------------------|
2136 ;; | n | Go to the page marked `next'. |
2137 ;; | p | Go to the page marked `previous'. |
2138 ;; |-----------+---------------------------------------------------------------------|
2139 ;; | l | Go to the previously displayed page. |
2140 ;; | r | Go to the next displayed page. |
2141 ;; |-----------+---------------------------------------------------------------------|
2142 ;; | TAB | Move point to next link on the page. |
2143 ;; | S-TAB | Move point to previous link on the page. |
2144 ;; |-----------+---------------------------------------------------------------------|
2145 ;; | SPC | Scroll up |
2146 ;; | DEL/Bkspc | Scroll down |
2147 ;; | S-SPC | Scroll down |
2148 ;; |-----------+---------------------------------------------------------------------|
2153 ** exec path from shell
2154 [2017-04-01 Sat 23:27]
2155 #+BEGIN_SRC emacs-lisp
2156 (use-package exec-path-from-shell
2160 ;; Import additional environment variables beyond just $PATH
2161 (dolist (var '("PYTHONPATH" ; Python modules
2162 "INFOPATH" ; Info directories
2163 "JAVA_OPTS" ; Options for java processes
2164 "RUST_SRC_PATH" ; Rust sources, for racer
2165 "CARGO_HOME" ; Cargo home, for racer
2172 (add-to-list 'exec-path-from-shell-variables var))
2173 (exec-path-from-shell-initialize)))
2176 [2014-06-01 Sun 15:16]
2177 #+BEGIN_SRC emacs-lisp
2178 (use-package expand-region
2179 :ensure expand-region
2180 :bind ("C-M-+" . er/expand-region)
2181 :commands er/expand-region)
2183 ** eyebrowse :CANCELLED:
2185 - State "NEXT" from "CANCELLED" [2017-09-16 Sat 23:06]
2186 - State "CANCELLED" from [2017-08-26 Sat 15:06]
2188 [2017-04-29 Sat 13:18]
2189 [[https://github.com/wasamasa/eyebrowse][Eyebrowse]] is a global minor mode for Emacs that allows you to manage
2190 your window configurations in a simple manner, just like tiling window
2191 managers like i3wm with their workspaces do. It displays their current
2192 state in the modeline by default. The behaviour is modeled after
2193 ranger, a file manager written in Python.
2194 #+BEGIN_SRC emacs-lisp :tangle no
2195 (use-package eyebrowse
2199 (setq eyebrowse-mode-line-separator " "
2200 eyebrowse-new-workspace t)
2201 (eyebrowse-setup-opinionated-keys)
2202 (setq eyebrowse-new-workspace t)
2208 [2013-04-28 So 22:21]
2209 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
2210 As the one time I tried Flymake i wasn't happy, thats easy to
2212 #+BEGIN_SRC emacs-lisp
2213 (use-package flycheck
2215 :diminish flycheck-mode
2216 :bind (("M-n" . next-error)
2217 ("M-p" . previous-error))
2220 (use-package flycheck-color-mode-line
2221 :ensure flycheck-color-mode-line)
2222 (setq flycheck-highlighting-mode 'nil)
2223 (setq flycheck-flake8-maximum-line-length '150)
2224 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
2225 (setq flycheck-sh-shellcheck-executable "/usr/bin/shellcheck -e 2086")
2226 (add-hook 'find-file-hook
2228 (when (not (equal 'emacs-lisp-mode major-mode))
2233 Obviously emacs can do syntax hilighting. For more things than you ever
2235 And I want to have it everywhere.
2236 #+BEGIN_SRC emacs-lisp
2237 (use-package font-lock
2240 (global-font-lock-mode 1)
2241 (setq font-lock-maximum-decoration t)
2242 (setq jit-lock-defer-time nil)
2243 (setq jit-lock-stealth-nice 0.1)
2244 (setq jit-lock-stealth-time 0.2)
2245 (setq jit-lock-stealth-verbose nil)))
2248 [2014-05-21 Wed 22:56]
2249 #+BEGIN_SRC emacs-lisp
2250 (use-package git-gutter+
2252 :diminish git-gutter+-mode
2253 :bind (("C-x n" . git-gutter+-next-hunk)
2254 ("C-x p" . git-gutter+-previous-hunk)
2255 ("C-x v =" . git-gutter+-show-hunk)
2256 ("C-x r" . git-gutter+-revert-hunks)
2257 ("C-x s" . git-gutter+-stage-hunks)
2258 ("C-x c" . git-gutter+-commit)
2262 (setq git-gutter+-disabled-modes '(org-mode))
2263 (global-git-gutter+-mode 1))
2266 (use-package git-gutter-fringe+
2267 :ensure git-gutter-fringe+
2270 (setq git-gutter-fr+-side 'right-fringe)
2271 ;(git-gutter-fr+-minimal)
2275 [2015-02-22 Sun 14:00]
2276 Provides function that popup commit message at current line. This is
2277 useful when you want to know why this line was changed.
2278 #+BEGIN_SRC emacs-lisp
2279 (use-package git-messenger
2280 :ensure git-messenger
2281 :commands (git-messenger:popup-message)
2282 :bind (("C-x v p" . git-messenger:popup-message))
2285 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
2286 (add-hook 'git-messenger:popup-buffer-hook 'magit-revision-mode)
2287 (setq git-messenger:show-detail t)))
2290 [2014-07-23 Mi 12:57]
2291 Browse historic versions of a file with p (previous) and n (next).
2292 #+BEGIN_SRC emacs-lisp
2293 (use-package git-timemachine
2294 :ensure git-timemachine
2295 :commands git-timemachine)
2299 [2017-06-27 Di 23:10]
2300 #+BEGIN_SRC emacs-lisp
2303 :commands (bbdb bbdb-insinuate-gnus bbdb-initialize)
2306 (use-package bbdb-message)
2307 (use-package bbdb-gnus)
2308 (use-package bbdb-com)
2310 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
2312 (setq bbdb-add-mails t)
2313 (setq bbdb-ignore-redundant-mails t)
2314 (setq bbdb-complete-mail-allow-cycling t)
2315 (setq bbdb-complete-name-allow-cycling t)
2316 (setq bbdb-completion-type 'primary-or-name)
2317 (setq bbdb-dwim-net-address-allow-redundancy t)
2318 (setq bbdb-default-area-code 661)
2319 (setq bbdb-dial-local-prefix "0")
2320 (setq bbdb-file-coding-system 'utf-8)
2321 (setq bbdb-hashtable-size 104729)
2322 (setq bbdb-ignore-messages-alist '(("To" . "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software.de\\)")))
2323 (setq bbdb-new-mails-primary t)
2324 (setq bbdb-notice-auto-save-file t)
2325 (setq bbdb-notice-mail-hook 'bbdb-auto-notes-hook)
2326 (setq bbdb-phone-style nil)
2327 (setq bbdb-pop-up-window-size 6)
2328 (setq bbdb-user-mail-names "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software.de\\)")
2329 (setq bbdb/gnus-summary-known-poster-mark "+")
2330 (setq bbdb/gnus-summary-mark-known-posters t)
2331 (setq bbdb/gnus-summary-prefer-real-names t)
2332 (setq bbdb/news-auto-create-p 'bbdb-ignore-most-messages-hook)
2333 (setq bbdb-auto-notes-rules
2334 '(("user-agent" (".*" interface 0))
2335 ("Organization" (".*" company 0))
2336 ("x-mailer" (".*" interface 0))
2337 ("x-newsreader" (".*" interface 0))
2338 ("X-URL" (".*" url 0))
2339 ("newsgroups" ("\\\\([^,]*\\\\),?" posted-to "\\\\1" t))
2340 ("xref" ("\\\\b[^ ]+:[0-9]+.*" seen-in 0))))
2341 (put 'seen-in 'field-separator "; ")
2342 (put 'interface 'field-seperator "; ")
2344 (use-package counsel-bbdb
2350 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
2351 what I want every emacs to know.
2352 #+BEGIN_SRC emacs-lisp
2355 :bind (("C-c g" . gnus)
2356 :map gnus-summary-mode-map
2357 ("<f6>" . jj-forward-spam)
2358 ("C-<f1>" . jj-move-mail-spambox)
2359 ("C-<f2>" . jj-copy-mail-hambox)
2360 ("C-c x" . gnus-scum-expunge)
2361 :map gnus-group-mode-map
2362 ("GG" . notmuch-search)
2372 ; When emacs exits, gnus does too, no need to ask me
2373 (defun exit-gnus-on-exit ()
2374 (if (and (fboundp 'gnus-group-exit)
2376 (with-current-buffer (get-buffer "*Group*")
2377 (gnus-group-exit))))
2378 (add-hook 'kill-emacs-hook 'exit-gnus-on-exit)
2380 ;; prettier summary buffers
2382 (setq gnus-sum-thread-tree-indent " ") ;; " "
2383 (setq gnus-sum-thread-tree-root "\u229e ") ;; "⊞ "
2384 (setq gnus-sum-thread-tree-false-root "\u22a1 ") ;; "⊡ "
2385 (setq gnus-sum-thread-tree-single-indent " ") ;; " "
2386 (setq gnus-sum-thread-tree-vertical " \u2502") ;; " │"
2387 (setq gnus-sum-thread-tree-leaf-with-other " \u251c\u2500 ") ;; " ├─ "
2388 (setq gnus-sum-thread-tree-single-leaf " \u2570\u2500 ") ;; " ╰─ "
2390 (use-package gnus-cite
2393 (defface dwa/mail-citation '((((class color)
2395 (:background "#383838"))
2398 (:background "#efefef")))
2399 "Mail citation base face.")
2400 (loop for x in gnus-cite-face-list do
2401 (set-face-attribute x nil ':inherit 'dwa/mail-citation))))
2403 (setq message-subscribed-address-functions
2404 '(gnus-find-subscribed-addresses))
2406 (if (string-match (system-name) "delenn.ganneff.de")
2408 (setq imap-ssl-program "openssl s_client -no_ssl2 -no_ssl3 -tls1 -connect %s:%p")
2410 (use-package org-gnus)
2412 (setq gnus-secondary-select-methods
2416 (nnimap-address "localhost")
2417 (nnimap-user "nsb@auth")
2418 (nnimap-nov-is-evil t)
2419 (nnimap-stream network)
2420 (nnir-search-engine notmuch)
2423 (nnimap-address "localhost")
2424 (nnimap-user "gmail@auth")
2425 (nnimap-stream network)
2426 (nnimap-nov-is-evil t)
2427 (nnir-search-engine notmuch)
2430 ;;** Von wo holt Gnus News
2431 (setq gnus-select-method '(nnimap "ganneff"
2432 (nnimap-address "localhost")
2433 (nnimap-user "ganneff@auth")
2434 (nnimap-stream network)
2435 (nnimap-nov-is-evil t)
2436 (nnir-search-engine notmuch)
2438 ;;** Kopien aller Mails/News speichern
2439 (setq gnus-message-archive-group
2440 '((if (message-news-p)
2441 "nnfolder+archive:Sentnews"
2442 "nnimap+ganneff:Sentmail")))
2445 (setq nnir-mail-backend (nth 1 gnus-secondary-select-methods))
2447 ;;** dont always read the active file.
2448 (setq gnus-read-active-file 'some)
2450 ;;** nnimap nich cachen, ebenso nnml
2451 (setq gnus-uncacheable-groups "^\\(nnml\\|nnimap\\)")
2453 ;;** Bei langsamer Anbindung dies auf t setzen
2454 (setq gnus-asynchronous t)
2456 ;;** Mein Gnus soll regelmaessig nach neuen Mails/News schauen.
2457 (gnus-demon-add-handler 'us-get-only-mail 20 10)
2460 ;; Set the default value of `mm-discouraged-alternatives'.
2461 (eval-after-load "gnus-sum"
2463 'gnus-newsgroup-variables
2464 '(mm-discouraged-alternatives
2465 . '("text/html" "text/richtext"))))
2467 ;; Display `text/html' parts in `nnrss' groups only.
2470 '("\\`nnrss:" (mm-discouraged-alternatives nil)))
2473 (setq gnus-auto-subscribed-groups
2474 (concat gnus-auto-subscribed-groups
2477 ;;** Immer Gruppen nach Topics anzeigen
2478 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
2480 ;;** Summary Anzeige umdefinieren.
2481 (setq gnus-summary-line-format "%U%R%z (%4k) %uy%* %B%(%[ %-22,22f %]%) %s\n")
2482 (setq gnus-summary-gather-subject-limit 'fuzzy)
2484 ;;** Und die Gruppenanzeige will ich auch anders. Will sehen wann ich zuletzt da reingesehen hab.
2485 (setq gnus-group-line-format
2486 "%M%S%p%P %4ux/%4i/%6R: %(%-55,55ug%3O%)%l <%2,2~(cut 6)d.%2,2~(cut 4)d.%2,2~(cut 2)d>\n")
2488 ;;** Different topic lines
2489 (setq gnus-topic-line-format "%i[ %u&topic-line; ] %v\n")
2491 ;;** Für die umdefinierte Gruppenanzeige muss Gnus aber einen Timestamp in der Gruppe speichern.
2492 (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
2494 ;;** Ich will manchmal den Empfänger statt des Absenders sehen
2495 (setq gnus-extra-headers '(To Newsgroups Newsgroup Cc))
2496 (setq nnmail-extra-headers gnus-extra-headers)
2497 (setq gnus-ignored-from-addresses '("\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software\\.de\\|dlh\\.de\\)"))
2499 ;; Don't send to these address in wide reply.
2500 (setq message-dont-reply-to-names (append '("notifications@github\\.com"
2501 ".*@noreply\\.github\\.com"
2503 gnus-ignored-from-addresses))
2505 ;;** Threads um 2 Zeichen einruecken.
2506 (setq gnus-thread-indent-level 1)
2508 ;;** Posting Styles. Nettes Feature
2509 (setq gnus-posting-styles
2512 (from "Joerg Jaspert <joerg@ganneff.de>")) ; Globale Einstellung
2513 ("Allgemein.Sabrina"
2514 (from "Joerg (悠軻) Jaspert <joerg@debian.org>"))
2516 (from "Joerg Jaspert <joerg@debian.org>")
2517 (signature-file "~/.signature.private"))
2519 (from "Joerg Jaspert <joerg@nsb-software.de>")
2520 (signature-file "~/.signature.nsb")
2521 (organization "NSB Nguyen Softwareentwicklung & beratung GmbH")
2522 (gcc "nnimap+nsb:Sent"))
2524 (from "Joerg Jaspert <joerg@nsb-software.de>")
2525 (signature-file "~/.signature.nsb")
2526 (organization "NSB Nguyen Softwareentwicklung & beratung GmbH")
2527 (gcc "nnimap+nsb:Sent"))
2528 ("nnimap\\+nsb:shared.gf.*"
2529 (from "Joerg Jaspert <gf@nsb-software.de>"))
2531 (from "Joerg Jaspert <joerg@debian.org>"))
2533 (Gcc "nnimap+ganneff:Debian.AM"))
2535 (reply-to "Debian Account Managers <da-manager@debian.org>"))
2537 (from "Joerg Jaspert <joerg@debconf.org>"))
2539 (from "Joerg Jaspert <joerg@debian.org>"))
2541 (from "Joerg Jaspert <joerg@debian.org>"))
2545 ;;** Antworten auf meine Nachrichten hervorheben, hochscoren
2546 (add-hook 'message-sent-hook 'gnus-score-followup-article)
2547 (add-hook 'message-sent-hook 'gnus-score-followup-thread)
2549 ;;** Grosse Newsgroups. Gnus fragt da laestigerweise immer nach.
2550 ;;** Aber da ich viele grosse Gruppen und nen schnellen Rechner habe
2551 ;;** soll der erst recht spaet nachfragen. Erst wenns wirklich fies wird.
2552 (setq gnus-large-newsgroup "15000")
2554 ;;** Beim Betreten einer Gruppe keinen Artikel auswählen. Gegen Adaptive Scoring iss des !
2555 (setq gnus-auto-select-first nil)
2557 ;;** Wenn ich in einer Gruppe fertig bin soll Gnus nich fragen ob ich in
2558 ;;** die naechste will. Es soll einfach tun.
2559 (setq gnus-auto-select-next 'quietly)
2561 ;;** Hervorhebungen (Unterstrichen und Fett bei "_X_" und "*X*")
2562 (add-hook 'gnus-article-display-hook 'gnus-article-emphasize t)
2564 ;;** Gnus Visible Headers
2565 (setq gnus-visible-headers
2571 "^Mail-Followup-To:"
2591 ;;; Order of headers
2592 (setq gnus-sorted-header-list '("^From:"
2606 ;;** Save gnus score files. Ziemlich doof wenn nicht
2607 (setq gnus-save-score t)
2609 ;;** Score Einstellungen. Welches Global File und woher die Scores holen.
2610 (setq gnus-global-score-files '("~/News/all.SCORE"))
2611 (setq gnus-score-find-score-files-function '(gnus-score-find-bnews bbdb/gnus-score))
2613 ;;** Adaptives Scoring
2614 (setq gnus-use-adaptive-scoring t)
2615 (defvar gnus-default-adaptive-score-alist
2616 '((gnus-unread-mark)
2617 (gnus-ticked-mark (from 5))
2618 (gnus-dormant-mark (from 6))
2619 (gnus-del-mark (subject -5))
2620 (gnus-read-mark (from 5) (subject 3))
2621 (gnus-expirable-mark (from -2) (subject -2))
2622 (gnus-killed-mark (from -2) (subject -4))
2623 (gnus-kill-file-mark)
2625 (gnus-low-score-mark)
2626 (gnus-catchup-mark (subject -3))
2629 ;;** Damit ich nicht mit Megabytegrossen Scorefiles rummachen muss, muss bei Adaptive-Scoring
2630 ;;** der Kram automagisch gelöscht werden. Sonst hats keinen Sinn !
2631 (setq gnus-decay-scores t)
2633 ;;** Artikel mit weniger Score werden nicht angezeigt
2634 (setq gnus-summary-expunge-below -1000)
2636 ;;** work around unimplemented handling of multiple similar attachments
2637 ;;** (recommended by ShengHuo Zhu Fri 20 Jul 2001 13:14)
2638 (setq gnus-mime-display-multipart-related-as-mixed t)
2640 ;;** Bilderchen direkt anzeigen.
2641 (setq mm-inline-large-images t)
2643 ;;** ueberfluessige Leerzeilen loeschen
2644 (setq gnus-treat-strip-trailing-blank-lines t)
2645 (setq gnus-treat-strip-leading-blank-lines t)
2647 ;;** Falsch gebaute Attachments ? Nich mit mir. Nuja, UUE wech. Was solls. Will ich eh nich haben
2648 (setq mm-uu-configure-list '((uu . disabled)))
2650 ;; (use-package message-utils
2651 ;; :commands (message-mark-inserted-region message-mark-insert-file message-strip-subject-was message-change-subject message-xpost-fup2 message-add-archive-header message-reduce-to-to-cc)
2652 ;; :bind ((:map message-mode-map
2653 ;; ("C-c m" . message-mark-inserted-region)
2654 ;; ("C-c f" . message-mark-insert-file)
2655 ;; ("C-c x" . message-xpost-fup2)
2656 ;; ("C-c s" . message-change-subject)
2657 ;; ("C-c a" . message-add-archive-header)
2658 ;; ("C-c t" . message-reduce-to-to-cc)
2660 ;(add-hook 'message-header-setup-hook 'message-strip-subject-was)
2661 ;(add-hook 'message-setup-hook 'message-utils-setup)
2663 ;;** Meine Smileys mag ich gelb
2667 (setq gnus-treat-display-smileys t)
2668 (setq smiley-flesh-color "Yellow")
2669 (setq smiley-data-directory "~/emacs/etc/smilies/")))
2671 ;;** utf-8, coding systems
2672 (setq mm-coding-system-priorities
2673 '(iso-latin-1 iso-latin-9 utf-8))
2676 :mode ("\\.siv\\'" . sieve-mode)
2678 (require 'gnus-sieve)
2681 (setq gnus-use-correct-string-widths nil)
2683 (setq nnrss-wash-html-in-text-plain-parts t)
2684 (setq canlock-password "canlockjjaspert")
2685 (setq canlock-sha1-function (quote canlock-sha1-with-openssl))
2686 (setq canlock-sha1-function-for-verify (quote canlock-sha1-with-openssl))
2687 (setq gnus-agent nil)
2688 (setq gnus-article-banner-alist (quote ((banner-perl . "^--.?
2694 Die Nutzung von.+html") (banner-debian . "^--.?
2696 .*@lists.debian.org$") (banner-debian-de . "^--.?
2698 Um sich aus der Liste auszutragen.+
2702 -+$\\|[0-9]+ eingetragene Mitglieder in dieser Liste.") (banner-sourceforge . "^_+
2703 .+@lists.sourceforge.net
2704 http://lists.sourceforge.net.+
2706 $") (banner-amavis . "^_+
2710 .*amavis-faq.php3$"))))
2711 (setq gnus-article-sort-functions (quote (gnus-article-sort-by-number gnus-article-sort-by-score gnus-article-sort-by-date)))
2712 (setq gnus-article-x-face-command (quote gnus-display-x-face-in-from))
2713 (setq gnus-boring-article-headers (quote (empty newsgroups followup-to reply-to)))
2714 (setq gnus-build-sparse-threads nil)
2715 (setq gnus-buttonized-mime-types '("multipart/signed"))
2717 ;; collaps long citations
2718 ;; (w/ `gnus-treat-hide-citation t' or `W W c'):
2719 gnus-cited-closed-text-button-line-format
2720 "%(%{... [ %n lines (%l chars) of citation hidden, click here to expand ] ...%}%)\n"
2721 gnus-cited-lines-visible '(3 . 6) ; (top . bottom)
2723 gnus-treat-hide-citation t)
2725 (setq gnus-default-article-saver (quote gnus-summary-save-in-file))
2726 ; (setq gnus-default-charset (quote iso-8859-1))
2727 (setq gnus-generate-tree-function (quote gnus-generate-vertical-tree))
2728 (setq gnus-group-charset-alist (quote (("\\(^\\|:\\)hk\\>\\|\\(^\\|:\\)tw\\>\\|\\<big5\\>" cn-big5) ("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" cn-gb-2312) ("\\(^\\|:\\)fj\\>\\|\\(^\\|:\\)japan\\>" iso-2022-jp-2) ("\\(^\\|:\\)tnn\\>\\|\\(^\\|:\\)pin\\>\\|\\(^\\|:\\)sci.lang.japan" iso-2022-7bit) ("\\(^\\|:\\)relcom\\>" koi8-r) ("\\(^\\|:\\)fido7\\>" koi8-r) ("\\(^\\|:\\)\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2) ("\\(^\\|:\\)israel\\>" iso-8859-1) ("\\(^\\|:\\)han\\>" euc-kr) ("\\(^\\|:\\)alt.chinese.text.big5\\>" chinese-big5) ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr) ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1))))
2729 (setq gnus-group-name-charset-group-alist (quote ((".*" . iso-8859-1))))
2730 (setq gnus-group-name-charset-method-alist (quote ((nntp . iso-8859-1))))
2731 (setq gnus-group-posting-charset-alist (quote (("^\\(no\\|fr\\)\\.[^,]*\\(,[
2732 ]*\\(no\\|fr\\)\\.[^,]*\\)*$" iso-8859-1 (iso-8859-1)) ("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[
2733 ]*\\(fido7\\|relcom\\)\\.[^,]*\\)*$" koi8-r (koi8-r)) (message-this-is-mail nil nil) (message-this-is-news nil t))))(setq gnus-gcc-mark-as-read t)
2734 (setq gnus-list-identifiers "\\[\\(a-zA-Z\\)+\\]")
2735 (setq gnus-message-replyencrypt nil)
2736 (setq gnus-message-replysign nil)
2737 (setq gnus-novice-user nil)
2738 (setq gnus-refer-thread-limit t)
2739 (setq gnus-save-duplicate-list t)
2740 (setq gnus-simplify-ignored-prefixes nil)
2741 (setq gnus-summary-exit-hook (quote (gnus-summary-bubble-group)))
2742 (setq gnus-summary-mode-line-format "Gnus: %g [%A] %Z - killed: %E")
2743 (setq gnus-suppress-duplicates t)
2744 (setq gnus-thread-indent-level 2)
2745 (setq gnus-thread-sort-functions (quote (gnus-thread-sort-by-number gnus-thread-sort-by-score gnus-thread-sort-by-date)))
2746 (setq gnus-treat-capitalize-sentences nil)
2747 (setq gnus-treat-date-local (quote head))
2748 (setq gnus-treat-display-picons nil)
2749 (setq gnus-treat-display-x-face (quote head))
2750 (setq gnus-treat-fill-article nil)
2751 (setq gnus-treat-fill-long-lines nil)
2752 (setq gnus-treat-from-picon (quote head))
2753 (setq gnus-treat-mail-picon (quote head))
2754 (setq gnus-treat-newsgroups-picon (quote head))
2755 (setq gnus-treat-unsplit-urls t)
2756 (setq gnus-treat-x-pgp-sig (quote head))
2757 (setq gnus-use-picons t)
2758 (setq gnus-uu-post-encode-method (quote gnus-uu-post-encode-mime))
2759 (setq mm-automatic-display (quote ("text/plain" "text/enriched" "text/richtext" "image/jpeg" "text/x-vcard" "image/pjepg" "image/.*" "message/delivery-status" "multipart/.*" "message/rfc822" "text/x-patch" "application/pgp-signature" "application/emacs-lisp" "application/x-pkcs7-signature" "application/pkcs7-signature" "application/x-pkcs7-mime" "application/pkcs7-mime" "application/pgp")))
2760 (setq mm-body-charset-encoding-alist (quote ((iso-2022-jp . 7bit) (iso-2022-jp-2 . 7bit) (iso-8859-1 . 8bit) (iso-8859-15 . 8bit))))
2761 (setq mm-decrypt-option (quote known))
2762 (setq mm-inlined-types (quote ("image/jpeg" "image/.*" "text/.*" "message/delivery-status" "message/rfc822" "message/partial" "message/external-body" "application/emacs-lisp" "application/x-emacs-lisp" "application/pgp-signature" "application/x-pkcs7-signature" "application/pkcs7-signature" "application/x-pkcs7-mime" "application/pkcs7-mime" "application/pgp")))
2763 (setq mm-verify-option (quote always))
2764 (setq nnimap-authinfo-file "~/.nnimap")
2765 (setq gnus-save-newsrc-file nil)
2766 (setq gnus-read-newsrc-file nil)
2767 (setq gnus-always-read-dribble-file t)
2769 (setq gnus-refer-article-method
2771 (nnweb "refer" (nnweb-type dejanews))))
2777 [2017-03-11 Sat 20:06]
2778 The go language, see golang.org
2779 #+BEGIN_SRC emacs-lisp
2780 (use-package go-mode
2782 :bind (("M-." . godef-jump)
2783 ("M-*" . pop-tag-mark))
2786 (defun my-go-mode-hook ()
2788 (add-hook 'before-save-hook 'gofmt-before-save)
2789 ; Customize compile command to run go build
2790 (if (not (string-match "go" compile-command))
2791 (set (make-local-variable 'compile-command)
2792 "go build -v && go test -v && go vet"))
2793 ; Use goimports instead of go-fmt
2794 (setq gofmt-command "goimports")
2796 (add-hook 'go-mode-hook 'my-go-mode-hook)
2797 (use-package go-autocomplete
2799 (use-package go-eldoc
2803 (add-hook 'go-mode-hook 'go-eldoc-setup)))
2804 (use-package go-guru
2808 (go-guru-hl-identifier-mode)
2809 (setq go-guru-command "golang-guru")))
2813 [2015-02-20 Fri 16:27]
2814 When working with many windows at the same time, each window has a
2815 size that is not convenient for editing.
2817 golden-ratio helps on this issue by resizing automatically the windows
2818 you are working on to the size specified in the "Golden Ratio". The
2819 window that has the main focus will have the perfect size for editing,
2820 while the ones that are not being actively edited will be re-sized to
2821 a smaller size that doesn't get in the way, but at the same time will
2822 be readable enough to know it's content.
2823 #+BEGIN_SRC emacs-lisp
2824 (use-package golden-ratio
2825 :ensure golden-ratio
2826 :diminish (golden-ratio-mode . "ⓖ")
2827 :commands (golden-ratio-mode golden-ratio)
2828 :bind (("C-c t g" . my-toggle-golden-ratio))
2831 (defun my-toggle-golden-ratio ()
2833 (if (bound-and-true-p golden-ratio-mode)
2835 (golden-ratio-mode -1)
2839 (golden-ratio-mode 1)
2843 (setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*" "*Ediff Control Panel*"))
2844 (setq golden-ratio-exclude-modes '("calendar-mode"
2850 "notmuch-message-mode"
2854 (setq golden-ratio-exclude-buffer-regexp `(,(rx bos "*which-key*" eos)
2855 ,(rx bos "*NeoTree*" eos)))
2856 (setq golden-ratio-extra-commands '(windmove-up
2864 ace-maximize-window))))
2867 [2015-02-22 Sun 13:28]
2868 Move point through buffer-undo-list positions.
2869 #+BEGIN_SRC emacs-lisp
2870 (use-package goto-last-change
2871 :commands (goto-last-change)
2872 :bind (("M-g l" . goto-last-change))
2875 ** CANCELLED guide-key :CANCELLED:
2876 CLOSED: [2018-12-30 Sun 17:09]
2878 - State "CANCELLED" from [2018-12-30 Sun 17:09] \\
2879 ersetzt von which-key
2881 [2014-06-11 Wed 22:27]
2882 guide-key.el displays the available key bindings automatically and
2885 For whatever reason I like this more than icicles <backtab> completion
2887 #+BEGIN_SRC emacs-lisp
2888 (use-package guide-key
2890 :diminish guide-key-mode
2894 (setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
2896 (setq guide-key/recursive-key-sequence-flag t)
2897 (setq guide-key/popup-window-position 'bottom)
2898 (setq guide-key/idle-delay 0.5)))
2902 ** highlighting modes
2903 [2014-05-21 Wed 23:51]
2904 #+BEGIN_SRC emacs-lisp
2905 (use-package hi-lock
2906 :bind (("M-o l" . highlight-lines-matching-regexp)
2907 ("M-o r" . highlight-regexp)
2908 ("M-o w" . highlight-phrase)
2909 ("M-o u" . unhighlight-regexp)))
2911 (use-package hilit-chg
2912 :bind ("M-o C" . highlight-changes-mode))
2914 (use-package highlight-indentation
2916 :commands 'highlight-indentation-mode
2918 (hook-into-modes 'highlight-indentation-mode '(yaml-mode-hook python-mode-hook))
2919 (hook-into-modes 'highlight-indentation-current-column-mode '(yaml-mode-hook python-mode-hook))
2921 (set-face-background 'highlight-indentation-face "#283d83")
2922 (set-face-background 'highlight-indentation-current-column-face "#285f85")
2925 (use-package highlight-numbers ; Fontify number literals
2927 :init (add-hook 'prog-mode-hook #'highlight-numbers-mode))
2932 Crazy way of completion. It looks at the word before point and then
2933 tries to expand it in various ways.
2934 #+BEGIN_SRC emacs-lisp
2935 (use-package hippie-exp
2936 :bind ("M-/" . hippie-expand)
2937 :commands hippie-expand
2940 (setq hippie-expand-try-functions-list '(try-expand-dabbrev
2941 try-expand-dabbrev-all-buffers
2942 try-expand-dabbrev-from-kill
2943 try-complete-file-name-partially
2944 try-complete-file-name
2945 try-expand-all-abbrevs try-expand-list
2947 try-complete-lisp-symbol-partially
2948 try-complete-lisp-symbol))))
2951 [2015-01-26 Mon 15:50]
2952 This is a package for GNU Emacs that can be used to tie related
2953 commands into a family of short bindings with a common prefix - a
2956 Once you summon the Hydra through the prefixed binding (the body + any
2957 one head), all heads can be called in succession with only a short
2960 The Hydra is vanquished once Hercules, any binding that isn't the
2961 Hydra's head, arrives. Note that Hercules, besides vanquishing the
2962 Hydra, will still serve his orignal purpose, calling his proper
2963 command. This makes the Hydra very seamless, it's like a minor mode
2964 that disables itself auto-magically.
2965 #+BEGIN_SRC emacs-lisp
2970 (setq hydra-is-helpful t)
2973 (defhydra hydra-error (:color red)
2975 ("h" first-error "first")
2976 ("j" next-error "next")
2977 ("k" previous-error "prev")
2978 ("v" recenter-top-bottom "recenter")
2980 (bind-key "M-g e" 'hydra-error/body)
2982 ;; (defhydra hydra-gnus (:color red)
2984 ;; ("m" gnus-uu-mark-thread "mark thread")
2985 ;; ("d" gnus-summary-delete-article "delete article(s)")
2986 ;; ("r" gnus-summary-mark-as-read-forward "mark read")
2987 ;; ("n" gnus-summary-next-thread "next thread")
2988 ;; ("p" gnus-summary-prev-thread "previous thread")
2989 ;; ("g" gnus-summary-next-group "next group")
2990 ;; ("l" gnus-recenter "recenter")
2991 ;; ("x" gnus-summary-limit-to-unread "unread")
2992 ;; ("q" nil "quit"))
2993 ;; (bind-key "C-c h" 'hydra-gnus/body)
2995 (defhydra hydra-launcher (:color blue)
2998 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
2999 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
3002 (bind-key "M-g r" 'hydra-launcher/body)
3004 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
3005 (defvar whitespace-mode nil)
3006 (defhydra hydra-toggle (:color pink)
3008 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
3009 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
3010 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
3011 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
3012 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
3015 ("a" abbrev-mode nil)
3016 ("c" auto-complete-mode nil)
3017 ; ("i" aggressive-indent-mode nil)
3018 ("d" toggle-debug-on-error nil)
3019 ("f" auto-fill-mode nil)
3020 ("g" golden-ratio-mode nil)
3021 ("t" toggle-truncate-lines nil)
3022 ("w" whitespace-mode nil)
3023 ("r" auto-revert-mode nil)
3024 ("l" linum-mode nil)
3025 ("k" linum-relative-toggle nil)
3027 (bind-key "C-c C-v" 'hydra-toggle/body)
3033 [2014-05-21 Wed 23:54]
3034 #+BEGIN_SRC emacs-lisp
3035 (use-package ibuffer
3036 :bind (("C-h h" . ibuffer)
3037 ("C-x C-b" . ibuffer)
3038 ("<XF86WebCam>" . ibuffer)
3039 :map ibuffer-mode-map
3040 ("s" . isearch-forward-regexp)
3041 ("." . ibuffer-invert-sorting)
3042 ("i" . ibuffer-magit-status)
3043 ("G" . ibuffer-magit-status))
3045 :defines (ibuffer-filtering-alist
3046 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
3047 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
3050 (defvar my-ibufffer-separator " • ")
3051 (setq ibuffer-filter-group-name-face 'variable-pitch
3052 ibuffer-use-header-line t)
3053 (unbind-key "M-o" ibuffer-mode-map)
3058 (use-package ibuffer-vc
3061 (ibuffer-vc-set-filter-groups-by-vc-root
3062 ibuffer-vc-generate-filter-groups-by-vc-root))
3064 (use-package ibuffer-tramp
3066 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
3067 ibuffer-tramp-set-filter-groups-by-tramp-connection))
3068 ;; Switching to ibuffer puts the cursor on the most recent buffer
3069 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
3070 "Open ibuffer with cursor pointed to most recent buffer name"
3071 (let ((recent-buffer-name (buffer-name)))
3073 (ibuffer-update nil t)
3074 (unless (string= recent-buffer-name "*Ibuffer*")
3075 (ibuffer-jump-to-buffer recent-buffer-name))))
3077 (defun ibuffer-magit-status ()
3079 (--when-let (get-buffer "*Ibuffer*")
3080 (with-current-buffer it
3081 (let* ((selected-buffer (ibuffer-current-buffer))
3082 (buffer-path (with-current-buffer
3084 (or (buffer-file-name)
3085 list-buffers-directory
3086 default-directory)))
3088 (if (file-regular-p buffer-path)
3089 (file-name-directory buffer-path)
3091 (magit-status-internal default-directory)))))
3093 (setq ibuffer-directory-abbrev-alist
3098 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
3099 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
3101 ("dak" . "/develop/dak/")
3103 ("config" . "~/.emacs.d/config/")
3105 ("systmp" . "/tmp/")
3106 ("puppet" . "~/git/puppet")
3110 (use-package ibuffer-git
3112 (use-package ibuffer-vc
3115 (define-ibuffer-column size-h
3116 (:name "Size" :inline t)
3118 ((> (buffer-size) 1000)
3119 (format "%7.1fk" (/ (buffer-size) 1000.0)))
3120 ((> (buffer-size) 1000000)
3121 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
3123 (format "%8d" (buffer-size)))))
3125 (use-package ibuf-ext
3127 (setq ibuffer-old-time 12))
3129 (define-ibuffer-filter filename2
3130 "Toggle current view to buffers with filename matching QUALIFIER."
3131 (:description "filename2"
3132 :reader (read-from-minibuffer "Filter by filename (regexp): "))
3133 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
3134 (ibuffer-awhen (with-current-buffer buf
3135 (or buffer-file-name
3137 (string-match qualifier it)))
3139 (defvar ibuffer-magit-filter-groups nil)
3140 (defun ibuffer-magit-define-filter-groups ()
3141 (when (and (not ibuffer-magit-filter-groups)
3142 (boundp 'magit-repo-dirs))
3143 (setq ibuffer-magit-filter-groups
3146 (file-name-nondirectory (directory-file-name it)))
3148 (mapcar 'cdr (magit-list-repos))))))
3150 (defun ibuffer-set-filter-groups-by-root ()
3152 ;; (ibuffer-projectile-define-filter-groups)
3153 ;; (ibuffer-magit-define-filter-groups)
3154 (setq ibuffer-filter-groups
3156 ;; ibuffer-projectile-filter-groups
3157 ibuffer-magit-filter-groups
3160 (or (mode . magit-log-edit-mode)
3161 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
3162 (name . "^\\*Pymacs\\*$")
3163 (name . "^\\*helm.*\\*")
3164 (name . "^\\*Compile-log\\*$")
3165 (name . "^\\*Ido Completions\\*$")
3166 (name . "^\\*magit-\\(process\\)\\*$")
3170 (name . "^\\*\\(tramp/.*\\)\\*$"))))
3173 (name . "^\\*scratch")
3174 (name . "^\\*Messages")
3177 (ibuffer-vc-generate-filter-groups-by-vc-root)
3178 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
3180 (defun toggle-ibuffer-filter-groups ()
3183 (let ((ibuf (get-buffer "*Ibuffer*")))
3185 (with-current-buffer ibuf
3186 (let ((selected-buffer (ibuffer-current-buffer)))
3187 (if (not ibuffer-filter-groups)
3188 (ibuffer-set-filter-groups-by-root)
3189 (setq ibuffer-filter-groups nil))
3190 (pop-to-buffer ibuf)
3191 (ibuffer-update nil t)
3192 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
3194 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
3196 (defun ibuffer-back-to-top ()
3198 (goto-char (point-min))
3201 (defun ibuffer-jump-to-bottom ()
3203 (goto-char (point-max))
3207 (define-key ibuffer-mode-map
3208 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
3209 (define-key ibuffer-mode-map
3210 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
3212 (setq ibuffer-default-sorting-mode 'recency)
3213 (setq ibuffer-eliding-string "…"
3214 ibuffer-compile-formats t
3215 ibuffer-git-column-length 6
3216 ibuffer-show-empty-filter-groups nil
3217 ibuffer-default-directory "~/"
3220 (setq ibuffer-formats '((mark vc-status-mini
3222 (git-status 8 8 :left)
3226 (name 18 18 :left :elide)
3228 (size-h 9 -1 :right)
3230 (mode 16 16 :left :elide)
3231 " " filename-and-process)
3233 (git-status 8 8 :left)
3239 (setq ibuffer-saved-filter-groups
3242 ("dired" (mode . dired-mode))
3243 ("perl" (mode . cperl-mode))
3245 (mode . puppet-mode)
3246 (mode . yaml-mode)))
3247 ("ruby" (mode . ruby-mode))
3249 (name . "^\\*scratch\\*$")
3250 (name . "^\\*Compile-log\\*$")
3251 (name . "^\\*Completions\\*$")
3252 (name . "^\\*Messages\\*$")
3253 (name . "^\\*Backtrace\\*$")
3254 (name . "^\\*Packages*\\*$")
3255 (name . "^\\*Help*\\*$")
3259 (mode . message-mode)
3262 (mode . gnus-group-mode)
3263 (mode . gnus-summary-mode)
3264 (mode . gnus-article-mode)
3265 (name . "^\\.bbdb$")
3266 (name . "^\\.newsrc-dribble")))
3268 (mode . org-agenda-mode)
3269 (name . "^*Org Agenda")))
3271 (filename . ".*/org/.*")
3272 ;(mode . org-agenda-mode)
3273 (name . "^diary$")))
3275 (mode . magit-status-mode)
3276 (mode . magit-log-mode)
3277 (mode . magit-diff-mode)
3278 (mode . magit-refs-mode)
3279 (mode . magit-revision-mode)
3280 (mode . vc-annotate-mode)))
3282 (name . "^\\*\\(tramp/.*\\)\\*$")))
3284 (mode . emacs-lisp-mode)
3285 (mode . python-mode)
3287 (mode . coffee-mode)
3290 (mode . actionscript-mode)
3293 (mode . haskell-mode)
3302 (mode . magit-log-edit-mode)
3303 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
3305 ;; -------------------------------------------------
3306 ;; programming languages #1
3308 (mode . emacs-lisp-mode)
3309 (mode . python-mode)
3311 (mode . coffee-mode)
3314 (mode . actionscript-mode)
3317 (mode . haskell-mode)
3325 ;; -------------------------------------------------
3326 ;; configuration/data files
3330 (mode . conf-mode)))
3331 ;; -------------------------------------------------
3332 ;; text/notetaking/org
3333 ("org agenda" (mode . org-agenda-mode))
3336 (name . "^\\*Calendar\\*$")
3337 (name . "^diary$")))
3341 (mode . markdown-mode)))
3342 ;; -------------------------------------------------
3345 (mode . image-mode)))
3346 ;; -------------------------------------------------
3348 ("w3m" (mode . w3m-mode))
3350 (mode . magit-status-mode)
3351 (mode . magit-log-mode)
3352 (mode . vc-annotate-mode)))
3353 ("dired" (mode . dired-mode))
3358 (name . "^\\*Personal Keybindings\\*$")))
3360 (name . "^\\*\\(tramp/.*\\)\\*$")))
3361 ;; -------------------------------------------------
3363 ("MORE" (or (mode . magit-log-edit-mode)
3364 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
3365 (name . "^\\*Pymacs\\*$")
3366 (name . "^\\*Compile-log\\*$")
3367 (name . "^\\*Completions\\*$")
3368 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
3370 ("*buffer*" (name . "\\*.*\\*"))))))
3372 (add-hook 'ibuffer-mode-hook
3374 (ibuffer-auto-mode 1)
3375 (ibuffer-switch-to-saved-filter-groups "default")))
3377 ;; Unless you turn this variable on you will be prompted every time
3378 ;; you want to delete a buffer, even unmodified ones, which is way
3379 ;; too cautious for most people. You’ll still be prompted for
3380 ;; confirmation when deleting modified buffers after the option has
3382 (setq ibuffer-expert t)
3385 ** ivy-mode, swiper, counsel
3386 [2015-10-16 Fri 16:28]
3387 Full docs at http://oremacs.com/swiper/
3388 #+BEGIN_SRC emacs-lisp
3391 :bind (("C-s" . swiper)
3393 ("C-c r" . ivy-resume)
3394 ("<f7>" . ivy-resume))
3398 (setq ivy-use-virtual-buffers t)
3399 (setq ivy-count-format "(%d/%d) ")
3400 (setq ivy-initial-inputs-alist nil)
3401 ;;advise swiper to recenter on exit
3402 (defun bjm-swiper-recenter (&rest args)
3403 "recenter display after swiper"
3406 (advice-add 'swiper :after #'bjm-swiper-recenter)
3409 counsel is a collection of Ivy enhanced versions of common Emacs
3410 commands, see https://github.com/abo-abo/swiper
3411 #+BEGIN_SRC emacs-lisp
3412 (use-package counsel
3414 :bind (("M-y" . counsel-yank-pop)
3415 ("M-x" . counsel-M-x)
3416 ("C-x C-f" . counsel-find-file)
3417 ("<f1> f" . counsel-describe-function)
3418 ("<f1> u" . counsel-unicode-char)
3419 ("C-c j" . counsel-git-grep)
3420 :map ivy-minibuffer-map
3421 ("M-y" . ivy-forward-line)))
3424 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
3425 ‘TAB’ completion is to typing things manually every time.”]]
3426 #+BEGIN_SRC emacs-lisp
3427 (use-package icicles
3428 :load-path "elisp/icicles"
3433 [2014-05-26 Mon 22:49]
3434 #+BEGIN_SRC emacs-lisp
3437 :commands (iedit-mode)
3439 :bind (("C-;" . iedit-mode)
3440 ("C-," . iedit-mode-toggle-on-function))
3445 [2014-05-20 Tue 23:35]
3446 #+BEGIN_SRC emacs-lisp
3448 :bind ("C-h C-i" . info-lookup-symbol)
3449 :commands info-lookup-symbol
3452 ;; (defadvice info-setup (after load-info+ activate)
3453 ;; (use-package info+))
3455 (defadvice Info-exit (after remove-info-window activate)
3456 "When info mode is quit, remove the window."
3457 (if (> (length (window-list)) 1)
3460 (use-package info-look
3461 :commands info-lookup-add-help)
3464 [2019-05-19 Sun 21:22]
3465 Easy note taking for PDF files
3466 #+BEGIN_SRC emacs-lisp
3467 (use-package interleave
3471 [2016-11-13 Sun 13:22]
3472 #+BEGIN_SRC emacs-lisp
3477 (setq ispell-personal-dictionary (expand-file-name "~/flydict" jj-cache-dir))
3479 (setq ispell-dictionary "de_DE")
3480 (setq ispell-program-name "hunspell")
3481 (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))
3482 (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_EXAMPLE" . "#\\+END_EXAMPLE"))
3486 [2018-12-30 Sun 23:20]
3487 #+BEGIN_SRC emacs-lisp
3488 (use-package json-mode ; JSON files
3491 :mode ("config.data" . json-mode)
3493 (progn ; https://github.com/skeeto/.emacs.d
3494 (setf json-reformat:pretty-string? t
3495 json-reformat:indent-width 2)
3496 (define-key json-mode-map (kbd "M-q")
3499 (if (region-active-p)
3500 (call-interactively #'json-reformat-region)
3501 (json-reformat-region (point-min) (point-max)))))
3503 (add-hook 'json-mode-hook
3504 ;; Fix JSON mode indentation
3505 (lambda () (setq-local js-indent-level 4)))))
3507 ** linum (line number)
3508 Various modes should have line numbers in front of each line.
3510 But then there are some where it would just be deadly - like org-mode,
3511 gnus, so we have a list of modes where we don't want to see it.
3512 #+BEGIN_SRC emacs-lisp
3513 (if (version<= "26.0.50" emacs-version )
3515 (global-display-line-numbers-mode 1)
3516 (add-hook 'gnus-group-mode-hook (lambda (&optional dummy) (display-line-numbers-mode -1)))
3517 (add-hook 'gnus-summary-mode-hook (lambda (&optional dummy) (display-line-numbers-mode -1)))
3518 (add-hook 'gnus-article-mode-hook (lambda (&optional dummy) (display-line-numbers-mode -1))))
3520 ; Old emacs versions
3522 :diminish linum-mode
3523 :defines (linum-mode-inhibit-modes-list)
3526 (setq linum-format "%3d ")
3527 (setq linum-mode-inhibit-modes-list '(org-mode
3534 (defadvice linum-on (around linum-on-inhibit-for-modes)
3535 "Stop the load of linum-mode for some major modes."
3536 (unless (member major-mode linum-mode-inhibit-modes-list)
3539 (ad-activate 'linum-on)
3541 (use-package linum-relative
3542 :ensure linum-relative
3545 (setq linum-format 'dynamic)
3548 (global-linum-mode 1))
3558 ** lisp editing stuff
3560 [2013-04-21 So 21:00]
3561 I'm not doing much of it, except for my emacs and gnus configs, but
3562 then I like it nice too...
3563 #+BEGIN_SRC emacs-lisp
3564 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
3565 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
3567 (defun remove-elc-on-save ()
3568 "If you're saving an elisp file, likely the .elc is no longer valid."
3569 (make-local-variable 'after-save-hook)
3570 (add-hook 'after-save-hook
3572 (if (file-exists-p (concat buffer-file-name "c"))
3573 (delete-file (concat buffer-file-name "c"))))))
3575 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
3576 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
3578 (use-package paredit
3580 :diminish paredit-mode " π")
3582 (setq lisp-coding-hook 'lisp-coding-defaults)
3583 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
3585 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
3586 (add-hook 'emacs-lisp-mode-hook (lambda ()
3587 (run-hooks 'prelude-emacs-lisp-mode-hook)))
3590 (after "elisp-slime-nav"
3591 '(diminish 'elisp-slime-nav-mode))
3592 (after "rainbow-mode"
3593 '(diminish 'rainbow-mode))
3595 '(diminish 'eldoc-mode))
3598 [2016-10-27 Thu 17:49]
3600 #+BEGIN_SRC emacs-lisp
3601 (use-package lua-mode
3604 :mode ("\\.lua" . lua-mode))
3607 [2013-04-21 So 20:48]
3608 magit is a mode for interacting with git.
3609 #+BEGIN_SRC emacs-lisp
3612 :commands (magit-log-other magit-run-gitk magit-run-git-gui magit-status
3613 magit-git-repo-p magit-list-repos)
3614 :bind (("C-x g" . magit-status)
3615 ("C-x G" . magit-status-with-prefix)
3616 :map magit-status-mode-map
3617 ("q" . magit-quit-session ))
3621 (setq magit-repository-directories '(("~/devel" . 4)
3624 (setq magit-log-auto-more t)
3625 (setq magit-completing-read-function 'ivy-completing-read)
3627 ; VC shouldnt do anything with git
3628 (setq vc-handled-backends (delq 'Git vc-handled-backends))
3630 (use-package magit-blame
3631 :commands magit-blame-mode)
3633 (add-hook 'magit-mode-hook 'hl-line-mode)
3634 (defun magit-status-with-prefix ()
3636 (let ((current-prefix-arg '(4)))
3637 (call-interactively 'magit-status)))
3638 (setenv "GIT_PAGER" "")
3640 (unbind-key "M-h" magit-mode-map)
3641 (unbind-key "M-s" magit-mode-map)
3642 (add-to-list 'magit-no-confirm 'stage-all-changes)
3643 (setq magit-push-always-verify nil)
3645 (add-hook 'magit-log-edit-mode-hook
3647 (set-fill-column 72)
3650 (add-hook 'git-rebase-mode-hook
3654 (defadvice magit-status (around magit-fullscreen activate)
3655 (window-configuration-to-register :magit-fullscreen)
3657 (delete-other-windows))
3659 (defun magit-quit-session ()
3660 "Restores the previous window configuration and kills the magit buffer"
3663 (jump-to-register :magit-fullscreen))
3669 (setq gitlab.salsa.debian.org.user "joerg")
3674 [2014-05-20 Tue 23:04]
3675 #+BEGIN_SRC emacs-lisp
3676 (use-package markdown-mode
3678 :mode (("\\.md\\'" . markdown-mode)
3679 ("\\.mdwn\\'" . markdown-mode))
3683 #+BEGIN_SRC emacs-lisp
3684 (use-package message
3685 :commands (message-mode)
3687 :bind (:map notmuch-message-mode-map
3688 ("C-c M-m" . 'my-message-mark-inserted-region)
3689 ("C-c h" . 'harden-newlines))
3692 (setq message-kill-buffer-on-exit t)
3694 (use-package time-date
3696 (setq message-citation-line-function 'september-citation-line))
3698 ;;** Message Size Limit
3699 (setq message-send-mail-partially-limit 5000000)
3701 (setq message-send-mail-function 'message-send-mail-with-sendmail)
3702 (setq smtpmail-default-smtp-server "localhost")
3703 (setq message-sendmail-envelope-from 'header)
3705 ;;** Keinen Sender Header zufuegen !
3706 (add-to-list 'message-syntax-checks '(sender . disabled))
3708 ;;** Kaputte Subjects Aw: Statt Re: fixen:
3709 (setq message-subject-re-regexp "^[ ]*\\([RrAaFf][EeWw]:[ ]*\\)*[ ]*")
3711 ;;** Ich will die Header in den Nachrichten sehen die ich schreibe.
3712 (setq message-generate-headers-first t)
3714 ;;** Und immer schoen Header zufuegen.
3715 (setq message-default-headers (concat "Organization: Ganneff\n"))
3716 (add-hook 'message-send-hook 'my-message-add-content)
3718 ;;** Und Courtesy-Mails wollen wir schon mal grad gar nicht
3719 (add-hook 'message-header-setup-hook 'my-message-header-setup-hook)
3721 ;;** In Forwards bitte das Subject aufraeumen
3722 (setq message-wash-forwarded-subjects t)
3724 ;;** Zitieren ohne Sig. Ausser Idioten sind zu doof die korrekt abzutrennen.
3725 (setq message-cite-function 'message-cite-original-without-signature)
3727 ;;** Automagischen Zeilenumbruch bei News/Mailangabe.
3728 (add-hook 'message-mode-hook
3730 (setq fill-column 72)
3734 (add-hook 'notmuch-message-mode-hook
3736 (setq fill-column 72)
3740 (setq fill-flowed-encode-column 78)
3743 (add-hook 'message-mode-hook 'orgstruct++-mode 'append)
3744 (add-hook 'message-mode-hook 'orgtbl-mode 'append)
3746 (setq message-forward-as-mime t)
3747 (use-package message-x
3748 :load-path "elisp/local")
3750 (use-package randomsig
3751 :bind (:map message-mode-map
3752 ("C-c s" . randomsig-replace-sig)
3753 ("C-c S" . randomsig-select-sig))
3756 (setq randomsig-dir "/home/joerg/sigs")
3757 (setq message-signature 'randomsig-signature)))
3759 (setq message-archive-note "X-No-Archive: Yes")
3760 (setq message-make-forward-subject-function (quote message-forward-subject-fwd))
3761 (setq message-max-buffers 5)
3762 (setq message-send-hook (quote (my-message-add-content)))
3763 (setq message-subscribed-regexps (quote (".*@lists.*" ".*@postfix.org" ".*@nongnu.org")))
3764 (setq message-use-followup-to (quote use))
3766 ; use format=flowed mail style, see
3767 (require 'messages-are-flowing)
3768 (setq mml-enable-flowed t)
3769 (add-hook 'message-mode-hook #'messages-are-flowing-use-and-mark-hard-newlines)
3771 ; A function to mark newlines as hard newlines for format=flowed stuff
3772 (defun harden-newlines (beg end)
3776 (narrow-to-region beg end)
3777 (goto-char (point-min))
3778 (while (search-forward "\n" nil t)
3779 (put-text-property (1- (point)) (point) 'hard t)))))
3781 (defun harden-message-buffer ()
3785 (message "Hardening body")
3786 (while (search-forward "\n" nil t)
3787 (put-text-property (1- (point)) (point) 'hard t))))
3789 (add-hook 'message-send-hook 'harden-message-buffer)
3790 (add-hook 'notmuch-mua-send-hook 'harden-message-buffer)
3791 ; In format=flowed our enclosing tags must end with a hard newline
3792 (defun my-message-mark-inserted-region (beg end &optional verbatim)
3793 "Mark some region in the current article with enclosing tags.
3794 See `message-mark-insert-begin' and `message-mark-insert-end'.
3795 If VERBATIM, use slrn style verbatim marks (\"#v+\" and \"#v-\")."
3796 (interactive "r\nP")
3798 ;; add to the end of the region first, otherwise end would be invalid
3800 (insert (if verbatim "#v-\n" message-mark-insert-end))
3801 (put-text-property (1- (point)) (point) 'hard t)
3803 (insert (if verbatim "#v+\n" message-mark-insert-begin))
3804 (put-text-property (1- (point)) (point) 'hard t)
3807 ;;** Nun das Paket um einfachst Fussnoten eingeben zu können.
3808 (use-package footnote
3809 :commands (footnote-mode)
3811 (setq footnote-body-tag-spacing 1
3812 footnote-spaced-footnotes nil
3813 footnote-style 'numeric-latin
3814 footnote-section-tag "Footnotes:"))
3815 (add-hook 'message-mode-hook 'footnote-mode))
3819 [2018-12-31 Mon 13:28]
3820 #+BEGIN_SRC emacs-lisp
3824 ;; http://mbork.pl/2015-11-28_Fixing_mml-attach-file_using_advice
3825 (defun mml-attach-file--go-to-eob (orig-fun &rest args)
3826 "Go to the end of buffer before attaching files."
3830 (goto-char (point-max))
3831 (apply orig-fun args))))
3833 (advice-add 'mml-attach-file :around #'mml-attach-file--go-to-eob)
3834 (setq mm-verify-option 'always)
3836 (use-package mml-sec
3837 :commands (sign-or-crypt)
3838 :hook ((message-setup gnus-message-setup notmuch-message-setup) . sign-or-crypt)
3841 ;; Keine extra Signatur erzeugen.
3842 (mml-signencrypt-style "pgpmime" 'combined)
3843 (setq mml-secure-openpgp-sign-with-sender 't)
3844 (setq gpg-unabbrev-trust-alist
3845 '(("TRUST_UNDEFINED" . trust-undefined)
3846 ("TRUST_NEVER" . trust-none)
3847 ("TRUST_MARGINAL" . trust-marginal)
3848 ("TRUST_FULLY" . trust-full)
3849 ("TRUST_ULTIMATE" . trust-ultimate)))
3853 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
3854 #+BEGIN_SRC emacs-lisp
3855 (use-package miniedit
3860 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
3861 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
3862 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
3863 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
3868 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
3870 #+BEGIN_SRC emacs-lisp
3871 (use-package mo-git-blame
3872 :ensure mo-git-blame
3873 :commands (mo-git-blame-current
3877 (setq mo-git-blame-blame-window-width 25)))
3880 ** CANCELLED multiple cursors :CANCELLED:
3881 CLOSED: [2017-08-26 Sat 15:18]
3883 - State "CANCELLED" from [2017-08-26 Sat 15:18]
3885 [2013-04-08 Mon 23:57]
3886 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
3887 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
3888 #+BEGIN_SRC emacs-lisp :tangle no
3889 (use-package multiple-cursors
3890 :ensure multiple-cursors
3892 :commands (mc/remove-fake-cursors
3893 mc/create-fake-cursor-at-point
3894 mc/pop-state-from-overlay
3895 mc/maybe-multiple-cursors-mode)
3896 :defines (multiple-cursors-mode
3898 mc--read-quoted-char
3899 rectangular-region-mode)
3900 :bind (("C-S-c C-S-c" . mc/edit-lines)
3901 ("C->" . mc/mark-next-like-this)
3902 ("C-<" . mc/mark-previous-like-this)
3903 ("C-c C-<" . mc/mark-all-like-this)
3904 ("C-c i" . mc/insert-numbers))
3907 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
3908 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
3909 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
3910 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
3911 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
3912 (setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
3915 [2014-08-27 Wed 17:15]
3917 #+BEGIN_SRC emacs-lisp
3918 (use-package neotree
3921 :bind (("<f8>" . neotree-toggle))
3922 :commands (neotree-find
3927 (bind-key "^" 'neotree-select-up-node neotree-mode-map)
3928 (setq neo-smart-open t)))
3932 [2016-10-24 Mon 18:18]
3933 Nice email search and interface
3934 #+BEGIN_SRC emacs-lisp
3935 (use-package notmuch
3938 :bind (("C-c n" . notmuch)
3939 :map notmuch-show-mode-map
3940 ("C-c C-c" . lld-notmuch-goto-message-in-gnus)
3941 :map notmuch-common-keymap
3951 (setq notmuch-search-oldest-first nil)
3953 (setq smtpmail-default-smtp-server "localhost")
3955 (setq notmuch-search-oldest-first nil)
3956 (setq notmuch-search-result-format
3957 '(("date" . "%12s ")
3959 ("authors" . "%-30s ")
3963 (setq notmuch-hello-thousands-separator ".")
3964 (setq notmuch-tree-show-out t)
3965 (setq notmuch-always-prompt-for-sender t)
3966 (setq notmuch-crypto-process-mime t)
3967 (setq notmuch-fcc-dirs
3969 ((".*@nsb-software.de" . "nsb/.Sent")
3970 ("da-manager@debian.org" . "ganneff/.Sentmail.DAM")
3971 (".*" . "ganneff/.Sentmail"))))
3973 (setq notmuch-message-headers (quote ("Subject"
3996 (setq notmuch-show-all-tags-list nil)
3997 (setq notmuch-show-mark-read-tags (list "-unread" "-inbox"))
3999 (setq notmuch-saved-searches '(
4000 ( :name "Nagios" :query "from:nagios@ AND tag:unread")
4001 ( :name "Debian BTS" :query "from:@bugs.debian.org AND tag:unread")
4002 ( :name "FTPMaster" :query "from:ftpmaster@ftp-master.debian.org AND tag:unread")
4003 ( :name "Mirror logs" :query "(from:archvsync@* OR from:mirror+arrakis@*) AND tag:mirrors AND tag:logs AND tag:unread")
4004 ( :name "Cron" :query "from:cron@ AND tag:unread")
4005 ( :name "List Admin" :query "subject:moderator request AND tag:unread")
4006 (:key "i" :name "Inbox Ganneff" :query "(tag:inbox AND tag:ganneff) AND NOT (tag:lists OR tag:kommerz OR from:support@hetzner.com or tag:mia)")
4007 ( :name "Inbox NSB" :query "(tag:inbox AND tag:nsb) AND NOT (tag:ganeti OR tag:lists/ganeti)")
4008 ( :name "Inbox All" :query "tag:inbox")
4009 (:key "n" :name "New Mail" :query "tag:new" )
4010 (:key "u" :name "Unread All" :query "tag:unread")
4011 ( :name "Unread NSB" :query "tag:unread AND tag:nsb AND NOT (from:nagios@ OR from:@bugs.debian.org OR from:cron@ or from:ftpmaster@ftp-master.debian.org OR tag:lists OR tag:ganeti OR tag:lists/ganeti)")
4012 ( :name "Unread Ganneff" :query "tag:unread AND tag:ganneff AND NOT ( \
4013 ( from:gitlab@salsa.debian.org AND subject:dak ) OR \
4014 ( ( tag:planet OR tag:kommerz OR from:cron@ OR from:archvsync@* OR \
4015 from:ftpmaster@ftp-master.debian.org OR from:nagios@ OR from:@bugs.debian.org \
4016 OR tag:lists/* OR from:support@hetzner.com) )")
4017 (:key "f" :name "Flagged" :query "tag:flagged")
4018 (:key "s" :name "Sent Ganneff" :query "tag:sent AND tag:ganneff OR tag:sent AND ( from:ganneff.de OR from:debian.org )")
4019 ( :name "Sent NSB" :query "tag:sent AND tag:nsb OR tag:sent AND from:nsb-software.de")
4020 ( :name "Sent DAM" :query "folder:ganneff/.Sentmail.DAM")
4021 (:key "g" :name "NSB GF" :query "tag:nsb AND tag:gf AND tag:unread")
4022 (:key "f" :name "Important" :query "tag:important")
4023 (:key "t" :name "TODO" :query "tag:todo")
4024 (:key "k" :name "Kommerz" :query "tag:kommerz AND tag:unread")
4025 (:key "d" :name "DA-Manager" :query "to:da-manager@debian.org AND (tag:todo OR tag:unread)")
4026 ( :name "Planet Debian" :query "to:planet@debian.org AND tag:unread")
4027 ( :name "Kommerz" :query "tag:Kommerz AND (tag:unread OR tag:inbox OR tag:flagged)" :sort-order oldest-first)
4028 ( :name "VH Unread" :query "(tag:unread OR tag:inbox) \
4029 AND ((from:nguyen@nsb-software.de OR to:nguyen@nsb-software.de \
4030 OR from:info@nsb-software.de OR to:info@nsb-software.de \
4031 OR from:van-hien.nguyen@dlh.de OR to:van-hien.nguyen@dlh.de \
4032 OR from:van-hien.nguyen.sp@dlh.de OR to:van-hien.nguyen.sp@dlh.de) \
4033 AND (tag:sent OR tag:sentmail OR tag:to-me))")
4034 ( :name "VH All" :query "(from:nguyen@nsb-software.de OR to:nguyen@nsb-software.de \
4035 OR from:info@nsb-software.de OR to:info@nsb-software.de \
4036 OR from:van-hien.nguyen@dlh.de OR to:van-hien.nguyen@dlh.de \
4037 OR from:van-hien.nguyen.sp@dlh.de OR to:van-hien.nguyen.sp@dlh.de) \
4038 AND (tag:sent OR tag:sentmail OR tag:to-me)")
4039 ( :name "D-Devel-Announce" :query "tag:lists/debian-devel-announce and tag:unread")
4040 ( :name "D-Devel" :query "tag:lists/debian-devel and tag:unread")
4041 ( :name "D-Project" :query "tag:lists/debian-project and tag:unread")
4042 ( :name "D-Private" :query "tag:lists/debian-private and tag:unread")
4043 ( :name "D-Vote" :query "tag:lists/debian-vote and tag:unread")
4044 ( :name "O-Staff" :query "tag:lists/oftc-staff and tag:unread")
4045 ( :name "O-Noc" :query "tag:lists/oftc-noc and tag:unread")
4046 ( :name "LugFD" :query "tag:lists/lugfd and tag:unread")
4047 ( :name "TODO" :query "tag:TODO")
4048 (:key "2" :name "Unread 2weeks" :query "date:2weeks...today AND tag:unread")
4049 ( :name "Dienstpläne" :query "date:4weeks...today AND tag:dienstplan")
4050 (:key "m" :name "To me" :query "tag:to-me")
4051 (:key "l" :name "Lists" :query "tag:lists AND tag:unread")
4052 ( :name "Hetzner Support" :query "from:support@hetzner.com AND tag:unread")
4053 ( :name "Ganeti" :query "(tag:ganeti OR tag:lists/ganeti) AND tag:unread")
4054 ( :name "MIA" :query "tag:mia AND tag:unread")
4055 ( :name "SPAM" :query "folder:ganneff/.SPAM AND tag:spam")
4056 ( :name "Drafts" :query "tag:draft")
4057 ; (:key "a" :name "all mail" :query "*")
4059 (setq notmuch-search-line-faces
4061 (("deleted" :foreground "tomato")
4062 ("unread" :weight bold)
4063 ("flagged" :foreground "wheat"))))
4065 (setq notmuch-show-insert-text/plain-hook
4067 (notmuch-wash-convert-inline-patch-to-part notmuch-wash-tidy-citations
4068 notmuch-wash-elide-blank-lines
4069 notmuch-wash-excerpt-citations
4072 (setq notmuch-print-mechanism 'notmuch-print-muttprint/evince)
4073 (setq notmuch-tagging-keys '(("a" notmuch-archive-tags "Archive")
4074 ("u" notmuch-show-mark-read-tags "Mark read")
4075 ("f" ("+flagged") "Flag")
4076 ("s" ("+spam" "-inbox" "-unread" "-learnham" "-moveham") "Mark as spam")
4077 ("d" ("+deleted" "-inbox" "-unread") "Delete")))
4079 (defun jj-forward (prefix)
4081 (let ((message-forward-as-mime nil))
4082 (notmuch-show-forward-open-messages prefix)))
4083 (define-key notmuch-show-mode-map "F" 'jj-forward)
4084 (define-key notmuch-show-mode-map "f" 'notmuch-show-forward-message)
4086 (define-key notmuch-search-mode-map "d"
4088 "toggle deleted tag for message"
4093 (if (member "deleted" (notmuch-search-get-tags))
4094 (notmuch-search-tag (list "-deleted"))
4095 (notmuch-search-tag (list "+deleted" "-unread" "-inbox")))
4097 (define-key notmuch-show-mode-map "d"
4099 "toggle deleted tag for message"
4101 (if (member "deleted" (notmuch-show-get-tags))
4102 (notmuch-show-tag (list "-deleted"))
4103 (notmuch-show-tag (list "+deleted" "-unread" "-inbox")))
4104 (notmuch-show-next-open-message t)))
4106 ; Toggle spam tag on a message in search/show
4107 (define-key notmuch-search-mode-map "s"
4109 "toggle spam tag for message"
4114 (if (member "spam" (notmuch-search-get-tags))
4115 (notmuch-search-tag (list "-spam" "+learnham" "+moveham"))
4116 (notmuch-search-tag (list "+spam" "-unread" "-inbox")))
4118 (define-key notmuch-show-mode-map "s"
4120 "toggle spam tag for message"
4122 (if (member "spam" (notmuch-show-get-tags))
4123 (notmuch-show-tag (list "-spam" "+learnham" "+moveham"))
4124 (notmuch-show-tag (list "+spam" "-unread" "-inbox")))
4125 (notmuch-show-next-open-message t)))
4126 (define-key notmuch-tree-mode-map "s"
4128 "toggle spam tag for message"
4133 (if (member "spam" (notmuch-tree-get-tags))
4134 (notmuch-tree-tag (list "-spam" "+learnham" "+moveham"))
4135 (notmuch-tree-tag (list "+spam" "-unread" "-inbox")))
4138 ; Toggle learnham tag on a message in search/show
4139 (define-key notmuch-search-mode-map "h"
4141 "toggle learnham tag for message"
4146 (if (member "learnham" (notmuch-search-get-tags))
4147 (notmuch-search-tag (list "-learnham"))
4148 (notmuch-search-tag (list "+learnham" "-spam" "+moveham")))
4150 (define-key notmuch-show-mode-map "h"
4152 "toggle learnham tag for message"
4154 (if (member "learnham" (notmuch-show-get-tags))
4155 (notmuch-show-tag (list "-learnham"))
4156 (notmuch-show-tag (list "+learnham" "-spam" "+moveham")))
4157 (notmuch-show-next-open-message t)))
4159 (define-key notmuch-search-mode-map "u"
4161 "toggle unread tag for message"
4166 (if (member "unread" (notmuch-search-get-tags))
4167 (notmuch-search-tag (list "-unread" "-inbox"))
4168 (notmuch-search-tag (list "+unread")))
4170 (define-key notmuch-show-mode-map "u"
4172 "toggle unread tag for message"
4174 (if (member "unread" (notmuch-show-get-tags))
4175 (notmuch-show-tag (list "-unread" "-inbox"))
4176 (notmuch-show-tag (list "+unread")))
4177 (notmuch-show-next-open-message t)))
4179 (define-key notmuch-search-mode-map "k"
4181 "mark a thread killed"
4186 (if (member "killed" (notmuch-search-get-tags))
4187 (notmuch-search-tag (list "-killed"))
4188 (notmuch-search-tag (list "+killed" "-inbox" "-unread")))
4190 (define-key notmuch-show-mode-map "k"
4192 "toggle killed tag for message"
4194 (if (member "killed" (notmuch-show-get-tags))
4195 (notmuch-show-tag (list "-killed"))
4196 (notmuch-show-tag (list "+killed" "-inbox" "-unread")))
4197 (notmuch-show-next-open-message t)))
4199 ; resend the current message in show mode.
4200 (define-key notmuch-show-mode-map "b"
4201 (lambda (&optional address)
4202 "Bounce the current message."
4203 (interactive "sBounce To: ")
4204 (notmuch-show-view-raw-message)
4205 (message-resend address)
4208 ;; add unread tree command
4209 (defun my-notmuch-tree-tag-thread-read ()
4210 "Mark whole tree as read"
4212 (notmuch-tree-tag-thread (list "-unread" "-inbox"))
4213 (notmuch-tree-refresh-view))
4214 (bind-key "." 'my-notmuch-tree-tag-thread-read notmuch-tree-mode-map)
4215 (bind-key "C-c C-d" 'notmuch-draft-postpone message-mode-map)
4217 (use-package counsel-notmuch
4220 (use-package gnus-alias
4223 :commands (gnus-alias-determine-identity)
4224 :hook ((message-setup . gnus-alias-determine-identity))
4225 :bind (:map notmuch-message-mode-map
4226 ("C-c i" . gnus-alias-select-identity))
4229 (setq gnus-alias-default-identity "default")
4230 (setq gnus-alias-overlay-identities t)
4231 (setq gnus-alias-override-user-mail-address t)
4232 (setq gnus-alias-identity-alist
4234 nil ;; Does not refer to any other identity
4235 "Joerg Jaspert <joerg@ganneff.de>" ;; From Header
4236 "Ganneff.de" ;; Organization header
4237 (("Fcc" . "ganneff/.Sentmail")) ;; List of extra headers
4238 nil ;; No extra body text
4239 "bye, Joerg" ;; Signature
4243 "Joerg (悠軻) Jaspert <joerg@debian.org>"
4249 nil ;; Not referencing another identity
4250 "Joerg Jaspert <joerg@nsb-software.de>"
4251 "NSB Nguyen Softwareentwicklung & beratung GmbH"
4252 (("Fcc" . "nsb/.Sent")) ;; One extra header
4253 nil ;; No extra body text
4257 "Joerg Jaspert <gf@nsb-software.de>"
4258 "NSB Nguyen Softwareentwicklung & beratung GmbH"
4259 (("Fcc" . "nsb/.Sent")) ;; One extra header
4265 "Joerg Jaspert <joerg@debian.org>"
4267 (("Fcc" . "ganneff/.Sentmail"))
4276 "~/.signature.private"
4280 "Joerg Jaspert <da-manager@debian.org>"
4282 (("Fcc" . "ganneff/.Sentmail.DAM")
4283 ("Reply-To" . "Debian Account Managers <da-manager@debian.org>"))
4288 (setq gnus-alias-identity-rules '(("Personal" ("to" ".*@ganneff.de" both) "default")
4289 ("Pei-Hua" ("to" "sab.tseng@gmail.com" both) "Pei-Hua")
4290 ("NSB GF" ("any" "gf@nsb-software.de" both) "NSBGF")
4291 ("NSB" ("any" ".*@nsb-software.de" both) "NSBJoerg")
4292 ("DebianDAM" ("any" "da-manager@debian.org" both) "DebianDAM")
4293 ("DebianPrivate" ("to" "debian-private@lists.debian.org" both) "DebianPrivate")
4294 ("DebianLists" ("to" ".*@lists.debian.org" both) "Debian")
4295 ("Debian" ("any" "joerg@debian.org" both) "Debian")
4300 [2013-05-22 Wed 22:02]
4301 nxml-mode is a major mode for editing XML.
4302 #+BEGIN_SRC emacs-lisp
4303 (use-package nxml-mode
4304 :mode (("web.config$" . xml-mode)
4305 ("\\.xml" . xml-mode)
4306 ("\\.xsd" . xml-mode)
4307 ("\\.sch" . xml-mode)
4308 ("\\.rng" . xml-mode)
4309 ("\\.xslt" . xml-mode)
4310 ("\\.svg" . xml-mode)
4311 ("\\.rss" . xml-mode)
4312 ("\\.gpx" . xml-mode)
4313 ("\\.tcx" . xml-mode))
4317 (setq nxml-child-indent 4)
4318 (setq nxml-slash-auto-complete-flag t)
4319 ;(add-hook 'nxml-mode-hook (lambda () (emmet-mode t)))
4321 (fset 'xml-mode 'nxml-mode)
4322 (setq nxml-slash-auto-complete-flag t)
4324 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
4325 (defun pp-xml-region (begin end)
4326 "Pretty format XML markup in region. The function inserts
4327 linebreaks to separate tags that have nothing but whitespace
4328 between them. It then indents the markup by using nxml's
4334 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
4335 (backward-char) (insert "\n"))
4336 (indent-region begin end)))
4341 *** General settings
4342 [2013-04-28 So 17:06]
4344 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
4345 it is quite extensive. Nevertheless, it starts out small, loading it.
4346 #+BEGIN_SRC emacs-lisp
4348 :defines (my-texcmd org-export-latex-default-packages-alist org-export-latex-classes org-alphabetical-lists web-mode-enable-comment-keywords))
4351 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
4352 that we need org-protocol.
4353 #+BEGIN_SRC emacs-lisp
4354 (require 'org-protocol)
4359 My current =org-agenda-files= variable only includes a set of
4361 #+BEGIN_SRC emacs-lisp
4362 (setq org-agenda-files (quote ("~/org/"
4364 (setq org-default-notes-file "~/org/notes.org")
4366 =org-mode= manages the =org-agenda-files= variable automatically using
4367 =C-c [= and =C-c ]= to add and remove files respectively. However,
4368 this replaces my directory list with a list of explicit filenames
4369 instead and is not what I want. If this occurs then adding a new org
4370 file to any of the above directories will not contribute to my agenda
4371 and I will probably miss something important.
4373 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
4374 prevent messing up my list of directories in the =org-agenda-files=
4375 variable. I just add and remove directories manually here. Changing
4376 the list of directories in =org-agenda-files= happens very rarely
4377 since new files in existing directories are automatically picked up.
4379 #+BEGIN_SRC emacs-lisp
4380 ;; Keep tasks with dates on the global todo lists
4381 (setq org-agenda-todo-ignore-with-date nil)
4383 ;; Keep tasks with deadlines on the global todo lists
4384 (setq org-agenda-todo-ignore-deadlines nil)
4386 ;; Keep tasks with scheduled dates on the global todo lists
4387 (setq org-agenda-todo-ignore-scheduled nil)
4389 ;; Keep tasks with timestamps on the global todo lists
4390 (setq org-agenda-todo-ignore-timestamp nil)
4392 ;; Remove completed deadline tasks from the agenda view
4393 (setq org-agenda-skip-deadline-if-done t)
4395 ;; Remove completed scheduled tasks from the agenda view
4396 (setq org-agenda-skip-scheduled-if-done t)
4398 ;; Remove completed items from search results
4399 (setq org-agenda-skip-timestamp-if-done t)
4401 ;; Include agenda archive files when searching for things
4402 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
4404 ;; Show all future entries for repeating tasks
4405 (setq org-agenda-repeating-timestamp-show-all t)
4407 ;; Show all agenda dates - even if they are empty
4408 (setq org-agenda-show-all-dates t)
4410 ;; Sorting order for tasks on the agenda
4411 (setq org-agenda-sorting-strategy
4412 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
4413 (todo category-up priority-down effort-up)
4414 (tags category-up priority-down effort-up)
4415 (search category-up))))
4417 ;; Start the weekly agenda on Monday
4418 (setq org-agenda-start-on-weekday 1)
4420 ;; Enable display of the time grid so we can see the marker for the current time
4421 (setq org-agenda-time-grid (quote ((daily today remove-match)
4422 (0800 1000 1200 1400 1500 1700 1900 2100)
4423 "......" "----------------")
4426 ;; Display tags farther right
4427 (setq org-agenda-tags-column -102)
4429 ; position the habit graph on the agenda to the right of the default
4430 (setq org-habit-graph-column 50)
4432 ; turn habits back on
4433 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
4436 ;; Agenda sorting functions
4438 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
4441 (setq org-deadline-warning-days 30)
4443 ;; Always hilight the current agenda line
4444 (add-hook 'org-agenda-mode-hook
4445 '(lambda () (hl-line-mode 1))
4449 #+BEGIN_SRC emacs-lisp
4450 (setq org-agenda-persistent-filter t)
4451 (add-hook 'org-agenda-mode-hook
4452 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
4455 (add-hook 'org-agenda-mode-hook
4456 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
4459 (add-hook 'org-agenda-mode-hook
4460 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
4463 (add-hook 'org-agenda-mode-hook
4464 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
4467 (add-hook 'org-agenda-mode-hook
4468 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
4471 ; Rebuild the reminders everytime the agenda is displayed
4472 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
4474 ;(if (file-exists-p "~/org/refile.org")
4475 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
4477 ; Activate appointments so we get notifications
4480 (setq org-agenda-log-mode-items (quote (closed clock state)))
4481 (setq org-agenda-span 4)
4483 (setq org-agenda-show-all-dates t)
4484 (setq org-agenda-start-on-weekday nil)
4485 (setq org-deadline-warning-days 14)
4488 *** Global keybindings.
4489 Start off by defining a series of keybindings.
4491 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
4492 setup manually, not by org-mode. Also turn off =C-c ;=, which
4493 comments headlines - a function never used.
4494 #+BEGIN_SRC emacs-lisp
4495 (add-hook 'org-mode-hook
4497 (org-defkey org-mode-map "\C-c[" 'undefined)
4498 (org-defkey org-mode-map "\C-c]" 'undefined)
4499 (org-defkey org-mode-map "\C-c;" 'undefined))
4503 And now a largish set of keybindings...
4504 #+BEGIN_SRC emacs-lisp
4505 (bind-key "C-c l" 'org-store-link)
4506 (bind-key "C-c a" 'org-agenda)
4507 ;(bind-key "C-c b" 'org-iswitchb)
4508 (define-key mode-specific-map [?a] 'org-agenda)
4510 (bind-key "<f12>" 'org-agenda)
4511 (bind-key "<f5>" 'bh/org-todo)
4512 (bind-key "<S-f5>" 'bh/widen)
4513 ;(bind-key "<f7>" 'bh/set-truncate-lines)
4514 ;(bind-key "<f8>" 'org-cycle-agenda-files)
4516 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
4517 (bind-key "<f9> b" 'bbdb)
4518 (bind-key "<f9> c" 'calendar)
4519 (bind-key "<f9> f" 'boxquote-insert-file)
4520 (bind-key "<f9> h" 'bh/hide-other)
4521 (bind-key "<f9> n" 'org-narrow-to-subtree)
4522 (bind-key "<f9> w" 'widen)
4523 (bind-key "<f9> u" 'bh/narrow-up-one-level)
4524 (bind-key "<f9> I" 'bh/punch-in)
4525 (bind-key "<f9> O" 'bh/punch-out)
4526 (bind-key "<f9> H" 'jj/punch-in-hw)
4527 (bind-key "<f9> W" 'jj/punch-out-hw)
4528 (bind-key "<f9> o" 'bh/make-org-scratch)
4529 (bind-key "<f9> p" 'bh/phone-call)
4530 (bind-key "<f9> r" 'boxquote-region)
4531 (bind-key "<f9> s" 'bh/switch-to-scratch)
4532 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
4533 (bind-key "<f9> T" 'tabify)
4534 (bind-key "<f9> U" 'untabify)
4535 (bind-key "<f9> v" 'visible-mode)
4536 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
4537 (bind-key "C-<f9>" 'previous-buffer)
4538 (bind-key "C-<f10>" 'next-buffer)
4539 (bind-key "M-<f9>" 'org-toggle-inline-images)
4540 ;(bind-key "C-x n r" 'narrow-to-region)
4541 (bind-key "<f11>" 'org-clock-goto)
4542 (bind-key "C-<f11>" 'org-clock-in)
4543 (bind-key "C-M-r" 'org-capture)
4544 ;(bind-key "C-c r" 'org-capture)
4545 (bind-key "C-S-<f12>" 'bh/save-then-publish)
4546 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
4550 *** Tasks, States, Todo fun
4552 First we define the global todo keywords.
4553 #+BEGIN_SRC emacs-lisp
4554 (setq org-todo-keywords
4555 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
4556 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
4558 (setq org-todo-keyword-faces
4559 (quote (("TODO" :foreground "red" :weight bold)
4560 ("NEXT" :foreground "light blue" :weight bold)
4561 ("DONE" :foreground "forest green" :weight bold)
4562 ("WAITING" :foreground "orange" :weight bold)
4563 ("HOLD" :foreground "orange" :weight bold)
4564 ("DELEGATED" :foreground "yellow" :weight bold)
4565 ("CANCELLED" :foreground "dark green" :weight bold)
4566 ("PHONE" :foreground "dark green" :weight bold))))
4569 **** Fast Todo Selection
4570 Fast todo selection allows changing from any task todo state to any
4571 other state directly by selecting the appropriate key from the fast
4572 todo selection key menu.
4573 #+BEGIN_SRC emacs-lisp
4574 (setq org-use-fast-todo-selection t)
4576 Changing a task state is done with =C-c C-t KEY=
4578 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
4581 #+BEGIN_SRC emacs-lisp
4582 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
4584 allows changing todo states with S-left and S-right skipping all of
4585 the normal processing when entering or leaving a todo state. This
4586 cycles through the todo states but skips setting timestamps and
4587 entering notes which is very convenient when all you want to do is fix
4588 up the status of an entry.
4590 **** Todo State Triggers
4591 I have a few triggers that automatically assign tags to tasks based on
4592 state changes. If a task moves to =CANCELLED= state then it gets a
4593 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
4594 =CANCELLED= tag. These are used for filtering tasks in agenda views
4595 which I'll talk about later.
4597 The triggers break down to the following rules:
4599 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
4600 - Moving a task to =WAITING= adds a =WAITING= tag
4601 - Moving a task to =HOLD= adds a =WAITING= tag
4602 - Moving a task to a done state removes a =WAITING= tag
4603 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
4604 - Moving a task to =NEXT= removes a =WAITING= tag
4605 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
4607 The tags are used to filter tasks in the agenda views conveniently.
4608 #+BEGIN_SRC emacs-lisp
4609 (setq org-todo-state-tags-triggers
4610 (quote (("CANCELLED" ("CANCELLED" . t))
4611 ("WAITING" ("WAITING" . t))
4612 ("HOLD" ("WAITING" . t) ("HOLD" . t))
4613 (done ("WAITING") ("HOLD"))
4614 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
4615 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
4616 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
4619 *** Capturing new tasks
4620 Org capture replaces the old remember mode.
4621 #+BEGIN_SRC emacs-lisp
4622 (setq org-directory "~/org")
4623 (setq org-default-notes-file "~/org/refile.org")
4625 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
4626 ;; see http://orgmode.org/manual/Template-elements.html
4627 (setq org-capture-templates
4628 (quote (("t" "todo" entry (file "~/org/refile.org")
4629 "* TODO %?\nAdded: %U\n"
4630 :clock-in t :clock-resume t)
4631 ("l" "linktodo" entry (file "~/org/refile.org")
4632 "* TODO %?\nAdded: %U\n%a\n"
4633 :clock-in t :clock-resume t)
4634 ("r" "respond" entry (file "~/org/refile.org")
4635 "* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
4636 :clock-in t :clock-resume t :immediate-finish t)
4637 ("n" "note" entry (file "~/org/refile.org")
4638 "* %? :NOTE:\nAdded: %U\n%a\n"
4639 :clock-in t :clock-resume t)
4640 ("d" "Delegated" entry (file "~/org/refile.org")
4641 "* DELEGATED %?\nAdded: %U\n%a\n"
4642 :clock-in t :clock-resume t)
4643 ("j" "Journal" entry (file+datetree "~/org/diary.org")
4645 :clock-in t :clock-resume t)
4646 ("w" "org-protocol" entry (file "~/org/refile.org")
4647 "* TODO Review %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\nAdded: %U\n\n\n%?"
4648 :immediate-finish t)
4649 ("W" "org-protocol link" entry (file "~/org/refile.org")
4650 "* %? [[%:link][%:description]] \nAdded: %U"
4651 :immediate-finish t)
4652 ("p" "Phone call" entry (file "~/org/refile.org")
4653 "* PHONE %? :PHONE:\nAdded: %U"
4654 :clock-in t :clock-resume t)
4655 ("x" "Bookmark link" entry (file "~/org/refile.org")
4656 "* Bookmark: %c\n%i\nAdded: %U\n"
4657 :immediate-finish t)
4658 ("h" "Habit" entry (file "~/org/refile.org")
4659 "* 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")
4663 Capture mode now handles automatically clocking in and out of a
4664 capture task. This all works out of the box now without special hooks.
4665 When I start a capture mode task the task is clocked in as specified
4666 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
4667 resumes on the original clocking task.
4669 The quick clocking in and out of capture mode tasks (often it takes
4670 less than a minute to capture some new task details) can leave
4671 empty clock drawers in my tasks which aren't really useful.
4672 The following prevents this.
4673 #+BEGIN_SRC emacs-lisp :tangle no
4674 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
4678 All my newly captured entries end up in =refile.org= and want to be
4679 moved over to the right place. The following is the setup for it.
4680 #+BEGIN_SRC emacs-lisp
4681 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
4682 (setq org-refile-targets (quote ((nil :maxlevel . 9)
4683 (org-agenda-files :maxlevel . 9))))
4685 ; Use full outline paths for refile targets - we file directly with IDO
4686 (setq org-refile-use-outline-path t)
4688 ; Targets complete directly with IDO
4689 (setq org-outline-path-complete-in-steps nil)
4691 ; Allow refile to create parent tasks with confirmation
4692 (setq org-refile-allow-creating-parent-nodes (quote confirm))
4694 ; Use IDO for both buffer and file completion and ido-everywhere to t
4695 (setq org-completion-use-ido t)
4696 (setq org-completion-use-iswitchb nil)
4697 :; Use IDO for both buffer and file completion and ido-everywhere to t
4698 ;(setq ido-everywhere t)
4699 ;(setq ido-max-directory-size 100000)
4700 ;(ido-mode (quote both))
4701 ; Use the current window when visiting files and buffers with ido
4702 (setq ido-default-file-method 'selected-window)
4703 (setq ido-default-buffer-method 'selected-window)
4705 ;;;; Refile settings
4706 (setq org-refile-target-verify-function 'bh/verify-refile-target)
4710 Agenda view is the central place for org-mode interaction...
4711 #+BEGIN_SRC emacs-lisp
4712 ;; Do not dim blocked tasks
4713 (setq org-agenda-dim-blocked-tasks nil)
4714 ;; Compact the block agenda view
4715 (setq org-agenda-compact-blocks t)
4717 ;; Custom agenda command definitions
4718 (setq org-agenda-custom-commands
4719 (quote (("N" "Notes" tags "NOTE"
4720 ((org-agenda-overriding-header "Notes")
4721 (org-tags-match-list-sublevels t)))
4722 ("h" "Habits" tags-todo "STYLE=\"habit\""
4723 ((org-agenda-overriding-header "Habits")
4724 (org-agenda-sorting-strategy
4725 '(todo-state-down effort-up category-keep))))
4729 ((org-agenda-overriding-header "Tasks to Refile")
4730 (org-tags-match-list-sublevels nil)))
4731 (tags-todo "-CANCELLED/!"
4732 ((org-agenda-overriding-header "Stuck Projects")
4733 (org-agenda-skip-function 'bh/skip-non-stuck-projects)
4734 (org-agenda-sorting-strategy
4736 (tags-todo "-HOLD-CANCELLED/!"
4737 ((org-agenda-overriding-header "Projects")
4738 (org-agenda-skip-function 'bh/skip-non-projects)
4739 (org-tags-match-list-sublevels 'indented)
4740 (org-agenda-sorting-strategy
4742 (tags-todo "-CANCELLED/!NEXT"
4743 ((org-agenda-overriding-header (concat "Project Next Tasks"
4744 (if bh/hide-scheduled-and-waiting-next-tasks
4746 " (including WAITING and SCHEDULED tasks)")))
4747 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
4748 (org-tags-match-list-sublevels t)
4749 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
4750 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
4751 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
4752 (org-agenda-sorting-strategy
4753 '(todo-state-down effort-up category-keep))))
4754 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
4755 ((org-agenda-overriding-header (concat "Project Subtasks"
4756 (if bh/hide-scheduled-and-waiting-next-tasks
4758 " (including WAITING and SCHEDULED tasks)")))
4759 (org-agenda-skip-function 'bh/skip-non-project-tasks)
4760 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
4761 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
4762 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
4763 (org-agenda-sorting-strategy
4765 (tags-todo "-REFILE-CANCELLED-WAITING-HOLD/!"
4766 ((org-agenda-overriding-header (concat "Standalone Tasks"
4767 (if bh/hide-scheduled-and-waiting-next-tasks
4769 " (including WAITING and SCHEDULED tasks)")))
4770 (org-agenda-skip-function 'bh/skip-project-tasks)
4771 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
4772 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)
4773 (org-agenda-todo-ignore-with-date bh/hide-scheduled-and-waiting-next-tasks)
4774 (org-agenda-sorting-strategy
4776 (tags-todo "-CANCELLED+WAITING|HOLD/!"
4777 ((org-agenda-overriding-header (concat "Waiting and Postponed Tasks"
4778 (if bh/hide-scheduled-and-waiting-next-tasks
4780 " (including WAITING and SCHEDULED tasks)")))
4781 (org-agenda-skip-function 'bh/skip-non-tasks)
4782 (org-tags-match-list-sublevels nil)
4783 (org-agenda-todo-ignore-scheduled bh/hide-scheduled-and-waiting-next-tasks)
4784 (org-agenda-todo-ignore-deadlines bh/hide-scheduled-and-waiting-next-tasks)))
4786 ((org-agenda-overriding-header "Tasks to Archive")
4787 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
4788 (org-tags-match-list-sublevels nil))))
4791 ; Overwrite the current window with the agenda
4792 (setq org-agenda-window-setup 'current-window)
4797 #+BEGIN_SRC emacs-lisp
4799 ;; Resume clocking task when emacs is restarted
4800 (org-clock-persistence-insinuate)
4802 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
4803 (setq org-clock-history-length 36)
4804 ;; Resume clocking task on clock-in if the clock is open
4805 (setq org-clock-in-resume t)
4806 ;; Change tasks to NEXT when clocking in
4807 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
4808 ;; Separate drawers for clocking and logs
4809 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
4810 ;; Save clock data and state changes and notes in the LOGBOOK drawer
4811 (setq org-clock-into-drawer t)
4812 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
4813 (setq org-clock-out-remove-zero-time-clocks t)
4814 ;; Clock out when moving task to a done state
4815 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
4816 ;; Save the running clock and all clock history when exiting Emacs, load it on startup