86b793c139b840beadf54dfe12dfc8dbc446d92f
[emacs.git] / .emacs.d / config / emacs.org
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
6 #+LATEX_CMD: xelatex
7 #+PROPERTY: header-args :tangle yes
8 # @compile: (message "FOO")
9 # @compile: (byte-compile-file "config.el")
10
11 * Base settings, Stuff without an extra package
12 ** Configure package loading
13 That is, most of my emacs packages are taken from Melpa/Elpa/Marmalade, so configure
14 emacs that it can fetch them if needed.
15 And while compiling the .emacs.el we need use-package, but we don't want it during
16 normal runtime.
17 #+BEGIN_SRC emacs-lisp
18 ;; Disable package initialize after us. We either initialize it
19 ;; anyway in case of interpreted .emacs, or we don't want slow
20 ;; initizlization in case of byte-compiled .emacs.elc.
21 (setq package-enable-at-startup nil)
22
23 ;; Ask package.el to not add (package-initialize) to .emacs.
24 (setq package--init-file-ensured t)
25
26 (require 'package)
27 (setq package-user-dir (expand-file-name "elpa" jj-elisp-dir))
28 (dolist (source '(("melpa" . "http://melpa.org/packages/")
29 ("melpa-stable" . "http://stable.melpa.org/packages/")
30 ("marmalade" . "http://marmalade-repo.org/packages/")
31 ("elpy" . "http://jorgenschaefer.github.io/packages/")
32 ("elpa" . "http://elpa.gnu.org/packages/")
33 ))
34 (add-to-list 'package-archives source t))
35 (package-initialize)
36
37
38 ;; set use-package-verbose to t for interpreted .emacs,
39 ;; and to nil for byte-compiled .emacs.elc
40 (eval-and-compile
41 (setq use-package-verbose (not (bound-and-true-p byte-compile-current-file))))
42
43 ;; Add the macro generated list of package.el loadpaths to load-path.
44 (mapc #'(lambda (add) (add-to-list 'load-path add))
45 (eval-when-compile
46 (package-initialize)
47 ;; Install use-package if not installed yet.
48 (unless (package-installed-p 'use-package)
49 (package-refresh-contents)
50 (package-install 'use-package))
51 (let ((package-user-dir-real (file-truename package-user-dir)))
52 ;; The reverse is necessary, because outside we mapc
53 ;; add-to-list element-by-element, which reverses.
54 (nreverse (apply #'nconc
55 ;; Only keep package.el provided loadpaths
56 (mapcar #'(lambda (path)
57 (if (string-prefix-p package-user-dir-real path)
58 (list path)
59 nil))
60 load-path))))))
61
62 (eval-when-compile
63 (require 'use-package))
64 (require 'bind-key)
65 (require 'diminish)
66 #+END_SRC
67
68 ** Tangle on save
69 Tangle my config on save, so next startup shouldn't need to do it.
70
71 #+BEGIN_SRC emacs-lisp
72 ;; This is GPLv2. If you still don't know the details, read
73 ;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
74 ;; Taken from https://bitbucket.org/holgerschurig/emacsconf/src/588093924ef8c1d44e7c11b9612f5aad7f6558ce/config.org?at=master
75 (defun my-tangle-config-org-hook-func ()
76 (when (string-prefix-p "emacs.org" (buffer-name))
77 (let ((orgfile (expand-file-name "emacs.org" (file-name-directory (or load-file-name (buffer-file-name)))))
78 (elfile (expand-file-name "emacs.el" (file-name-directory (or load-file-name (buffer-file-name))))))
79 (my-tangle-config-org orgfile elfile))))
80 (add-hook 'after-save-hook #'my-tangle-config-org-hook-func)
81 #+END_SRC
82
83 ** Schema validation for the config
84 [2016-10-30 Sun 17:15]
85 #+BEGIN_SRC emacs-lisp
86 (use-package validate
87 :ensure t)
88 #+END_SRC
89
90 ** safe-load
91 safe-load does not break emacs initialization, should a file be
92 unreadable while emacs boots up.
93 #+BEGIN_SRC emacs-lisp
94 (defvar safe-load-error-list ""
95 "*List of files that reported errors when loaded via safe-load")
96
97 (defun safe-load (file &optional noerror nomessage nosuffix)
98 "Load a file. If error on load, report back, wait for
99 a key stroke then continue on"
100 (interactive "f")
101 (condition-case nil (load file noerror nomessage nosuffix)
102 (error
103 (progn
104 (setq safe-load-error-list (concat safe-load-error-list " " file))
105 (message "****** [Return to continue] Error loading %s" safe-load-error-list )
106 (sleep-for 1)
107 nil))))
108
109 (defun safe-load-check ()
110 "Check for any previous safe-load loading errors. (safe-load.el)"
111 (interactive)
112 (if (string-equal safe-load-error-list "") ()
113 (message (concat "****** error loading: " safe-load-error-list))))
114 #+END_SRC
115 ** Local autoloads
116 I have some stuff put away in my local dir. I don't want to load it all
117 at startup time, so it is using the autoload feature. For that to work
118 load the loaddefs, so autoload knows where to grab stuff
119 #+BEGIN_SRC emacs-lisp
120 ;(safe-load (concat jj-elisp-dir "/tiny/loaddefs.el"))
121 (safe-load (concat jj-elisp-local-dir "/loaddefs.el"))
122 #+END_SRC
123 ** hook-into-modes
124 [2014-05-20 Tue 22:36]
125 #+BEGIN_SRC emacs-lisp
126 ;; (defmacro hook-into-modes (func modes)
127 ;; `(dolist (mode-hook ,modes)
128 ;; (add-hook mode-hook ,func)))
129
130 (defmacro hook-into-modes (function mode-hooks)
131 "Add FUNCTION to hooks in MODE-HOOKS."
132 `(dolist (hook ,mode-hooks)
133 (add-hook hook ,function)))
134 #+END_SRC
135 ** add-auto-mode
136 Handier way to add modes to auto-mode-alist
137 #+BEGIN_SRC emacs-lisp
138 (defun add-auto-mode (mode &rest patterns)
139 "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
140 (dolist (pattern patterns)
141 (add-to-list 'auto-mode-alist (cons pattern mode))))
142 #+END_SRC
143
144 ** Load path
145 We need to define the load-path. As I have lots of things I add
146 locally, its getting a few entries. I disliked the repeated
147 /add-to-list/ lines, so I now just take all subdirectories of
148 jj-elisp-dir and add them.
149
150 #+BEGIN_SRC emacs-lisp
151 (dolist
152 (project (directory-files jj-elisp-dir t "\\w+"))
153 (when (file-directory-p project)
154 (if (string= project "emacs23")
155 (when (version< emacs-version "24")
156 (add-to-list 'load-path project))
157 (add-to-list 'load-path project))
158 ;(byte-recompile-directory project 0)
159 ))
160 #+END_SRC
161
162 ** Info path
163 Help emacs to find the info files
164 #+BEGIN_SRC emacs-lisp :tangle yes
165 (setq Info-directory-list (cons jj-info-dir
166 '("/usr/local/share/info/"
167 "/usr/local/info/"
168 "/usr/local/gnu/info/"
169 "/usr/local/gnu/lib/info/"
170 "/usr/local/gnu/lib/emacs/info/"
171 "/usr/local/emacs/info/"
172 "/usr/local/lib/info/"
173 "/usr/local/lib/emacs/info/"
174 "/usr/share/info/emacs-23"
175 "/usr/share/info/"
176 "/usr/share/info/")))
177 (setq Info-default-directory-list
178 (cons jj-info-dir Info-default-directory-list))
179 #+END_SRC
180 ** Exec path from PATH Environment
181 [2017-03-11 Sat 20:08]
182 #+BEGIN_SRC emacs-lisp
183 (defun set-exec-path-from-shell-PATH ()
184 (let ((path-from-shell (replace-regexp-in-string
185 "[ \t\n]*$"
186 ""
187 (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
188 (setenv "PATH" path-from-shell)
189 (setq exec-path (split-string path-from-shell path-separator))))
190
191 (when window-system (set-exec-path-from-shell-PATH))
192 #+END_SRC
193
194 ** General stuff
195 :PROPERTIES:
196 :ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
197 :END:
198
199 *** Hide Startup message
200 I dislike the startup message
201 #+BEGIN_SRC emacs-lisp
202 (validate-setq inhibit-splash-screen t)
203 (validate-setq inhibit-startup-message t)
204 #+END_SRC
205
206 *** Linebreak at 72
207 Usually I want the lines to break at 72 characters.
208 #+BEGIN_SRC emacs-lisp
209 (validate-setq fill-column 72)
210 #+END_SRC
211
212 *** Require final newline
213 And it is nice to have a final newline in files.
214 #+BEGIN_SRC emacs-lisp
215 (validate-setq require-final-newline nil)
216 (validate-setq mode-require-final-newline nil)
217 #+END_SRC
218
219 *** Autosave
220 After I typed 300 characters or took a break for more than a minute it
221 would be nice of emacs to save whatever I am on in one of its auto-save
222 backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
223 #+BEGIN_SRC emacs-lisp
224 (validate-setq auto-save-interval 300)
225 (validate-setq auto-save-timeout 60)
226 #+END_SRC
227
228 *** Name and mail settings
229 Set my full name and my default mail address - for whatever wants to use
230 it later. Also, I am using gnus.
231 #+BEGIN_SRC emacs-lisp
232 (validate-setq user-full-name "Joerg Jaspert")
233 (validate-setq user-mail-address "joerg@ganneff.de")
234 (validate-setq mail-user-agent (quote gnus-user-agent))
235 #+END_SRC
236
237 *** Smtpmail
238 My default mail server. Well, simply a localhost, I have a forwarder that
239 puts mail off the right way, no need for emacs to have any further
240 knowledge here.
241 #+BEGIN_SRC emacs-lisp
242 (use-package smtpmail
243 :ensure t
244 :config
245 (progn
246 (validate-setq smtpmail-default-smtp-server "localhost")
247 (validate-setq smtpmail-smtp-server "localhost")))
248 #+END_SRC
249
250 *** Compressed files
251 Enable automatic handling of compressed files.
252 #+BEGIN_SRC emacs-lisp
253 (auto-compression-mode 1)
254 #+END_SRC
255
256 *** Advanced commands
257 Emacs forbids a certain set of commands, as they can be very confusing
258 for new users. Enable them.
259 #+BEGIN_SRC emacs-lisp
260 (put 'narrow-to-region 'disabled nil)
261 (put 'narrow-to-page 'disabled nil)
262 (put 'narrow-to-defun 'disabled nil)
263 (put 'upcase-region 'disabled nil)
264 (put 'downcase-region 'disabled nil)
265 #+END_SRC
266
267 *** Adjust recenter
268 Recenter in a different order - first go to top, then middle, then
269 bottom
270 #+BEGIN_SRC emacs-lisp
271 (validate-setq recenter-positions '(top middle bottom))
272 #+END_SRC
273
274 ** Look / Theme
275 *** Font
276 I've tried various different fonts and while I like the Terminus font
277 most for my shells, in Emacs Inconsolata clearly wins.
278 #+BEGIN_SRC emacs-lisp
279 (set-frame-font "Inconsolata-14")
280 #+END_SRC
281
282 *** Background dark
283 I always use dark backgrounds, so tell Emacs about it. No need to
284 guess around.
285 #+BEGIN_SRC emacs-lisp
286 (setq-default frame-background-mode jj-color-style)
287 #+END_SRC
288
289 *** Color theme
290 And I always liked dark backgrounds with colors setup for them. So I
291 switched through multiple themes doing it in emacs too, but never
292 entirely liked it. Until I found solarized, which is now not only my
293 emacs theme, but also for most of my other software too, especially my
294 shell. Consistent look is great.
295 #+BEGIN_SRC emacs-lisp
296 (use-package solarized-theme
297 :ensure solarized-theme
298 :init
299 (progn
300 (defun jj-init-theme ()
301 (interactive)
302
303 (if (eq jj-color-style 'dark )(load-theme 'solarized-dark t)
304 (load-theme 'solarized-light t))
305 (set-face-attribute 'org-date nil :underline nil)
306 (message "Initializing theme solarized-dark")
307 )
308
309 ;; ;; make the fringe stand out from the background
310 (setq solarized-distinct-fringe-background t)
311
312 ;; ;; Don't change the font for some headings and titles
313 ;; (validate-setq solarized-use-variable-pitch nil)
314
315 ;; ;; make the modeline high contrast
316 ;; (validate-setq solarized-high-contrast-mode-line nil)
317
318 ;; ;; Use less bolding
319 ;; (validate-setq solarized-use-less-bold t)
320
321 ;; ;; Use more italics
322 ;; (validate-setq solarized-use-more-italic t)
323
324 ;; ;; Use less colors for indicators such as git:gutter, flycheck and similar
325 ;; (validate-setq solarized-emphasize-indicators nil)
326
327 ;; ;; Don't change size of org-mode headlines (but keep other size-changes)
328 ;; (validate-setq solarized-scale-org-headlines nil)
329
330 ;; ;; Avoid all font-size changes
331 ;; (validate-setq solarized-height-minus-1 1)
332 ;; (validate-setq solarized-height-plus-1 1)
333 ;; (validate-setq solarized-height-plus-2 1)
334 ;; (validate-setq solarized-height-plus-3 1)
335 ;; (validate-setq solarized-height-plus-4 1)
336 (setq x-underline-at-descent-line t)
337
338 (add-to-list 'custom-theme-load-path jj-theme-dir)
339 (add-hook 'after-init-hook 'jj-init-theme)
340 (jj-init-theme)))
341 #+END_SRC
342
343 *** Fringe
344 Make the fringe (gutter) smaller, the argument is a width in pixels (the default is 8)
345 #+BEGIN_SRC emacs-lisp
346 (if (fboundp 'fringe-mode)
347 (fringe-mode 8))
348 #+END_SRC
349
350 *** Line spacing
351 A bit more spacing between buffer lines
352 #+BEGIN_SRC emacs-lisp
353 (setq-default line-spacing 0.1)
354 #+END_SRC
355 *** Cursor changes
356 [2013-04-21 So 20:54]
357 I do not want my cursor to blink.
358 #+BEGIN_SRC emacs-lisp
359 (blink-cursor-mode -1)
360 #+END_SRC
361 *** Menu, Tool and Scrollbar
362 I don't want to see the menu-bar, tool-bar or scrollbar.
363 #+BEGIN_SRC emacs-lisp
364 (when window-system
365 (dolist (mode '(menu-bar-mode tool-bar-mode scroll-bar-mode))
366 (when (fboundp mode) (funcall mode -1))))
367 #+END_SRC
368 **** When using emacs in daemon mode
369 Emacs has a very nice mode where it detaches itself and runs as daemon -
370 and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
371 Client]]. It's fast, it's nice, it's convinient.
372
373 Except that Emacs behaves stupid when you do that and ignores your
374 menu/tool/scrollbar settings. Sucks.
375
376 For them to work even then, we have to do two things.
377 1. We have to set the frame alist. We simple set both,
378 =initial-frame-alist= and =default-frame-alist= to the same value here.
379 #+BEGIN_SRC emacs-lisp
380 (setq initial-frame-alist '(
381 (horizontal-scroll-bars . nil)
382 (vertical-scroll-bars . nil)
383 (menu-bar-lines . 0)
384 (tool-bar-lines . 0)
385 ))
386 (setq default-frame-alist (copy-alist initial-frame-alist))
387 #+END_SRC
388
389 *** Hilight current line in buffer
390 As it says, it does a hilight of the current line.
391 #+BEGIN_SRC emacs-lisp
392 (global-hl-line-mode +1)
393 #+END_SRC
394 *** Allow recursive minibuffers
395 This allows (additional) minibuffer commands while in the minibuffer.
396 #+BEGIN_SRC emacs-lisp
397 (validate-setq enable-recursive-minibuffers 't)
398 #+END_SRC
399 *** No GC during minibuffer action
400 [2016-02-15 Mon 22:09]
401 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.
402 #+BEGIN_SRC emacs-lisp
403 (defun my-minibuffer-setup-hook ()
404 (validate-setq gc-cons-threshold most-positive-fixnum))
405
406 (defun my-minibuffer-exit-hook ()
407 (validate-setq gc-cons-threshold 16777216))
408
409 (add-hook 'minibuffer-setup-hook #'my-minibuffer-setup-hook)
410 (add-hook 'minibuffer-exit-hook #'my-minibuffer-exit-hook)
411 #+END_SRC
412 *** Modeline related changes
413 I want to see line and column numbers, so turn them on.
414 Size indication lets me know how far I am in a buffer.
415
416 And modeline-posn is great. It will hilight the column number in the
417 modeline in red as soon as you are over the defined limit.
418 #+BEGIN_SRC emacs-lisp
419 (line-number-mode 1)
420 (column-number-mode 1)
421 (size-indication-mode 1)
422 (display-time-mode 1)
423 (validate-setq display-time-day-and-date nil)
424 (validate-setq display-time-default-load-average nil)
425 (validate-setq display-time-24hr-format t)
426 (validate-setq display-time-mail-string "")
427 (validate-setq display-time-default-load-average nil)
428 (validate-setq display-time-interval 15)
429 (validate-setq modelinepos-column-limit 72)
430
431 (use-package modeline-posn
432 :ensure t
433 :config
434 (progn
435 (set-face-foreground 'modelinepos-column-warning "grey20")
436 (set-face-background 'modelinepos-column-warning "red")
437 (setq modelinepos-column-limit 72))
438 )
439 #+END_SRC
440
441 **** diminish
442 [2013-04-22 Mon 11:27]
443 The modeline is easily cluttered up with stuff I don't really need to
444 see. So lets hide those. There are two ways, one of them uses diminish
445 to get entirely rid of some modes, the other is a function taken from
446 "Mastering Emacs" which replaces the modes text with an own (set of)
447 character(s).
448 #+BEGIN_SRC emacs-lisp
449 (require 'diminish)
450 (diminish 'auto-fill-function)
451 (defvar mode-line-cleaner-alist
452 `((auto-complete-mode . " α")
453 (yas-minor-mode . " y")
454 (paredit-mode . " π")
455 (eldoc-mode . "")
456 (abbrev-mode . "")
457 (golden-ratio-mode . "")
458 ;; Major modes
459 (lisp-interaction-mode . "λ")
460 (hi-lock-mode . "")
461 (python-mode . "Py")
462 (emacs-lisp-mode . "EL")
463 (org-mode . "Ω")
464 (org-indent-mode . "")
465 (sh-mode . " Σ")
466 (nxhtml-mode . "nx")
467 (subword-mode . ""))
468
469 "Alist for `clean-mode-line'.
470
471 When you add a new element to the alist, keep in mind that you
472 must pass the correct minor/major mode symbol and a string you
473 want to use in the modeline *in lieu of* the original.
474
475 Want some symbols? Go:
476
477 ;ςερτζθιοπασδφγηξκλυχψωβνμ
478 :ΣΕΡΤΖΘΙΟΠΑΣΔΦΓΗΞΚΛΥΧΨΩΒΝΜ
479 @ł€¶ŧ←↓→øþ¨~æſðđŋħ̣ĸł˝^`|»«¢„“”µ·…
480 ☃⌕☥
481 ")
482
483 ; (add-hook 'after-change-major-mode-hook 'clean-mode-line)
484 #+END_SRC
485 Unfortunately icicles breaks this with the way it adds/removes itself,
486 so take it our for now...
487
488 **** Default mode
489 Back when I started with text-mode. But nowadays I want default mode to
490 be org-mode - it is just so much better to use. And does sensible things
491 with many README files out there, and various other "crap" you get to
492 read in emacs.
493 #+BEGIN_SRC emacs-lisp :tangle yes
494 (setq-default major-mode 'org-mode)
495 #+END_SRC
496
497 *** Don't query to kill processes at exit
498 [2016-10-03 Mo 14:05]
499 The variable at t (its default) lets emacs query before killing
500 processes when exiting.
501 #+BEGIN_SRC emacs-lisp :tangle yes
502 ;;(validate-setq confirm-kill-processes nil)
503 (validate-setq kill-buffer-query-functions
504 (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
505 #+END_SRC
506 ** Keyboard related changes
507 *** Cycle Spacing
508 This lets M-SPC cycle through spacing, that is
509 1. replace all spaces with a single space
510 2. remove all spaces
511 3. restore the original spacing
512 #+BEGIN_SRC emacs-lisp :tangle yes
513 (bind-key "M-SPC" 'cycle-spacing)
514 #+END_SRC
515 *** Toggle/Cycle letter case
516 [2015-05-22 Fri 22:42]
517
518 This is from [[http://ergoemacs.org/emacs/modernization_upcase-word.html][Emacs: Toggle/Cycle Letter Case]]
519
520 Emacs has several user level commands for changing letter case. They
521 are: upcase-word 【Alt+u】, downcase-word 【Alt+l】, capitalize-word
522 【Alt+c】.
523
524 There are also “region” versions for each: upcase-region 【Ctrl+x
525 Ctrl+u】, downcase-region 【Ctrl+x Ctrl+l】, capitalize-region, and
526 also upcase-initials-region. (Note: for elisp programing, there are
527 also these functions: upcase, capitalize, downcase, upcase-initials.)
528
529 One problem with these commands is that you need to move your cursor
530 to the beginning of the word first. For example, if you have the text
531 “THat”, and your cursor is on the “a”, and you call downcase-word, but
532 it doesn't do anything because it only start at the cursor point to
533 end of word. It would be nice if it'll just automatically perform the
534 operation on the whole word.
535
536 Another problem is that it does not consider the final result. For
537 example, if you have “oncE upon a time …”, and you select the whole
538 sentence and call upcase-initials-region, it becomes “OncE Upon A Time
539 …”. Note the capital E is not automatically lowered. For elisp
540 programing, the orthogonal precision is nice, but as user commands, it
541 is better to change the whole sentence.
542
543 Also, these commands have a “-word” and “-region” variants, great for
544 precision in elisp programing but not smart as user commands. It would
545 be nice if emacs automatically choose the right command depending
546 whether there is text selection.
547 #+BEGIN_SRC emacs-lisp :tangle yes
548 (bind-key "M-c" 'toggle-letter-case)
549 #+END_SRC
550 *** Faster pop-to-mark command
551 [2015-12-22 Di 14:56]
552 From [[http://endlessparentheses.com/faster-pop-to-mark-command.html?source=rss][Endless Parentheses]], a nice way to pop back in the marks.
553 #+BEGIN_SRC emacs-lisp :tangle yes
554 ;; When popping the mark, continue popping until the cursor
555 ;; actually moves
556 (defadvice pop-to-mark-command (around ensure-new-position activate)
557 (let ((p (point)))
558 (dotimes (i 10)
559 (when (= p (point)) ad-do-it))))
560 (validate-setq set-mark-command-repeat-pop t)
561 #+END_SRC
562 *** Don't kill-buffer, kill-this-buffer instead
563 From [[http://pragmaticemacs.com/emacs/dont-kill-buffer-kill-this-buffer-instead/][Pragmatic Emacs]]: By default C-x k runs the command kill-buffer
564 which prompts you for which buffer you want to kill, defaulting to the
565 current active buffer. I don’t know about you, but I rarely want to
566 kill a different buffer than the one I am looking at, so I rebind C-x
567 k to kill-this-buffer which just kills the current buffer without
568 prompting (unless there are unsaved changes).
569 #+BEGIN_SRC emacs-lisp :tangle yes
570 (global-set-key (kbd "C-x k") 'kill-this-buffer)
571 #+END_SRC
572 *** Bind sort-lines
573 [2016-10-25 Di 13:38]
574 Its really helpful, but doesn't seem to have a default keybinding, so
575 make up our own.
576 #+BEGIN_SRC emacs-lisp
577 (bind-key "C-c C-s" 'sort-lines)
578 #+END_SRC
579 *** Bind mark-sexp to an easier to reach combo
580 [2017-09-01 Fri 09:14]
581 #+BEGIN_SRC emacs-lisp
582 (bind-key "C-c C-q" 'mark-sexp)
583 #+END_SRC
584
585 ** Miscellaneous stuff
586 *** Isearch related
587 Incremental search is great, but annoyingly you need to type whatever
588 you want. If you want to search for just the next (or previous)
589 occurence of what is at your cursor position use the following.
590 *C-x* will insert the current word while *M-up* and *M-down* will just
591 jump to the next/previous occurence of it.
592 #+BEGIN_SRC emacs-lisp
593 (bind-key "C-x" 'sacha/isearch-yank-current-word isearch-mode-map)
594 (bind-key* "<M-up>" 'sacha/search-word-backward)
595 (bind-key* "<M-down>" 'sacha/search-word-forward)
596 #+END_SRC
597
598 *** Frame configuration
599 I want to see the buffername and its size, not the host I am on in my
600 frame title.
601 #+BEGIN_SRC emacs-lisp
602 (validate-setq frame-title-format "%b (%i)")
603 #+END_SRC
604
605 *** yes-or-no-p
606 Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
607 lazy.
608 #+BEGIN_SRC emacs-lisp
609 (defalias 'yes-or-no-p 'y-or-n-p)
610 #+END_SRC
611
612 *** Language/i18n stuff
613 In this day and age, UTF-8 is the way to go.
614 #+BEGIN_SRC emacs-lisp
615 (set-language-environment 'utf-8)
616 (set-default-coding-systems 'utf-8)
617 (set-terminal-coding-system 'utf-8)
618 (set-keyboard-coding-system 'utf-8)
619 (set-clipboard-coding-system 'utf-8)
620 (prefer-coding-system 'utf-8)
621 (set-charset-priority 'unicode)
622 (validate-setq default-process-coding-system '(utf-8-unix . utf-8-unix))
623 (when (display-graphic-p)
624 (validate-setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
625 #+END_SRC
626
627 *** Kill other buffers
628 While many editors allow you to close "all the other files, not the one
629 you are in", emacs doesn't have this... Except, now it will.
630 (Update 30.05.2014: Not used ever, deactivated)
631 #+BEGIN_SRC emacs-lisp :tangle no
632 (bind-key "C-c k" 'prelude-kill-other-buffers)
633 #+END_SRC
634 *** Scrolling
635 Default scrolling behaviour in emacs is a bit annoying, who wants to
636 jump half-windows?
637 #+BEGIN_SRC emacs-lisp
638 (validate-setq scroll-margin 3)
639 (validate-setq scroll-conservatively 100000)
640 (validate-setq scroll-up-aggressively 0.0)
641 (validate-setq scroll-down-aggressively 0.0)
642 (validate-setq scroll-preserve-screen-position 'always)
643 #+END_SRC
644
645 *** Copy/Paste with X
646 [2013-04-09 Di 23:31]
647 The default how emacs handles cutting/pasting with the primary selection
648 changed in emacs24. I am used to the old way, so get it back.
649 #+BEGIN_SRC emacs-lisp
650 (validate-setq select-enable-primary t)
651 (validate-setq select-enable-clipboard nil)
652 (validate-setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
653 (validate-setq mouse-drag-copy-region t)
654 #+END_SRC
655 *** Global keyboard changes not directly related to a mode
656 **** disable suspend frame
657 Disable /suspend_frame/ function, I dislike it.
658 #+BEGIN_SRC emacs-lisp
659 (unbind-key "C-z")
660 (unbind-key "C-x C-z")
661 #+END_SRC
662 **** kill line but move to beginning of it first
663 http://endlessparentheses.com/kill-entire-line-with-prefix-argument.html?source=rss
664 #+BEGIN_SRC emacs-lisp :tangle no
665 (defmacro bol-with-prefix (function)
666 "Define a new function which calls FUNCTION.
667 Except it moves to beginning of line before calling FUNCTION when
668 called with a prefix argument. The FUNCTION still receives the
669 prefix argument."
670 (let ((name (intern (format "endless/%s-BOL" function))))
671 `(progn
672 (defun ,name (p)
673 ,(format
674 "Call `%s', but move to BOL when called with a prefix argument."
675 function)
676 (interactive "P")
677 (when p
678 (forward-line 0))
679 (call-interactively ',function))
680 ',name)))
681
682 (global-set-key [remap paredit-kill] (bol-with-prefix paredit-kill))
683 (global-set-key [remap org-kill-line] (bol-with-prefix org-kill-line))
684 (global-set-key [remap kill-line] (bol-with-prefix kill-line))
685 #+END_SRC
686 **** kill entire line
687 Default of *C-k* is to kill from the point to the end of line. If
688 'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
689 set, including newline. But to kill the entire line, one still needs a
690 *C-a* in front of it. So I change it, by defining a function to do just this for
691 me. Lazyness++.
692 #+BEGIN_SRC emacs-lisp :tangle no
693 (defun kill-entire-line ()
694 "Kill this entire line (including newline), regardless of where point is within the line."
695 (interactive)
696 (beginning-of-line)
697 (kill-line)
698 (back-to-indentation))
699
700 (bind-key* "C-k" 'kill-entire-line)
701 (global-set-key [remap kill-whole-line] 'kill-entire-line)
702 #+END_SRC
703
704 And the same is true when I'm in org-mode, which has an own kill function...
705 (the keybinding happens later, after org-mode is loaded fully)
706 #+BEGIN_SRC emacs-lisp :tangle no
707 (defun jj-org-kill-line (&optional arg)
708 "Kill the entire line, regardless of where point is within the line, org-mode-version"
709 (interactive "P")
710 (beginning-of-line)
711 (org-kill-line arg)
712 (back-to-indentation)
713 )
714 #+END_SRC
715 **** No tabs
716 I really hate tabs, so I don't want any indentation to try using them.
717 And in case a project really needs them, I can change it just for that
718 file/project, but luckily none of those I work in is as broken.
719 #+BEGIN_SRC emacs-lisp
720 (setq-default indent-tabs-mode nil)
721 #+END_SRC
722 **** match paren
723 Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
724 #+BEGIN_SRC emacs-lisp
725 (bind-key* "M-5" 'match-paren)
726 #+END_SRC
727 **** backward-kill-word
728 Instead of the default "mark-defun" I want a more readline-like setting.
729 #+BEGIN_SRC emacs-lisp
730 (bind-key "C-M-h" 'backward-kill-word)
731 #+END_SRC
732 **** Align with regexp
733 Align whatever with a regexp.
734 #+BEGIN_SRC emacs-lisp
735 (bind-key "C-x \\" 'align-regexp)
736 #+END_SRC
737 **** Font size changes
738 #+BEGIN_SRC emacs-lisp
739 (bind-key "C-+" 'text-scale-increase)
740 (bind-key "C--" 'text-scale-decrease)
741 #+END_SRC
742 **** rgrep
743 Rgrep is infinitely useful in multi-file projects.
744 #+begin_src emacs-lisp
745 ; (bind-key "C-x C-g" 'rgrep)
746 (bind-key "C-x C-g" 'counsel-ag)
747 #+end_src
748 **** Transpose lines
749 Easy way to move a line up - or down. Simpler than dealing with C-x C-t
750 AKA transpose lines.
751 #+BEGIN_SRC emacs-lisp
752 (bind-key "<M-S-up>" 'move-line-up)
753 (bind-key "<M-S-down>" 'move-line-down)
754 #+END_SRC
755 **** "Pull" lines up, join them
756 #+BEGIN_SRC emacs-lisp
757 (defun join-line-or-lines-in-region ()
758 "Join this line or the lines in the selected region.
759 Joins single lines in reverse order to the default, ie. pulls the next one up."
760 (interactive)
761 (cond ((region-active-p)
762 (let ((min (line-number-at-pos (region-beginning))))
763 (goto-char (region-end))
764 (while (> (line-number-at-pos) min)
765 (join-line ))))
766 (t (let ((current-prefix-arg '(4)))
767 (call-interactively 'join-line)))))
768 (bind-key "M-j" 'join-line-or-lines-in-region)
769 #+END_SRC
770 **** Let enter indent next line
771 When I press Enter I almost always want to go to the right indentation on the next line.
772 #+BEGIN_SRC emacs-lisp
773 (bind-key "RET" 'newline-and-indent)
774 #+END_SRC
775 **** Easier undo
776 and i don't need suspend-frame
777 #+BEGIN_SRC emacs-lisp
778 (bind-key "C-z" 'undo)
779 #+END_SRC
780 **** Window switching, go backwards. (C-x o goes to the next window)
781 #+BEGIN_SRC emacs-lisp
782 (bind-key "C-x O" (lambda ()
783 (interactive)
784 (other-window -1)))
785 #+END_SRC
786 **** Edit file as root
787 #+BEGIN_SRC emacs-lisp
788 (bind-key "C-x C-r" 'prelude-sudo-edit)
789 #+END_SRC
790 **** Just one space with newline
791 M-space is bound to just-one-space, which is great for programming. What
792 it does is remove all spaces around the cursor, except for one. But to
793 be really useful, it also should include newlines. It doesn’t do this by
794 default. Rather, you have to call it with a negative argument. Sure
795 not, bad Emacs.
796 #+BEGIN_SRC emacs-lisp
797 (bind-key "M-SPC" 'just-one-space-with-newline)
798 #+END_SRC
799 **** Count which commands I use how often.
800 #+BEGIN_SRC emacs-lisp :tangle no
801 (use-package keyfreq
802 :ensure keyfreq
803 :config
804 (progn
805 (validate-setq keyfreq-file (expand-file-name "keyfreq" jj-cache-dir))
806 (validate-setq keyfreq-file-lock (expand-file-name "keyfreq.lock" jj-cache-dir))
807 (keyfreq-mode 1)
808 (keyfreq-autosave-mode 1)))
809 #+END_SRC
810 **** Duplicate current line
811 #+BEGIN_SRC emacs-lisp
812 (defun duplicate-line ()
813 "Insert a copy of the current line after the current line."
814 (interactive)
815 (save-excursion
816 (let ((line-text (buffer-substring-no-properties
817 (line-beginning-position)
818 (line-end-position))))
819 (move-end-of-line 1)
820 (newline)
821 (insert line-text))))
822
823 (bind-key "C-c p" 'duplicate-line)
824 #+END_SRC
825 **** Smarter move to the beginning of the line.
826 That is, it first moves to the beginning of the line - and on second
827 keypress it goes to the first character on line.
828 #+BEGIN_SRC emacs-lisp
829 (defun smarter-move-beginning-of-line (arg)
830 "Move point back to indentation of beginning of line.
831
832 Move point to the first non-whitespace character on this line.
833 If point is already there, move to the beginning of the line.
834 Effectively toggle between the first non-whitespace character and
835 the beginning of the line.
836
837 If ARG is not nil or 1, move forward ARG - 1 lines first. If
838 point reaches the beginning or end of the buffer, stop there."
839 (interactive "^p")
840 (validate-setq arg (or arg 1))
841
842 ;; Move lines first
843 (when (/= arg 1)
844 (let ((line-move-visual nil))
845 (forward-line (1- arg))))
846
847 (let ((orig-point (point)))
848 (back-to-indentation)
849 (when (= orig-point (point))
850 (move-beginning-of-line 1))))
851
852 ;; remap C-a to `smarter-move-beginning-of-line'
853 (global-set-key [remap move-beginning-of-line]
854 'smarter-move-beginning-of-line)
855
856 #+END_SRC
857 **** Copy characters from previous line
858 Easily copy characters from the previous nonblank line, starting just
859 above point. With a prefix argument, only copy ARG characters (never
860 past EOL), no argument copies rest of line.
861 #+BEGIN_SRC emacs-lisp
862 (use-package misc
863 :bind ("H-y" . copy-from-above-command))
864 #+END_SRC
865 **** Misc keybindings
866 Open a new X Terminal pointing to the directory of the current
867 buffers path.
868 #+BEGIN_SRC emacs-lisp
869 (bind-key "H-t" 'jj-open-shell)
870 #+END_SRC
871
872 Align code
873 #+BEGIN_SRC emacs-lisp
874 (bind-key "H-a" 'align-code)
875 #+END_SRC
876
877 Insert date
878 #+BEGIN_SRC emacs-lisp
879 (bind-key "C-c d" 'insert-date)
880 #+END_SRC
881
882 Another key for indenting
883 #+BEGIN_SRC emacs-lisp
884 (bind-key "H-i" 'indent-region)
885 #+END_SRC
886
887 Clean all whitespace stuff
888 #+BEGIN_SRC emacs-lisp
889 (bind-key "H-w" 'whitespace-cleanup)
890 #+END_SRC
891
892 Comment/Uncomment
893 #+BEGIN_SRC emacs-lisp
894 (bind-key "H-c" 'comment-dwim)
895 #+END_SRC
896
897 Show keystrokes in progress
898 #+BEGIN_SRC emacs-lisp
899 (validate-setq echo-keystrokes 0.1)
900 #+END_SRC
901 **** Overwrite mode
902 Usually you can press the *Ins*ert key, to get into overwrite mode. I
903 don't like that, have broken much with it and so just forbid it by
904 disabling that.
905 #+BEGIN_SRC emacs-lisp
906 (unbind-key "<insert>")
907 (unbind-key "<kp-insert>")
908 #+END_SRC
909
910 **** Easily navigate sillyCased words
911 #+BEGIN_SRC emacs-lisp
912 (global-subword-mode 1)
913 #+END_SRC
914 **** Delete file of current buffer, then kill buffer
915 [2014-06-14 Sat 23:03]
916 #+BEGIN_SRC emacs-lisp
917 (defun delete-current-buffer-file ()
918 "Removes file connected to current buffer and kills buffer."
919 (interactive)
920 (let ((filename (buffer-file-name))
921 (buffer (current-buffer))
922 (name (buffer-name)))
923 (if (not (and filename (file-exists-p filename)))
924 (ido-kill-buffer)
925 (when (yes-or-no-p "Are you sure you want to remove this file? ")
926 (delete-file filename)
927 (kill-buffer buffer)
928 (message "File '%s' successfully removed" filename)))))
929
930 (bind-key "C-x C-k" 'delete-current-buffer-file)
931 #+END_SRC
932 **** Rename file of current buffer
933 [2014-06-14 Sat 23:04]
934 #+BEGIN_SRC emacs-lisp
935 (defun rename-current-buffer-file ()
936 "Renames current buffer and file it is visiting."
937 (interactive)
938 (let ((name (buffer-name))
939 (filename (buffer-file-name)))
940 (if (not (and filename (file-exists-p filename)))
941 (error "Buffer '%s' is not visiting a file!" name)
942 (let ((new-name (read-file-name "New name: " filename)))
943 (if (get-buffer new-name)
944 (error "A buffer named '%s' already exists!" new-name)
945 (rename-file filename new-name 1)
946 (rename-buffer new-name)
947 (set-visited-file-name new-name)
948 (set-buffer-modified-p nil)
949 (message "File '%s' successfully renamed to '%s'"
950 name (file-name-nondirectory new-name)))))))
951
952 (bind-key "C-x C-S-r" 'rename-current-buffer-file)
953 #+END_SRC
954 **** Quickly find emacs lisp sources
955 [2014-06-22 Sun 23:05]
956 #+BEGIN_SRC emacs-lisp
957 (bind-key "C-l" 'find-library 'help-command)
958 (bind-key "C-f" 'find-function 'help-command)
959 (bind-key "C-k" 'find-function-on-key 'help-command)
960 (bind-key "C-v" 'find-variable 'help-command)
961 #+END_SRC
962 *** Adjust occur
963 [2015-01-26 Mon 16:01]
964 #+BEGIN_SRC emacs-lisp
965 (bind-key "M-s o" 'occur-dwim)
966 #+END_SRC
967 *** Searches and matches should ignore case.
968 #+BEGIN_SRC emacs-lisp
969 (setq-default case-fold-search t)
970 #+END_SRC
971 *** Don't display a cursor in non-selected windows.
972 #+BEGIN_SRC emacs-lisp
973 (setq-default cursor-in-non-selected-windows nil)
974 #+END_SRC
975 *** Modeline filetype endings display
976 What should be displayed in the mode-line for files with those types
977 of line endings.
978 #+BEGIN_SRC emacs-lisp
979 (validate-setq eol-mnemonic-dos "(DOS)")
980 (validate-setq eol-mnemonic-mac "(Mac)")
981 #+END_SRC
982
983 #+BEGIN_SRC emacs-lisp
984 (validate-setq max-lisp-eval-depth 1000)
985 (validate-setq max-specpdl-size 3000)
986 #+END_SRC
987 *** Unfill paragraph
988 From https://raw.github.com/qdot/conf_emacs/master/emacs_conf.org
989 #+BEGIN_SRC emacs-lisp
990 (defun unfill-paragraph ()
991 "Takes a multi-line paragraph and makes it into a single line of text."
992 (interactive)
993 (let ((fill-column (point-max)))
994 (fill-paragraph nil)))
995 (bind-key "H-u" 'unfill-paragraph)
996 #+END_SRC
997
998 #+BEGIN_SRC emacs-lisp
999 (setq-default indicate-empty-lines t)
1000 (validate-setq sentence-end-double-space nil)
1001 #+END_SRC
1002 *** Hilight annotations in comments, like FIXME/TODO/...
1003 #+BEGIN_SRC emacs-lisp :tangle yes
1004 (add-hook 'prog-mode-hook 'font-lock-comment-annotations)
1005 #+END_SRC
1006 *** Wait a bit longer before considering emacs idle
1007 #+BEGIN_SRC emacs-lisp :tangle yes
1008 (validate-setq idle-update-delay 2)
1009 #+END_SRC
1010 *** Make gnutls a bit safer, the default is an absurdly low 256
1011 #+BEGIN_SRC emacs-lisp :tangle yes
1012 (validate-setq gnutls-min-prime-bits 4096)
1013 #+END_SRC
1014 *** Emacs defaults to using --insecure - and supporting ssl3. No thanks.
1015 #+BEGIN_SRC emacs-lisp :tangle yes
1016 (setq tls-program
1017 ;; Defaults:
1018 ;; '("gnutls-cli --insecure -p %p %h"
1019 ;; "gnutls-cli --insecure -p %p %h --protocols ssl3"
1020 ;; "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")
1021 '("gnutls-cli -p %p %h"
1022 "openssl s_client -connect %h:%p -no_ssl2 -no_ssl3 -ign_eof"))
1023 #+END_SRC
1024 *** Resolve symlinks without asking
1025 #+BEGIN_SRC emacs-lisp :tangle no
1026 (setq-default find-file-visit-truename t)
1027 #+END_SRC
1028
1029 #+BEGIN_SRC emacs-lisp :tangle yes
1030 (setq-default bidi-display-reordering nil)
1031 #+END_SRC
1032
1033 *** When saving a script - make it executable
1034 #+BEGIN_SRC emacs-lisp
1035 (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
1036 #+END_SRC
1037
1038 *** Emacs Server
1039 #+BEGIN_SRC emacs-lisp
1040 (use-package server
1041 :init
1042 (progn
1043 (add-hook 'after-init-hook 'server-start)))
1044 #+END_SRC
1045 **** Edit-server for chromium extension "Edit with emacs"
1046 [2015-10-15 Thu 22:32]
1047 #+BEGIN_SRC emacs-lisp :tangle no
1048 (use-package edit-server
1049 :config
1050 (progn
1051 (validate-setq edit-server-new-frame nil)
1052 (edit-server-start)))
1053 #+END_SRC
1054 *** Adjust buffer mode for zsh commandline editing buffers
1055 [2017-03-17 Fr 13:35]
1056 I got a handy zsh setup, using edit-command-line widget, so typing C-x
1057 C-e I end up in emacs with whatever is in my commandline. Save, exit -
1058 and commandline is changed to it. Very nice.
1059 Now I want the buffers of it appear in sh-mode by default
1060 #+BEGIN_SRC emacs-lisp
1061 (add-auto-mode 'sh-mode "zshe.*$")
1062 #+END_SRC
1063 *** No need for lockfiles (foo~)
1064 [2017-12-08 Fri 09:29]
1065 #+BEGIN_SRC emacs-lisp
1066 (setq create-lockfiles nil)
1067 (setq make-backup-files nil)
1068
1069 #+END_SRC
1070 * Customized variables
1071 [2013-05-02 Thu 22:14]
1072 The following contains a set of variables i may reasonably want to
1073 change on other systems - which don't affect the init file loading
1074 process. So I *can* use the customization interface for it...
1075 #+BEGIN_SRC emacs-lisp
1076 (defgroup ganneff nil
1077 "Modify ganneffs settings"
1078 :group 'environment)
1079
1080 (defgroup ganneff-org-mode nil
1081 "Ganneffs org-mode settings"
1082 :tag "Ganneffs org-mode settings"
1083 :group 'ganneff
1084 :link '(custom-group-link "ganneff"))
1085
1086 (defcustom bh/organization-task-id "d0db0d3c-f22e-42ff-a654-69524ff7cc91"
1087 "ID of the organization task."
1088 :tag "Organization Task ID"
1089 :type 'string
1090 :group 'ganneff-org-mode)
1091
1092 (defcustom org-my-archive-expiry-days 2
1093 "The number of days after which a completed task should be auto-archived.
1094 This can be 0 for immediate, or a floating point value."
1095 :tag "Archive expiry days"
1096 :type 'float
1097 :group 'ganneff-org-mode)
1098 #+END_SRC
1099
1100 ** Customized variables
1101 :PROPERTIES:
1102 :ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
1103 :END:
1104 Of course I want to be able to use the customize interface, and some
1105 things can only be set via it (or so they say). I usually prefer to put
1106 things I keep for a long while into statements somewhere else, not just
1107 custom-set here, but we need it anyways.
1108
1109 #+BEGIN_SRC emacs-lisp
1110 (validate-setq custom-file jj-custom-file)
1111 (safe-load custom-file)
1112 #+END_SRC
1113
1114 The source of this is:
1115 #+INCLUDE: "~/.emacs.d/config/customized.el" src emacs-lisp
1116
1117
1118 * Extra modes, additions, thingies, fun
1119 ** abbrev
1120 A defined abbrev is a word which expands, if you insert it, into some
1121 different text. Abbrevs are defined by the user to expand in specific
1122 ways.
1123 Also see [[http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html][Ispell and Abbrev, the Perfect Auto-Correct]].
1124 #+BEGIN_SRC emacs-lisp :tangle yes
1125 (use-package abbrev
1126 :commands abbrev-mode
1127 :diminish abbrev-mode
1128 :bind (:map ctl-x-map
1129 ("C-i" . endless/ispell-word-then-abbrev))
1130 :init
1131 (progn
1132 (setq-default abbrev-mode t)
1133 (hook-into-modes #'abbrev-mode '(text-mode-hook)))
1134 :config
1135 (progn
1136 (validate-setq save-abbrevs 'silently)
1137 (validate-setq abbrev-file-name (expand-file-name "abbrev_defs" jj-cache-dir))
1138 (if (file-exists-p abbrev-file-name)
1139 (quietly-read-abbrev-file))
1140
1141 (add-hook 'expand-load-hook
1142 (lambda ()
1143 (add-hook 'expand-expand-hook 'indent-according-to-mode)
1144 (add-hook 'expand-jump-hook 'indent-according-to-mode)))
1145
1146 (defun endless/ispell-word-then-abbrev (p)
1147 "Call `ispell-word', then create an abbrev for it.
1148 With prefix P, create local abbrev. Otherwise it will
1149 be global.
1150 If there's nothing wrong with the word at point, keep
1151 looking for a typo until the beginning of buffer. You can
1152 skip typos you don't want to fix with `SPC', and you can
1153 abort completely with `C-g'."
1154 (interactive "P")
1155 (let (bef aft)
1156 (save-excursion
1157 (while (if (validate-setq bef (thing-at-point 'word))
1158 ;; Word was corrected or used quit.
1159 (if (ispell-word nil 'quiet)
1160 nil ; End the loop.
1161 ;; Also end if we reach `bob'.
1162 (not (bobp)))
1163 ;; If there's no word at point, keep looking
1164 ;; until `bob'.
1165 (not (bobp)))
1166 (backward-word))
1167 (validate-setq aft (thing-at-point 'word)))
1168 (if (and aft bef (not (equal aft bef)))
1169 (let ((aft (downcase aft))
1170 (bef (downcase bef)))
1171 (define-abbrev
1172 (if p local-abbrev-table global-abbrev-table)
1173 bef aft)
1174 (message "\"%s\" now expands to \"%s\" %sally"
1175 bef aft (if p "loc" "glob")))
1176 (user-error "No typo at or before point"))))
1177 (validate-setq save-abbrevs 'silently)))
1178 #+END_SRC
1179 ** Atomic chrome, edit text from Chrome in Emacs
1180 [2017-03-09 Do 14:56]
1181 #+BEGIN_SRC emacs-lisp
1182 (use-package atomic-chrome
1183 :ensure t
1184 :init
1185 (progn
1186 (atomic-chrome-start-server)))
1187 #+END_SRC
1188 ** ace-window
1189 [2013-04-21 So 20:27]
1190 Use H-w to switch windows
1191 #+BEGIN_SRC emacs-lisp
1192 (use-package ace-window
1193 :ensure ace-window
1194 :commands ace-window
1195 :bind ("H-w" . ace-window)
1196 :config
1197 (progn
1198 (validate-setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))
1199 ))
1200 #+END_SRC
1201 ** anzu
1202 [2014-06-01 Sun 23:02]
1203 Provides a minor mode which displays current match and total matches
1204 information in the mode-line in various search modes.
1205 #+BEGIN_SRC emacs-lisp
1206 (use-package anzu
1207 :ensure anzu
1208 :diminish anzu-mode
1209 :defer t
1210 :init
1211 (global-anzu-mode 1)
1212 :config
1213 (progn
1214 (validate-setq anzu-search-threshold 1000)
1215 (set-face-attribute 'anzu-mode-line nil :foreground "yellow" :weight 'bold)))
1216 #+END_SRC
1217 ** CANCELLED ansible :CANCELLED:
1218 CLOSED: [2017-08-27 So 15:16]
1219 :LOGBOOK:
1220 - State "CANCELLED" from [2017-08-27 So 15:16]
1221 :END:
1222 [2017-08-26 Sa 14:24]
1223 Something for that horrible tool
1224 #+BEGIN_SRC emacs-lisp :tangle no
1225 (use-package ansible
1226 :ensure t)
1227 #+END_SRC
1228 ** avy-mode
1229 [2013-04-28 So 11:26]
1230 avy is a GNU Emacs package for jumping to visible text using a char-based decision tree.
1231 #+BEGIN_SRC emacs-lisp
1232 (use-package avy
1233 :ensure avy
1234 :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)
1235 :bind (("H-SPC" . avy-goto-char-2)
1236 ("M-g g" . avy-goto-line)
1237 :map isearch-mode-map
1238 ("C-y" . avy-isearch)
1239 )
1240 :config
1241 (progn
1242 (validate-setq avy-all-windows 'all-frames)
1243 (setq avi-keys '(?a ?s ?d ?e ?f ?h ?j ?k ?l ?n ?m ?v ?r ?u) )
1244 ))
1245 #+END_SRC
1246 ** Browser
1247 #+BEGIN_SRC emacs-lisp
1248 (use-package browse-url
1249 :ensure t
1250 :commands (browse-url)
1251 :config
1252 (progn
1253 (validate-setq browse-url-browser-function (quote browse-url-generic))
1254 (validate-setq browse-url-generic-program "/usr/bin/x-www-browser")))
1255 #+END_SRC
1256
1257 ** CANCELLED Emacs shell :CANCELLED:
1258 CLOSED: [2017-08-26 Sa 13:55]
1259 :LOGBOOK:
1260 - State "CANCELLED" from [2017-08-26 Sa 13:55] \\
1261 Not using it at the moment
1262 :END:
1263 Basic settings for emacs integrated shell
1264 #+BEGIN_SRC emacs-lisp
1265 (use-package eshell
1266 :defer t
1267 :defines eshell-path-env
1268 :commands eshell
1269 :init
1270 (progn
1271 (defun eshell-initialize ()
1272 (defun eshell-spawn-external-command (beg end)
1273 "Parse and expand any history references in current input."
1274 (save-excursion
1275 (goto-char end)
1276 (when (looking-back "&!" beg)
1277 (delete-region (match-beginning 0) (match-end 0))
1278 (goto-char beg)
1279 (insert "spawn "))))
1280 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
1281 (eval-after-load "em-unix"
1282 '(progn
1283 (unintern 'eshell/su)
1284 (unintern 'eshell/sudo))))
1285 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
1286 )
1287 :config
1288 (progn
1289 (setq eshell-path-env path-from-shell) ; for eshell users
1290 (defalias 'emacs 'find-file)
1291 (defalias 'ec 'find-file)
1292 (defalias 'e 'find-file)
1293
1294 (use-package f
1295 :ensure f)
1296 (use-package 'em-cmpl)
1297 (use-package 'em-prompt)
1298 (use-package 'em-term)
1299
1300 (validate-setq eshell-cmpl-cycle-completions nil
1301 eshell-save-history-on-exit t
1302 eshell-buffer-maximum-lines 20000
1303 eshell-history-size 350
1304 eshell-buffer-shorthand t
1305 eshell-highlight-prompt t
1306 eshell-plain-echo-behavior t
1307 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
1308
1309 (setenv "PAGER" "cat")
1310 (validate-setq eshell-visual-commands
1311 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
1312 (validate-setq eshell-visual-subcommands
1313 '(("git" "log" "l" "diff" "show")))
1314
1315 (add-to-list 'eshell-command-completions-alist
1316 '("gunzip" "gz\\'"))
1317 (add-to-list 'eshell-command-completions-alist
1318 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
1319
1320 (when (not (functionp 'eshell/rgrep))
1321 (defun eshell/rgrep (&rest args)
1322 "Use Emacs grep facility instead of calling external grep."
1323 (eshell-grep "rgrep" args t)))
1324
1325 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
1326 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
1327 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
1328 (add-hook 'eshell-preoutput-filter-functions
1329 'ansi-color-filter-apply)
1330 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
1331
1332 (defmacro with-face (str &rest properties)
1333 `(propertize ,str 'face (list ,@properties)))
1334
1335 (defun eshell/abbr-pwd ()
1336 (let ((home (getenv "HOME"))
1337 (path (eshell/pwd)))
1338 (cond
1339 ((string-equal home path) "~")
1340 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
1341 (path))))
1342
1343 (defun eshell/my-prompt ()
1344 (let ((header-bg "#161616"))
1345 (concat
1346 (with-face user-login-name :foreground "cyan")
1347 (with-face (concat "@" hostname) :foreground "white")
1348 " "
1349 (with-face (eshell/abbr-pwd) :foreground "#009900")
1350 (if (= (user-uid) 0)
1351 (with-face "#" :foreground "red")
1352 (with-face "$" :foreground "#69b7f0"))
1353 " ")))
1354
1355 (use-package eshell-prompt-extras
1356 :ensure t
1357 :init
1358 (progn
1359 (validate-setq eshell-highlight-prompt nil
1360 ;; epe-git-dirty-char "Ϟ"
1361 epe-git-dirty-char "*"
1362 eshell-prompt-function 'epe-theme-dakrone)))
1363
1364 (defun eshell/magit ()
1365 "Function to open magit-status for the current directory"
1366 (interactive)
1367 (magit-status default-directory)
1368 nil)
1369
1370 (validate-setq eshell-prompt-function 'eshell/my-prompt)
1371 (validate-setq eshell-highlight-prompt nil)
1372 (validate-setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
1373 #+END_SRC
1374
1375 ** keep-buffers
1376 I don't want some buffers to be killed, **scratch** for example.
1377 In the past I had a long function that just recreated them, but the
1378 =keep-buffers= package is easier.
1379 #+BEGIN_SRC emacs-lisp
1380 (use-package keep-buffers
1381 :config
1382 (progn
1383 (keep-buffers-mode 1)
1384 (push '("\\`*scratch" . erase) keep-buffers-protected-alist)
1385 (push '("\\`*Org Agenda" . nil) keep-buffers-protected-alist)
1386 ))
1387 #+END_SRC
1388
1389 ** midnight mode
1390 #+BEGIN_SRC emacs-lisp
1391 (use-package midnight
1392 :ensure t
1393 :init
1394 (midnight-mode)
1395 :config
1396 (progn
1397 (validate-setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
1398 "*Man " "*Buffer List*"
1399 "*Compile-Log*"
1400 "*info*" "*vc*"
1401 "*vc-diff*" "*diff*"
1402 "*Customize"
1403 "*tramp/" "*debug "
1404 "*magit" "*Calendar"
1405 "*eww*")))
1406 (midnight-delay-set 'midnight-delay (* 14 60 60))
1407 ))
1408 #+END_SRC
1409 ** mic-paren
1410 While I do have the nifty shortcut to jump to the other parentheses,
1411 hilighting them makes it obvious where they are.
1412 #+BEGIN_SRC emacs-lisp
1413 (use-package mic-paren
1414 :ensure t
1415 :config
1416 (paren-activate))
1417 #+END_SRC
1418
1419 ** Paradox
1420 Paradox is a nicer interface to the package system
1421 #+BEGIN_SRC emacs-lisp
1422 (use-package paradox
1423 :ensure t
1424 :commands (paradox-list-packages paradox-install paradox-upgrade-packages paradox-enable)
1425 :config
1426 (progn
1427 (setq paradox-github-token t)
1428 ))
1429 :defer 5
1430 :init
1431 (paradox-enable)
1432
1433 #+END_SRC
1434 ** Shell (ZSH)
1435 [2013-04-23 Tue 16:43]
1436 Shell. zsh in my case.
1437 #+BEGIN_SRC emacs-lisp
1438 (use-package shell
1439 :commands (shell)
1440 :defer t
1441 :config
1442 (progn
1443 (validate-setq shell-file-name "zsh")
1444 (validate-setq shell-command-switch "-c")
1445 (validate-setq explicit-shell-file-name shell-file-name)
1446 (setenv "SHELL" shell-file-name)
1447 (setq explicit-sh-args '("-login" "-i"))
1448 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
1449 (validate-setq comint-scroll-to-bottom-on-input t) ; always insert at the bottom
1450 (validate-setq comint-scroll-to-bottom-on-output t) ; always add output at the bottom
1451 (validate-setq comint-scroll-show-maximum-output t) ; scroll to show max possible output
1452 (validate-setq comint-completion-autolist t) ; show completion list when ambiguous
1453 (validate-setq comint-input-ignoredups t) ; no duplicates in command history
1454 (validate-setq comint-completion-addsuffix t) ; insert space/slash after file completion
1455 (validate-setq comint-buffer-maximum-size 20000) ; max lenght of the buffer in lines
1456 (validate-setq comint-prompt-read-only nil) ; if this is t, it breaks shell-command
1457 ))
1458 #+END_SRC
1459
1460 ** ascii
1461 [2014-05-21 Wed 00:33]
1462 #+BEGIN_SRC emacs-lisp
1463 (use-package ascii
1464 :ensure t
1465 :commands (ascii-on ascii-toggle ascii-display)
1466 :bind (("C-c e A" . ascii-toggle))
1467 :init
1468 (progn
1469 (defun ascii-toggle ()
1470 (interactive)
1471 (defvar ascii-display nil)
1472 (if ascii-display
1473 (ascii-off)
1474 (ascii-on)))))
1475 #+END_SRC
1476 ** auctex
1477 #+BEGIN_SRC emacs-lisp
1478 (use-package tex
1479 :ensure auctex
1480 :mode ("\\.tex\\'" . latex-mode)
1481 :commands (latex-mode LaTeX-mode plain-tex-mode)
1482 :config
1483 (progn
1484 (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
1485 (add-hook 'LaTeX-mode-hook #'flyspell-mode)
1486 (add-hook 'LaTeX-mode-hook #'turn-on-reftex)
1487 (setq TeX-auto-save t
1488 TeX-parse-self t
1489 TeX-save-query nil
1490 TeX-PDF-mode t)
1491 (setq-default TeX-master nil)
1492
1493 ;; Compilation command
1494 (add-hook 'LaTeX-mode-hook (lambda () (setq compile-command "latexmk -pdf")))))
1495 #+END_SRC
1496 ** CANCELLED auto-complete mode :CANCELLED:
1497 CLOSED: [2017-12-08 Fri 15:25]
1498 :LOGBOOK:
1499 - State "CANCELLED" from [2017-12-08 Fri 15:25]
1500 :END:
1501 [2013-04-27 Sa 16:33]
1502 And aren't we all lazy? I definitely am, and I like my emacs doing as
1503 much possible work for me as it can.
1504 So here, auto-complete-mode, which lets emacs do this, based on what I
1505 already had typed.
1506 #+BEGIN_SRC emacs-lisp
1507 (use-package auto-complete
1508 :ensure auto-complete
1509 :commands auto-complete-mode
1510 :bind (("C-n" . ac-next)
1511 ("C-p" . ac-previous)
1512 :map ac-complete-mode-map
1513 ("\t" . ac-expand)
1514 ("\r" . ac-complete)
1515 ("M-n" . ac-next)
1516 ("M-p" . ac-previous)
1517 :map ac-mode-map
1518 ("M-TAB" . auto-complete)
1519 :map ac-completing-map
1520 ("C-s" . ac-isearch))
1521 :init
1522 (progn
1523 (auto-complete-mode t))
1524 :config
1525 (progn
1526 (ac-config-default)
1527 ;; hook AC into completion-at-point
1528 (defun sanityinc/auto-complete-at-point ()
1529 (when (and (not (minibufferp))
1530 (fboundp 'auto-complete-mode)
1531 auto-complete-mode)
1532 (auto-complete)))
1533 (defun set-auto-complete-as-completion-at-point-function ()
1534 (add-to-list 'completion-at-point-functions 'sanityinc/auto-complete-at-point))
1535 ;; Exclude very large buffers from dabbrev
1536 (defun sanityinc/dabbrev-friend-buffer (other-buffer)
1537 (< (buffer-size other-buffer) (* 1 1024 1024)))
1538
1539 (use-package pos-tip
1540 :ensure t)
1541
1542 (validate-setq ac-comphist-file (expand-file-name "ac-comphist.dat" jj-cache-dir))
1543 (validate-setq ac-use-comphist t)
1544 (validate-setq ac-expand-on-auto-complete nil)
1545 (validate-setq ac-dwim t)
1546 (validate-setq ac-auto-start 3)
1547 (validate-setq ac-delay 0.3)
1548 (validate-setq ac-menu-height 15)
1549 (validate-setq ac-quick-help-delay 0.5)
1550 (validate-setq ac-use-fuzzy t)
1551
1552 (ac-flyspell-workaround)
1553
1554 ;; use 't when auto-complete is disabled
1555 (validate-setq tab-always-indent 'complete)
1556 (add-to-list 'completion-styles 'initials t)
1557
1558 ;; Use space and punctuation to accept the current the most likely completion.
1559 (setq auto-completion-syntax-alist (quote (global accept . word)))
1560 ;; Avoid completion for short trivial words.
1561 (setq auto-completion-min-chars (quote (global . 3)))
1562 (setq completion-use-dynamic t)
1563
1564 (add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
1565
1566 ;; Exclude very large buffers from dabbrev
1567 (setq dabbrev-friend-buffer-function 'sanityinc/dabbrev-friend-buffer)
1568
1569 (use-package ac-dabbrev
1570 :ensure t)
1571
1572 (set-default 'ac-sources
1573 '(ac-source-imenu
1574 ac-source-dictionary
1575 ac-source-words-in-buffer
1576 ac-source-words-in-same-mode-buffers
1577 ; ac-source-words-in-all-buffer
1578 ac-source-dabbrev))
1579
1580 (dolist (mode '(magit-log-edit-mode log-edit-mode org-mode text-mode haml-mode
1581 sass-mode yaml-mode csv-mode espresso-mode haskell-mode
1582 html-mode nxml-mode sh-mode smarty-mode clojure-mode go-mode
1583 lisp-mode textile-mode markdown-mode tuareg-mode python-mode
1584 js3-mode css-mode less-css-mode sql-mode ielm-mode))
1585 (add-to-list 'ac-modes mode))
1586
1587 (hook-into-modes 'auto-complete-mode '(latex-mode-hook LaTeX-mode-hook prog-mode-hook html-mode lisp-mode css-mode org-mode-hook))))
1588 #+END_SRC
1589 ** company-mode
1590 [2017-12-08 Fri 09:42]
1591 Auto-completion comp any mode.
1592 #+BEGIN_SRC emacs-lisp
1593 (use-package company
1594 :ensure t
1595 :defer t
1596 :diminish company-mode
1597 :init (global-company-mode)
1598 :config
1599 (progn
1600 ;; Use Company for completion
1601 (bind-key [remap completion-at-point] #'company-complete company-mode-map)
1602 (global-company-mode)
1603
1604 (setq company-dabbrev-downcase nil)
1605 (setq company-echo-delay 0)
1606 (setq company-idle-delay 0.2)
1607 (setq company-minimum-prefix-length 2)
1608 (setq company-require-match nil)
1609 (setq company-selection-wrap-around t)
1610 (setq company-show-numbers t)
1611 (setq company-tooltip-align-annotations t)
1612 (setq company-tooltip-flip-when-above t)
1613 (setq company-tooltip-limit 10)
1614 (setq company-transformers '(company-sort-by-occurrence)) ; weight by frequency
1615 ))
1616
1617 (use-package company-quickhelp ; Documentation popups for Company
1618 :ensure t
1619 :defer t
1620 :init (add-hook 'global-company-mode-hook #'company-quickhelp-mode))
1621
1622 (use-package company-statistics
1623 :ensure t
1624 :config
1625 (add-hook 'after-init-hook 'company-statistics-mode))
1626
1627 (use-package company-go
1628 :ensure t
1629 :defer t
1630 :init
1631 (with-eval-after-load 'company
1632 (add-to-list 'company-backends 'company-go)))
1633
1634 (use-package company-auctex
1635 :ensure t)
1636
1637 (use-package company-jedi
1638 :ensure t)
1639 #+END_SRC
1640
1641 ** auto-revert
1642 When files change outside emacs for whatever reason I want emacs to deal
1643 with it. Not to have to revert buffers myself
1644 #+BEGIN_SRC emacs-lisp
1645 (use-package autorevert
1646 :commands auto-revert-mode
1647 :diminish auto-revert-mode
1648 :init
1649 (progn
1650 (validate-setq global-auto-revert-mode t)
1651 (setq global-auto-revert-non-file-buffers t)
1652 (global-auto-revert-mode)))
1653 #+END_SRC
1654
1655 ** CANCELLED backups :CANCELLED:
1656 CLOSED: [2017-08-26 Sa 14:41]
1657 Emacs should keep backup copies of files I edit, but I do not want them
1658 to clutter up the filesystem everywhere. So I put them into one defined
1659 place, backup-directory, which even contains my username (for systems
1660 where =temporary-file-directory= is not inside my home).
1661 #+BEGIN_SRC emacs-lisp :tangle no
1662 (use-package backups-mode
1663 :load-path "elisp/backups-mode"
1664 :disabled t
1665 :bind (("\C-cv" . save-version)
1666 ("\C-cb" . list-backups)
1667 ("\C-ck" . kill-buffer-prompt)
1668 ("\C-cw" . backup-walker-start))
1669 :init
1670 (progn
1671 (validate-setq backup-directory jj-backup-directory)
1672 ; (validate-setq tramp-backup-directory (concat jj-backup-directory "/tramp"))
1673 ; (if (not (file-exists-p tramp-backup-directory))
1674 ; (make-directory tramp-backup-directory))
1675 ; (validate-setq tramp-backup-directory-alist `((".*" . ,tramp-backup-directory)))
1676 (validate-setq backup-directory-alist `(("." . ,jj-backup-directory)))
1677 (validate-setq auto-save-list-file-prefix (concat jj-backup-directory ".auto-saves-"))
1678 (validate-setq auto-save-file-name-transforms `((".*" ,jj-backup-directory t)))
1679
1680 (validate-setq version-control t) ;; Use version numbers for backups
1681 (validate-setq kept-new-versions 10) ;; Number of newest versions to keep
1682 (validate-setq kept-old-versions 2) ;; Number of oldest versions to keep
1683 (validate-setq delete-old-versions t) ;; Ask to delete excess backup versions?
1684 (validate-setq backup-by-copying t)
1685 (validate-setq backup-by-copying-when-linked t) ;; Copy linked files, don't rename.
1686 (validate-setq make-backup-files t)
1687
1688 (defadvice kill-buffer (around kill-buffer)
1689 "Always save before killing a file buffer"
1690 (when (and (buffer-modified-p)
1691 (buffer-file-name)
1692 (file-exists-p (buffer-file-name)))
1693 (save-buffer))
1694 ad-do-it)
1695 (ad-activate 'kill-buffer)
1696
1697 (defadvice save-buffers-kill-emacs (around save-buffers-kill-emacs)
1698 "Always save before killing emacs"
1699 (save-some-buffers t)
1700 ad-do-it)
1701 (ad-activate 'save-buffers-kill-emacs)
1702
1703 (defun kill-buffer-prompt ()
1704 "Allows one to kill a buffer without saving it.
1705 This is necessary since once you start backups-mode all file based buffers
1706 are saved automatically when they are killed"
1707 (interactive)
1708 (if (and (buffer-modified-p) (buffer-file-name) (file-exists-p (buffer-file-name)) (y-or-n-p "Save buffer?"))
1709 (save-buffer)
1710 (set-buffer-modified-p nil))
1711 (kill-buffer))
1712
1713 (validate-setq backup-enable-predicate
1714 (lambda (name)
1715 (and (normal-backup-enable-predicate name)
1716 (not
1717 (let ((method (file-remote-p name 'method)))
1718 (when (stringp method)
1719 (member method '("su" "sudo"))))))))))
1720
1721 #+END_SRC
1722 ** CANCELLED browse-kill-ring :CANCELLED:
1723 CLOSED: [2017-08-26 Sat 14:46]
1724 :LOGBOOK:
1725 - State "CANCELLED" from [2017-08-26 Sat 14:46] \\
1726 deactivated
1727 :END:
1728 [2014-12-11 Thu 11:31]
1729 Currently replaced with counsel, see Ivy
1730 #+BEGIN_SRC emacs-lisp :tangle no
1731 (use-package browse-kill-ring
1732 :ensure t
1733 :commands (browse-kill-ring browse-kill-ring-mode)
1734 :bind ("M-y" . browse-kill-ring)
1735 )
1736 #+END_SRC
1737 ** CANCELLED calendar :CANCELLED:
1738 CLOSED: [2017-08-26 Sat 14:47]
1739 :LOGBOOK:
1740 - State "CANCELLED" from [2017-08-26 Sat 14:47]
1741 :END:
1742 [2014-06-10 Tue 22:20]
1743 #+BEGIN_SRC emacs-lisp
1744 (use-package calendar
1745 :commands (cal/insert)
1746 :bind ("C-c c" . cal/insert)
1747 :config
1748 (progn
1749 ; Weeks start on Monday, not sunday.
1750 (validate-setq calendar-week-start-day 1)
1751 (validate-setq calendar-date-style 'european)
1752
1753 ; Display ISO week numbers in Calendar Mode
1754 (copy-face font-lock-constant-face 'calendar-iso-week-face)
1755 (set-face-attribute 'calendar-iso-week-face nil :height 0.7)
1756 (validate-setq calendar-intermonth-text
1757 '(propertize
1758 (format "%2d"
1759 (car
1760 (calendar-iso-from-absolute
1761 (calendar-absolute-from-gregorian (list month day year)))))
1762 'font-lock-face 'calendar-iso-week-face))
1763 (copy-face 'default 'calendar-iso-week-header-face)
1764 (set-face-attribute 'calendar-iso-week-header-face nil :height 0.7)
1765 (validate-setq calendar-intermonth-header
1766 (propertize "Wk" ; or e.g. "KW" in Germany
1767 'font-lock-face 'calendar-iso-week-header-face))))
1768
1769 #+END_SRC
1770 ** corral
1771 [2015-10-15 Thu 11:34]
1772 Corral is a lightweight package that lets you quickly wrap parentheses
1773 and other delimiters around text, intuitively surrounding what you
1774 want it to using just two commands.
1775 #+BEGIN_SRC emacs-lisp
1776 (use-package corral
1777 :ensure corral
1778 :bind (("C-c c" . hydra-corral/body))
1779 :config
1780 (progn
1781 ; Interpret # and * as part of the word
1782 (validate-setq corral-syntax-entries '((?# "_")
1783 (?* "_")
1784 (?$ ".")
1785 (?/ ".")))
1786 (defhydra hydra-corral (:columns 4)
1787 "Corral"
1788 ("(" corral-parentheses-backward "Back")
1789 (")" corral-parentheses-forward "Forward")
1790 ("[" corral-brackets-backward "Back")
1791 ("]" corral-brackets-forward "Forward")
1792 ("{" corral-braces-backward "Back")
1793 ("}" corral-braces-forward "Forward")
1794 ("\"" corral-double-quotes-backward "Back")
1795 ("2" corral-double-quotes-forward "Forward")
1796 ("'" corral-single-quotes-backward "Back")
1797 ("#" corral-single-quotes-forward "Forward")
1798 ("." hydra-repeat "Repeat"))
1799 ))
1800 #+END_SRC
1801 ** crontab-mode
1802 [2013-05-21 Tue 23:18]
1803 #+BEGIN_SRC emacs-lisp
1804 (use-package crontab-mode
1805 :ensure crontab-mode
1806 :commands crontab-mode
1807 :mode ("\\.?cron\\(tab\\)?\\'" . crontab-mode))
1808 #+END_SRC
1809
1810 ** CANCELLED css :CANCELLED:
1811 CLOSED: [2017-08-26 Sat 14:50]
1812 :LOGBOOK:
1813 - State "CANCELLED" from [2017-08-26 Sat 14:50] \\
1814 web mode it is
1815 :END:
1816 web-mode takes over, see [[*web-mode][web-mode]]
1817 #+BEGIN_SRC emacs-lisp :tangle no
1818 (use-package css-mode
1819 :mode ("\\.css\\'" . css-mode)
1820 :defer t
1821 :config
1822 (progn
1823 ;;; CSS flymake
1824 (use-package flymake-css
1825 :ensure flymake-css
1826 :config
1827 (progn
1828 (defun maybe-flymake-css-load ()
1829 "Activate flymake-css as necessary, but not in derived modes."
1830 (when (eq major-mode 'css-mode)
1831 (flymake-css-load)))
1832 (add-hook 'css-mode-hook 'maybe-flymake-css-load)))
1833 ;;; Auto-complete CSS keywords
1834 (eval-after-load 'auto-complete
1835 '(progn
1836 (dolist (hook '(css-mode-hook sass-mode-hook scss-mode-hook))
1837 (add-hook hook 'ac-css-mode-setup))))))
1838 #+END_SRC
1839
1840 ** cua
1841 I know that this lets it look "more like windows", but I don't much care
1842 about its paste/copy/cut keybindings, the really nice part is the great
1843 support for rectangular regions, which I started to use a lot since I
1844 know this mode. The normal keybindings for those are just to useless.
1845 #+BEGIN_SRC emacs-lisp
1846 (cua-mode t)
1847 (validate-setq cua-enable-cua-keys (quote shift))
1848 #+END_SRC
1849
1850 Luckily cua-mode easily supports this, with the following line I just
1851 get the CUA selection and rectangle stuff, not the keybindings. Yes,
1852 even though the above =cua-enable-cua-keys= setting would only enable
1853 them if the selection is done when the region was marked with a shifted
1854 movement keys.
1855 #+BEGIN_SRC emacs-lisp
1856 (cua-selection-mode t)
1857 #+END_SRC
1858
1859 ** Debian related
1860 #+BEGIN_SRC emacs-lisp
1861 (require 'dpkg-dev-el-loaddefs nil 'noerror)
1862 (require 'debian-el-loaddefs nil 'noerror)
1863
1864 (setq debian-changelog-full-name "Joerg Jaspert")
1865 (setq debian-changelog-mailing-address "joerg@debian.org")
1866 #+END_SRC
1867
1868 ** diff-mode
1869 #+BEGIN_SRC emacs-lisp
1870 (use-package diff-mode
1871 :commands diff-mode
1872 :mode (("\\.diff" . diff-mode)))
1873 #+END_SRC
1874
1875 ** dired & co
1876 #+BEGIN_SRC emacs-lisp
1877 (use-package dired
1878 :commands (dired dired-other-window dired-other-frame dired-noselect
1879 dired-mode dired-jump)
1880 :defines (dired-omit-regexp-orig)
1881 :bind (:map dired-mode-map
1882 ("F" . find-name-dired)
1883 ("/" . dired-narrow))
1884 :defer
1885 :init
1886 (progn
1887 (setq diredp-hide-details-initially-flag nil))
1888 :config
1889 (progn
1890 (validate-setq dired-auto-revert-buffer (quote dired-directory-changed-p))
1891 (validate-setq dired-dwim-target t)
1892 (validate-setq dired-listing-switches "-alh")
1893 (validate-setq dired-listing-switches "-alXh --group-directories-first")
1894 (validate-setq dired-recursive-copies (quote top))
1895 (validate-setq dired-recursive-deletes (quote top))
1896
1897 (use-package dired+
1898 :ensure dired+)
1899
1900 (use-package dired-x
1901 :init
1902 (progn
1903 (validate-setq dired-guess-shell-alist-user
1904 '(("\\.pdf\\'" "mupdf")
1905 ("\\.\\(?:djvu\\|eps\\)\\'" "evince")
1906 ("\\.\\(?:jpg\\|jpeg\\|png\\|gif\\|xpm\\)\\'" "eog")
1907 ("\\.\\(?:xcf\\)\\'" "gimp")
1908 ("\\.csv\\'" "libreoffice")
1909 ("\\.tex\\'" "pdflatex" "latex")
1910 ("\\.\\(?:mp4\\|mkv\\|avi\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "vlc")
1911 ("\\.html?\\'" "conkeror")))))
1912
1913 (use-package dired-single
1914 :ensure dired-single
1915 :bind (:map dired-mode-map
1916 ("<return>" . dired-single-buffer)
1917 ("<mouse-1>" . dired-single-buffer))
1918 :init
1919 (progn
1920 (bind-key "^"
1921 (function
1922 (lambda nil (interactive) (dired-single-buffer ".."))) dired-mode-map )))
1923
1924 (use-package wdired
1925 :ensure wdired
1926 :bind (:map dired-mode-map
1927 ("r" . wdired-change-to-wdired-mode))
1928 :config
1929 (progn
1930 (setq wdired-allow-to-change-permissions t)))
1931
1932 (use-package dired-narrow
1933 :ensure t
1934 :diminish dired-narrow-mode
1935 :bind (:map dired-mode-map
1936 ("/" . dired-narrow)))
1937
1938 (use-package gnus-dired
1939 :commands (gnus-dired-attach gnus-dired-mode)
1940 :bind (:map dired-mode-map
1941 ("a" . gnus-dired-attach)))
1942
1943 (use-package runner
1944 :ensure runner)
1945
1946 (defvar mark-files-cache (make-hash-table :test #'equal))
1947
1948 (defun mark-similar-versions (name)
1949 (let ((pat name))
1950 (if (string-match "^\\(.+?\\)-[0-9._-]+$" pat)
1951 (validate-setq pat (match-string 1 pat)))
1952 (or (gethash pat mark-files-cache)
1953 (ignore (puthash pat t mark-files-cache)))))
1954
1955 (defun dired-mark-similar-version ()
1956 (interactive)
1957 (validate-setq mark-files-cache (make-hash-table :test #'equal))
1958 (dired-mark-sexp '(mark-similar-versions name)))
1959
1960 (defun dired-package-initialize ()
1961 (unless (featurep 'runner)
1962 (bind-key "M-!" 'async-shell-command dired-mode-map)
1963 (unbind-key "M-s f" dired-mode-map)
1964
1965 (defadvice dired-omit-startup (after diminish-dired-omit activate)
1966 "Make sure to remove \"Omit\" from the modeline."
1967 (diminish 'dired-omit-mode) dired-mode-map)
1968
1969 ;; Omit files that Git would ignore
1970 (defun dired-omit-regexp ()
1971 (let ((file (expand-file-name ".git"))
1972 parent-dir)
1973 (while (and (not (file-exists-p file))
1974 (progn
1975 (validate-setq parent-dir
1976 (file-name-directory
1977 (directory-file-name
1978 (file-name-directory file))))
1979 ;; Give up if we are already at the root dir.
1980 (not (string= (file-name-directory file)
1981 parent-dir))))
1982 ;; Move up to the parent dir and try again.
1983 (validate-setq file (expand-file-name ".git" parent-dir)))
1984 ;; If we found a change log in a parent, use that.
1985 (if (file-exists-p file)
1986 (let ((regexp (funcall dired-omit-regexp-orig))
1987 (omitted-files
1988 (shell-command-to-string "git clean -d -x -n")))
1989 (if (= 0 (length omitted-files))
1990 regexp
1991 (concat
1992 regexp
1993 (if (> (length regexp) 0)
1994 "\\|" "")
1995 "\\("
1996 (mapconcat
1997 #'(lambda (str)
1998 (concat
1999 "^"
2000 (regexp-quote
2001 (substring str 13
2002 (if (= ?/ (aref str (1- (length str))))
2003 (1- (length str))
2004 nil)))
2005 "$"))
2006 (split-string omitted-files "\n" t)
2007 "\\|")
2008 "\\)")))
2009 (funcall dired-omit-regexp-orig))))))
2010
2011 (add-hook 'dired-mode-hook 'dired-package-initialize)
2012
2013 (defun dired-double-jump (first-dir second-dir)
2014 (interactive
2015 (list (read-directory-name "First directory: "
2016 (expand-file-name "~")
2017 nil nil "/Downloads/")
2018 (read-directory-name "Second directory: "
2019 (expand-file-name "~")
2020 nil nil "/")))
2021 (dired first-dir)
2022 (dired-other-window second-dir))
2023 (bind-key "C-c J" 'dired-double-jump)
2024
2025 (defun dired-back-to-top ()
2026 (interactive)
2027 (goto-char (point-min))
2028 (dired-next-line 4))
2029
2030 (define-key dired-mode-map
2031 (vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
2032
2033 (defun dired-jump-to-bottom ()
2034 (interactive)
2035 (goto-char (point-max))
2036 (dired-next-line -1))
2037
2038 (define-key dired-mode-map
2039 (vector 'remap 'end-of-buffer) 'dired-jump-to-bottom)))
2040
2041 #+END_SRC
2042 ** discover-my-major
2043 [2014-06-01 Sun 23:32]
2044 Discover key bindings and their meaning for the current Emacs major mode.
2045 #+BEGIN_SRC emacs-lisp
2046 (use-package discover-my-major
2047 :ensure discover-my-major
2048 :commands discover-my-major
2049 :bind ("C-h C-m" . discover-my-major))
2050 #+END_SRC
2051 ** easypg
2052 EasyPG is a GnuPG interface for Emacs.
2053 Bookmark: [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
2054 #+BEGIN_SRC emacs-lisp
2055 (use-package epa-file
2056 :config
2057 (progn
2058 (epa-file-enable)
2059 ;; I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
2060 (defadvice epg--start (around advice-epg-disable-agent disable)
2061 "Don't allow epg--start to use gpg-agent in plain text
2062 terminals . "
2063 (if (display-graphic-p)
2064 ad-do-it
2065 (let ((agent (getenv "GPG_AGENT_INFO")))
2066 (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
2067 ad-do-it
2068 (setenv "GPG_AGENT_INFO" agent))))
2069 (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
2070 (ad-activate 'epg--start)
2071 ))
2072 #+END_SRC
2073 ** ediff
2074 [2013-04-21 So 20:36]
2075 ediff - don't start another frame
2076 #+BEGIN_SRC emacs-lisp
2077 (use-package ediff
2078 :init
2079 (progn
2080 (defvar ctl-period-equals-map)
2081 (define-prefix-command 'ctl-period-equals-map)
2082 (bind-key "C-. =" 'ctl-period-equals-map)
2083 (bind-key "C-. = c" 'compare-windows)) ; not an ediff command, but it fits
2084
2085 :bind (("C-. = b" . ediff-buffers)
2086 ("C-. = B" . ediff-buffers3)
2087 ("C-. = =" . ediff-files)
2088 ("C-. = f" . ediff-files)
2089 ("C-. = F" . ediff-files3)
2090 ("C-. = r" . ediff-revision)
2091 ("C-. = p" . ediff-patch-file)
2092 ("C-. = P" . ediff-patch-buffer)
2093 ("C-. = l" . ediff-regions-linewise)
2094 ("C-. = w" . ediff-regions-wordwise))
2095 :config (progn
2096 (validate-setq ediff-window-setup-function 'ediff-setup-windows-plain)
2097 (validate-setq ediff-split-window-function 'split-window-horizontally)
2098 )
2099 )
2100 #+END_SRC
2101 ** CANCELLED edit-server :CANCELLED:
2102 CLOSED: [2017-08-26 Sat 14:55]
2103 :LOGBOOK:
2104 - State "CANCELLED" from [2017-08-26 Sat 14:55] \\
2105 no more workinng
2106 :END:
2107 [2015-12-16 Wed 22:13]
2108 Allows chromium to "send" files (textbox inputs) to emacs to edit.
2109 #+BEGIN_SRC emacs-lisp :tangle no
2110 (use-package edit-server
2111 :ensure t
2112 :if window-system
2113 :config
2114 (progn
2115 (validate-setq edit-server-new-frame t)
2116 (edit-server-start)))
2117 #+END_SRC
2118 ** CANCELLED emms :CANCELLED:
2119 CLOSED: [2017-08-26 Sat 14:55]
2120 :LOGBOOK:
2121 - State "CANCELLED" from [2017-08-26 Sat 14:55]
2122 :END:
2123
2124 EMMS is the Emacs Multimedia System.
2125 #+BEGIN_SRC emacs-lisp :tangle no
2126 (require 'emms-source-file)
2127 (require 'emms-source-playlist)
2128 (require 'emms-info)
2129 (require 'emms-cache)
2130 (require 'emms-playlist-mode)
2131 (require 'emms-playing-time)
2132 (require 'emms-player-mpd)
2133 (require 'emms-playlist-sort)
2134 (require 'emms-mark)
2135 (require 'emms-browser)
2136 (require 'emms-lyrics)
2137 (require 'emms-last-played)
2138 (require 'emms-score)
2139 (require 'emms-tag-editor)
2140 (require 'emms-history)
2141 (require 'emms-i18n)
2142
2143 (validate-setq emms-playlist-default-major-mode 'emms-playlist-mode)
2144 (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track)
2145 (emms-playing-time 1)
2146 (emms-lyrics 1)
2147 (add-hook 'emms-player-started-hook 'emms-last-played-update-current)
2148 ;(add-hook 'emms-player-started-hook 'emms-player-mpd-sync-from-emms)
2149 (emms-score 1)
2150 (when (fboundp 'emms-cache) ; work around compiler warning
2151 (emms-cache 1))
2152 (validate-setq emms-score-default-score 3)
2153
2154 (defun emms-mpd-init ()
2155 "Connect Emms to mpd."
2156 (interactive)
2157 (emms-player-mpd-connect))
2158
2159 ;; players
2160 (require 'emms-player-mpd)
2161 (validate-setq emms-player-mpd-server-name "localhost")
2162 (validate-setq emms-player-mpd-server-port "6600")
2163 (add-to-list 'emms-info-functions 'emms-info-mpd)
2164 (add-to-list 'emms-player-list 'emms-player-mpd)
2165 (validate-setq emms-volume-change-function 'emms-volume-mpd-change)
2166 (validate-setq emms-player-mpd-sync-playlist t)
2167
2168 (validate-setq emms-source-file-default-directory "/var/lib/mpd/music")
2169 (validate-setq emms-player-mpd-music-directory "/var/lib/mpd/music")
2170 (validate-setq emms-info-auto-update t)
2171 (validate-setq emms-lyrics-scroll-p t)
2172 (validate-setq emms-lyrics-display-on-minibuffer t)
2173 (validate-setq emms-lyrics-display-on-modeline nil)
2174 (validate-setq emms-lyrics-dir "~/.emacs.d/var/lyrics")
2175
2176 (validate-setq emms-last-played-format-alist
2177 '(((emms-last-played-seconds-today) . "%H:%M")
2178 (604800 . "%a %H:%M") ; this week
2179 ((emms-last-played-seconds-month) . "%d.%m.%Y")
2180 ((emms-last-played-seconds-year) . "%d.%m.%Y")
2181 (t . "Never played")))
2182
2183 ;; Playlist format
2184 (defun my-describe (track)
2185 (let* ((empty "...")
2186 (name (emms-track-name track))
2187 (type (emms-track-type track))
2188 (short-name (file-name-nondirectory name))
2189 (play-count (or (emms-track-get track 'play-count) 0))
2190 (last-played (or (emms-track-get track 'last-played) '(0 0 0)))
2191 (artist (or (emms-track-get track 'info-artist) empty))
2192 (year (emms-track-get track 'info-year))
2193 (playing-time (or (emms-track-get track 'info-playing-time) 0))
2194 (min (/ playing-time 60))
2195 (sec (% playing-time 60))
2196 (album (or (emms-track-get track 'info-album) empty))
2197 (tracknumber (emms-track-get track 'info-tracknumber))
2198 (short-name (file-name-sans-extension
2199 (file-name-nondirectory name)))
2200 (title (or (emms-track-get track 'info-title) short-name))
2201 (rating (emms-score-get-score name))
2202 (rate-char ?☭)
2203 )
2204 (format "%12s %20s (%.4s) [%-20s] - %2s. %-30s | %2d %s"
2205 (emms-last-played-format-date last-played)
2206 artist
2207 year
2208 album
2209 (if (and tracknumber ; tracknumber
2210 (not (zerop (string-to-number tracknumber))))
2211 (format "%02d" (string-to-number tracknumber))
2212 "")
2213 title
2214 play-count
2215 (make-string rating rate-char)))
2216 )
2217
2218 (validate-setq emms-track-description-function 'my-describe)
2219
2220 ;; (global-set-key (kbd "C-<f9> t") 'emms-play-directory-tree)
2221 ;; (global-set-key (kbd "H-<f9> e") 'emms-play-file)
2222 (global-set-key (kbd "H-<f9> <f9>") 'emms-mpd-init)
2223 (global-set-key (kbd "H-<f9> d") 'emms-play-dired)
2224 (global-set-key (kbd "H-<f9> x") 'emms-start)
2225 (global-set-key (kbd "H-<f9> v") 'emms-stop)
2226 (global-set-key (kbd "H-<f9> n") 'emms-next)
2227 (global-set-key (kbd "H-<f9> p") 'emms-previous)
2228 (global-set-key (kbd "H-<f9> o") 'emms-show)
2229 (global-set-key (kbd "H-<f9> h") 'emms-shuffle)
2230 (global-set-key (kbd "H-<f9> SPC") 'emms-pause)
2231 (global-set-key (kbd "H-<f9> a") 'emms-add-directory-tree)
2232 (global-set-key (kbd "H-<f9> b") 'emms-smart-browse)
2233 (global-set-key (kbd "H-<f9> l") 'emms-playlist-mode-go)
2234
2235 (global-set-key (kbd "H-<f9> r") 'emms-toggle-repeat-track)
2236 (global-set-key (kbd "H-<f9> R") 'emms-toggle-repeat-playlist)
2237 (global-set-key (kbd "H-<f9> m") 'emms-lyrics-toggle-display-on-minibuffer)
2238 (global-set-key (kbd "H-<f9> M") 'emms-lyrics-toggle-display-on-modeline)
2239
2240 (global-set-key (kbd "H-<f9> <left>") (lambda () (interactive) (emms-seek -10)))
2241 (global-set-key (kbd "H-<f9> <right>") (lambda () (interactive) (emms-seek +10)))
2242 (global-set-key (kbd "H-<f9> <down>") (lambda () (interactive) (emms-seek -60)))
2243 (global-set-key (kbd "H-<f9> <up>") (lambda () (interactive) (emms-seek +60)))
2244
2245 (global-set-key (kbd "H-<f9> s u") 'emms-score-up-playing)
2246 (global-set-key (kbd "H-<f9> s d") 'emms-score-down-playing)
2247 (global-set-key (kbd "H-<f9> s o") 'emms-score-show-playing)
2248 (global-set-key (kbd "H-<f9> s s") 'emms-score-set-playing)
2249
2250 (define-key emms-playlist-mode-map "u" 'emms-score-up-playing)
2251 (define-key emms-playlist-mode-map "d" 'emms-score-down-playing)
2252 (define-key emms-playlist-mode-map "o" 'emms-score-show-playing)
2253 (define-key emms-playlist-mode-map "s" 'emms-score-set-playing)
2254 (define-key emms-playlist-mode-map "r" 'emms-mpd-init)
2255 (define-key emms-playlist-mode-map "N" 'emms-playlist-new)
2256
2257 (define-key emms-playlist-mode-map "x" 'emms-start)
2258 (define-key emms-playlist-mode-map "v" 'emms-stop)
2259 (define-key emms-playlist-mode-map "n" 'emms-next)
2260 (define-key emms-playlist-mode-map "p" 'emms-previous)
2261
2262 (validate-setq emms-playlist-buffer-name "*EMMS Playlist*"
2263 emms-playlist-mode-open-playlists t)
2264
2265 ;; Faces
2266 (if (window-system)
2267 ((lambda ()
2268 (set-face-attribute
2269 'emms-browser-artist-face nil
2270 :family "Arno Pro")
2271 )
2272 ))
2273
2274 (validate-setq emms-player-mpd-supported-regexp
2275 (or (emms-player-mpd-get-supported-regexp)
2276 (concat "\\`http://\\|"
2277 (emms-player-simple-regexp
2278 "m3u" "ogg" "flac" "mp3" "wav" "mod" "au" "aiff"))))
2279 (emms-player-set emms-player-mpd 'regex emms-player-mpd-supported-regexp)
2280
2281 #+END_SRC
2282 ** CANCELLED Emacs shell :CANCELLED:
2283 CLOSED: [2017-08-26 Sat 14:56]
2284 :LOGBOOK:
2285 - State "CANCELLED" from [2017-08-26 Sat 14:56]
2286 :END:
2287 Basic settings for emacs integrated shell
2288 #+BEGIN_SRC emacs-lisp :tangle no
2289 (use-package eshell
2290 :defer t
2291 :commands eshell
2292 :init
2293 (progn
2294 (defun eshell-initialize ()
2295 (defun eshell-spawn-external-command (beg end)
2296 "Parse and expand any history references in current input."
2297 (save-excursion
2298 (goto-char end)
2299 (when (looking-back "&!" beg)
2300 (delete-region (match-beginning 0) (match-end 0))
2301 (goto-char beg)
2302 (insert "spawn "))))
2303 (add-hook 'eshell-expand-input-functions 'eshell-spawn-external-command)
2304 (eval-after-load "em-unix"
2305 '(progn
2306 (unintern 'eshell/su)
2307 (unintern 'eshell/sudo))))
2308 (add-hook 'eshell-first-time-mode-hook 'eshell-initialize)
2309 )
2310 :config
2311 (progn
2312 (defalias 'emacs 'find-file)
2313 (defalias 'ec 'find-file)
2314 (defalias 'e 'find-file)
2315
2316 (use-package f
2317 :ensure f)
2318 (use-package 'em-cmpl)
2319 (use-package 'em-prompt)
2320 (use-package 'em-term)
2321
2322 (validate-setq eshell-cmpl-cycle-completions nil
2323 eshell-save-history-on-exit t
2324 eshell-buffer-maximum-lines 20000
2325 eshell-history-size 350
2326 eshell-buffer-shorthand t
2327 eshell-highlight-prompt t
2328 eshell-plain-echo-behavior t
2329 eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
2330
2331 (setenv "PAGER" "cat")
2332 (validate-setq eshell-visual-commands
2333 '("less" "tmux" "htop" "top" "bash" "zsh" "tail"))
2334 (validate-setq eshell-visual-subcommands
2335 '(("git" "log" "l" "diff" "show")))
2336
2337 (add-to-list 'eshell-command-completions-alist
2338 '("gunzip" "gz\\'"))
2339 (add-to-list 'eshell-command-completions-alist
2340 '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
2341
2342 (when (not (functionp 'eshell/rgrep))
2343 (defun eshell/rgrep (&rest args)
2344 "Use Emacs grep facility instead of calling external grep."
2345 (eshell-grep "rgrep" args t)))
2346
2347 ;(set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
2348 (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
2349 '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
2350 (add-hook 'eshell-preoutput-filter-functions
2351 'ansi-color-filter-apply)
2352 ;; Prompt with a bit of help from http://www.emacswiki.org/emacs/EshellPrompt
2353
2354 (defmacro with-face (str &rest properties)
2355 `(propertize ,str 'face (list ,@properties)))
2356
2357 (defun eshell/abbr-pwd ()
2358 (let ((home (getenv "HOME"))
2359 (path (eshell/pwd)))
2360 (cond
2361 ((string-equal home path) "~")
2362 ((f-ancestor-of? home path) (concat "~/" (f-relative path home)))
2363 (path))))
2364
2365 (defun eshell/my-prompt ()
2366 (let ((header-bg "#161616"))
2367 (concat
2368 (with-face user-login-name :foreground "cyan")
2369 (with-face (concat "@" hostname) :foreground "white")
2370 " "
2371 (with-face (eshell/abbr-pwd) :foreground "#009900")
2372 (if (= (user-uid) 0)
2373 (with-face "#" :foreground "red")
2374 (with-face "$" :foreground "#69b7f0"))
2375 " ")))
2376
2377 (use-package eshell-prompt-extras
2378 :ensure t
2379 :init
2380 (progn
2381 (validate-setq eshell-highlight-prompt nil
2382 ;; epe-git-dirty-char "Ϟ"
2383 epe-git-dirty-char "*"
2384 eshell-prompt-function 'epe-theme-dakrone)))
2385
2386 (defun eshell/magit ()
2387 "Function to open magit-status for the current directory"
2388 (interactive)
2389 (magit-status default-directory)
2390 nil)
2391
2392 (validate-setq eshell-prompt-function 'eshell/my-prompt)
2393 (validate-setq eshell-highlight-prompt nil)
2394 (validate-setq eshell-prompt-regexp "^[^#$\n]+[#$] ")))
2395
2396 #+END_SRC
2397
2398 ** CANCELLED ethan-wspace :CANCELLED:
2399 CLOSED: [2017-08-26 Sat 14:57]
2400 :LOGBOOK:
2401 - State "CANCELLED" from [2017-08-26 Sat 14:57]
2402 :END:
2403 [2014-06-01 Sun 15:00]
2404 Proper whitespace handling
2405 #+BEGIN_SRC emacs-lisp :tangle no
2406 (use-package ethan-wspace
2407 :ensure ethan-wspace
2408 :diminish (ethan-wspace-mode . "ew")
2409 :init
2410 (global-ethan-wspace-mode 1))
2411 #+END_SRC
2412 ** Eww - Emacs browser
2413 [2016-10-03 Mo 21:30]
2414 Eww - Emacs browser (needs emacs 24.4 or higher)
2415 #+BEGIN_SRC emacs-lisp
2416 (use-package eww
2417 :bind (("M-s M-w" . eww-search-words)
2418 :map eww-mode-map
2419 (":" . eww) ; Go to URL
2420 ("h" . eww-list-histories) ; View history
2421 :map eww-text-map ; For single line text fields
2422 ("<backtab>" . shr-previous-link) ; S-TAB Jump to previous link on the page
2423 ("<C-return>" . eww-submit)
2424 :map eww-textarea-map ; For multi-line text boxes
2425 ("<backtab>" . shr-previous-link)
2426 ("<C-return>" . eww-submit)
2427 :map eww-checkbox-map
2428 ("<down-mouse-1>" . eww-toggle-checkbox)
2429 :map shr-map
2430 ("w" . modi/eww-copy-url-dwim)
2431 :map eww-link-keymap
2432 ("w" . modi/eww-copy-url-dwim))
2433
2434 :config
2435 (progn
2436 ;; Make the binding for `revert-buffer' do `eww-reload' in eww-mode
2437 (define-key eww-mode-map [remap revert-buffer] #'eww-reload)
2438
2439 ;; (validate-setq eww-search-prefix "https://duckduckgo.com/html/?q=")
2440 (validate-setq eww-search-prefix "https://www.google.com/search?q=")
2441 (validate-setq eww-download-directory "~/Downloads")
2442 ;; (validate-setq eww-form-checkbox-symbol "[ ]")
2443 (validate-setq eww-form-checkbox-symbol "☐") ; Unicode hex 2610
2444 ;; (validate-setq eww-form-checkbox-selected-symbol "[X]")
2445 (validate-setq eww-form-checkbox-selected-symbol "☑") ; Unicode hex 2611
2446 ;; Improve the contract of pages like Google results
2447 ;; http://emacs.stackexchange.com/q/2955/115
2448 (setq shr-color-visible-luminance-min 80) ; default = 40
2449
2450 ;; Auto-rename new eww buffers
2451 ;; http://ergoemacs.org/emacs/emacs_eww_web_browser.html
2452 (defun xah-rename-eww-hook ()
2453 "Rename eww browser's buffer so sites open in new page."
2454 (rename-buffer "eww" t))
2455 (add-hook 'eww-mode-hook #'xah-rename-eww-hook)
2456
2457 ;; If the current buffer is an eww buffer, "M-x eww" will always reuse the
2458 ;; current buffer to load the new page. Below advice will make "C-u M-x eww"
2459 ;; force a new eww buffer even when the current buffer is an eww buffer.
2460 ;; The above `xah-rename-eww-hook' fix is still needed in order to create
2461 ;; uniquely named eww buffers.
2462 ;; http://emacs.stackexchange.com/a/24477/115
2463 (defun modi/force-new-eww-buffer (orig-fun &rest args)
2464 "When prefix argument is used, a new eww buffer will be created.
2465 This is regardless of whether the current buffer is an eww buffer. "
2466 (if current-prefix-arg
2467 (with-temp-buffer
2468 (apply orig-fun args))
2469 (apply orig-fun args)))
2470 (advice-add 'eww :around #'modi/force-new-eww-buffer)
2471
2472 ;; Override the default definition of `eww-search-words'
2473 (defun eww-search-words (&optional beg end)
2474 "Search the web for the text between the point and marker.
2475 See the `eww-search-prefix' variable for the search engine used."
2476 (interactive "r")
2477 (if (use-region-p)
2478 (eww (buffer-substring beg end))
2479 (eww (modi/get-symbol-at-point))))
2480
2481 ;; eww-lnum
2482 ;; https://github.com/m00natic/eww-lnum
2483 (use-package eww-lnum
2484 :ensure t
2485 :bind (:map eww-mode-map
2486 ("f" . eww-lnum-follow)
2487 ("U" . eww-lnum-universal)))
2488
2489 ;; org-eww
2490 ;; Copy text from html page for pasting in org mode file/buffer
2491 ;; e.g. Copied HTML hyperlinks get converted to [[link][desc]] for org mode.
2492 ;; http://emacs.stackexchange.com/a/8191/115
2493 (use-package org-eww
2494 :bind (:map eww-mode-map
2495 ("o" . org-eww-copy-for-org-mode)))
2496
2497 ;; Auto-refreshing eww buffer whenever the html file it's showing changes
2498 ;; http://emacs.stackexchange.com/a/2566/115
2499 (defvar modi/eww--file-notify-descriptors-list ()
2500 "List to store file-notify descriptor for all files that have an
2501 associated auto-reloading eww buffer.")
2502
2503 (defun modi/advice-eww-open-file-to-auto-reload (orig-fun &rest args)
2504 "When `eww-open-file' is called with \\[universal-argument], open
2505 the file in eww and also add `file-notify' watch for it so that the eww
2506 buffer auto-reloads when the HTML file changes."
2507 (prog1
2508 (apply orig-fun args)
2509 (when current-prefix-arg ; C-u M-x eww-open-file
2510 (require 'filenotify)
2511 (let ((file-name (car args)))
2512 (file-notify-add-watch file-name
2513 '(change attribute-change)
2514 #'modi/file-notify-callback-eww-reload)
2515 ;; Show the HTML file and its rendered form in eww side-by-side
2516 (find-file-other-window file-name))
2517 ;; Redefine the `q' binding in `eww-mode-map'
2518 (bind-key "q" #'modi/eww-quit-and-update-fn-descriptors eww-mode-map))))
2519 (advice-add 'eww-open-file :around #'modi/advice-eww-open-file-to-auto-reload)
2520
2521 (defun modi/file-notify-callback-eww-reload (event)
2522 "On getting triggered, switch to the eww buffer, reload and switch
2523 back to the working buffer. Also save the `file-notify-descriptor' of the
2524 triggering event."
2525 (let* ((working-buffer (buffer-name)))
2526 (switch-to-buffer-other-window "eww")
2527 (eww-reload)
2528 (switch-to-buffer-other-window working-buffer))
2529 ;; `(car event)' will return the event descriptor
2530 (add-to-list 'modi/eww--file-notify-descriptors-list (car event)))
2531
2532 (defun modi/eww-quit-and-update-fn-descriptors ()
2533 "When quitting `eww', first remove any saved file-notify descriptors
2534 specific to eww, while also updating `modi/eww--file-notify-descriptors-list'."
2535 (interactive)
2536 (dotimes (index (safe-length modi/eww--file-notify-descriptors-list))
2537 (file-notify-rm-watch (pop modi/eww--file-notify-descriptors-list)))
2538 (quit-window :kill))))
2539
2540 ;; Default eww key bindings
2541 ;; |-----------+---------------------------------------------------------------------|
2542 ;; | Key | Function |
2543 ;; |-----------+---------------------------------------------------------------------|
2544 ;; | & | Browse the current URL with an external browser. |
2545 ;; | - | Begin a negative numeric argument for the next command. |
2546 ;; | 0 .. 9 | Part of the numeric argument for the next command. |
2547 ;; | C | Display a buffer listing the current URL cookies, if there are any. |
2548 ;; | H | List the eww-histories. |
2549 ;; | F | Toggle font between variable-width and fixed-width. |
2550 ;; | G | Go to a URL |
2551 ;; | R | Readable mode |
2552 ;; | S | List eww buffers |
2553 ;; | d | Download URL under point to `eww-download-directory'. |
2554 ;; | g | Reload the current page. |
2555 ;; | q | Quit WINDOW and bury its buffer. |
2556 ;; | v | `eww-view-source' |
2557 ;; | w | `eww-copy-page-url' |
2558 ;; |-----------+---------------------------------------------------------------------|
2559 ;; | b | Add the current page to the bookmarks. |
2560 ;; | B | Display the bookmark list. |
2561 ;; | M-n | Visit the next bookmark |
2562 ;; | M-p | Visit the previous bookmark |
2563 ;; |-----------+---------------------------------------------------------------------|
2564 ;; | t | Go to the page marked `top'. |
2565 ;; | u | Go to the page marked `up'. |
2566 ;; |-----------+---------------------------------------------------------------------|
2567 ;; | n | Go to the page marked `next'. |
2568 ;; | p | Go to the page marked `previous'. |
2569 ;; |-----------+---------------------------------------------------------------------|
2570 ;; | l | Go to the previously displayed page. |
2571 ;; | r | Go to the next displayed page. |
2572 ;; |-----------+---------------------------------------------------------------------|
2573 ;; | TAB | Move point to next link on the page. |
2574 ;; | S-TAB | Move point to previous link on the page. |
2575 ;; |-----------+---------------------------------------------------------------------|
2576 ;; | SPC | Scroll up |
2577 ;; | DEL/Bkspc | Scroll down |
2578 ;; | S-SPC | Scroll down |
2579 ;; |-----------+---------------------------------------------------------------------|
2580 #+END_SRC
2581
2582 #+results:
2583
2584 ** exec path from shell
2585 [2017-04-01 Sat 23:27]
2586 #+BEGIN_SRC emacs-lisp
2587 (use-package exec-path-from-shell
2588 :ensure t
2589 :config
2590 (progn
2591 (exec-path-from-shell-initialize)
2592 (exec-path-from-shell-copy-env "GOPATH")))
2593 #+END_SRC
2594 ** expand-region
2595 [2014-06-01 Sun 15:16]
2596 #+BEGIN_SRC emacs-lisp
2597 (use-package expand-region
2598 :ensure expand-region
2599 :bind ("C-M-+" . er/expand-region)
2600 :commands er/expand-region)
2601 #+END_SRC
2602 ** NEXT eyebrowse
2603 :LOGBOOK:
2604 - State "NEXT" from "CANCELLED" [2017-09-16 Sat 23:06]
2605 - State "CANCELLED" from [2017-08-26 Sat 15:06]
2606 :END:
2607 [2017-04-29 Sat 13:18]
2608 [[https://github.com/wasamasa/eyebrowse][Eyebrowse]] is a global minor mode for Emacs that allows you to manage
2609 your window configurations in a simple manner, just like tiling window
2610 managers like i3wm with their workspaces do. It displays their current
2611 state in the modeline by default. The behaviour is modeled after
2612 ranger, a file manager written in Python.
2613 #+BEGIN_SRC emacs-lisp
2614 (use-package eyebrowse
2615 :ensure t
2616 :config
2617 (progn
2618 (validate-setq eyebrowse-mode-line-separator " "
2619 eyebrowse-new-workspace t)
2620 (eyebrowse-setup-opinionated-keys)
2621 (eyebrowse-mode t)
2622 ))
2623 #+END_SRC
2624
2625 ** CANCELLED filladapt :CANCELLED:
2626 CLOSED: [2017-12-10 So 14:58]
2627 :LOGBOOK:
2628 - State "CANCELLED" from [2017-12-10 So 14:58] \\
2629 Old style backquotes
2630 :END:
2631 [2013-05-02 Thu 00:04]
2632 Filladapt by KyleJones enhances Emacs’ fill functions by guessing a
2633 fill prefix, such as a comment sequence in program code, and handling
2634 bullet points like “1.” or “*”.
2635 #+BEGIN_SRC emacs-lisp :tangle no
2636 (use-package filladapt
2637 :load-path ("elisp/local")
2638 :diminish filladapt-mode
2639 :init
2640 (setq-default filladapt-mode t))
2641 #+END_SRC
2642 ** flycheck
2643 [2013-04-28 So 22:21]
2644 Flycheck is a on-the-fly syntax checking tool, supposedly better than Flymake.
2645 As the one time I tried Flymake i wasn't happy, thats easy to
2646 understand for me.
2647 #+BEGIN_SRC emacs-lisp
2648 (use-package flycheck
2649 :ensure flycheck
2650 :diminish flycheck-mode
2651 :bind (("M-n" . next-error)
2652 ("M-p" . previous-error))
2653 :config
2654 (progn
2655 (use-package flycheck-color-mode-line
2656 :ensure flycheck-color-mode-line)
2657 (validate-setq flycheck-highlighting-mode 'nil)
2658 (validate-setq flycheck-flake8-maximum-line-length '150)
2659 (add-hook 'flycheck-mode-hook 'flycheck-color-mode-line-mode)
2660 (validate-setq flycheck-sh-shellcheck-executable "/usr/bin/shellcheck -e 2086")
2661 (add-hook 'find-file-hook
2662 (lambda ()
2663 (when (not (equal 'emacs-lisp-mode major-mode))
2664 (flycheck-mode))))
2665 ))
2666 #+END_SRC
2667 ** font-lock
2668 Obviously emacs can do syntax hilighting. For more things than you ever
2669 heard about.
2670 And I want to have it everywhere.
2671 #+BEGIN_SRC emacs-lisp
2672 (use-package font-lock
2673 :init
2674 (progn
2675 (global-font-lock-mode 1)
2676 (validate-setq font-lock-maximum-decoration t)
2677 (validate-setq jit-lock-defer-time nil)
2678 (validate-setq jit-lock-stealth-nice 0.1)
2679 (validate-setq jit-lock-stealth-time 0.2)
2680 (validate-setq jit-lock-stealth-verbose nil)))
2681 #+END_SRC
2682 ** CANCELLED form-feed-mode :CANCELLED:
2683 CLOSED: [2017-08-26 Sat 15:07]
2684 :LOGBOOK:
2685 - State "CANCELLED" from [2017-08-26 Sat 15:07]
2686 :END:
2687 [2015-08-31 Mon 11:27]
2688 Display nice lines instead of page breaks
2689 #+BEGIN_SRC emacs-lisp :tangle no
2690 (use-package form-feed
2691 :ensure t
2692 )
2693 #+END_SRC
2694 ** CANCELLED git commit mode :CANCELLED:
2695 CLOSED: [2017-08-26 Sat 15:07]
2696 :LOGBOOK:
2697 - State "CANCELLED" from [2017-08-26 Sat 15:07]
2698 :END:
2699 #+BEGIN_SRC emacs-lisp :tangle no
2700 (use-package git-commit
2701 :commands git-commit
2702 :mode ("COMMIT_EDITMSG" . git-commit-mode))
2703 #+END_SRC
2704
2705 ** CANCELLED git rebase mode :CANCELLED:
2706 CLOSED: [2017-08-26 Sat 15:07]
2707 :LOGBOOK:
2708 - State "CANCELLED" from [2017-08-26 Sat 15:07]
2709 :END:
2710 #+BEGIN_SRC emacs-lisp :tangle no
2711 (use-package git-rebase
2712 :commands git-rebase
2713 :mode ("git-rebase-todo" . git-rebase-mode))
2714 #+END_SRC
2715 ** git-gutter+
2716 [2014-05-21 Wed 22:56]
2717 #+BEGIN_SRC emacs-lisp
2718 (use-package git-gutter+
2719 :ensure git-gutter+
2720 :diminish git-gutter+-mode
2721 :bind (("C-x n" . git-gutter+-next-hunk)
2722 ("C-x p" . git-gutter+-previous-hunk)
2723 ("C-x v =" . git-gutter+-show-hunk)
2724 ("C-x r" . git-gutter+-revert-hunks)
2725 ("C-x s" . git-gutter+-stage-hunks)
2726 ("C-x c" . git-gutter+-commit)
2727 )
2728 :init
2729 (progn
2730 (setq git-gutter+-disabled-modes '(org-mode))
2731 (global-git-gutter+-mode 1))
2732 :config
2733 (progn
2734 (use-package git-gutter-fringe+
2735 :ensure git-gutter-fringe+
2736 :config
2737 (progn
2738 (validate-setq git-gutter-fr+-side 'right-fringe)
2739 ;(git-gutter-fr+-minimal)
2740 ))))
2741 #+END_SRC
2742 ** git-messenger
2743 [2015-02-22 Sun 14:00]
2744 Provides function that popup commit message at current line. This is
2745 useful when you want to know why this line was changed.
2746 #+BEGIN_SRC emacs-lisp
2747 (use-package git-messenger
2748 :ensure git-messenger
2749 :commands (git-messenger:popup-message)
2750 :bind (("C-x v p" . git-messenger:popup-message))
2751 :config
2752 (progn
2753 (bind-key "m" 'git-messenger:copy-message git-messenger-map)
2754 (add-hook 'git-messenger:popup-buffer-hook 'magit-revision-mode)
2755 (validate-setq git-messenger:show-detail t)))
2756 #+END_SRC
2757 ** git timemachine
2758 [2014-07-23 Mi 12:57]
2759 Browse historic versions of a file with p (previous) and n (next).
2760 #+BEGIN_SRC emacs-lisp
2761 (use-package git-timemachine
2762 :ensure git-timemachine
2763 :commands git-timemachine)
2764 #+END_SRC
2765 ** Mail handling
2766 *** bbdb
2767 [2017-06-27 Di 23:10]
2768 #+BEGIN_SRC emacs-lisp
2769 (use-package bbdb
2770 :ensure t
2771 :commands (bbdb bbdb-insinuate-gnus bbdb-initialize)
2772 :config
2773 (progn
2774 (use-package bbdb-message)
2775 (use-package bbdb-gnus)
2776 (use-package bbdb-com)
2777
2778 (add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
2779
2780 (setq bbdb-add-mails t)
2781 (setq bbdb-canonicalize-redundant-mails t)
2782 (setq bbdb-complete-mail-allow-cycling t)
2783 (setq bbdb-complete-name-allow-cycling t)
2784 (setq bbdb-completion-type 'primary-or-name)
2785 (setq bbdb-dwim-net-address-allow-redundancy t)
2786 (setq bbdb-default-area-code 661)
2787 (setq bbdb-dial-local-prefix "0")
2788 (setq bbdb-file-coding-system 'utf-8)
2789 (setq bbdb-hashtable-size 104729)
2790 (setq bbdb-ignore-messages-alist '(("To" . "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software.de\\)")))
2791 (setq bbdb-new-mails-primary t)
2792 (setq bbdb-notice-auto-save-file t)
2793 (setq bbdb-notice-mail-hook 'bbdb-auto-notes-hook)
2794 (setq bbdb-phone-style nil)
2795 (setq bbdb-pop-up-window-size 6)
2796 (setq bbdb-user-mail-names "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software.de\\)")
2797 (setq bbdb/gnus-summary-known-poster-mark "+")
2798 (setq bbdb/gnus-summary-mark-known-posters t)
2799 (setq bbdb/gnus-summary-prefer-real-names t)
2800 (setq bbdb/news-auto-create-p 'bbdb-ignore-most-messages-hook)
2801 (setq bbdb-auto-notes-rules
2802 '(("user-agent" (".*" interface 0))
2803 ("Organization" (".*" company 0))
2804 ("x-mailer" (".*" interface 0))
2805 ("x-newsreader" (".*" interface 0))
2806 ("X-URL" (".*" url 0))
2807 ("newsgroups" ("\\\\([^,]*\\\\),?" posted-to "\\\\1" t))
2808 ("xref" ("\\\\b[^ ]+:[0-9]+.*" seen-in 0))))
2809 (put 'seen-in 'field-separator "; ")
2810 (put 'interface 'field-seperator "; ")
2811 )
2812 )
2813 #+END_SRC
2814
2815 *** gnus
2816 Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
2817 what I want every emacs to know.
2818 #+BEGIN_SRC emacs-lisp
2819 (use-package gnus
2820 :commands (gnus)
2821 :bind (("C-c g" . gnus)
2822 :map gnus-summary-mode-map
2823 ("<f6>" . jj-forward-spam)
2824 ("C-<f1>" . jj-move-mail-spambox)
2825 ("C-<f2>" . jj-copy-mail-hambox)
2826 ("C-c x" . gnus-scum-expunge)
2827 :map gnus-group-mode-map
2828 ("GG" . notmuch-search)
2829 :map notmuch-show-mode-map
2830 ("C-c C-c" . lld-notmuch-goto-message-in-gnus)
2831 )
2832 :init
2833 (progn
2834 (after 'gnus
2835 (jj-init-theme))
2836 )
2837 :config
2838 (progn
2839 (bbdb-initialize)
2840 ; When emacs exits, gnus does too, no need to ask me
2841 (defun exit-gnus-on-exit ()
2842 (if (and (fboundp 'gnus-group-exit)
2843 (gnus-alive-p))
2844 (with-current-buffer (get-buffer "*Group*")
2845 (gnus-group-exit))))
2846 (add-hook 'kill-emacs-hook 'exit-gnus-on-exit)
2847
2848 ;; prettier summary buffers
2849
2850 (setq gnus-sum-thread-tree-indent " ") ;; " "
2851 (setq gnus-sum-thread-tree-root "\u229e ") ;; "⊞ "
2852 (setq gnus-sum-thread-tree-false-root "\u22a1 ") ;; "⊡ "
2853 (setq gnus-sum-thread-tree-single-indent " ") ;; " "
2854 (setq gnus-sum-thread-tree-vertical " \u2502") ;; " │"
2855 (setq gnus-sum-thread-tree-leaf-with-other " \u251c\u2500 ") ;; " ├─ "
2856 (setq gnus-sum-thread-tree-single-leaf " \u2570\u2500 ") ;; " ╰─ "
2857
2858 (use-package gnus-cite
2859 :config
2860 (progn
2861 (defface dwa/mail-citation '((((class color)
2862 (background dark))
2863 (:background "#383838"))
2864 (((class color)
2865 (background light))
2866 (:background "#efefef")))
2867 "Mail citation base face.")
2868 (loop for x in gnus-cite-face-list do
2869 (set-face-attribute x nil ':inherit 'dwa/mail-citation))))
2870
2871 (use-package time-date
2872 :config
2873 (setq message-citation-line-function 'september-citation-line))
2874
2875 (setq message-subscribed-address-functions
2876 '(gnus-find-subscribed-addresses))
2877
2878 (if (string-match system-name "delenn.ganneff.de")
2879 (progn
2880 (setq imap-ssl-program "openssl s_client -no_ssl2 -no_ssl3 -tls1 -connect %s:%p")
2881
2882 (use-package notmuch
2883 :config
2884 (setq notmuch-search-oldest-first nil))
2885 (use-package org-gnus)
2886
2887 (setq gnus-secondary-select-methods
2888 '((nnml "")
2889
2890 (nnimap "nsb"
2891 (nnimap-address "localhost")
2892 (nnimap-user "nsb@auth")
2893 (nnimap-nov-is-evil t)
2894 (nnimap-stream network)
2895 (nnir-search-engine notmuch)
2896 )
2897 (nnimap "gmail"
2898 (nnimap-address "localhost")
2899 (nnimap-user "gmail@auth")
2900 (nnimap-stream network)
2901 (nnimap-nov-is-evil t)
2902 (nnir-search-engine notmuch)
2903 )
2904 ))
2905 ;;** Von wo holt Gnus News
2906 (setq gnus-select-method '(nnimap "ganneff"
2907 (nnimap-address "localhost")
2908 (nnimap-user "ganneff@auth")
2909 (nnimap-stream network)
2910 (nnimap-nov-is-evil t)
2911 (nnir-search-engine notmuch)
2912 ))
2913 ;;** Kopien aller Mails/News speichern
2914 (setq gnus-message-archive-group
2915 '((if (message-news-p)
2916 "nnfolder+archive:Sentnews"
2917 "nnimap+ganneff:Sentmail")))
2918 )
2919 )
2920 (setq nnir-mail-backend (nth 1 gnus-secondary-select-methods))
2921
2922 ;;** dont always read the active file.
2923 (setq gnus-read-active-file 'some)
2924
2925 ;;** nnimap nich cachen, ebenso nnml
2926 (setq gnus-uncacheable-groups "^\\(nnml\\|nnimap\\)")
2927
2928 ;;** Bei langsamer Anbindung dies auf t setzen
2929 (setq gnus-asynchronous t)
2930
2931 ;;** Mein Gnus soll regelmaessig nach neuen Mails/News schauen.
2932 (gnus-demon-add-handler 'us-get-only-mail 20 10)
2933 (gnus-demon-init)
2934
2935 ;; Set the default value of `mm-discouraged-alternatives'.
2936 (eval-after-load "gnus-sum"
2937 '(add-to-list
2938 'gnus-newsgroup-variables
2939 '(mm-discouraged-alternatives
2940 . '("text/html" "text/richtext"))))
2941
2942 ;; Display `text/html' parts in `nnrss' groups only.
2943 (add-to-list
2944 'gnus-parameters
2945 '("\\`nnrss:" (mm-discouraged-alternatives nil)))
2946
2947 ;;** Message Size Limit
2948 (setq message-send-mail-partially-limit 5000000)
2949
2950 (setq message-send-mail-function 'message-send-mail-with-sendmail)
2951 (setq smtpmail-default-smtp-server "localhost")
2952 (setq message-sendmail-envelope-from 'header)
2953
2954 ;;** Keinen Sender Header zufuegen !
2955 (add-to-list 'message-syntax-checks '(sender . disabled))
2956
2957 ;;** Auto-Subscribe
2958 (setq gnus-auto-subscribed-groups
2959 (concat gnus-auto-subscribed-groups
2960 "\\|^nnimap*"))
2961
2962 ;;** Kaputte Subjects Aw: Statt Re: fixen:
2963 (setq message-subject-re-regexp "^[ ]*\\([RrAaFf][EeWw]:[ ]*\\)*[ ]*")
2964
2965 ;;** Immer Gruppen nach Topics anzeigen
2966 (add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
2967
2968 ;;** Summary Anzeige umdefinieren.
2969 (setq gnus-summary-line-format "%U%R%z (%4k) %uy%* %B%(%[ %-22,22f %]%) %s\n")
2970 (setq gnus-summary-gather-subject-limit 'fuzzy)
2971
2972 ;;** Und die Gruppenanzeige will ich auch anders. Will sehen wann ich zuletzt da reingesehen hab.
2973 (setq gnus-group-line-format
2974 "%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")
2975
2976 ;;** Different topic lines
2977 (setq gnus-topic-line-format "%i[ %u&topic-line; ] %v\n")
2978
2979 ;;** Für die umdefinierte Gruppenanzeige muss Gnus aber einen Timestamp in der Gruppe speichern.
2980 (add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
2981
2982 ;;** Ich will manchmal den Empfänger statt des Absenders sehen
2983 (setq gnus-extra-headers '(To Newsgroups Newsgroup Cc))
2984 (setq nnmail-extra-headers gnus-extra-headers)
2985 (setq gnus-ignored-from-addresses '("\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gf\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\|nsb-software\\.de\\|dlh\\.de\\)"))
2986
2987 ;; Don't send to these address in wide reply.
2988 (setq message-dont-reply-to-names (append '("notifications@github\\.com"
2989 ".*@noreply\\.github\\.com"
2990 )
2991 gnus-ignored-from-addresses))
2992
2993 ;;** Threads um 2 Zeichen einruecken.
2994 (setq gnus-thread-indent-level 1)
2995
2996 ;;** Posting Styles. Nettes Feature
2997 (setq gnus-posting-styles
2998 '(
2999 (".*"
3000 (from "Joerg Jaspert <joerg@ganneff.de>")) ; Globale Einstellung
3001 ("Allgemein.Sabrina"
3002 (from "Joerg (悠軻) Jaspert <joerg@debian.org>"))
3003 ("Debian.Private"
3004 (from "Joerg Jaspert <joerg@debian.org>")
3005 (signature-file "~/.signature.private"))
3006 ("dlh"
3007 (from "Joerg Jaspert <joerg@nsb-software.de>")
3008 (signature-file "~/.signature.nsb")
3009 (organization "NSB Nguyen Softwareentwicklung & beratung GmbH")
3010 (gcc "nnimap+nsb:Sent"))
3011 ("nnimap\\+nsb:.*"
3012 (from "Joerg Jaspert <joerg@nsb-software.de>")
3013 (signature-file "~/.signature.nsb")
3014 (organization "NSB Nguyen Softwareentwicklung & beratung GmbH")
3015 (gcc "nnimap+nsb:Sent"))
3016 ("nnimap\\+nsb:shared.gf.*"
3017 (from "Joerg Jaspert <gf@nsb-software.de>"))
3018 ("Debian"
3019 (from "Joerg Jaspert <joerg@debian.org>"))
3020 ("Debian.AM"
3021 (Gcc "nnimap+ganneff:Debian.AM"))
3022 ("Debian.DAM"
3023 (reply-to "Debian Account Managers <da-manager@debian.org>"))
3024 ("Debconf"
3025 (from "Joerg Jaspert <joerg@debconf.org>"))
3026 ("Bugs"
3027 (from "Joerg Jaspert <joerg@debian.org>"))
3028 ("SPI"
3029 (from "Joerg Jaspert <joerg@debian.org>"))
3030 ))
3031
3032
3033 ;;** Ich will die Header in den Nachrichten sehen die ich schreibe.
3034 (setq message-generate-headers-first t)
3035
3036 ;;** Und immer schoen Header zufuegen.
3037 (setq message-default-headers (concat "Organization: Ganneff\n"))
3038 (add-hook 'message-send-hook 'my-message-add-content)
3039
3040 ;;** Und Courtesy-Mails wollen wir schon mal grad gar nicht
3041 (add-hook 'message-header-setup-hook 'my-message-header-setup-hook)
3042
3043 ;;** Antworten auf meine Nachrichten hervorheben, hochscoren
3044 (add-hook 'message-sent-hook 'gnus-score-followup-article)
3045 (add-hook 'message-sent-hook 'gnus-score-followup-thread)
3046
3047 ;;** In Forwards bitte das Subject aufraeumen
3048 (setq message-wash-forwarded-subjects t)
3049
3050 ;;** Zitieren ohne Sig. Ausser Idioten sind zu doof die korrekt abzutrennen.
3051 (setq message-cite-function 'message-cite-original-without-signature)
3052
3053 ;;** Grosse Newsgroups. Gnus fragt da laestigerweise immer nach.
3054 ;;** Aber da ich viele grosse Gruppen und nen schnellen Rechner habe
3055 ;;** soll der erst recht spaet nachfragen. Erst wenns wirklich fies wird.
3056 (setq gnus-large-newsgroup "15000")
3057
3058 ;;** Beim Betreten einer Gruppe keinen Artikel auswählen. Gegen Adaptive Scoring iss des !
3059 (setq gnus-auto-select-first nil)
3060
3061 ;;** Wenn ich in einer Gruppe fertig bin soll Gnus nich fragen ob ich in
3062 ;;** die naechste will. Es soll einfach tun.
3063 (setq gnus-auto-select-next 'quietly)
3064
3065 ;;** Hervorhebungen (Unterstrichen und Fett bei "_X_" und "*X*")
3066 (add-hook 'gnus-article-display-hook 'gnus-article-emphasize t)
3067
3068 ;;** Gnus Visible Headers
3069 (setq gnus-visible-headers
3070 '("^From:"
3071 "^Newsgroups:"
3072 "^Subject:"
3073 "^Date:"
3074 "^Followup-To:"
3075 "^Reply-To:"
3076 "^Organization:"
3077 "^Summary:"
3078 "^Keywords:"
3079 "^To:"
3080 "^[BGF]?Cc:"
3081 "^Posted-To:"
3082 "^Mail-Copies-To:"
3083 "^Apparently-To:"
3084 "^X-Gnus-Warning:"
3085 "^Resent-From:"
3086 "^Xref:"
3087 "^X-Spam-Status:"
3088 "^X-Sent:"
3089 "^X-Mailer:"
3090 "^X-Newsreader:"
3091 "^X-User-Agent:"
3092 "^User-Agent:"))
3093
3094 ;;; Order of headers
3095 (setq gnus-sorted-header-list '("^From:"
3096 "^Subject:"
3097 "^Summary:"
3098 "^Keywords:"
3099 "^Newsgroups:"
3100 "^Followup-To:"
3101 "^To:"
3102 "^Cc:"
3103 "^Date:"
3104 "^Organization:"
3105 "^User-Agent:"
3106 "^X-Mailer:"
3107 "^X-Newsreader:"))
3108
3109 ;;** Automagischen Zeilenumbruch bei News/Mailangabe nach 72 Zeichen. SO wies sein soll.
3110 (add-hook 'message-mode-hook
3111 (lambda ()
3112 (setq fill-column 72)
3113 (turn-on-auto-fill)
3114 (epa-mail-mode 1)
3115 ))
3116
3117 ;;** Save gnus score files. Ziemlich doof wenn nicht
3118 (setq gnus-save-score t)
3119
3120 ;;** Score Einstellungen. Welches Global File und woher die Scores holen.
3121 (setq gnus-global-score-files '("~/News/all.SCORE"))
3122 (setq gnus-score-find-score-files-function '(gnus-score-find-bnews bbdb/gnus-score))
3123
3124 ;;** Adaptives Scoring
3125 (setq gnus-use-adaptive-scoring t)
3126 (defvar gnus-default-adaptive-score-alist
3127 '((gnus-unread-mark)
3128 (gnus-ticked-mark (from 5))
3129 (gnus-dormant-mark (from 6))
3130 (gnus-del-mark (subject -5))
3131 (gnus-read-mark (from 5) (subject 3))
3132 (gnus-expirable-mark (from -2) (subject -2))
3133 (gnus-killed-mark (from -2) (subject -4))
3134 (gnus-kill-file-mark)
3135 (gnus-ancient-mark)
3136 (gnus-low-score-mark)
3137 (gnus-catchup-mark (subject -3))
3138 ))
3139
3140 ;;** Damit ich nicht mit Megabytegrossen Scorefiles rummachen muss, muss bei Adaptive-Scoring
3141 ;;** der Kram automagisch gelöscht werden. Sonst hats keinen Sinn !
3142 (setq gnus-decay-scores t)
3143
3144 ;;** Artikel mit weniger Score werden nicht angezeigt
3145 (setq gnus-summary-expunge-below -1000)
3146
3147 ;;** work around unimplemented handling of multiple similar attachments
3148 ;;** (recommended by ShengHuo Zhu Fri 20 Jul 2001 13:14)
3149 (setq gnus-mime-display-multipart-related-as-mixed t)
3150
3151 ;;** Bilderchen direkt anzeigen.
3152 (setq mm-inline-large-images t)
3153
3154 ;;** ueberfluessige Leerzeilen loeschen
3155 (setq gnus-treat-strip-trailing-blank-lines t)
3156 (setq gnus-treat-strip-leading-blank-lines t)
3157
3158 ;;** Falsch gebaute Attachments ? Nich mit mir. Nuja, UUE wech. Was solls. Will ich eh nich haben
3159 (setq mm-uu-configure-list '((uu . disabled)))
3160
3161 ;; (use-package message-utils
3162 ;; :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)
3163 ;; :bind ((:map message-mode-map
3164 ;; ("C-c m" . message-mark-inserted-region)
3165 ;; ("C-c f" . message-mark-insert-file)
3166 ;; ("C-c x" . message-xpost-fup2)
3167 ;; ("C-c s" . message-change-subject)
3168 ;; ("C-c a" . message-add-archive-header)
3169 ;; ("C-c t" . message-reduce-to-to-cc)
3170 ;; )))
3171 ;(add-hook 'message-header-setup-hook 'message-strip-subject-was)
3172 ;(add-hook 'message-setup-hook 'message-utils-setup)
3173
3174 ;;** Nun das Paket um einfachst Fussnoten eingeben zu können.
3175 (use-package footnote
3176 :commands (footnote-mode)
3177 :config
3178 (setq footnote-body-tag-spacing 1
3179 footnote-spaced-footnotes nil
3180 footnote-style 'numeric-latin
3181 footnote-section-tag "Fussnoten: "))
3182 (add-hook 'message-mode-hook 'footnote-mode)
3183
3184 ;;** Meine Smileys mag ich gelb
3185 (use-package smiley
3186 :init
3187 (progn
3188 (setq gnus-treat-display-smileys t)
3189 (setq smiley-flesh-color "Yellow")
3190 (setq smiley-data-directory "~/emacs/etc/smilies/")))
3191
3192 (use-package mml-sec
3193 :commands (sign-or-crypt)
3194 :config
3195 (progn
3196 (setq mm-verify-option 'always)
3197 ;; Keine extra Signatur erzeugen.
3198 (mml-signencrypt-style "pgpmime" 'combined)
3199 (setq mml-secure-openpgp-sign-with-sender 't)
3200 (setq gpg-unabbrev-trust-alist
3201 '(("TRUST_UNDEFINED" . trust-undefined)
3202 ("TRUST_NEVER" . trust-none)
3203 ("TRUST_MARGINAL" . trust-marginal)
3204 ("TRUST_FULLY" . trust-full)
3205 ("TRUST_ULTIMATE" . trust-ultimate)))
3206 ))
3207 (add-hook 'gnus-message-setup-hook 'sign-or-crypt)
3208
3209 ;;** utf-8, coding systems
3210 (setq mm-coding-system-priorities
3211 '(iso-latin-1 iso-latin-9 utf-8))
3212
3213 (unify-8859-on-encoding-mode 1)
3214 (unify-8859-on-decoding-mode 1)
3215 (prefer-coding-system 'latin-9)
3216 (prefer-coding-system 'latin-1)
3217 (prefer-coding-system 'utf-8)
3218
3219 ;;** org-mode
3220 (add-hook 'message-mode-hook 'orgstruct++-mode 'append)
3221 (add-hook 'message-mode-hook 'orgtbl-mode 'append)
3222
3223 (use-package message-x
3224 :ensure t)
3225
3226 (use-package randomsig
3227 :bind (:map message-mode-map
3228 ("C-c s" . randomsig-replace-sig)
3229 ("C-c S" . randomsig-select-sig))
3230 :config
3231 (progn
3232 (setq randomsig-dir "/home/joerg/sigs")
3233 (setq message-signature 'randomsig-signature)))
3234
3235 (use-package sieve
3236 :mode ("\\.siv\\'" . sieve-mode)
3237 :config
3238 (require 'gnus-sieve)
3239 )
3240
3241 (setq gnus-use-correct-string-widths nil)
3242
3243 (setq nnrss-wash-html-in-text-plain-parts t)
3244 (setq canlock-password "canlockjjaspert")
3245 (setq canlock-sha1-function (quote canlock-sha1-with-openssl))
3246 (setq canlock-sha1-function-for-verify (quote canlock-sha1-with-openssl))
3247 (setq gnus-agent nil)
3248 (setq gnus-article-banner-alist (quote ((banner-perl . "^--.?
3249 .+
3250 .+
3251 .+
3252 .+
3253 .+
3254 Die Nutzung von.+html") (banner-debian . "^--.?
3255 To UNSUBSCRIBE.*
3256 .*@lists.debian.org$") (banner-debian-de . "^--.?
3257 -+
3258 Um sich aus der Liste auszutragen.+
3259 .+
3260 .+
3261 .+
3262 -+$\\|[0-9]+ eingetragene Mitglieder in dieser Liste.") (banner-sourceforge . "^_+
3263 .+@lists.sourceforge.net
3264 http://lists.sourceforge.net.+
3265 .+
3266 $") (banner-amavis . "^_+
3267 .+AMaViS-.*
3268 .*
3269 .*
3270 .*amavis-faq.php3$"))))
3271 (setq gnus-article-sort-functions (quote (gnus-article-sort-by-number gnus-article-sort-by-score gnus-article-sort-by-date)))
3272 (setq gnus-article-x-face-command (quote gnus-display-x-face-in-from))
3273 (setq gnus-boring-article-headers (quote (empty newsgroups followup-to reply-to)))
3274 (setq gnus-build-sparse-threads nil)
3275 (setq gnus-buttonized-mime-types '("multipart/signed"))
3276 (setq
3277 ;; collaps long citations
3278 ;; (w/ `gnus-treat-hide-citation t' or `W W c'):
3279 gnus-cited-closed-text-button-line-format
3280 "%(%{... [ %n lines (%l chars) of citation hidden, click here to expand ] ...%}%)\n"
3281 gnus-cited-lines-visible '(3 . 6) ; (top . bottom)
3282 ;; [...]
3283 gnus-treat-hide-citation t)
3284
3285 (setq gnus-default-article-saver (quote gnus-summary-save-in-file))
3286 ; (setq gnus-default-charset (quote iso-8859-1))
3287 (setq gnus-generate-tree-function (quote gnus-generate-vertical-tree))
3288 (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))))
3289 (setq gnus-group-name-charset-group-alist (quote ((".*" . iso-8859-1))))
3290 (setq gnus-group-name-charset-method-alist (quote ((nntp . iso-8859-1))))
3291 (setq gnus-group-posting-charset-alist (quote (("^\\(no\\|fr\\)\\.[^,]*\\(,[
3292 ]*\\(no\\|fr\\)\\.[^,]*\\)*$" iso-8859-1 (iso-8859-1)) ("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[
3293 ]*\\(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)
3294 (setq gnus-list-identifiers "\\[\\(a-zA-Z\\)+\\]")
3295 (setq gnus-message-replyencrypt nil)
3296 (setq gnus-message-replysign nil)
3297 (setq gnus-novice-user nil)
3298 (setq gnus-refer-thread-limit t)
3299 (setq gnus-save-duplicate-list t)
3300 (setq gnus-simplify-ignored-prefixes nil)
3301 (setq gnus-summary-exit-hook (quote (gnus-summary-bubble-group)))
3302 (setq gnus-summary-mode-line-format "Gnus: %g [%A] %Z - killed: %E")
3303 (setq gnus-suppress-duplicates t)
3304 (setq gnus-thread-indent-level 2)
3305 (setq gnus-thread-sort-functions (quote (gnus-thread-sort-by-number gnus-thread-sort-by-score gnus-thread-sort-by-date)))
3306 (setq gnus-treat-capitalize-sentences nil)
3307 (setq gnus-treat-date-local (quote head))
3308 (setq gnus-treat-display-picons nil)
3309 (setq gnus-treat-display-xface (quote head))
3310 (setq gnus-treat-fill-article nil)
3311 (setq gnus-treat-fill-long-lines nil)
3312 (setq gnus-treat-from-picon (quote head))
3313 (setq gnus-treat-mail-picon (quote head))
3314 (setq gnus-treat-newsgroups-picon (quote head))
3315 (setq gnus-treat-strip-pgp (quote head))
3316 (setq gnus-treat-unsplit-urls t)
3317 (setq gnus-treat-x-pgp-sig (quote head))
3318 (setq gnus-use-picons t)
3319 (setq gnus-uu-post-encode-method (quote gnus-uu-post-encode-mime))
3320 (setq message-archive-note "X-No-Archive: Yes")
3321 ;(setq message-default-charset (quote iso-8859-1))
3322 (setq message-make-forward-subject-function (quote message-forward-subject-fwd))
3323 (setq message-max-buffers 5)
3324 (setq message-send-hook (quote (my-message-add-content)))
3325 (setq message-subscribed-regexps (quote (".*@lists.*" ".*@postfix.org" ".*@nongnu.org")))
3326 (setq message-use-followup-to (quote use))
3327 (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")))
3328 (setq mm-body-charset-encoding-alist (quote ((iso-2022-jp . 7bit) (iso-2022-jp-2 . 7bit) (iso-8859-1 . 8bit) (iso-8859-15 . 8bit))))
3329 (setq mm-decrypt-option (quote known))
3330 (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")))
3331 (setq mm-verify-option (quote always))
3332 (setq nnimap-authinfo-file "~/.nnimap")
3333 (setq gnus-save-newsrc-file nil)
3334 (setq gnus-read-newsrc-file nil)
3335 (setq gnus-always-read-dribble-file t)
3336
3337 (setq gnus-refer-article-method
3338 '(current
3339 (nnweb "refer" (nnweb-type dejanews))))
3340
3341 ))
3342
3343 #+END_SRC
3344 ** go-mode
3345 [2017-03-11 Sat 20:06]
3346 The go language, see golang.org
3347 #+BEGIN_SRC emacs-lisp
3348 (use-package go-mode
3349 :ensure t
3350 :bind (("M-." . godef-jump)
3351 ("M-*" . pop-tag-mark))
3352 :config
3353 (progn
3354 (defun my-go-mode-hook ()
3355 (interactive)
3356 (add-hook 'before-save-hook 'gofmt-before-save)
3357 ; Customize compile command to run go build
3358 (if (not (string-match "go" compile-command))
3359 (set (make-local-variable 'compile-command)
3360 "go build -v && go test -v && go vet"))
3361 ; Use goimports instead of go-fmt
3362 (setq gofmt-command "goimports")
3363 )
3364 (add-hook 'go-mode-hook 'my-go-mode-hook)
3365 (use-package go-autocomplete
3366 :ensure t)
3367 (use-package go-eldoc
3368 :ensure t
3369 :config
3370 (progn
3371 (add-hook 'go-mode-hook 'go-eldoc-setup)))
3372 (use-package go-guru
3373 :ensure t
3374 :config
3375 (progn
3376 (go-guru-hl-identifier-mode)
3377 (setq go-guru-command "golang-guru")))
3378 ))
3379 #+END_SRC
3380 ** golden ratio
3381 [2015-02-20 Fri 16:27]
3382 When working with many windows at the same time, each window has a
3383 size that is not convenient for editing.
3384
3385 golden-ratio helps on this issue by resizing automatically the windows
3386 you are working on to the size specified in the "Golden Ratio". The
3387 window that has the main focus will have the perfect size for editing,
3388 while the ones that are not being actively edited will be re-sized to
3389 a smaller size that doesn't get in the way, but at the same time will
3390 be readable enough to know it's content.
3391 #+BEGIN_SRC emacs-lisp
3392 (use-package golden-ratio
3393 :ensure golden-ratio
3394 :diminish golden-ratio-mode
3395 :init
3396 (progn
3397 (golden-ratio-mode 1)
3398 (validate-setq golden-ratio-exclude-buffer-names '("*LV*" "*guide-key*" "*Ediff Control Panel*"))
3399 (validate-setq golden-ratio-exclude-modes '("calendar-mode" "gnus-summary-mode"
3400 "gnus-article-mode" "calc-mode" "calc-trail-mode"
3401 "bbdb-mode"))
3402 ))
3403 #+END_SRC
3404 ** goto last change
3405 [2015-02-22 Sun 13:28]
3406 Move point through buffer-undo-list positions.
3407 #+BEGIN_SRC emacs-lisp
3408 (use-package goto-last-change
3409 :commands (goto-last-change)
3410 :bind (("M-g l" . goto-last-change))
3411 )
3412 #+END_SRC
3413 ** guide-key
3414 [2014-06-11 Wed 22:27]
3415 guide-key.el displays the available key bindings automatically and
3416 dynamically.
3417
3418 For whatever reason I like this more than icicles <backtab> completion
3419 for this.
3420 #+BEGIN_SRC emacs-lisp
3421 (use-package guide-key
3422 :ensure guide-key
3423 :diminish guide-key-mode
3424 :config
3425 (progn
3426 (validate-setq guide-key/guide-key-sequence '("C-x" "C-c" "M-g" "M-s"))
3427 (guide-key-mode 1)
3428 (validate-setq guide-key/recursive-key-sequence-flag t)
3429 (validate-setq guide-key/popup-window-position 'bottom)
3430 (validate-setq guide-key/idle-delay 0.5)))
3431
3432 #+END_SRC
3433
3434 ** highlighting modes
3435 [2014-05-21 Wed 23:51]
3436 #+BEGIN_SRC emacs-lisp
3437 (use-package hi-lock
3438 :bind (("M-o l" . highlight-lines-matching-regexp)
3439 ("M-o r" . highlight-regexp)
3440 ("M-o w" . highlight-phrase)
3441 ("M-o u" . unhighlight-regexp)))
3442
3443 (use-package hilit-chg
3444 :bind ("M-o C" . highlight-changes-mode))
3445
3446 (use-package highlight-indentation
3447 :ensure t
3448 :commands 'highlight-indentation-mode
3449 :init
3450 (hook-into-modes 'highlight-indentation-mode '(yaml-mode-hook python-mode-hook))
3451 (hook-into-modes 'highlight-indentation-current-column-mode '(yaml-mode-hook python-mode-hook))
3452 :config
3453 (set-face-background 'highlight-indentation-face "#283d83")
3454 (set-face-background 'highlight-indentation-current-column-face "#285f85")
3455 )
3456 #+END_SRC
3457 ** hippie-exp
3458 Crazy way of completion. It looks at the word before point and then
3459 tries to expand it in various ways.
3460 #+BEGIN_SRC emacs-lisp
3461 (use-package hippie-exp
3462 :bind ("M-/" . hippie-expand)
3463 :commands hippie-expand
3464 :config
3465 (progn
3466 (validate-setq hippie-expand-try-functions-list '(try-expand-dabbrev
3467 try-expand-dabbrev-all-buffers
3468 try-expand-dabbrev-from-kill
3469 try-complete-file-name-partially
3470 try-complete-file-name
3471 try-expand-all-abbrevs try-expand-list
3472 try-expand-line
3473 try-complete-lisp-symbol-partially
3474 try-complete-lisp-symbol))))
3475 #+END_SRC
3476 ** CANCELLED html-helper :CANCELLED:
3477 CLOSED: [2017-08-26 Sat 15:09]
3478 :LOGBOOK:
3479 - State "CANCELLED" from [2017-08-26 Sat 15:09]
3480 :END:
3481 Replaced by web-mode [[*web-mode][web-mode]]
3482 #+BEGIN_SRC emacs-lisp :tangle no
3483 (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
3484 (add-auto-mode 'html-helper-mode "\\.html$")
3485 (add-auto-mode 'html-helper-mode "\\.asp$")
3486 (add-auto-mode 'html-helper-mode "\\.phtml$")
3487 (add-auto-mode 'html-helper-mode "\\.(jsp|tmpl)\\'")
3488 (defalias 'html-mode 'html-helper-mode)
3489 #+END_SRC
3490 ** hydra
3491 [2015-01-26 Mon 15:50]
3492 This is a package for GNU Emacs that can be used to tie related
3493 commands into a family of short bindings with a common prefix - a
3494 Hydra.
3495
3496 Once you summon the Hydra through the prefixed binding (the body + any
3497 one head), all heads can be called in succession with only a short
3498 extension.
3499
3500 The Hydra is vanquished once Hercules, any binding that isn't the
3501 Hydra's head, arrives. Note that Hercules, besides vanquishing the
3502 Hydra, will still serve his orignal purpose, calling his proper
3503 command. This makes the Hydra very seamless, it's like a minor mode
3504 that disables itself auto-magically.
3505 #+BEGIN_SRC emacs-lisp
3506 (use-package hydra
3507 :ensure hydra
3508 :init
3509 (progn
3510 (validate-setq hydra-is-helpful t)
3511 (validate-setq hydra-lv t)
3512
3513 (defhydra hydra-error (:color red)
3514 "goto-error"
3515 ("h" first-error "first")
3516 ("j" next-error "next")
3517 ("k" previous-error "prev")
3518 ("v" recenter-top-bottom "recenter")
3519 ("q" nil "quit"))
3520 (bind-key "M-g e" 'hydra-error/body)
3521
3522 (defhydra hydra-gnus (:color red)
3523 "gnus functions"
3524 ("m" gnus-uu-mark-thread "mark thread")
3525 ("d" gnus-summary-delete-article "delete article(s)")
3526 ("r" gnus-summary-mark-as-read-forward "mark read")
3527 ("n" gnus-summary-next-thread "next thread")
3528 ("p" gnus-summary-prev-thread "previous thread")
3529 ("g" gnus-summary-next-group "next group")
3530 ("l" gnus-recenter "recenter")
3531 ("x" gnus-summary-limit-to-unread "unread")
3532 ("q" nil "quit"))
3533 (bind-key "C-c h" 'hydra-gnus/body)
3534
3535 (defhydra hydra-launcher (:color blue)
3536 "Launch"
3537 ("h" man "man")
3538 ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
3539 ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
3540 ("s" shell "shell")
3541 ("q" nil "cancel"))
3542 (bind-key "M-g r" 'hydra-launcher/body)
3543
3544 ; whitespace mode gets loaded late, so variable may not be there yet. Workaround...
3545 (defvar whitespace-mode nil)
3546 (defhydra hydra-toggle (:color pink)
3547 "
3548 _a_ abbrev-mode: % 4`abbrev-mode^^^^ _f_ auto-fill-mode: %`auto-fill-function
3549 _c_ auto-complete-mode: % 4`auto-complete-mode _r_ auto-revert-mode: %`auto-revert-mode
3550 _d_ debug-on-error: % 4`debug-on-error^ _t_ truncate-lines: %`truncate-lines
3551 _w_ whitespace-mode: % 4`whitespace-mode _g_ golden-ratio-mode: %`golden-ratio-mode
3552 _l_ linum-mode: % 4`linum-mode _k_ linum relative: %`linum-format
3553
3554 "
3555 ("a" abbrev-mode nil)
3556 ("c" auto-complete-mode nil)
3557 ("i" aggressive-indent-mode nil)
3558 ("d" toggle-debug-on-error nil)
3559 ("f" auto-fill-mode nil)
3560 ("g" golden-ratio-mode nil)
3561 ("t" toggle-truncate-lines nil)
3562 ("w" whitespace-mode nil)
3563 ("r" auto-revert-mode nil)
3564 ("l" linum-mode nil)
3565 ("k" linum-relative-toggle nil)
3566 ("q" nil "cancel"))
3567 (bind-key "C-c C-v" 'hydra-toggle/body)
3568 ))
3569
3570
3571 #+END_SRC
3572 ** ibuffer
3573 [2014-05-21 Wed 23:54]
3574 #+BEGIN_SRC emacs-lisp
3575 (use-package ibuffer
3576 :bind (("C-h h" . ibuffer)
3577 ("C-x C-b" . ibuffer)
3578 ("<XF86WebCam>" . ibuffer)
3579 :map ibuffer-mode-map
3580 ("s" . isearch-forward-regexp)
3581 ("." . ibuffer-invert-sorting)
3582 ("i" . ibuffer-magit-status)
3583 ("G" . ibuffer-magit-status))
3584 :commands (ibuffer)
3585 :defines (ibuffer-filtering-alist
3586 ibuffer-filter-groups ibuffer-compile-formats ibuffer-git-column-length
3587 ibuffer-show-empty-filter-groups ibuffer-saved-filter-groups)
3588 :config
3589 (progn
3590 (defvar my-ibufffer-separator " • ")
3591 (validate-setq ibuffer-filter-group-name-face 'variable-pitch
3592 ibuffer-use-header-line t)
3593 (unbind-key "M-o" ibuffer-mode-map)
3594
3595 (use-package f
3596 :ensure f)
3597
3598 (use-package ibuffer-vc
3599 :ensure t
3600 :commands
3601 (ibuffer-vc-set-filter-groups-by-vc-root
3602 ibuffer-vc-generate-filter-groups-by-vc-root))
3603
3604 (use-package ibuffer-tramp
3605 :ensure t
3606 :commands (ibuffer-tramp-generate-filter-groups-by-tramp-connection
3607 ibuffer-tramp-set-filter-groups-by-tramp-connection))
3608 ;; Switching to ibuffer puts the cursor on the most recent buffer
3609 (defadvice ibuffer (around ibuffer-point-to-most-recent activate)
3610 "Open ibuffer with cursor pointed to most recent buffer name"
3611 (let ((recent-buffer-name (buffer-name)))
3612 ad-do-it
3613 (ibuffer-update nil t)
3614 (unless (string= recent-buffer-name "*Ibuffer*")
3615 (ibuffer-jump-to-buffer recent-buffer-name))))
3616
3617 (defun ibuffer-magit-status ()
3618 (interactive)
3619 (--when-let (get-buffer "*Ibuffer*")
3620 (with-current-buffer it
3621 (let* ((selected-buffer (ibuffer-current-buffer))
3622 (buffer-path (with-current-buffer
3623 selected-buffer
3624 (or (buffer-file-name)
3625 list-buffers-directory
3626 default-directory)))
3627 (default-directory
3628 (if (file-regular-p buffer-path)
3629 (file-name-directory buffer-path)
3630 buffer-path)))
3631 (magit-status default-directory)))))
3632
3633 (validate-setq ibuffer-directory-abbrev-alist
3634 (-uniq
3635 (-flatten
3636 (--map
3637 (list
3638 (cons (f-slash (f-expand (cdr it))) my-ibufffer-separator)
3639 (cons (f-slash (f-canonical (cdr it))) (concat (car it) my-ibufffer-separator)))
3640 '(
3641 ("dak" . "/develop/dak/")
3642 ("org" . "~/org/")
3643 ("config" . "~/.emacs.d/config/")
3644 ("tmp" . "~/tmp/")
3645 ("systmp" . "/tmp/")
3646 ("puppet" . "~/git/puppet")
3647 ("git" . "~/git/")
3648 )))))
3649
3650 (use-package ibuffer-git
3651 :ensure t)
3652 (use-package ibuffer-vc
3653 :ensure t)
3654
3655 (define-ibuffer-column size-h
3656 (:name "Size" :inline t)
3657 (cond
3658 ((> (buffer-size) 1000)
3659 (format "%7.1fk" (/ (buffer-size) 1000.0)))
3660 ((> (buffer-size) 1000000)
3661 (format "%7.1fM" (/ (buffer-size) 1000000.0)))
3662 (t
3663 (format "%8d" (buffer-size)))))
3664
3665 (use-package ibuf-ext
3666 :config
3667 (validate-setq ibuffer-old-time 12))
3668
3669 (define-ibuffer-filter filename2
3670 "Toggle current view to buffers with filename matching QUALIFIER."
3671 (:description "filename2"
3672 :reader (read-from-minibuffer "Filter by filename (regexp): "))
3673 ;; (ibuffer-awhen (buffer-local-value 'buffer-file-name buf)
3674 (ibuffer-awhen (with-current-buffer buf
3675 (or buffer-file-name
3676 default-directory))
3677 (string-match qualifier it)))
3678
3679 (defvar ibuffer-magit-filter-groups nil)
3680 (defun ibuffer-magit-define-filter-groups ()
3681 (when (and (not ibuffer-magit-filter-groups)
3682 (boundp 'magit-repo-dirs))
3683 (validate-setq ibuffer-magit-filter-groups
3684 (--map (list
3685 (concat "git:: "
3686 (file-name-nondirectory (directory-file-name it)))
3687 `(filename2 . ,it))
3688 (mapcar 'cdr (magit-list-repos magit-repo-dirs))))))
3689
3690 (defun ibuffer-set-filter-groups-by-root ()
3691 (interactive)
3692 ;; (ibuffer-projectile-define-filter-groups)
3693 ;; (ibuffer-magit-define-filter-groups)
3694 (validate-setq ibuffer-filter-groups
3695 (-concat
3696 ;; ibuffer-projectile-filter-groups
3697 ibuffer-magit-filter-groups
3698
3699 '(("MORE"
3700 (or (mode . magit-log-edit-mode)
3701 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
3702 (name . "^\\*Pymacs\\*$")
3703 (name . "^\\*helm.*\\*")
3704 (name . "^\\*Compile-log\\*$")
3705 (name . "^\\*Ido Completions\\*$")
3706 (name . "^\\*magit-\\(process\\)\\*$")
3707 (name . "^ "))))
3708 '(("Tramp"
3709 (or
3710 (name . "^\\*\\(tramp/.*\\)\\*$"))))
3711 '(("EMACS"
3712 (or
3713 (name . "^\\*scratch")
3714 (name . "^\\*Messages")
3715 (name . "^\\*Help")
3716 )))
3717 (ibuffer-vc-generate-filter-groups-by-vc-root)
3718 (ibuffer-tramp-generate-filter-groups-by-tramp-connection))))
3719
3720 (defun toggle-ibuffer-filter-groups ()
3721 "DOCSTRING"
3722 (interactive)
3723 (let ((ibuf (get-buffer "*Ibuffer*")))
3724 (when ibuf
3725 (with-current-buffer ibuf
3726 (let ((selected-buffer (ibuffer-current-buffer)))
3727 (if (not ibuffer-filter-groups)
3728 (ibuffer-set-filter-groups-by-root)
3729 (validate-setq ibuffer-filter-groups nil))
3730 (pop-to-buffer ibuf)
3731 (ibuffer-update nil t)
3732 (ibuffer-jump-to-buffer (buffer-name selected-buffer )))))))
3733
3734 (bind-key "h" 'toggle-ibuffer-filter-groups ibuffer-mode-map)
3735
3736 (defun ibuffer-back-to-top ()
3737 (interactive)
3738 (beginning-of-buffer)
3739 (next-line 3))
3740
3741 (defun ibuffer-jump-to-bottom ()
3742 (interactive)
3743 (end-of-buffer)
3744 (beginning-of-line)
3745 (next-line -2))
3746
3747 (define-key ibuffer-mode-map
3748 (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
3749 (define-key ibuffer-mode-map
3750 (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)
3751
3752 (setq ibuffer-default-sorting-mode 'recency)
3753 (setq ibuffer-eliding-string "…"
3754 ibuffer-compile-formats t
3755 ibuffer-git-column-length 6
3756 ibuffer-show-empty-filter-groups nil
3757 ibuffer-default-directory "~/"
3758 )
3759
3760 (validate-setq ibuffer-formats '((mark vc-status-mini
3761 " "
3762 (git-status 8 8 :left)
3763 " "
3764 read-only modified
3765 " "
3766 (name 18 18 :left :elide)
3767 " "
3768 (size-h 9 -1 :right)
3769 " "
3770 (mode 16 16 :left :elide)
3771 " " filename-and-process)
3772 (mark " "
3773 (git-status 8 8 :left)
3774 " "
3775 (name 16 -1)
3776 " " filename)
3777 ))
3778
3779 (validate-setq ibuffer-saved-filter-groups
3780 (quote (("flat")
3781 ("default"
3782 ("dired" (mode . dired-mode))
3783 ("perl" (mode . cperl-mode))
3784 ("puppet" (or
3785 (mode . puppet-mode)
3786 (mode . yaml-mode)))
3787 ("ruby" (mode . ruby-mode))
3788 ("emacs" (or
3789 (name . "^\\*scratch\\*$")
3790 (name . "^\\*Compile-log\\*$")
3791 (name . "^\\*Completions\\*$")
3792 (name . "^\\*Messages\\*$")
3793 (name . "^\\*Backtrace\\*$")
3794 (name . "^\\*Packages*\\*$")
3795 (name . "^\\*Help*\\*$")
3796 (mode . grep-mode)
3797 ))
3798 ("gnus" (or
3799 (mode . message-mode)
3800 (mode . bbdb-mode)
3801 (mode . mail-mode)
3802 (mode . gnus-group-mode)
3803 (mode . gnus-summary-mode)
3804 (mode . gnus-article-mode)
3805 (name . "^\\.bbdb$")
3806 (name . "^\\.newsrc-dribble")))
3807 ("org agenda" (or
3808 (mode . org-agenda-mode)
3809 (name . "^*Org Agenda")))
3810 ("org" (or
3811 (filename . ".*/org/.*")
3812 ;(mode . org-agenda-mode)
3813 (name . "^diary$")))
3814 ("scm" (or
3815 (mode . magit-status-mode)
3816 (mode . magit-log-mode)
3817 (mode . magit-diff-mode)
3818 (mode . magit-refs-mode)
3819 (mode . magit-revision-mode)
3820 (mode . vc-annotate-mode)))
3821 ("Tramp" (or
3822 (name . "^\\*\\(tramp/.*\\)\\*$")))
3823 ("code" (or
3824 (mode . emacs-lisp-mode)
3825 (mode . python-mode)
3826 (mode . ruby-mode)
3827 (mode . coffee-mode)
3828 (mode . js-mode)
3829 (mode . js2-mode)
3830 (mode . actionscript-mode)
3831 (mode . java-mode)
3832 (mode . sh-mode)
3833 (mode . haskell-mode)
3834 (mode . html-mode)
3835 (mode . web-mode)
3836 (mode . haml-mode)
3837 (mode . nxml-mode)
3838 (mode . go-mode)
3839 (mode . rust-mode)
3840 (mode . css-mode)))
3841 ("other" (or
3842 (mode . magit-log-edit-mode)
3843 (name . "^\\*magit-\\(process\\|commit\\)\\*$"))))
3844 ("categorized"
3845 ;; -------------------------------------------------
3846 ;; programming languages #1
3847 ("code" (or
3848 (mode . emacs-lisp-mode)
3849 (mode . python-mode)
3850 (mode . ruby-mode)
3851 (mode . coffee-mode)
3852 (mode . js-mode)
3853 (mode . js2-mode)
3854 (mode . actionscript-mode)
3855 (mode . java-mode)
3856 (mode . sh-mode)
3857 (mode . haskell-mode)
3858 (mode . html-mode)
3859 (mode . web-mode)
3860 (mode . haml-mode)
3861 (mode . nxml-mode)
3862 (mode . go-mode)
3863 (mode . rust-mode)
3864 (mode . css-mode)))
3865 ;; -------------------------------------------------
3866 ;; configuration/data files
3867 ("conf" (or
3868 (mode . json-mode)
3869 (mode . yaml-mode)
3870 (mode . conf-mode)))
3871 ;; -------------------------------------------------
3872 ;; text/notetaking/org
3873 ("org agenda" (mode . org-agenda-mode))
3874 ("org" (or
3875 (mode . org-mode)
3876 (name . "^\\*Calendar\\*$")
3877 (name . "^diary$")))
3878 ("text misc" (or
3879 (mode . text-mode)
3880 (mode . rst-mode)
3881 (mode . markdown-mode)))
3882 ;; -------------------------------------------------
3883 ;; media
3884 ("media" (or
3885 (mode . image-mode)))
3886 ;; -------------------------------------------------
3887 ;; misc
3888 ("w3m" (mode . w3m-mode))
3889 ("scm" (or
3890 (mode . magit-status-mode)
3891 (mode . magit-log-mode)
3892 (mode . vc-annotate-mode)))
3893 ("dired" (mode . dired-mode))
3894 ("help" (or
3895 (mode . Info-mode)
3896 (mode . help-mode)
3897 (mode . Man-mode)
3898 (name . "^\\*Personal Keybindings\\*$")))
3899 ("Tramp" (or
3900 (name . "^\\*\\(tramp/.*\\)\\*$")))
3901 ;; -------------------------------------------------
3902 ;; *buffer* buffers
3903 ("MORE" (or (mode . magit-log-edit-mode)
3904 (name . "^\\*\\(traad-server\\|httpd\\|epc con.*\\|tramp/.*\\|Completions\\)\\*$")
3905 (name . "^\\*Pymacs\\*$")
3906 (name . "^\\*Compile-log\\*$")
3907 (name . "^\\*Completions\\*$")
3908 (name . "^\\*magit-\\(process\\|commit\\)\\*$")
3909 (name . "^ ")))
3910 ("*buffer*" (name . "\\*.*\\*"))))))
3911
3912 (add-hook 'ibuffer-mode-hook
3913 (lambda ()
3914 (ibuffer-auto-mode 1)
3915 (ibuffer-switch-to-saved-filter-groups "default")))
3916
3917 ;; Unless you turn this variable on you will be prompted every time
3918 ;; you want to delete a buffer, even unmodified ones, which is way
3919 ;; too cautious for most people. You’ll still be prompted for
3920 ;; confirmation when deleting modified buffers after the option has
3921 ;; been turned off.
3922 (validate-setq ibuffer-expert t)
3923 ))
3924 #+END_SRC
3925 ** ivy-mode, swiper, counsel
3926 [2015-10-16 Fri 16:28]
3927 Full docs at http://oremacs.com/swiper/
3928 #+BEGIN_SRC emacs-lisp
3929 (use-package swiper
3930 :ensure swiper
3931 :bind (("C-s" . swiper)
3932 ("C-r" . swiper)
3933 ("C-c r" . ivy-resume)
3934 ("<f7>" . ivy-resume))
3935 :config
3936 (progn
3937 ;(ivy-mode 1)
3938 (validate-setq ivy-use-virtual-buffers t)
3939 (setq ivy-count-format "(%d/%d) ")
3940 ;;advise swiper to recenter on exit
3941 (defun bjm-swiper-recenter (&rest args)
3942 "recenter display after swiper"
3943 (recenter)
3944 )
3945 (advice-add 'swiper :after #'bjm-swiper-recenter)
3946 ))
3947 #+END_SRC
3948 counsel is a collection of Ivy enhanced versions of common Emacs
3949 commands, see https://github.com/abo-abo/swiper
3950 #+BEGIN_SRC emacs-lisp
3951 (use-package counsel
3952 :ensure t
3953 :bind (("M-y" . counsel-yank-pop)
3954 ("M-x" . counsel-M-x)
3955 ("C-x C-f" . counsel-find-file)
3956 ("<f1> f" . counsel-describe-function)
3957 ("<f1> u" . counsel-unicode-char)
3958 ("C-c j" . counsel-git-grep)
3959 :map ivy-minibuffer-map
3960 ("M-y" . ivy-next-line)))
3961 #+END_SRC
3962 ** icicles
3963 [[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles]["In case you never heard of it, Icicles is to ‘TAB’ completion what
3964 ‘TAB’ completion is to typing things manually every time.”]]
3965 #+BEGIN_SRC emacs-lisp
3966 (use-package icicles
3967 :ensure icicles
3968 :config
3969 (icy-mode 1))
3970 #+END_SRC
3971 ** CANCELLED icomplete :CANCELLED:
3972 CLOSED: [2017-08-26 Sat 14:44]
3973 :LOGBOOK:
3974 - State "CANCELLED" from [2017-08-26 Sat 14:44] \\
3975 ivy and icomplete dont work together
3976 :END:
3977 Incremental mini-buffer completion preview: Type in the minibuffer,
3978 list of matching commands is echoed
3979 #+BEGIN_SRC emacs-lisp
3980 (icomplete-mode 99)
3981 #+END_SRC
3982 ** iedit
3983 [2014-05-26 Mon 22:49]
3984 #+BEGIN_SRC emacs-lisp
3985 (use-package iedit
3986 :ensure iedit
3987 :commands (iedit-mode)
3988 :defer t
3989 :bind (("C-;" . iedit-mode)
3990 ("C-," . iedit-mode-toggle-on-function))
3991 )
3992
3993 #+END_SRC
3994 ** info stuff
3995 [2014-05-20 Tue 23:35]
3996 #+BEGIN_SRC emacs-lisp
3997 (use-package info
3998 :bind ("C-h C-i" . info-lookup-symbol)
3999 :commands info-lookup-symbol
4000 :config
4001 (progn
4002 ;; (defadvice info-setup (after load-info+ activate)
4003 ;; (use-package info+))
4004
4005 (defadvice Info-exit (after remove-info-window activate)
4006 "When info mode is quit, remove the window."
4007 (if (> (length (window-list)) 1)
4008 (delete-window)))))
4009
4010 (use-package info-look
4011 :commands info-lookup-add-help)
4012 #+END_SRC
4013 ** ispell
4014 [2016-11-13 Sun 13:22]
4015 #+BEGIN_SRC emacs-lisp
4016 (use-package ispell
4017 :defer t
4018 :config
4019 (progn
4020 (validate-setq ispell-personal-dictionary (expand-file-name "~/flydict" jj-cache-dir))
4021
4022 (validate-setq ispell-dictionary "de_DE")
4023 (validate-setq ispell-program-name "hunspell")
4024 (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))
4025 (add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_EXAMPLE" . "#\\+END_EXAMPLE"))
4026 ))
4027 #+END_SRC
4028 ** linum (line number)
4029 Various modes should have line numbers in front of each line.
4030
4031 But then there are some where it would just be deadly - like org-mode,
4032 gnus, so we have a list of modes where we don't want to see it.
4033 #+BEGIN_SRC emacs-lisp
4034 (use-package linum
4035 :diminish linum-mode
4036 :config
4037 (progn
4038 (validate-setq linum-format "%3d ")
4039 (setq linum-mode-inhibit-modes-list '(org-mode
4040 eshell-mode
4041 shell-mode
4042 gnus-group-mode
4043 gnus-summary-mode
4044 gnus-article-mode))
4045
4046 (defadvice linum-on (around linum-on-inhibit-for-modes)
4047 "Stop the load of linum-mode for some major modes."
4048 (unless (member major-mode linum-mode-inhibit-modes-list)
4049 ad-do-it))
4050
4051 (ad-activate 'linum-on)
4052
4053 (use-package linum-relative
4054 :ensure linum-relative
4055 :init
4056 (progn
4057 (validate-setq linum-format 'dynamic)
4058 )))
4059 :init
4060 (global-linum-mode 1))
4061
4062 (use-package hlinum
4063 :ensure t
4064 :config
4065 (progn
4066 (hlinum-activate)))
4067 #+END_SRC
4068
4069 ** lisp editing stuff
4070
4071 [2013-04-21 So 21:00]
4072 I'm not doing much of it, except for my emacs and gnus configs, but
4073 then I like it nice too...
4074 #+BEGIN_SRC emacs-lisp
4075 (bind-key "TAB" 'lisp-complete-symbol read-expression-map)
4076 (bind-key "M-." 'find-function-at-point emacs-lisp-mode-map)
4077
4078 (defun remove-elc-on-save ()
4079 "If you're saving an elisp file, likely the .elc is no longer valid."
4080 (make-local-variable 'after-save-hook)
4081 (add-hook 'after-save-hook
4082 (lambda ()
4083 (if (file-exists-p (concat buffer-file-name "c"))
4084 (delete-file (concat buffer-file-name "c"))))))
4085
4086 (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
4087 (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
4088
4089 (use-package paredit
4090 :ensure paredit
4091 :diminish paredit-mode " π")
4092
4093 (setq lisp-coding-hook 'lisp-coding-defaults)
4094 (setq interactive-lisp-coding-hook 'interactive-lisp-coding-defaults)
4095
4096 (setq prelude-emacs-lisp-mode-hook 'prelude-emacs-lisp-mode-defaults)
4097 (add-hook 'emacs-lisp-mode-hook (lambda ()
4098 (run-hooks 'prelude-emacs-lisp-mode-hook)))
4099
4100
4101 (after "elisp-slime-nav"
4102 '(diminish 'elisp-slime-nav-mode))
4103 (after "rainbow-mode"
4104 '(diminish 'rainbow-mode))
4105 (after "eldoc"
4106 '(diminish 'eldoc-mode))
4107 #+END_SRC
4108 ** lua
4109 [2016-10-27 Thu 17:49]
4110 Lua editing
4111 #+BEGIN_SRC emacs-lisp
4112 (use-package lua-mode
4113 :ensure t
4114 :commands lua-mode
4115 :mode ("\\.lua" . lua-mode))
4116 #+END_SRC
4117 ** magit
4118 [2013-04-21 So 20:48]
4119 magit is a mode for interacting with git.
4120 #+BEGIN_SRC emacs-lisp
4121 (use-package magit
4122 :ensure magit
4123 :commands (magit-log magit-run-gitk magit-run-git-gui magit-status
4124 magit-git-repo-p magit-list-repos)
4125 :bind (("C-x g" . magit-status)
4126 ("C-x G" . magit-status-with-prefix)
4127 :map magit-status-mode-map
4128 ("q" . magit-quit-session ))
4129
4130 :config
4131 (progn
4132 (setq magit-repository-directories '("~/devel"
4133 "~/git/"
4134 ))
4135 (setq magit-repository-directories-depth 4)
4136 (setq magit-log-auto-more t)
4137 (setq magit-completing-read-function 'ivy-completing-read)
4138
4139 ; VC shouldnt do anything with git
4140 (setq vc-handled-backends (delq 'Git vc-handled-backends))
4141
4142 (use-package magit-blame
4143 :commands magit-blame-mode)
4144
4145 (add-hook 'magit-mode-hook 'hl-line-mode)
4146 (defun magit-status-with-prefix ()
4147 (interactive)
4148 (let ((current-prefix-arg '(4)))
4149 (call-interactively 'magit-status)))
4150 (setenv "GIT_PAGER" "")
4151
4152 (unbind-key "M-h" magit-mode-map)
4153 (unbind-key "M-s" magit-mode-map)
4154 (add-to-list 'magit-no-confirm 'stage-all-changes)
4155 (setq magit-push-always-verify nil)
4156
4157 (add-hook 'magit-log-edit-mode-hook
4158 #'(lambda ()
4159 (set-fill-column 72)
4160 (flyspell-mode)))
4161
4162 (add-hook 'git-rebase-mode-hook
4163 #'(lambda ()
4164 (smartscan-mode 0))
4165 )
4166 (defadvice magit-status (around magit-fullscreen activate)
4167 (window-configuration-to-register :magit-fullscreen)
4168 ad-do-it
4169 (delete-other-windows))
4170
4171 (defun magit-quit-session ()
4172 "Restores the previous window configuration and kills the magit buffer"
4173 (interactive)
4174 (kill-buffer)
4175 (jump-to-register :magit-fullscreen))
4176
4177 (defun magit-rebase-unpushed (commit &optional args)
4178 "Start an interactive rebase sequence over all unpushed commits."
4179 (interactive (list (magit-get-tracked-branch)
4180 (magit-rebase-arguments)))
4181 (if (setq commit (magit-rebase-interactive-assert commit))
4182 (magit-run-git-sequencer "rebase" "-i" commit args)
4183 (magit-log-select
4184 `(lambda (commit)
4185 (magit-rebase-interactive (concat commit "^") (list ,@args))))))
4186
4187 (magit-define-popup-action 'magit-rebase-popup ?l "Rebase unpushed" 'magit-rebase-unpushed)
4188 ))
4189 #+END_SRC
4190 ** markdown-mode
4191 [2014-05-20 Tue 23:04]
4192 #+BEGIN_SRC emacs-lisp
4193 (use-package markdown-mode
4194 :ensure t
4195 :mode (("\\.md\\'" . markdown-mode)
4196 ("\\.mdwn\\'" . markdown-mode))
4197 :defer t)
4198 #+END_SRC
4199 ** message
4200 #+BEGIN_SRC emacs-lisp
4201 (use-package message
4202 :config
4203 (progn
4204 (validate-setq message-kill-buffer-on-exit t)))
4205 #+END_SRC
4206 ** CANCELLED mingus :CANCELLED:
4207 CLOSED: [2017-08-26 Sat 15:18]
4208 :LOGBOOK:
4209 - State "CANCELLED" from [2017-08-26 Sat 15:18]
4210 :END:
4211 [[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
4212
4213 I want to access it from anywhere using =F6=.
4214 #+BEGIN_SRC emacs-lisp :tangle no
4215 (use-package mingus-stays-home
4216 :bind ( "<f6>" . mingus)
4217 :defer t
4218 :config
4219 (progn
4220 (validate-setq mingus-dired-add-keys t)
4221 (validate-setq mingus-mode-always-modeline nil)
4222 (validate-setq mingus-mode-line-show-elapsed-percentage nil)
4223 (validate-setq mingus-mode-line-show-volume nil)
4224 (validate-setq mingus-mpd-config-file "/etc/mpd.conf")
4225 (validate-setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
4226 (validate-setq mingus-mpd-root "/share/music/")))
4227 #+END_SRC
4228
4229 ** miniedit
4230 Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
4231 #+BEGIN_SRC emacs-lisp
4232 (use-package miniedit
4233 :ensure miniedit
4234 :commands miniedit
4235 :config
4236 (progn
4237 (bind-key "M-C-e" 'miniedit minibuffer-local-map)
4238 (bind-key "M-C-e" 'miniedit minibuffer-local-ns-map)
4239 (bind-key "M-C-e" 'miniedit minibuffer-local-completion-map)
4240 (bind-key "M-C-e" 'miniedit minibuffer-local-must-match-map)
4241 ))
4242 #+END_SRC
4243
4244 ** CANCELLED mmm-mode :CANCELLED:
4245 CLOSED: [2017-08-26 Sat 15:18]
4246 :LOGBOOK:
4247 - State "CANCELLED" from [2017-08-26 Sat 15:18]
4248 :END:
4249 [2013-05-21 Tue 23:39]
4250 MMM Mode is a minor mode for Emacs that allows Multiple Major Modes to
4251 coexist in one buffer.
4252 #+BEGIN_SRC emacs-lisp :tangle no
4253 (use-package mmm-auto
4254 :ensure mmm-mode
4255 :init
4256 (progn
4257 (validate-setq mmm-global-mode 'buffers-with-submode-classes)
4258 (validate-setq mmm-submode-decoration-level 2)
4259 (eval-after-load 'mmm-vars
4260 '(progn
4261 (mmm-add-group
4262 'html-css
4263 '((css-cdata
4264 :submode css-mode
4265 :face mmm-code-submode-face
4266 :front "<style[^>]*>[ \t\n]*\\(//\\)?<!\\[CDATA\\[[ \t]*\n?"
4267 :back "[ \t]*\\(//\\)?]]>[ \t\n]*</style>"
4268 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
4269 @ "\n" _ "\n" @ "</script>" @)))
4270 (css
4271 :submode css-mode
4272 :face mmm-code-submode-face
4273 :front "<style[^>]*>[ \t]*\n?"
4274 :back "[ \t]*</style>"
4275 :insert ((?j js-tag nil @ "<style type=\"text/css\">"
4276 @ "\n" _ "\n" @ "</style>" @)))
4277 (css-inline
4278 :submode css-mode
4279 :face mmm-code-submode-face
4280 :front "style=\""
4281 :back "\"")))
4282 (dolist (mode (list 'html-mode 'nxml-mode))
4283 (mmm-add-mode-ext-class mode "\\.r?html\\(\\.erb\\)?\\'" 'html-css))
4284 (mmm-add-mode-ext-class 'html-mode "\\.php\\'" 'html-php)
4285 ))))
4286 #+END_SRC
4287
4288 ** mo-git-blame
4289 This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
4290 Emacs]].
4291 #+BEGIN_SRC emacs-lisp
4292 (use-package mo-git-blame
4293 :ensure mo-git-blame
4294 :commands (mo-git-blame-current
4295 mo-git-blame-file)
4296 :config
4297 (progn
4298 (validate-setq mo-git-blame-blame-window-width 25)))
4299 #+END_SRC
4300
4301 ** CANCELLED multiple cursors :CANCELLED:
4302 CLOSED: [2017-08-26 Sat 15:18]
4303 :LOGBOOK:
4304 - State "CANCELLED" from [2017-08-26 Sat 15:18]
4305 :END:
4306 [2013-04-08 Mon 23:57]
4307 Use multiple cursors mode. See [[http://emacsrocks.com/e13.html][Emacs Rocks! multiple cursors]] and
4308 [[https://github.com/emacsmirror/multiple-cursors][emacsmirror/multiple-cursors · GitHub]]
4309 #+BEGIN_SRC emacs-lisp :tangle no
4310 (use-package multiple-cursors
4311 :ensure multiple-cursors
4312 :defer t
4313 :commands (mc/remove-fake-cursors
4314 mc/create-fake-cursor-at-point
4315 mc/pop-state-from-overlay
4316 mc/maybe-multiple-cursors-mode)
4317 :defines (multiple-cursors-mode
4318 mc--read-char
4319 mc--read-quoted-char
4320 rectangular-region-mode)
4321 :bind (("C-S-c C-S-c" . mc/edit-lines)
4322 ("C->" . mc/mark-next-like-this)
4323 ("C-<" . mc/mark-previous-like-this)
4324 ("C-c C-<" . mc/mark-all-like-this)
4325 ("C-c i" . mc/insert-numbers))
4326 :config
4327 (progn
4328 (bind-key "a" 'mc/mark-all-like-this region-bindings-mode-map)
4329 (bind-key "p" 'mc/mark-previous-like-this region-bindings-mode-map)
4330 (bind-key "n" 'mc/mark-next-like-this region-bindings-mode-map)
4331 (bind-key "l" 'mc/edit-lines region-bindings-mode-map)
4332 (bind-key "m" 'mc/mark-more-like-this-extended region-bindings-mode-map)
4333 (validate-setq mc/list-file (expand-file-name "mc-cache.el" jj-cache-dir))))
4334 #+END_SRC
4335 ** neotree
4336 [2014-08-27 Wed 17:15]
4337 A emacs tree plugin
4338 #+BEGIN_SRC emacs-lisp
4339 (use-package neotree
4340 :ensure neotree
4341 :defer t
4342 :bind (("<f8>" . neotree-toggle))
4343 :commands (neotree-find
4344 neotree-toggle
4345 neotree)
4346 :config
4347 (progn
4348 (bind-key "^" 'neotree-select-up-node neotree-mode-map)
4349 (validate-setq neo-smart-open t)))
4350
4351 #+END_SRC
4352 ** notmuch
4353 [2016-10-24 Mon 18:18]
4354 Nice email search
4355 #+BEGIN_SRC emacs-lisp
4356 (use-package notmuch
4357 :ensure t
4358 :defer t
4359 :commands (notmuch)
4360 :config
4361 (progn
4362 (validate-setq notmuch-search-oldest-first nil)))
4363 #+END_SRC
4364 ** nxml
4365 [2013-05-22 Wed 22:02]
4366 nxml-mode is a major mode for editing XML.
4367 #+BEGIN_SRC emacs-lisp
4368 (use-package nxml-mode
4369 :mode (("web.config$" . xml-mode)
4370 ("\\.xml" . xml-mode)
4371 ("\\.xsd" . xml-mode)
4372 ("\\.sch" . xml-mode)
4373 ("\\.rng" . xml-mode)
4374 ("\\.xslt" . xml-mode)
4375 ("\\.svg" . xml-mode)
4376 ("\\.rss" . xml-mode)
4377 ("\\.gpx" . xml-mode)
4378 ("\\.tcx" . xml-mode))
4379 :defer t
4380 :config
4381 (progn
4382 (setq nxml-child-indent 4)
4383 (setq nxml-slash-auto-complete-flag t)
4384 ;(add-hook 'nxml-mode-hook (lambda () (emmet-mode t)))
4385
4386 (fset 'xml-mode 'nxml-mode)
4387 (validate-setq nxml-slash-auto-complete-flag t)
4388
4389 ;; See: http://sinewalker.wordpress.com/2008/06/26/pretty-printing-xml-with-emacs-nxml-mode/
4390 (defun pp-xml-region (begin end)
4391 "Pretty format XML markup in region. The function inserts
4392 linebreaks to separate tags that have nothing but whitespace
4393 between them. It then indents the markup by using nxml's
4394 indentation rules."
4395 (interactive "r")
4396 (save-excursion
4397 (nxml-mode)
4398 (goto-char begin)
4399 (while (search-forward-regexp "\>[ \\t]*\<" nil t)
4400 (backward-char) (insert "\n"))
4401 (indent-region begin end)))
4402
4403 ;;----------------------------------------------------------------------------
4404 ;; Integration with tidy for html + xml
4405 ;;----------------------------------------------------------------------------
4406 ;; tidy is autoloaded
4407 (eval-after-load 'tidy
4408 '(progn
4409 (add-hook 'nxml-mode-hook (lambda () (tidy-build-menu nxml-mode-map)))
4410 (add-hook 'html-mode-hook (lambda () (tidy-build-menu html-mode-map)))
4411 ))))
4412
4413 #+END_SRC
4414 ** org :FIXME:
4415 *** General settings
4416 [2013-04-28 So 17:06]
4417
4418 I use org-mode a lot and, having my config for this based on [[*Bernt%20Hansen][the config of Bernt Hansen]],
4419 it is quite extensive. Nevertheless, it starts out small, loading it.
4420 #+BEGIN_SRC emacs-lisp
4421 (require 'org)
4422 #+END_SRC
4423
4424 My browsers (Conkeror, Iceweasel) can store links in org-mode. For
4425 that we need org-protocol.
4426 #+BEGIN_SRC emacs-lisp
4427 (require 'org-protocol)
4428 #+END_SRC
4429
4430 *** Agenda
4431
4432 My current =org-agenda-files= variable only includes a set of
4433 directories.
4434 #+BEGIN_SRC emacs-lisp
4435 (setq org-agenda-files (quote ("~/org/"
4436 "~/org/nsb"
4437 )))
4438 (setq org-default-notes-file "~/org/notes.org")
4439 #+END_SRC
4440 =org-mode= manages the =org-agenda-files= variable automatically using
4441 =C-c [= and =C-c ]= to add and remove files respectively. However,
4442 this replaces my directory list with a list of explicit filenames
4443 instead and is not what I want. If this occurs then adding a new org
4444 file to any of the above directories will not contribute to my agenda
4445 and I will probably miss something important.
4446
4447 I have disabled the =C-c [= and =C-c ]= keys in =org-mode-hook= to
4448 prevent messing up my list of directories in the =org-agenda-files=
4449 variable. I just add and remove directories manually here. Changing
4450 the list of directories in =org-agenda-files= happens very rarely
4451 since new files in existing directories are automatically picked up.
4452
4453 #+BEGIN_SRC emacs-lisp
4454 ;; Keep tasks with dates on the global todo lists
4455 (setq org-agenda-todo-ignore-with-date nil)
4456
4457 ;; Keep tasks with deadlines on the global todo lists
4458 (setq org-agenda-todo-ignore-deadlines nil)
4459
4460 ;; Keep tasks with scheduled dates on the global todo lists
4461 (setq org-agenda-todo-ignore-scheduled nil)
4462
4463 ;; Keep tasks with timestamps on the global todo lists
4464 (setq org-agenda-todo-ignore-timestamp nil)
4465
4466 ;; Remove completed deadline tasks from the agenda view
4467 (setq org-agenda-skip-deadline-if-done t)
4468
4469 ;; Remove completed scheduled tasks from the agenda view
4470 (setq org-agenda-skip-scheduled-if-done t)
4471
4472 ;; Remove completed items from search results
4473 (setq org-agenda-skip-timestamp-if-done t)
4474
4475 ;; Include agenda archive files when searching for things
4476 (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
4477
4478 ;; Show all future entries for repeating tasks
4479 (setq org-agenda-repeating-timestamp-show-all t)
4480
4481 ;; Show all agenda dates - even if they are empty
4482 (setq org-agenda-show-all-dates t)
4483
4484 ;; Sorting order for tasks on the agenda
4485 (setq org-agenda-sorting-strategy
4486 (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
4487 (todo category-up priority-down effort-up)
4488 (tags category-up priority-down effort-up)
4489 (search category-up))))
4490
4491 ;; Start the weekly agenda on Monday
4492 (setq org-agenda-start-on-weekday 1)
4493
4494 ;; Enable display of the time grid so we can see the marker for the current time
4495 (setq org-agenda-time-grid (quote ((daily today remove-match)
4496 #("----------------" 0 16 (org-heading t))
4497 (0800 1000 1200 1400 1500 1700 1900 2100))))
4498
4499 ;; Display tags farther right
4500 (setq org-agenda-tags-column -102)
4501
4502 ; position the habit graph on the agenda to the right of the default
4503 (setq org-habit-graph-column 50)
4504
4505 ; turn habits back on
4506 (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
4507
4508 ;;
4509 ;; Agenda sorting functions
4510 ;;
4511 (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
4512
4513
4514 (setq org-deadline-warning-days 30)
4515
4516 ;; Always hilight the current agenda line
4517 (add-hook 'org-agenda-mode-hook
4518 '(lambda () (hl-line-mode 1))
4519 'append)
4520 #+END_SRC
4521
4522 #+BEGIN_SRC emacs-lisp
4523 (setq org-agenda-persistent-filter t)
4524 (add-hook 'org-agenda-mode-hook
4525 '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
4526 'append)
4527
4528 (add-hook 'org-agenda-mode-hook
4529 '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
4530 'append)
4531
4532 (add-hook 'org-agenda-mode-hook
4533 '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
4534 'append)
4535
4536 (add-hook 'org-agenda-mode-hook
4537 '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
4538 'append)
4539
4540 (add-hook 'org-agenda-mode-hook
4541 '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
4542 'append)
4543
4544 ; Rebuild the reminders everytime the agenda is displayed
4545 (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
4546
4547 ;(if (file-exists-p "~/org/refile.org")
4548 ; (add-hook 'after-init-hook 'bh/org-agenda-to-appt))
4549
4550 ; Activate appointments so we get notifications
4551 (appt-activate t)
4552
4553 (setq org-agenda-log-mode-items (quote (closed clock state)))
4554 (if (> emacs-major-version 23)
4555 (setq org-agenda-span 3)
4556 (setq org-agenda-ndays 3))
4557
4558 (setq org-agenda-show-all-dates t)
4559 (setq org-agenda-start-on-weekday nil)
4560 (setq org-deadline-warning-days 14)
4561
4562 #+END_SRC
4563 *** Global keybindings.
4564 Start off by defining a series of keybindings.
4565
4566 Well, first we remove =C-c [= and =C-c ]=, as all agenda directories are
4567 setup manually, not by org-mode. Also turn off =C-c ;=, which
4568 comments headlines - a function never used.
4569 #+BEGIN_SRC emacs-lisp
4570 (add-hook 'org-mode-hook
4571 (lambda ()
4572 (org-defkey org-mode-map "\C-c[" 'undefined)
4573 (org-defkey org-mode-map "\C-c]" 'undefined)
4574 (org-defkey org-mode-map "\C-c;" 'undefined))
4575 'append)
4576 #+END_SRC
4577
4578 And now a largish set of keybindings...
4579 #+BEGIN_SRC emacs-lisp
4580 (bind-key "C-c l" 'org-store-link)
4581 (bind-key "C-c a" 'org-agenda)
4582 ;(bind-key "C-c b" 'org-iswitchb)
4583 (define-key mode-specific-map [?a] 'org-agenda)
4584
4585 (bind-key "<f12>" 'org-agenda)
4586 (bind-key "<f5>" 'bh/org-todo)
4587 (bind-key "<S-f5>" 'bh/widen)
4588 ;(bind-key "<f7>" 'bh/set-truncate-lines)
4589 ;(bind-key "<f8>" 'org-cycle-agenda-files)
4590
4591 (bind-key "<f9> <f9>" 'bh/show-org-agenda)
4592 (bind-key "<f9> b" 'bbdb)
4593 (bind-key "<f9> c" 'calendar)
4594 (bind-key "<f9> f" 'boxquote-insert-file)
4595 (bind-key "<f9> h" 'bh/hide-other)
4596 (bind-key "<f9> n" 'org-narrow-to-subtree)
4597 (bind-key "<f9> w" 'widen)
4598 (bind-key "<f9> u" 'bh/narrow-up-one-level)
4599 (bind-key "<f9> I" 'bh/punch-in)
4600 (bind-key "<f9> O" 'bh/punch-out)
4601 (bind-key "<f9> H" 'jj/punch-in-hw)
4602 (bind-key "<f9> W" 'jj/punch-out-hw)
4603 (bind-key "<f9> o" 'bh/make-org-scratch)
4604 (bind-key "<f9> p" 'bh/phone-call)
4605 (bind-key "<f9> r" 'boxquote-region)
4606 (bind-key "<f9> s" 'bh/switch-to-scratch)
4607 (bind-key "<f9> t" 'bh/insert-inactive-timestamp)
4608 (bind-key "<f9> T" 'tabify)
4609 (bind-key "<f9> U" 'untabify)
4610 (bind-key "<f9> v" 'visible-mode)
4611 (bind-key "<f9> SPC" 'bh/clock-in-last-task)
4612 (bind-key "C-<f9>" 'previous-buffer)
4613 (bind-key "C-<f10>" 'next-buffer)
4614 (bind-key "M-<f9>" 'org-toggle-inline-images)
4615 ;(bind-key "C-x n r" 'narrow-to-region)
4616 (bind-key "<f11>" 'org-clock-goto)
4617 (bind-key "C-<f11>" 'org-clock-in)
4618 (bind-key "C-M-r" 'org-capture)
4619 ;(bind-key "C-c r" 'org-capture)
4620 (bind-key "C-S-<f12>" 'bh/save-then-publish)
4621 ;(bind-key "C-k" 'jj-org-kill-line org-mode-map)
4622
4623 #+END_SRC
4624
4625 *** Tasks, States, Todo fun
4626
4627 First we define the global todo keywords.
4628 #+BEGIN_SRC emacs-lisp
4629 (setq org-todo-keywords
4630 (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)")
4631 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
4632
4633 (setq org-todo-keyword-faces
4634 (quote (("TODO" :foreground "red" :weight bold)
4635 ("NEXT" :foreground "light blue" :weight bold)
4636 ("DONE" :foreground "forest green" :weight bold)
4637 ("WAITING" :foreground "orange" :weight bold)
4638 ("HOLD" :foreground "orange" :weight bold)
4639 ("DELEGATED" :foreground "yellow" :weight bold)
4640 ("CANCELLED" :foreground "dark green" :weight bold)
4641 ("PHONE" :foreground "dark green" :weight bold))))
4642 #+END_SRC
4643
4644 **** Fast Todo Selection
4645 Fast todo selection allows changing from any task todo state to any
4646 other state directly by selecting the appropriate key from the fast
4647 todo selection key menu.
4648 #+BEGIN_SRC emacs-lisp
4649 (setq org-use-fast-todo-selection t)
4650 #+END_SRC
4651 Changing a task state is done with =C-c C-t KEY=
4652
4653 where =KEY= is the appropriate fast todo state selection key as defined in =org-todo-keywords=.
4654
4655 The setting
4656 #+BEGIN_SRC emacs-lisp
4657 (setq org-treat-S-cursor-todo-selection-as-state-change nil)
4658 #+END_SRC
4659 allows changing todo states with S-left and S-right skipping all of
4660 the normal processing when entering or leaving a todo state. This
4661 cycles through the todo states but skips setting timestamps and
4662 entering notes which is very convenient when all you want to do is fix
4663 up the status of an entry.
4664
4665 **** Todo State Triggers
4666 I have a few triggers that automatically assign tags to tasks based on
4667 state changes. If a task moves to =CANCELLED= state then it gets a
4668 =CANCELLED= tag. Moving a =CANCELLED= task back to =TODO= removes the
4669 =CANCELLED= tag. These are used for filtering tasks in agenda views
4670 which I'll talk about later.
4671
4672 The triggers break down to the following rules:
4673
4674 - Moving a task to =CANCELLED= adds a =CANCELLED= tag
4675 - Moving a task to =WAITING= adds a =WAITING= tag
4676 - Moving a task to =HOLD= adds a =WAITING= tag
4677 - Moving a task to a done state removes a =WAITING= tag
4678 - Moving a task to =TODO= removes =WAITING= and =CANCELLED= tags
4679 - Moving a task to =NEXT= removes a =WAITING= tag
4680 - Moving a task to =DONE= removes =WAITING= and =CANCELLED= tags
4681
4682 The tags are used to filter tasks in the agenda views conveniently.
4683 #+BEGIN_SRC emacs-lisp
4684 (setq org-todo-state-tags-triggers
4685 (quote (("CANCELLED" ("CANCELLED" . t))
4686 ("WAITING" ("WAITING" . t))
4687 ("HOLD" ("WAITING" . t) ("HOLD" . t))
4688 (done ("WAITING") ("HOLD"))
4689 ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
4690 ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
4691 ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
4692 #+END_SRC
4693
4694 *** Capturing new tasks
4695 Org capture replaces the old remember mode.
4696 #+BEGIN_SRC emacs-lisp
4697 (setq org-directory "~/org")
4698 (setq org-default-notes-file "~/org/refile.org")
4699
4700 ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
4701 ;; see http://orgmode.org/manual/Template-elements.html
4702 (setq org-capture-templates
4703 (quote (("t" "todo" entry (file "~/org/refile.org")
4704 "* TODO %?\nAdded: %U\n"
4705 :clock-in t :clock-resume t)
4706 ("l" "linktodo" entry (file "~/org/refile.org")
4707 "* TODO %?\nAdded: %U\n%a\n"
4708 :clock-in t :clock-resume t)
4709 ("r" "respond" entry (file "~/org/refile.org")
4710 "* TODO Respond to %:from on %:subject\nSCHEDULED: %t\nAdded: %U\n%a\n"
4711 :clock-in t :clock-resume t :immediate-finish t)
4712 ("n" "note" entry (file "~/org/refile.org")
4713 "* %? :NOTE:\nAdded: %U\n%a\n"
4714 :clock-in t :clock-resume t)
4715 ("d" "Delegated" entry (file "~/org/refile.org")
4716 "* DELEGATED %?\nAdded: %U\n%a\n"
4717 :clock-in t :clock-resume t)
4718 ("j" "Journal" entry (file+datetree "~/org/diary.org")
4719 "* %?\nAdded: %U\n"
4720 :clock-in t :clock-resume t)
4721 ("w" "org-protocol" entry (file "~/org/refile.org")
4722 "* TODO Review %c\nAdded: %U\n"
4723 :immediate-finish t)
4724 ("p" "Phone call" entry (file "~/org/refile.org")
4725 "* PHONE %? :PHONE:\nAdded: %U"
4726 :clock-in t :clock-resume t)
4727 ("x" "Bookmark link" entry (file "~/org/refile.org")
4728 "* Bookmark: %c\n%i\nAdded: %U\n"
4729 :immediate-finish t)
4730 ("h" "Habit" entry (file "~/org/refile.org")
4731 "* 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")
4732 )))
4733 #+END_SRC
4734
4735 Capture mode now handles automatically clocking in and out of a
4736 capture task. This all works out of the box now without special hooks.
4737 When I start a capture mode task the task is clocked in as specified
4738 by =:clock-in t= and when the task is filed with =C-c C-c= the clock
4739 resumes on the original clocking task.
4740
4741 The quick clocking in and out of capture mode tasks (often it takes
4742 less than a minute to capture some new task details) can leave
4743 empty clock drawers in my tasks which aren't really useful.
4744 The following prevents this.
4745 #+BEGIN_SRC emacs-lisp :tangle no
4746 (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
4747 #+END_SRC
4748
4749 *** Refiling
4750 All my newly captured entries end up in =refile.org= and want to be
4751 moved over to the right place. The following is the setup for it.
4752 #+BEGIN_SRC emacs-lisp
4753 ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
4754 (setq org-refile-targets (quote ((nil :maxlevel . 9)
4755 (org-agenda-files :maxlevel . 9))))
4756
4757 ; Use full outline paths for refile targets - we file directly with IDO
4758 (setq org-refile-use-outline-path t)
4759
4760 ; Targets complete directly with IDO
4761 (setq org-outline-path-complete-in-steps nil)
4762
4763 ; Allow refile to create parent tasks with confirmation
4764 (setq org-refile-allow-creating-parent-nodes (quote confirm))
4765
4766 ; Use IDO for both buffer and file completion and ido-everywhere to t
4767 (setq org-completion-use-ido t)
4768 (setq org-completion-use-iswitchb nil)
4769 :; Use IDO for both buffer and file completion and ido-everywhere to t
4770 ;(setq ido-everywhere t)
4771 ;(setq ido-max-directory-size 100000)
4772 ;(ido-mode (quote both))
4773 ; Use the current window when visiting files and buffers with ido
4774 (setq ido-default-file-method 'selected-window)
4775 (setq ido-default-buffer-method 'selected-window)
4776
4777 ;;;; Refile settings
4778 (setq org-refile-target-verify-function 'bh/verify-refile-target)
4779 #+END_SRC
4780
4781 *** Custom agenda
4782 Agenda view is the central place for org-mode interaction...
4783 #+BEGIN_SRC emacs-lisp
4784 ;; Do not dim blocked tasks
4785 (setq org-agenda-dim-blocked-tasks nil)
4786 ;; Compact the block agenda view
4787 (setq org-agenda-compact-blocks t)
4788
4789 ;; Custom agenda command definitions
4790 (setq org-agenda-custom-commands
4791 (quote (("N" "Notes" tags "NOTE"
4792 ((org-agenda-overriding-header "Notes")
4793 (org-tags-match-list-sublevels t)))
4794 ("h" "Habits" tags-todo "STYLE=\"habit\""
4795 ((org-agenda-overriding-header "Habits")
4796 (org-agenda-sorting-strategy
4797 '(todo-state-down effort-up category-keep))))
4798 (" " "Agenda"
4799 ((agenda "" nil)
4800 (tags "REFILE"
4801 ((org-agenda-overriding-header "Tasks to Refile")
4802 (org-tags-match-list-sublevels nil)))
4803 (tags-todo "-HOLD-CANCELLED/!"
4804 ((org-agenda-overriding-header "Projects")
4805 (org-agenda-skip-function 'bh/skip-non-projects)
4806 (org-agenda-sorting-strategy
4807 '(category-keep))))
4808 (tags-todo "-CANCELLED/!"
4809 ((org-agenda-overriding-header "Stuck Projects")
4810 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
4811 (tags-todo "-WAITING-CANCELLED/!NEXT"
4812 ((org-agenda-overriding-header "Next Tasks")
4813 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
4814 (org-agenda-todo-ignore-scheduled t)
4815 (org-agenda-todo-ignore-deadlines t)
4816 (org-agenda-todo-ignore-with-date t)
4817 (org-tags-match-list-sublevels t)
4818 (org-agenda-sorting-strategy
4819 '(todo-state-down effort-up category-keep))))
4820 (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
4821 ((org-agenda-overriding-header "Tasks")
4822 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
4823 (org-agenda-todo-ignore-scheduled t)
4824 (org-agenda-todo-ignore-deadlines t)
4825 (org-agenda-todo-ignore-with-date t)
4826 (org-agenda-sorting-strategy
4827 '(category-keep))))
4828 (tags-todo "-CANCELLED+WAITING/!"
4829 ((org-agenda-overriding-header "Waiting and Postponed Tasks")
4830 (org-agenda-skip-function 'bh/skip-stuck-projects)
4831 (org-tags-match-list-sublevels nil)
4832 (org-agenda-todo-ignore-scheduled 'future)
4833 (org-agenda-todo-ignore-deadlines 'future)))
4834 (tags "-REFILE/"
4835 ((org-agenda-overriding-header "Tasks to Archive")
4836 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
4837 (org-tags-match-list-sublevels nil))))
4838 nil)
4839 ("r" "Tasks to Refile" tags "REFILE"
4840 ((org-agenda-overriding-header "Tasks to Refile")
4841 (org-tags-match-list-sublevels nil)))
4842 ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
4843 ((org-agenda-overriding-header "Stuck Projects")
4844 (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
4845 ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
4846 ((org-agenda-overriding-header "Next Tasks")
4847 (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
4848 (org-agenda-todo-ignore-scheduled t)
4849 (org-agenda-todo-ignore-deadlines t)
4850 (org-agenda-todo-ignore-with-date t)
4851 (org-tags-match-list-sublevels t)
4852 (org-agenda-sorting-strategy
4853 '(todo-state-down effort-up category-keep))))
4854 ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
4855 ((org-agenda-overriding-header "Tasks")
4856 (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
4857 (org-agenda-sorting-strategy
4858 '(category-keep))))
4859 ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
4860 ((org-agenda-overriding-header "Projects")
4861 (org-agenda-skip-function 'bh/skip-non-projects)
4862 (org-agenda-sorting-strategy
4863 '(category-keep))))
4864 ("w" "Waiting Tasks" tags-todo "-CANCELLED+WAITING/!"
4865 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
4866 (org-tags-match-list-sublevels nil))
4867 ("A" "Tasks to Archive" tags "-REFILE/"
4868 ((org-agenda-overriding-header "Tasks to Archive")
4869 (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
4870 (org-tags-match-list-sublevels nil))))))
4871
4872 ; Overwrite the current window with the agenda
4873 (setq org-agenda-window-setup 'current-window)
4874
4875 #+END_SRC
4876
4877 *** Time
4878 #+BEGIN_SRC emacs-lisp
4879 ;;
4880 ;; Resume clocking task when emacs is restarted
4881 (org-clock-persistence-insinuate)
4882 ;;
4883 ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
4884 (setq org-clock-history-length 36)
4885 ;; Resume clocking task on clock-in if the clock is open
4886 (setq org-clock-in-resume t)
4887 ;; Change tasks to NEXT when clocking in
4888 (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
4889 ;; Separate drawers for clocking and logs
4890 (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
4891 ;; Save clock data and state changes and notes in the LOGBOOK drawer
4892 (setq org-clock-into-drawer t)
4893 ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
4894 (setq org-clock-out-remove-zero-time-clocks t)
4895 ;; Clock out when moving task to a done state
4896 (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
4897 ;; Save the running clock and all clock history when exiting Emacs, load it on startup
4898 (setq org-clock-persist t)
4899 ;; Do not prompt to resume an active clock
4900 (setq org-clock-persist-query-resume nil)
4901 ;; Enable auto clock resolution for finding open clocks
4902 (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
4903 ;; Include current clocking task in clock reports
4904 (setq org-clock-report-include-clocking-task t)
4905
4906 ; use discrete minute intervals (no rounding) increments
4907 (setq org-time-stamp-rounding-minutes (quote (1 1)))
4908
4909 (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
4910
4911 (setq bh/keep-clock-running nil)
4912
4913 (setq org-agenda-clock-consistency-checks
4914 (quote (:max-duration "4:00"
4915 :min-duration 0
4916 :max-gap 0
4917 :gap-ok-around ("4:00"))))
4918
4919 #+END_SRC
4920
4921 **** Setting a default clock task
4922 Per default the =** Organization= task in my tasks.org file receives
4923 misc clock time. This is the task I clock in on when I punch in at the
4924 start of my work day with =F9-I=. Punching-in anywhere clocks in this
4925 Organization task as the default task.
4926
4927 If I want to change the default clocking task I just visit the
4928 new task in any org buffer and clock it in with =C-u C-u C-c C-x
4929 C-i=. Now this new task that collects miscellaneous clock
4930 minutes when the clock would normally stop.
4931
4932 You can quickly clock in the default clocking task with =C-u C-c
4933 C-x C-i d=. Another option is to repeatedly clock out so the
4934 clock moves up the project tree until you clock out the
4935 top-level task and the clock moves to the default task.
4936
4937 **** Reporting
4938 #+BEGIN_SRC emacs-lisp
4939 ;; Agenda clock report parameters
4940 (setq org-agenda-clockreport-parameter-plist
4941 (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
4942
4943 ;; Agenda log mode items to display (closed and state changes by default)
4944 (setq org-agenda-log-mode-items (quote (closed state)))
4945 #+END_SRC
4946 **** Task estimates, column view
4947 Setup column view globally with the following headlines
4948 #+BEGIN_SRC emacs-lisp
4949 ; Set default column view headings: Task Effort Clock_Summary
4950 (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
4951 #+END_SRC
4952 Setup the estimate for effort values.
4953 #+BEGIN_SRC emacs-lisp
4954 ; global Effort estimate values
4955 ; global STYLE property values for completion
4956 (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
4957 ("STYLE_ALL" . "habit"))))
4958 #+END_SRC
4959
4960 *** Tags
4961 Tags are mostly used for filtering inside the agenda.
4962 #+BEGIN_SRC emacs-lisp
4963 ; Tags with fast selection keys
4964 (setq org-tag-alist (quote ((:startgroup)
4965 ("@errand" . ?e)
4966 ("@office" . ?o)
4967 ("@home" . ?H)
4968 (:endgroup)
4969 ("PHONE" . ?p)
4970 ("WAITING" . ?w)
4971 ("HOLD" . ?h)
4972 ("PERSONAL" . ?P)
4973 ("WORK" . ?W)
4974 ("ORG" . ?O)
4975 ("PRIVATE" . ?N)
4976 ("crypt" . ?E)
4977 ("MARK" . ?M)
4978 ("NOTE" . ?n)
4979 ("CANCELLED" . ?c)
4980 ("FLAGGED" . ??))))
4981
4982 ; Allow setting single tags without the menu
4983 (setq org-fast-tag-selection-single-key (quote expert))
4984
4985 ; For tag searches ignore tasks with scheduled and deadline dates
4986 (setq org-agenda-tags-todo-honor-ignore-options t)
4987 #+END_SRC
4988
4989 *** Archiving
4990 #+BEGIN_SRC emacs-lisp
4991 (setq org-archive-mark-done nil)
4992 (setq org-archive-location "%s_archive::* Archived Tasks")
4993 #+END_SRC
4994
4995 *** org-babel
4996 #+BEGIN_SRC emacs-lisp
4997 (setq org-ditaa-jar-path "~/java/ditaa0_6b.jar")
4998 (setq org-plantuml-jar-path "~/java/plantuml.jar")
4999
5000 (add-hook 'org-babel-after-execute-hook 'bh/display-inline-images 'append)
5001
5002 ; Make babel results blocks lowercase
5003 (setq org-babel-results-keyword "results")
5004
5005 (org-babel-do-load-languages
5006 (quote org-babel-load-languages)
5007 (quote ((emacs-lisp . t)
5008 (awk . t)
5009 (css . t)
5010 (makefile . t)
5011 (perl . t)
5012 (ruby . t)
5013 (dot . t)
5014 (ditaa . t)
5015 (R . t)
5016 (python . t)
5017 (ruby . t)
5018 (gnuplot . t)
5019 (clojure . t)
5020 (shell . t)
5021 (ledger . t)
5022 (org . t)
5023 (plantuml . t)
5024 (latex . t))))
5025
5026 ; Do not prompt to confirm evaluation
5027 ; This may be dangerous - make sure you understand the consequences
5028 ; of setting this -- see the docstring for details
5029 (setq org-confirm-babel-evaluate nil)
5030
5031 ; Use fundamental mode when editing plantuml blocks with C-c '
5032 (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
5033 #+END_SRC
5034
5035 #+BEGIN_SRC emacs-lisp
5036 ;; Don't have images visible on startup, breaks on console
5037 (setq org-startup-with-inline-images nil)