various fixes
[dot-emacs] / my-init.org
1 #+TITLE: My Personal Init Customization
2 #+OPTIONS: toc:nil num:nil ^:nil
3 * copyright
4 # Copyright (C) 2016 Ian Kelling
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 * things that should be at the beginning
20 #+begin_src emacs-lisp
21 ;; todo, evaluating this manually disables debug on error instead of toggling it
22 ;(toggle-debug-on-error) ;uncomment to help debug and catch errors
23
24
25 #+end_src
26
27
28 packages installed from package manager: i pretty much prioritize repos this way: gnu, then melpa, then marmalade.
29
30 package-activated-list:
31 ac-dabbrev ac-haskell-process ack-and-a-half alect-themes auctex bash-completion bbdb csv-mode cyberpunk-theme dot-mode expand-region f find-file-in-project flycheck foreign-regexp ggtags ghc gnuplot-mode goto-chg haskell-mode heroku-theme highlight-indentation highlight-symbol htmlize inf-ruby info+ inkpot-theme jedi auto-complete jedi-core epc ctable concurrent key-chord leuven-theme logstash-conf magit git-commit magit-popup misc-fns mouse+ naquadah-theme nginx-mode occidental-theme org paredit pcsv php-mode pkg-info epl popup py-autopep8 python-environment deferred python-info python-mode rainbow-mode rust-mode rw-hunspell s smartparens smex smooth-scroll sr-speedbar strings swiper ivy tabulated-list tangotango-theme thingatpt+ undo-tree vimrc-mode volatile-highlights web-mode with-editor dash async ws-butler yasnippet
32
33 alternate keyboards
34 #+begin_src emacs-lisp
35 ;; todo, figure out an easy way to disable this when using external keyboard
36 (if (display-graphic-p)
37 (setq
38 enter-key (kbd "<return>")
39 s-enter-key (kbd "<S-return>")
40 c-m-enter-key (kbd "<C-M-return>")
41 m-enter (kbd "<M-return>")
42 c-enter (kbd "<C-return>"))
43 (setq
44 enter-key (kbd "C-m")
45 s-enter-key (kbd "C-8")
46 c-m-enter-key (kbd "C-M-8")
47 m-enter (kbd "M-m")
48 c-enter (kbd "C-8")))
49
50 (setq tp (string= (system-name) "tp"))
51 (setq x200 (string= (system-name) "x2"))
52 (setq laptop-keyboard (or tp x200))
53 #+end_src
54
55 - Ubiquitous Packages which should be loaded on startup rather than
56 autoloaded on demand since they are likely to be used in every
57 session.
58 #+name: starter-kit-load-on-startup
59 #+begin_src emacs-lisp
60 (require 'saveplace)
61 (require 'ffap)
62 (require 'uniquify)
63 (require 'ansi-color)
64 (require 'recentf)
65
66 #+end_src
67
68
69 - Better to have a list of packages in here vs installed manually.
70 However, I install manually because sometimes there are two
71 versions and it is not necessarily easy to reconcile that.
72 #+begin_src emacs-lisp
73 ;; based on marmalage website front page.
74 (require 'package)
75
76 ;; little kit to help remove a down server
77 ;; (setq package-archives nil)
78
79 (add-to-list 'package-archives
80 '("marmalade" .
81 "http://marmalade-repo.org/packages/"))
82
83 (add-to-list 'package-archives
84 '("melpa" . "http://melpa.milkbox.net/packages/") t)
85
86 ;; if this is a new machine/config, get package list
87 ;; not sure why we need it, but it is recommended in starter kit,
88 ;; and doesn't seem like a bad thing
89 (unless package-archive-contents (package-refresh-contents))
90
91 #+end_src
92
93
94 keep our init.el clean, by moving customization elisp to it's own file
95 #+name: m-x-customize-customizations
96 #+begin_src emacs-lisp
97 (setq custom-file "~/.emacs.d/custom.el")
98 (load custom-file 'noerror)
99 #+end_src
100
101 undo tree stuff
102 #+begin_src emacs-lisp
103 ;; more resilient undo-tree-history if we have their locations set up front.
104 (setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history")))
105 ;; Undo in region just happens accidentally, and throws me off, and it's been buggy in the past
106 (setq undo-tree-enable-undo-in-region nil)
107 #+end_src
108
109 * Stuff that I do not recommend that others use without reading,
110 understanding, and customizing themselves are
111
112 all mouse stuff disabled till i have time to figure it out again.
113 #+begin_src emacs-lisp :tangle no
114 (defun xterm-mouse-translate-1 (&optional extension)
115 (save-excursion
116 (let* ((event (xterm-mouse-event extension))
117 (ev-command (nth 0 event))
118 (ev-data (nth 1 event))
119 (ev-where (nth 1 ev-data))
120 (vec (vector event))
121 (is-down (string-match "down-" (symbol-name ev-command))))
122
123 (cond
124 ((null event) nil) ;Unknown/bogus byte sequence!
125 (is-down
126 (setf (terminal-parameter nil 'xterm-mouse-last-down) event)
127 vec)
128 (t
129 (let* ((down (terminal-parameter nil 'xterm-mouse-last-down))
130 (down-data (nth 1 down))
131 (down-where (nth 1 down-data)))
132 (setf (terminal-parameter nil 'xterm-mouse-last-down) nil)
133 (cond
134 ((null down)
135 ;; This is an "up-only" event. Pretend there was an up-event
136 ;; right before and keep the up-event for later.
137 (push event unread-command-events)
138 (vector (cons (intern (replace-regexp-in-string
139 "\\`\\([ACMHSs]-\\)*" "\\&down-"
140 (symbol-name ev-command) t))
141 (cdr event))))
142 ((equal ev-where down-where) vec)
143 (t
144 (let ((drag (if (symbolp ev-where)
145 0 ;FIXME: Why?!?
146 (list (intern (replace-regexp-in-string
147 "\\`\\([ACMHSs]-\\)*" "\\&drag-"
148 (symbol-name ev-command) t))
149 down-data ev-data))))
150 (if (null track-mouse)
151 (vector drag)
152 (push drag unread-command-events)
153 (vector (list 'mouse-movement ev-data))))))))))))
154
155 #+end_src
156 * how to find auto-saved files that need recovering
157 find a recently dated file in ~/.emacs.d/auto-save-list/, and see the files listed in it.
158 #file# is an auto-save file. It may or may not be different than the file is corresponds to.
159 If it is different, emacs will give a message about recovering it when you open it.
160
161
162
163 * TODO update comint-exec-1
164 * TODO learn some more ivy mode stuff
165 * TODO disable return overriding ctrl-m
166 * TODO declarative package installations,
167 with documentation.
168 * TODO shell mode reverse search hides 2nd+ line of multi-line result
169 * TODO report bug in latest emacs,
170 c-c ', does't exit org-mode src editing mode.
171 * TODO button for switching to scratch buffer
172 * TODO figure out browsing files with broken nfs mount
173 causes emacs to freeze until I kill -9 it.
174 * TODO make a keybind to print var under cursor
175 and actually, putting the start of it in th emodeline might be cool
176 * TODO fix undo tree files literering filesystem
177 * TODO c-<delete> in shell mode should send over
178 previous line if current line is empty
179 * TODO make c-m-s be just a control key for easier use
180 * TODO bind a in group mode of gnus to c-u a,
181 also, make a default for number of articles
182 * TODO make auto-complete be on by default in sql-mode
183 * TODO make an easy bind for open previous buffer
184 * TODO i think my autosave for sudo-edit might be too fast
185 it sometimes leaves #_asdfjasdf files littered
186 * TODO readline-compleste doesn't work when you cat a file without a newline,
187 and so the prompt is messed up. not sure exactly what needs to be in end, or if its anything
188 * TODO figure out how to paste a path into find file
189 probably have to use the old kind of find file
190 * TODO readline-complete doesn't escape special chars in filenames
191 * TODO readline-complete dev
192
193
194
195 ** misc fixes
196
197 bad code, the comment this relates to was removed, but not the comment
198 /* If waiting for this channel, arrange to return as
199 soon as no more input to be processed. No more
200 waiting. */
201
202
203 (status_notify): New arg WAIT_PROC. this is unused, this is a bug.
204 The change in status_notify's return is just passing more information
205 from what it did already. No changes at all inside this function.
206
207 * TODO consider whether to bind indent-for-tab-command
208 I removed it from m-tab for terminal compatibility.
209 It's the default tab command, which yasnippet replaces.
210 * TODO readline-complete: remove the hardcoded rlc-no-readline-hook
211 * TODO isearch doesn't automatically wrap in info
212 * TODO look into fixing shell mode reverse search
213 and why auto-complete dies
214 caveat is that it doesn't work well with certain unusual prompts, for example if $/# is not used at the end
215 see if we can load history, or reverse search with history commands
216 * TODO keybinds for s-delete/tab etc
217 * TODO fix bbdb info packaging in melpa
218 * TODO figure out why my emacs startup script doesn't work from dmenu
219 * TODO post idea to make customize group show function var names so we can read doc strings
220 * TODO report/fix bug that kill-whole-line doesn't work right with append kill
221 * TODO make bash keybind for copy paste interoperate with x windows
222 * TODO fix org stderr redirection
223 make this produce output of "ok"
224 #+begin_src sh
225 echo ok >&2
226
227 #+end_src
228 * TODO make ido keybinds better
229 * TODO fix indenting in org
230
231 (defun my-org-indent-region (start end)
232 "Indent region."
233 (interactive "r")
234 (save-excursion
235 (let ((line-end (org-current-line end)))
236 (goto-char start)
237 (while (< (org-current-line) line-end)
238 (cond ((org-in-src-block-p) (org-babel-do-in-edit-buffer (indent-according-to-mode)))
239 (t (call-interactively 'org-indent-line)))
240 (move-beginning-of-line 2)))))
241
242
243
244 org-indent-region is broken for source blocks
245 the above function works, but has several problems.
246 first: it should not have separate logic from org-indent-line
247 second: it runs way too slow, mainly the command
248 (org-babel-do-in-edit-buffer (indent-according-to-mode)))
249
250
251 * TODO figure out newline in prompt shell issue
252 setting this before readline-complete is loaded allows completion to work,
253 but auto-completion still fails. Need to debug readline-complete to figure this out.
254 (setq shell-prompt-pattern "^[^#$%>]*[#$]\n")
255 * TODO setup bind for find tag / lisp function at point
256
257 * TODO org-delete-char should also work for the delete/backspace keys!
258 fix and send patch
259
260 * TODO checkout projectile / graphene's project settings
261
262 * TODO check up on recent changes to 3rd party default configs
263 - last checked apr 24
264 https://github.com/eschulte/emacs24-starter-kit/commits/master
265
266 last checked mayish
267 https://github.com/bbatsov/prelude
268 - redefined mouse functions from this file
269
270 * TODO figure out how to setup emacs to format text nicely like thunderbird
271 * TODO it appears impossible make C-[ not be the same as escape
272 * TODO movement within info buffer after opening a link doesn't cancel isearch
273 leads to many frustrations
274 * TODO fix org resolve clock message. it is innacurate
275 i is not the same, becuase it does not make org realize there is an active clock
276
277 * TODO add apropos commands to help prefix, from
278 http://stackoverflow.com/questions/3124844/what-are-your-favorite-global-key-bindings-in-emacs
279 * TODO my autosave goes into an endless prompting loop
280 when running save buffer, and the buffer has been changed
281 outside of emacs
282 * TODO smart peren does not see ?\\) as a valid paren
283
284 * TODO why does org-end-of-line not go all the way to the end on a closed headline?
285 * TODO org makes random ... things, and delete right before them does ctrl-i
286 * TODO try mark word, which might be a useful keybind
287 * TODO fix org-cycle: it assumes which key it is bound to for its last alternative
288 * TODO checkout lisp-complete-symbol to augment auto-complete
289 * TODO learn dired.
290 * TODO emacs keylogger to optimize key binds
291 * TODO remap/investigate find tag, find tag at point
292 * TODO set key to cycle buffers by mode, example below
293
294 (defun cycle-buffer-by-mode (p-mode)
295 "Cycle buffers by mode name"
296 (interactive)
297 (dolist (buffer (buffer-list))
298 (with-current-buffer buffer
299 (when (buffer-live-p buffer)
300 (if (string-match p-mode mode-name) ;(regexp-quote p-mode)
301 (setq switch2buffer buffer)))))
302 (when (boundp 'switch2buffer)
303 (switch-to-buffer switch2buffer)))
304
305 And I have bound this to my F9 key
306
307 (global-set-key [f9] '(lambda () (interactive) (cycle-buffer-by-mode "Shell$")))
308
309 * TODO test out usefulness of forward/back sexp in different languages
310
311 * TODO major mode settings to check out in future
312 ** emacs24 starter kit
313 - Nxhtml -- utilities for web development
314 [[http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html][Nxhtml]] is a large package of utilities for web development and for
315 embedding multiple major modes in a single buffer.
316
317 Nxhtml is not installed in this version of the starter-kit by default,
318 for information on installing nxhtml see [[http://www.emacswiki.org/emacs/NxhtmlMode][EmacsWiki-Nxhtml]].
319
320 web-mode is competing package and actively developed, so i'm using that instead
321
322
323 (dolist (package '(yaml-mode js2-mode))
324 (unless (package-installed-p package)
325
326 - Associate modes with file extensions
327
328 (add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
329 (add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
330 (require 'yaml-mode)
331 (add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
332 (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
333 (add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
334 (add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
335 ;; (add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))
336
337 - clojure in starter-kit-lisp.org
338
339 - others = gnus, js, publish, perl, python, perl, ruby
340 they each have their own starter kit file.
341
342 - snippets for various modes other than org-mode
343
344 * TODO update yasnippet documentation
345 yas expand key customization is rediculously hard to figure out
346 and completely undocumented
347 * TODO fix org source indenting, send patch
348 * TODO check out bundling aka compiling yasnippet
349 * TODO try xml/html mode url func
350
351 (defun view-url ()
352 "Open a new buffer containing the contents of URL."
353 (interactive)
354 (let* ((default (thing-at-point-url-at-point))
355 (url (read-from-minibfer "URL: " default)))
356 (switch-to-buffer (url-retrieve-synchronously url))
357 (rename-buffer url t)
358 ;; TODO: switch to nxml/nxhtml mode
359 (cond ((search-forward "<?xml" nil t) (xml-mode))
360 ((search-forward "<html" nil t) (html-mode)))))
361
362 * TODO flyspell-buffer automatically
363
364 * TODO respond to ediff thread
365 * TODO fix horizontal mouse resizing
366 resizing a window horizontally with the mouse should be allowed in more places
367
368 * TODO try using / making abbreviations
369
370 * abbreviations
371 #+begin_src emacs-lisp
372
373 ;; turn on abbrev mode globally
374 (setq-default abbrev-mode t)
375
376 #+end_src
377 default abbreviation mode file is .emacs.d/abbrev_defs.
378 add-global-abbrev, add-mode-abbrev for expansion at point
379 if all else fails, edit the abbrev file
380
381 * auto-complete
382
383 #+begin_src emacs-lisp
384 ;; auto-completion in minibuffer
385 ;; disabled while I look for another alternative
386 ;;(icomplete-mode)
387
388 (require 'auto-complete-config)
389 (ac-config-default)
390
391
392 ;; complete after 1 char instead of default 2
393 (setq ac-auto-start 1)
394 (setq ac-delay 0.001)
395
396 (add-to-list 'ac-modes 'org-mode 'sql-mode)
397
398 (defun ac-common-setup ()
399 (add-to-list 'ac-sources 'ac-source-yasnippet))
400
401 ;; for org mode completion source taken from wiki.
402 ;; it did not work. no idea why. todo, investigate
403 ;; the ac-sources code is at http://www.emacswiki.org/emacs/AutoCompleteSources
404 ;; i've deleted it here so as to save space and not spam this file
405 ;;(defun my-ac-org-mode ()
406 ;; (setq ac-sources (append ac-sources '(ac-source-org))))
407
408
409 ;; this makes the org-self-insert command not do a flyspell spell check.
410 ;; low priority thing to look into sometime
411 (ac-flyspell-workaround)
412
413
414 (define-key ac-completing-map (kbd "<up>") nil)
415 (define-key ac-completing-map (kbd "<down>") nil)
416 (define-key ac-completing-map (kbd "<S-return>") 'ac-expand)
417 (define-key ac-completing-map "\t" 'ac-complete)
418 (define-key ac-completing-map (kbd "<tab>") 'ac-complete)
419
420
421
422 #+end_src
423 * auto-complete readline-complete
424 #+begin_src emacs-lisp
425
426 (add-to-list 'load-path "~/.emacs.d/src/readline-complete")
427 (require 'readline-complete)
428 ;; not sure how I made these, but I deleted, and
429 ;; it would be nice to make them again sometime
430 ;;(require 'src-loaddefs)
431
432 ;; disabled cuz broken
433 ;; redefining function in readline-complete so ac-complete only uses readline as a source
434 (defun ac-rlc-setup-sources ()
435 "Add me to shell-mode-hook!"
436 (setq ac-sources '(ac-source-shell)))
437 (add-hook 'shell-mode-hook 'ac-rlc-setup-sources)
438
439 ;; generally unnecessary, but why not
440 (setq explicit-shell-file-name "bash")
441
442 ;; readline-complete says to add this line.
443 ;; however, it messes up my procfs directory tracking hook
444 ;; because get-process doesn't notice the child shell.
445 ;; instead, I've removed export EMACS=t from
446 ;; comint-exec-1 (the function which initially sets it)
447 ;; by finding it in emacs sources and redefinind it here
448 ;; and done stty echo in my bashrc
449 ;;(setq explicit-bash-args '("-c" "export EMACS=; stty echo; bash"))
450
451 (setenv "EMACS" "")
452 (setq explicit-bash-args nil)
453 (setq comint-process-echoes t)
454 ;; default of 30 is way too slow. todo, consider pushing this upstream
455 (setq rlc-attempts 5)
456
457 (add-to-list 'ac-modes 'shell-mode)
458
459 ;; readline-complete recommends this (i assume this format),
460 ;; but greping finds no reference in emacs or my .emacs.d
461 ;; so I'm assuming it is for an older emacs
462 ;;(setq explicit-ssh-args '("-t"))
463
464 (add-hook 'shell-mode-hook
465 (lambda ()
466 (define-key shell-mode-map (kbd "<tab>") 'auto-complete)))
467
468
469 #+end_src
470 #+RESULTS:
471 : comint-exec-1
472
473 debugging
474
475
476 * auto save & backup
477
478 there is a bug that when emacs has been running for a long time,
479 auto-save-timeout never happens simply by waiting.
480 doing something like an M-x function will trigger it.
481 Todo: report this bug.
482
483 #+begin_src emacs-lisp
484
485 ;; enable auto-save hook
486 (setq auto-save-timeout 1) ; idle time before auto-save.
487
488
489 ;; main hook for my auto save
490 (add-hook 'auto-save-hook 'my-auto-save)
491 ;; additional hook to try to deal with emacs not auto-saving when a buffer isn't active
492 (add-hook 'window-configuration-change-hook 'my-auto-save)
493
494
495 (defun my-auto-save ()
496 (if (and my-as (buffer-file-name) (buffer-modified-p))
497 (let (message-log-max)
498 ;; a bit of a hack to partially suppress the constant saving in the echo area
499 (with-temp-message ""
500 (basic-save-buffer)))))
501
502 (defun my-as-off ()
503 (interactive)
504 (setq my-as nil))
505
506 (defun my-as-on ()
507 (interactive)
508 (setq my-as t))
509
510 ;; based on suggestion in the emacs docs, redefine these 2 functions
511 ;; to avoid prompt spamming the user when we do auto-save
512 (defun ask-user-about-supersession-threat (fn)
513 (discard-input)
514 (message
515 "File for %s has changed on disk outside of emacs. Auto-save is overwriting it, however
516 a backup is being created in case that is not what you intended." buffer-file-name)
517 (setq buffer-backed-up nil))
518
519 (defadvice ask-user-about-lock (before lock-deactivate-as activate)
520 (make-local-variable 'my-as)
521 (setq my-as nil)
522 (message "proper autosave has been turned off for this buffer because of lock file problem.
523 In this buffer, do M-x my-as-on to reenable"))
524
525 ;; todo, this doesn't work consistently to override the auto-save message
526 (defalias 'do-auto-save-original (symbol-function 'do-auto-save))
527 (defun do-auto-save (&optional no-message current-only)
528 "This function has been modified to wrap the original so that NO-MESSAGE
529 is always set to t, since we auto-save a lot, it spams otherwise.
530 The original doc string is as follows:
531
532 Auto-save all buffers that need it.
533 This is all buffers that have auto-saving enabled
534 and are changed since last auto-saved.
535 Auto-saving writes the buffer into a file
536 so that your editing is not lost if the system crashes.
537 This file is not the file you visited; that changes only when you save.
538 Normally we run the normal hook `auto-save-hook' before saving.
539
540
541 A non-nil NO-MESSAGE argument means do not print any message if successful.
542 A non-nil CURRENT-ONLY argument means save only current buffer."
543 (interactive)
544 (do-auto-save-original t current-only))
545
546 ;; enable MY auto-save
547 (my-as-on)
548
549 #+end_src
550
551
552 backups, separate from auto-save
553
554 #+begin_src emacs-lisp
555
556 ;; set backup file location
557 (setq backup-directory-alist '(("." . "~/.editor-backups")))
558 (setq auto-save-file-name-transforms
559 '((".*" "~/.editor-backups/" t)))
560
561 (setq version-control t ;; Use version numbers for backups
562 kept-new-versions 100
563 kept-old-versions 2
564 delete-old-versions t ;; delete old versions silently
565 ;; assume hard linked files are done on purpose, don't screw them up
566 backup-by-copying-when-linked t)
567
568 ;; todo, the time needs to be an integer, not a vector type thing
569 (defun constant-backup ()
570 "Backup conditioned on some time passing since last one.
571 Hooked into 'before-save-hook."
572 (cl-flet ((b-time (minutes)
573 (< last-backup-time
574 (- (current-time) (* 60 minutes)))))
575 (when (or (not (boundp 'last-backup-time)) (and (< (buffer-size) 10000000) (b-time 5)) (b-time 30))
576 (setq buffer-backed-up nil)
577 (setq-local last-backup-time (current-time)))))
578
579 ;; make a backup on auto-save, because the backup feature is not
580 ;; utilized with my-auto-save, only normal interactive save.
581 ;; todo, enable when fixed
582 ;;(add-hook 'before-save-hook 'constant-backup)
583
584 (add-hook 'auto-save-hook 'auto-save-size-limit)
585
586 (defun auto-save-size-limit ()
587 (when (and (not backup-inhibited) (> (buffer-size) 2000000))
588 (message "Backups disabled for this buffer due to size > 2 megs")
589 (make-local-variable 'backup-inhibited)
590 (setq backup-inhibited t)))
591
592 #+end_src
593
594
595
596 background:
597 the faq suggests to auto-save using
598 (setq auto-save-visited-file-name t)
599 and to toggle auto-saving in the current buffer, type `M-x auto-save-mode'
600
601 however, this is buggy.
602 it leaves around lock files, which can be disabled with
603 (setq create-lockfiles nil)
604 but it is also buggy on other things that appear to hook onto file saving
605 so i created my own function, which originally had bugs,
606 but new emacs version fixed all that, yay!.
607
608
609 ; not using, but here for documentation,
610 ; alternate way to enable and specify how long between autosaves.
611 ; number of input events between autosave.
612 ; lowest bound of functionality is actually about 15 input events
613 ;(setq auto-save-interval
614 ** todo keep an eye out for why/when and fix the fact that normal auto-save files are being made soemtimes
615 they are #filename#
616 seems they are created
617
618 * bbdb
619 #+begin_src emacs-lisp
620 ;; based on bbdb manual
621 ;; also has instructions to initialize upon launching gnus, etc
622 ;; but I figure try this to make sure everything works all the time first
623 (require 'bbdb)
624 (bbdb-initialize 'message)
625
626 ;; recommended by gnus,
627 ;; but seems like it could be good to have set for other stuff
628 (setq user-full-name "Ian Kelling"
629 user-mail-address "ian@iankelling.org")
630 ;; general email setting? recommended by mu4e
631 (setq message-kill-buffer-on-exit t)
632
633
634 ;; based on emacs24-starter-kit
635 (setq bbdb-offer-save 'auto
636 bbdb-notice-auto-save-file t
637 bbdb-expand-mail-aliases t
638 bbdb-canonicalize-redundant-nets-p t
639 bbdb-complete-name-allow-cycling t)
640
641 ;; use d instead
642 (add-hook 'bbdb-mode-hook
643 (lambda () (define-key bbdb-mode-map (kbd "C-k") nil)))
644
645 (add-to-list 'load-path "~/.emacs.d/src/bbdb-csv-import")
646 (require 'bbdb-csv-import)
647 #+end_src
648
649 * bookmark settings
650 #+begin_src emacs-lisp
651 ; save bookmarks whenever they are changed instead of just when emacs quits
652 (setq bookmark-save-flag 1)
653 ; increase bookmark context size for better functionality
654 (setq bookmark-search-size 2000)
655 #+end_src
656 * c-like settings
657 #+begin_src emacs-lisp
658 ;; change last thing from gnu.
659 ;; notably this avoids brace indent after if, and 4 space indent
660 (setq c-default-style '((java-mode . "java")
661 (awk-mode . "awk")
662 (other . "stroustrup")))
663 ;; for emacs itself, use
664 ;; (setq c-default-style '((java-mode . "java")
665 ;; (awk-mode . "awk")
666 ;; (other . "gnu")))
667 ;; (setq-default c-basic-offset 2)
668 #+end_src
669 * color theme
670
671 A Theme builder is available at http://elpa.gnu.org/themes/ along with
672 a list of pre-built themes at http://elpa.gnu.org/themes/view.html and
673 themes are available through ELPA.
674
675
676 interesting light themes
677
678
679 #+begin_src emacs-lisp
680 (defun override-theme (arg)
681 (interactive)
682 (while custom-enabled-themes
683 (disable-theme (car custom-enabled-themes)))
684 (load-theme arg t))
685 (setq color-theme-is-global t)
686
687 (defun toggle-night ()
688 (interactive)
689 (if (equal (car custom-enabled-themes) 'naquadah)
690 (override-theme 'leuven)
691 (override-theme 'naquadah)))
692
693
694 (override-theme 'leuven) ;; org mode features, with monitor darkened. part of org-mode i think
695
696
697
698 ;; disable color thing with this:
699 ;;(disable-theme (car custom-enabled-themes))
700
701 ;; decent dark themes
702
703 ;;(override-theme 'tangotango)
704 ;;(override-theme 'deeper-blue)
705 ;;(override-theme 'tango-dark)
706 ;;(override-theme 'tsdh-dark)
707
708 ;;(override-theme 'heroku)
709 ;;(override-theme 'inkpot) ;; part of inkpot-theme package
710 ;;(override-theme 'naquadah) ; org mode features, part of naquadah-theme package
711 ;;(override-theme 'spolsky) ;; part of sublime-themes package
712 ;;(override-theme 'twilight-anti-bright) ;; from twilight-anti-bright-theme package
713
714 ;; interesting but not usable colors
715 ;;(override-theme 'cyberpunk) ; cool org mode features, from cyberpunk-theme package
716 ;;(override-theme 'wombat) ; cursor not visible enough. from a wombat package, not sure which
717 ;;(override-theme 'misterioso) ; cursor not visible enough
718
719
720
721 ;;decent light themes
722 ;;(override-theme 'alect-light) ; theres a -alt version, don't see a dif. could use this without dimming. from alect-something package
723 ;;(override-theme 'occidental) ; from occidental-theme package
724
725
726 ;;color-theme is deprecated in emacs 24.
727
728 ;; theme packages i tried then removed:
729 ;; ignored ones that didn't use the new theme engine
730
731 ;;66 packages (zenburn-theme-2.1, zen-and-art-theme-1.0.1, waher-theme-20130917.7, ujelly-theme-1.0.35, twilight-theme-1.0.0, twilight-bright-theme-20130605.143, twilight-anti-bright-theme-20120713.316, tronesque-theme-1.3, tron-theme-12, toxi-theme-0.1.0, tommyh-theme-1.2, tango-2-theme-1.0.0, sunny-day-theme-20131203.1250, sublime-themes-20140117.323, subatomic-theme-20131011.1048, soothe-theme-0.3.16, soft-morning-theme-20131211.1342, soft-charcoal-theme-20130924.1206, sea-before-storm-theme-0.3, purple-haze-theme-20130929.1751, phoenix-dark-pink-theme-20130905.941, phoenix-dark-mono-theme-20130306.1215, pastels-on-dark-theme-0.3, obsidian-theme-20130920.937, nzenburn-theme-20130513, noctilux-theme-20131019.31, mustang-theme-20130920.939, monokai-theme-0.0.10, molokai-theme-20130828.0, late-night-theme-0.0, jujube-theme-0.1, ir-black-theme-20130302.2355, gruvbox-theme-20131229.1458, gruber-darker-theme-0.6, grandshell-theme-20140118.1003, github-theme-0.0.3, gandalf-theme-0.1, flatland-theme-20131204.858, django-theme-20131022.202, deep-thought-theme-0.1.1, dakrone-theme-20131212.1159, colorsarenice-theme-20131128.1106, color-theme-wombat+-0.0.2, color-theme-wombat-0.0.1, color-theme-twilight-0.1, color-theme-tango-0.0.2, color-theme-solarized-20120301, color-theme-sanityinc-solarized-2.25, color-theme-railscasts-0.0.2, color-theme-monokai-0.0.5, color-theme-molokai-0.1, color-theme-ir-black-1.0.1, color-theme-heroku-1.0.0, color-theme-github-0.0.3, color-theme-eclipse-0.0.2, color-theme-dpaste-0.0.1, color-theme-dawn-night-1.0, color-theme-colorful-obsolescence-0.0.1, color-theme-cobalt-0.0.2, color-theme-20080305.34, clues-theme-20130908.801, busybee-theme-20130920.942, bubbleberry-theme-0.1.2, assemblage-theme-20130715.621, anti-zenburn-theme-20140104.1542, ample-zen-theme-0.2)
732
733
734
735 #+end_src
736
737 * yasnippet
738 cd ~/.emacs.d/src
739 git clone --recursive https://github.com/capitaomorte/yasnippet
740 touch snippets/.yas-make-groups
741
742 This all makes it so I can look through the default snippets
743 in the menu bar, but they don't show up elsewhere, because they are
744 mostly things I don't want.
745
746 #+begin_src emacs-lisp
747
748 (require 'yasnippet)
749 ;; this needs to be before yas-global-mode
750 (setq yas-snippet-dirs (list "~/.emacs.d/snippets"))
751 (yas-global-mode 1)
752
753 (setq
754 yas-also-auto-indent-first-line t
755 yas-choose-tables-first t
756 yas-use-menu (quote full)
757 ;; this sets ido-prompt as first function
758 yas-prompt-functions
759 '(yas-ido-prompt yas-dropdown-prompt yas-x-prompt yas-completing-prompt yas-no-prompt))
760
761 ;; todo, explore this option for wrapping region
762 ;; '(yas/wrap-around-region t))
763
764 #+end_src
765
766 #+RESULTS:
767 | yas-ido-prompt | yas-dropdown-prompt | yas-x-prompt | yas-completing-prompt | yas-no-prompt |
768
769 * cross session settings
770 #+begin_src emacs-lisp
771
772 ;; Save a list of recent files visited.
773 (recentf-mode 1)
774 (setq recentf-max-saved-items 200
775 recentf-max-menu-items 15)
776
777
778 (setq save-place t
779 save-place-version-control 'nospecial
780 save-place-limit 40000
781 save-place-file "~/.emacs.d/places")
782
783
784
785 ;; savehist keeps track of some history
786 ;; search entries
787 (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring)
788 ;; save every minute
789 savehist-autosave-interval 60
790 ;; keep the home clean
791 savehist-file "~/.emacs.d/.savehist")
792 (savehist-mode 1)
793
794 #+end_src
795
796 * ediff
797 #+begin_src emacs-lisp
798 ;; ediff-buffers is the main command to use
799
800 ;; ediff - don't start another frame for the control panel
801 ;; unfortunately, this doesn't allow me to use 2 frames for the diff buffers
802 ;; so disable this temporarily with the next line if you want that
803 ;; sometime I should setup 2 functions to explicitly do each type
804 (setq ediff-window-setup-function 'ediff-setup-windows-plain)
805 ;;(setq ediff-window-setup-function 'ediff-setup-windows-default)
806
807 ;; do side by side diffs
808 (setq ediff-split-window-function 'split-window-horizontally)
809
810
811 #+end_src
812
813
814
815 Things I tried which didn't work, which intuitively I think should work better: I can open the second diff buffer in a new frame, and close it's window in the first frame after starting ediff, but when I hit n to go to the next diff, it restores the window in the first frame. Another thing I tried is to open 2 new frames and set them up as I want. However, if I try to open the *Ediff Control Panel* buffer in a different window from its original one, my mouse jumps to one of the diff frames, or if that isn't visible, the buffer just hangs until I select the original ediff control panel window. This seems like a bug to me. I am using a very recent development version of emacs.
816
817 * dired
818 #+begin_src emacs-lisp
819
820 ;; dired - reuse current buffer by pressing 'a'
821 (put 'dired-find-alternate-file 'disabled nil)
822 #+end_src
823
824 * disabled but saved for documentation purposes
825 :PROPERTIES:
826 :tangle: no
827 :END:
828 ** indent settings for git's perl code
829 don't have a way to set this automatically or a good place to put this
830 #+begin_src emacs-lisp
831 (setq
832 perl-indent-level 8
833 perl-continued-statement-offset 8
834 perl-continued-brace-offset -8
835 perl-brace-offset 0
836 perl-brace-imaginary-offset 0
837 indent-tabs-mode t
838 )
839 #+end_src
840 ** org mode website
841
842 #+begin_src emacs-lisp
843 ;; use org-publish-current-project with a project file open
844 (setq org-publish-project-alist
845 '(("org"
846 :base-directory "/a/h/src"
847 :publishing-directory "/a/h/output"
848 :base-extension "org"
849 ;;:publishing-function org-org-publish-to-org
850 :publishing-function org-html-publish-to-html
851 :preserve-breaks t
852 :html-postamble "Everything here is <a rel=\"license\"
853 href=\"http://creativecommons.org/licenses/by-sa/4.0/\"><img
854 alt=\"Creative Commons License\" style=\"border-width:0\"
855 src=\"http://i.creativecommons.org/l/by-sa/4.0/80x15.png\" /></a>"
856 :html-head "<link rel=\"stylesheet\"
857 href=\"style.css\"
858 type=\"text/css\"/>"
859 :htmlized-source t)
860 ("othersrc"
861 :base-directory "/a/h/src"
862 :base-extension "css\\|el\\|"
863 :publishing-directory "/a/h/output"
864 :publishing-function org-publish-attachment)
865 ("other"
866 :base-directory "/a/h/other"
867 :base-extension ".*"
868 :publishing-directory "/a/h/output"
869 :publishing-function org-publish-attachment)))
870 ;; default is xhtml-strict. don't really care, but this is more common
871 (setq org-html-doctype "html4-strict")
872
873 ;; this is needed for worg
874 ;; todo: for my own site, I need to define the css in a separate file
875 ;; in order to use this setting. see the variable help for info
876 (setq org-export-htmlize-output-type t)
877
878
879 #+end_src
880
881 ** bash-completion
882 #+begin_src emacs-lisp
883 ;; this eventually gets set in
884 ;; comint-dynamic-complete-functions
885 ;; (car comint-dynamic-complete-functions)
886 (autoload 'bash-completion-dynamic-complete "bash-completion"
887 "BASH completion hook")
888 (add-hook 'shell-dynamic-complete-functions
889 'bash-completion-dynamic-complete)
890
891 ;; this appears useless, but was in the recommended init code
892 (add-hook 'shell-command-complete-functions
893 'bash-completion-dynamic-complete)
894
895 (defun ac-rlc-setup-sources ()
896 "Add me to shell-mode-hook!"
897 (setq ac-sources '(ac-source-shell)))
898 (add-hook 'shell-mode-hook 'ac-rlc-setup-sources)
899
900 #+end_src
901
902 ** ace-jump
903 It is an awesome mode for keyboard navigation.
904 However, using the mouse takes less thought and works as well,
905 especially with my foot mouse ;)
906
907 #+begin_src emacs-lisp
908
909
910
911
912 ;; this has a problem that it doesn't work with emacsclient, so I'm using a more standard method
913 ;; This has the benefit of working with less fuss otherwise, I think.
914 ;; no method works on a terminal
915 ;; makes C-i and tab be distinct. same deal is done for c-m
916 ;;(setq local-function-key-map (delete '(tab . [9]) local-function-key-map))
917 ;; (define-key input-decode-map (kbd "C-i") [f15])
918 ;; (define-key input-decode-map (kbd "<f15>") [?\C-i])
919 ;; (define-key input-decode-map (kbd "<tab>") [?\C-i])
920 ;; (global-set-key (kbd "<f15>") 'query-replace)
921
922
923 ; not using ace jump mode, but if mouse is ever not good,
924 ; here is config for it
925 (require 'ace-jump-mode)
926 (eval-after-load "ace-jump-mode"
927 '(ace-jump-mode-enable-mark-sync))
928 (define-key global-map (kbd "") 'ace-jump-mode)
929
930
931
932 ;; revert buffers automatically when underlying files are changed externally
933 ;; too dangerous, and thus disabled.
934 ;; do m-x auto-revert-mode to auto-rever a specific buffer
935 ;;(global-auto-revert-mode t)
936
937
938 ;; whitespace-mode config. minimal for bad whitespace
939 ;(setq whitespace-line-column 80) ; for style of lines-tail, but I have it disabled
940 (setq whitespace-style '(face tabs empty trailing))
941 ;to enable whitespace mode
942 (whitespace-mode +1)
943
944
945
946 (defun org-set-mark-command (arg)
947 "Do set-mark-command and then org-show-context if the point
948 moves to invisible text."
949 (interactive "P")
950 (let ((initial-point (point)))
951 (setq this-command 'set-mark-command)
952 (set-mark-command (arg))
953 (if (and (not (= (point) initial-point))
954 (or (outline-invisible-p) (org-invisible-p2)))
955 (org-show-context 'mark-goto))))
956
957 (defun org-exchange-point-and-mark (&optional arg)
958 (interactive "P")
959 (let ((initial-point (point)))
960 (exchange-point-and-mark)
961 (if (and (not (= (point) initial-point))
962 (or (outline-invisible-p) (org-invisible-p2)))
963 (org-show-context 'mark-goto))))
964
965
966 (defun toggle-mode-line ()
967 "Toggle mode line on and off."
968 (interactive)
969 (if mode-line-format
970 (progn (setq my-saved-mode-line-format mode-line-format)
971 (setq mode-line-format nil))
972 (setq mode-line-format my-saved-mode-line-format))
973 (force-mode-line-update))
974 (toggle-mode-line)
975 (global-set-key (kbd "M-m") 'toggle-mode-line)
976 (add-hook 'after-change-major-mode-hook
977 (lambda () (setq my-saved-mode-line-format mode-line-format)
978 (setq mode-line-format nil)))
979
980
981 #+end_src
982
983 ** Copy mode-line to the top
984 #+begin_src emacs-lisp
985 ;; Copy mode-line to the top
986 (setq-default header-line-format mode-line-format
987 mode-line-format nil)
988 ;; copied the mode-line theme into the header theme, else it is unreadable
989 ;; this goes after loading the theme
990 (let ((class '((class color) (min-colors 89))))
991 (custom-theme-set-faces
992 'leuven
993 `(header-line ((,class (:box (:line-width 1 :color "#1A2F54") :foreground "#85CEEB" :background "#335EA8"))))))
994
995 #+end_src
996
997 ** tab bindings for when I wanted to make tab be for search
998 #+begin_src emacs-lisp
999
1000 (define-key emacs-lisp-mode-map (kbd "<tab>") nil)
1001 (define-key button-buffer-map "\t" nil)
1002 (define-key button-buffer-map (kbd "f") 'forward-button)
1003 (define-key Info-mode-map "\t" nil)
1004 (define-key widget-keymap "\t" nil)
1005 (define-key widget-keymap (kbd "<tab>") nil)
1006
1007 (add-hook 'compilation-mode-hook (lambda ()
1008 (define-key compilation-mode-map (kbd "<tab>") nil)
1009 (define-key compilation-mode-map "\t" nil)))
1010
1011 ;; unbind c-i for yas. it already separately binds <tab>
1012 (add-hook 'yas-minor-mode-hook (lambda ()
1013 (define-key yas-minor-mode-map "\t" nil)))
1014
1015 (add-hook 'haskell-interactive-mode-hook
1016 (lambda ()
1017 (define-key haskell-interactive-mode-map "\t" nil)
1018 (define-key haskell-interactive-mode-map (kbd "<tab>") 'haskell-interactive-mode-tab)))
1019
1020 (define-key minibuffer-local-must-match-map "\t" nil)
1021 (define-key minibuffer-local-must-match-map (kbd "<tab>") 'minibuffer-complete)
1022 (define-key minibuffer-local-completion-map (kbd "<tab>") 'minibuffer-complete)
1023 (define-key minibuffer-local-completion-map "\t" 'minibuffer-complete)
1024
1025 (add-hook 'ido-setup-hook
1026 (lambda()
1027 (define-key ido-completion-map (kbd "<tab>") 'ido-complete)
1028 (define-key ido-completion-map "\t" nil)))
1029
1030 #+end_src
1031
1032 ** kill buffer and window
1033 #+begin_src emacs-lisp
1034 (defun kill-buffer-and-window ()
1035 "Close the current window and kill the buffer it's visiting."
1036 (interactive)
1037 (progn
1038 (kill-buffer)
1039 (delete-window)))
1040 #+end_src
1041 ** sending multiple commands to a comint buffer
1042 without waiting for commands to finish is unreliable.
1043 seems like 1 in 100 times, an invisible command to restore prompt didn't work
1044 #+begin_src emacs-lisp
1045 (setq shell-unset-prompt "unset PROMPT_COMMAND; unset PS1")
1046 (setq shell-set-prompt "PROMPT_COMMAND=prompt_command")
1047
1048 (if (boundp 'shell-unset-prompt)
1049 (send-invisible-string proc shell-unset-prompt))
1050 (if (boundp 'shell-set-prompt)
1051 (send-invisible-string proc shell-set-prompt))
1052
1053
1054 (defun send-invisible-string (proc string)
1055 "Like send-invisible, but non-interactive"
1056 (comint-snapshot-last-prompt)
1057 (funcall comint-input-sender proc string))
1058
1059 #+end_src
1060
1061
1062
1063 ** mu4e
1064
1065 alsot tried notmuch, it had some glitches, and it's config
1066 has a list of folders which i'd rather not publish, so it's config is archived.
1067
1068 #+begin_src emacs-lisp
1069 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
1070 (require 'mu4e)
1071 (setq send-mail-function (quote sendmail-send-it) ;; common to gnus also
1072 mu4e-sent-folder "/Sent Items"
1073 mu4e-drafts-folder "/Drafts"
1074 mu4e-trash-folder "/Trash"
1075 mu4e-refile-folder "/Archive"
1076 mu4e-get-mail-command "offlineimap"
1077 mu4e-update-interval 60
1078 mu4e-sent-messages-behavior 'delete
1079 mu4e-use-fancy-chars t
1080 mu4e-confirm-quit nil
1081 mu4e-headers-leave-behavior 'apply ;; dont ask
1082 mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields)
1083 ;; a bit faster than the default 500
1084 mu4e-headers-results-limit 80)
1085
1086 (define-key mu4e-headers-mode-map (kbd "<return>") 'mu4e-headers-view-message)
1087
1088 (defun my-mu4e-to ()
1089 "inspired by mu4e info manual"
1090 (--reduce-from (if (mu4e-message-contact-field-matches
1091 mu4e-compose-parent-message :to (cadr it))
1092 (concat (car it) (cadr it))
1093 acc)
1094 '("Ian Kelling <ian@iankelling.org")
1095 ;;'(("Ian Kelling " "<alternate1@example.com>")
1096 ;; ("Ian Kelling " "<alternate2@example.com>"))
1097 ))
1098
1099 (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
1100
1101 (add-to-list 'mu4e-view-actions
1102 '("ViewInBrowser" . mu4e-action-view-in-browser) t)
1103 (setq mu4e-maildir-shortcuts
1104 '( ("/INBOX" . ?i)
1105 ("/bog" . ?b)
1106 ("/Drafts" . ?d)))
1107
1108 #+end_src
1109
1110
1111
1112
1113 ** org-mode auto-complete source
1114
1115 todo, someday take a look at this. it is broken.
1116
1117 ;(defvar ac-source-eshell-pcomplete
1118 ; '((candidates . (pcomplete-completions))))
1119 ;(defun ac-complete-eshell-pcomplete ()
1120 ; (interactive)
1121 ; (auto-complete '(ac-source-eshell-pcomplete)))
1122
1123 ;(add-hook 'org-mode-hook (lambda () (setq ac-sources (cons 'ac-source-eshell-pcomplete ac-sources))))
1124 ;(add-to-list 'ac-modes 'eshell-mode)
1125
1126
1127 ** gnus nice unicode
1128
1129
1130 this looks nice, but it lags gnus just a bit
1131 #+begin_src emacs-lisp
1132
1133 (defun gnus-pretty-chars-setup ()
1134 (when window-system
1135 (setq gnus-sum-thread-tree-indent " "
1136 gnus-sum-thread-tree-root "● "
1137 gnus-sum-thread-tree-false-root "◯ "
1138 gnus-sum-thread-tree-single-indent "◎ "
1139 gnus-sum-thread-tree-leaf-with-other "├─► "
1140 gnus-sum-thread-tree-vertical "│"
1141 gnus-sum-thread-tree-single-leaf "╰─► ")))
1142 ;; dunno why, but this didn't work just setting on startup
1143 (add-hook 'gnus-startup-hook 'gnus-pretty-chars-setup)
1144
1145 #+end_src
1146
1147 ** readline complete fix, replaced with proper solution
1148
1149 update: I need this function here, where INSIDE_EMACS is replaced with RLC_INSIDE_EMACS.
1150
1151 i had commented out a few lines here, but instead I am setting in my profile
1152 the environment variable I commented out here. Yes, that is not the best explanation, but I will probably delete this as
1153 old history anyways.
1154 #+begin_src emacs-lisp
1155
1156 (defun comint-exec-1 (name buffer command switches)
1157 (let ((process-environment
1158 (nconc
1159 ;; If using termcap, we specify `emacs' as the terminal type
1160 ;; because that lets us specify a width.
1161 ;; If using terminfo, we specify `dumb' because that is
1162 ;; a defined terminal type. `emacs' is not a defined terminal type
1163 ;; and there is no way for us to define it here.
1164 ;; Some programs that use terminfo get very confused
1165 ;; if TERM is not a valid terminal type.
1166 ;; ;; There is similar code in compile.el.
1167 (if (and (boundp 'system-uses-terminfo) system-uses-terminfo)
1168 (list "TERM=dumb" "TERMCAP="
1169 (format "COLUMNS=%d" (window-width)))
1170 (list "TERM=emacs"
1171 (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
1172 ;; ian: commented this out
1173 ;;(unless (getenv "EMACS")
1174 ;; (list "EMACS=t"))
1175 (list (format "RLC_INSIDE_EMACS=%s,comint" emacs-version))
1176 process-environment))
1177 (default-directory
1178 (if (file-accessible-directory-p default-directory)
1179 default-directory
1180 "/"))
1181 proc decoding encoding changed)
1182 (let ((exec-path (if (and command (file-name-directory command))
1183 ;; If the command has slashes, make sure we
1184 ;; first look relative to the current directory.
1185 (cons default-directory exec-path) exec-path)))
1186 (setq proc (apply 'start-file-process name buffer command switches)))
1187 ;; Some file name handler cannot start a process, fe ange-ftp.
1188 (unless (processp proc) (error "No process started"))
1189 (let ((coding-systems (process-coding-system proc)))
1190 (setq decoding (car coding-systems)
1191 encoding (cdr coding-systems)))
1192 ;; Even if start-file-process left the coding system for encoding data
1193 ;; sent from the process undecided, we had better use the same one
1194 ;; as what we use for decoding. But, we should suppress EOL
1195 ;; conversion.
1196 (if (and decoding (not encoding))
1197 (setq encoding (coding-system-change-eol-conversion decoding 'unix)
1198 changed t))
1199 (if changed
1200 (set-process-coding-system proc decoding encoding))
1201 proc))
1202 #+end_src
1203 ** misc
1204 #+begin_src emacs-lisp
1205
1206 ; todo, is this require things necessary?
1207 ; (require 'flyspell)
1208
1209
1210
1211 ; whenever M-tab is completion, swap it with tab
1212 ;(define-key emacs-lisp-mode-map (kbd "<tab>") 'completion-at-point)
1213 ;(define-key emacs-lisp-mode-map (kbd "C-M-i") 'indent-for-tab-command)
1214 ;(define-key lisp-interaction-mode-map (kbd "<tab>") 'completion-at-point)
1215 ;(define-key lisp-interaction-mode-map (kbd "C-M-i") 'indent-for-tab-command)
1216 ;the global tab keyind. for some reason this totally screws up mini-buffer tab.
1217 ; disabled until I actually find myself using this, and find a fix for the above problem
1218 ;(global-set-key (kbd "<tab>") 'complete-symbol)
1219
1220
1221 ; todo, see how mastering emacs defines this function
1222 ;(global-set-key (kbd "M-j") 'ido-goto-symbol)
1223
1224
1225 ; todo, make my custom overlays have an underline if they are
1226 ; overriding a paren matching overlay
1227 ; make right click set the mark
1228 ; make search tab do completion instead of meta-tab
1229 ; in isearch, move C-y to C-v
1230 ; in isearch, move c-s to c-f
1231
1232 ; some testing to figure out the underlining when paren highlight conflicts
1233 ; (let ((extra-overlays (overlays-at (1+ end-point))))
1234 ; (when extra-overlays (print extra-overlays)))
1235
1236
1237
1238
1239 ; commented out because it messes up yank-pop.
1240 ; todo, fix it someday
1241 ; make yank linewise if it ends in a newline
1242 ;(defadvice yank (before linewise-yank-advice activate)
1243 ; (let ((arg (ad-get-arg 0)))
1244 ; (when (string-match "\n[ \t]*$" (current-kill (cond
1245 ;; ((listp arg) 0)
1246 ;; ((eq arg '-) -2)
1247 ;; (t (1- arg))) t))
1248 ;; (move-beginning-of-line nil))))
1249
1250
1251
1252 ; todo, look into augmenting auto-complete with hippie expand.
1253 ; starter kit has some hippie expand settings to look into:
1254 ; (when (boundp 'hippie-expand-try-functions-list)
1255 ; (delete 'try-expand-line hippie-expand-try-functions-list)
1256 ; (delete 'try-expand-list hippie-expand-try-functions-list))
1257
1258
1259 ;; hippie expand is dabbrev expand on steroids
1260 ;(setq hippie-expand-try-functions-list '(try-expand-dabbrev
1261 ; try-expand-dabbrev-all-buffers
1262 ; try-expand-dabbrev-from-kill
1263 ; try-complete-file-name-partially
1264 ; try-complete-file-name
1265 ; try-expand-all-abbrevs
1266 ; try-expand-list
1267 ; try-expand-line
1268 ; try-complete-lisp-symbol-partially
1269 ; try-complete-lisp-symbol))
1270 ;; use hippie-expand instead of dabbrev
1271 ;(global-set-key (kbd "M-/") 'hippie-expand)
1272
1273
1274 ; commented because i haven't had time to check it out yet
1275 ;; shorter aliases for ack-and-a-half commands
1276 ;(defalias 'ack 'ack-and-a-half)
1277 ;(defalias 'ack-same 'ack-and-a-half-same)
1278 ;(defalias 'ack-find-file 'ack-and-a-half-find-file)
1279 ;(defalias 'ack-find-file-same 'ack-and-a-half-find-file-same)
1280
1281
1282
1283
1284 ; todo. take a look at fixing this
1285 ;delete-old-versions t ; fix description in http://www.emacswiki.org/emacs/ForceBackups
1286
1287
1288
1289
1290 ;; prelude uses paredit mode.
1291 ;; paredit has some useful stuff but also annoying stuff.
1292 ;; if I ever do a ton of lisp coding, I should look into it
1293
1294
1295
1296
1297
1298
1299 ; random notes and example code
1300
1301
1302 ; usefull thing
1303 ;(map 'list #'list tabSwapKeys (reverse (getBinds tabSwapKeys)))
1304
1305 ; example of getting keymap info
1306 ;(car (car (minor-mode-key-binding (kbd "C-/") t)))
1307 ;(cdr (car (minor-mode-key-binding (kbd "C-/") t)))
1308 ;(global-key-binding (kbd "C-M-i") t)
1309 ;(minor-mode-key-binding (kbd "<tab>") t)
1310 ;(local-key-binding (kbd "C-M-i") t)
1311 ;(current-minor-mode-maps)
1312 ;(cdr (assq 'undo-tree-mode minor-mode-map-alist))
1313
1314
1315 ; center on incremental search, instead of being at top or bottom of screen.
1316 ; i'm hoping that setting Isearch Allow Scroll is good enough to fix this annoyance
1317 ;from http://stackoverflow.com/questions/11052678/emacs-combine-iseach-forward-and-recenter-top-bottom
1318
1319 ;example of constant definition of an overlay and propreries
1320 ;(defface mouse-flash-position '((t (:background "Yellow")))
1321 ; "*Face used to highlight mouse position temporarily."
1322 ; :group 'mouse)
1323 ;(defface mouse-flash-position '((t (:background "Yellow")))
1324 ; "*Face used to highlight mouse position temporarily."
1325 ; :group 'mouse)
1326 ;(defconst mouse-flash-posn-overlay
1327 ; ;; Create and immediately delete, to get "overlay in no buffer".
1328 ; (let ((ol (make-overlay (point-min) (point-max))))
1329 ; ;(delete-overlay ol)
1330 ; ;(overlay-put ol 'face 'mouse-flash-position)
1331 ; (overlay-put ol 'mouse-face 'mouse-flash-position)
1332 ; (overlay-put ol 'priority 1000000)
1333 ; ol)
1334 ; "Overlay to highlight current mouse position.")
1335
1336
1337 ;tip, put the last interactive command as elisp on the kill ring:
1338 ;C-x <ESC> <ESC> C-a C-k C-g
1339
1340 ; example of overlay testing
1341 ;(setq foo (make-overlay 2 3 nil t nil))
1342 ;(setq foo2 (make-overlay 3 4 nil t nil))
1343 ;(overlay-put foo 'face '(:background "red3" :foreground "black"))
1344 ;(overlay-put foo2 'face '(:background "red1" :foreground "black"))
1345 ;(overlay-put foo 'face 'visible-mark-face)
1346 ;(overlay-put foo 'face visible-mark-face2)
1347
1348
1349 #+end_src
1350
1351
1352 ** SQL
1353
1354 disabled, as I haven't used it in a long time. I think it was good for learning some sql stuff.
1355 #+begin_src emacs-lisp :tangle no
1356 (require 'sqlup-mode)
1357 (add-hook 'sql-mode-hook 'sqlup-mode)
1358 (add-hook 'sql-interactive-mode-hook 'sqlup-mode)
1359
1360 (setq sql-product 'postgres)
1361 #+end_src
1362
1363
1364 * elisp settings
1365 #+begin_src emacs-lisp
1366 ; when manually evaluating lisp, go into debugger on error
1367 (setq eval-expression-debug-on-error t)
1368 ;reminder of useful var: debug-on-error
1369 #+end_src
1370
1371
1372
1373
1374
1375 * gnus
1376
1377 good info http://www.emacswiki.org/emacs/GnusTutorial
1378 good info http://www.emacs.uniyar.ac.ru/doc/em24h/emacs183.htm
1379
1380 searching / accessing old mailing list messages:
1381 http://wiki.list.org/display/DOC/How+do+I+make+the+archives+searchable
1382 3 options suggested. nabble is very good, and you can even reply directly from their web interface with your own email
1383 address.
1384 google with site:example.com/archive works
1385 However, it has the downside of relying on a 3rd party running unreleased software.
1386 mail-archive.com and gmane.org search do not work.
1387
1388 Some lists mirror to a newsgroup via gmane, and then mirror the newsgroup via a google group, which has good search
1389 ability, and you can post via the newsgroup.
1390
1391 Downsides of nabble/google. Doesn't integrate with normal email programs, and lock in. They store and show you what you
1392 have and haven't read, what messages you've sent, etc. migrating that data to a normal mail program is undocumented and
1393 unsupported.
1394
1395 mailmans normal public archives are a bit obfuscated, but there is also a "private" archive, available to subscribers,
1396 which is not obfuscated, and can be easily imported to your local email program.
1397 you have to sub and log in to the web interfact to access it, and then the url is unpublished, but follows a format,
1398 which is documented in a few places around the web like
1399 https://mail.python.org/pipermail/mailman-users/2005-September/046757.html
1400 its form is:
1401 https://lists.fedorahosted.org/mailman/private/hyperkitty-devel.mbox/hyperkitty-devel.mbox
1402 http://www.example.com/mailman/private/<listname>.mbox/<listname>.mbox
1403 if you copy the url after logging in, and pass it to this function, it will print the transformed url
1404 lurl() { local x="${1#*/options/}"; x="${x%%/*}.mbox"; echo "${1%/mailman/*}/mailman/private/$x/$x"; }
1405
1406 Then you can download that url. Actually downloading the url is something firefox doesn't make the easiest out of the box.
1407 Here are some options:
1408 - paste in the url bar, the save the page
1409 as a file after it loads.
1410 - use downthemall extension or similar and paste the url in it.
1411 - put it in an html page as
1412 a link (or a small javascript program which will display input as a link), then right click and save as.
1413 wget won't work because you need to have (i assume) the authorization cookie mailman gives your browser
1414
1415 people have written various tools to de-obfuscate the normal public archives and sometimes import them to a mail
1416 program. It seems they were not aware of the private archive. However, these tools are probably still useful to automate
1417 things. None of them has a lot of usage, so I decided it was not worth the risk of hitting bugs vs doing a few extra clicks.
1418
1419 this was the most interesting one I found within a few minutes of googling.
1420 https://github.com/wcdolphin/mailman-downloader
1421
1422 Once you have an mbox file, there are rather straightforward ways to get it into any mail program, but I will cover
1423 gnus, which I use and is a bit tricky.
1424
1425 gnus has a native search (limited, too slow for body text searches), and external search engine integration.
1426 gnus manual recommends converting to maildir for searching local mail, but importing lots of maildir messages to gnus
1427 takes 10+ minutes, so scratch that option. it suggests 2 alternate options
1428 mairix. for mbox, it doesn't integrate 100% with gnus, it copies the search results to a mbox
1429 and tells gnus to make a group of that mbox and display it. This means the read state won't be persistent, but otherwise
1430 works great.
1431
1432 local imap server which will use the mbox and provide search.
1433 dovecot is modular, theres a dovecot-common which uses recommends to install i guess it's most used modules. Its
1434 description is completely not useful. Anyways, I'm not sure if there is any benefit to installing this over just the
1435 module we need.
1436 pi dovecot-imapd
1437
1438 dovecot by default also makes a an inbox folder based on the normal local mail location /var/mail/<username>
1439 those locations are adjustable and well documented via the var mail_location in
1440 /etc/dovecot/conf.d/10-mail.conf
1441 I forward my local mail, didn't see immediately how to turn off the inbox, but it will always be empty, so I left as
1442 is. you could make the var be empty, which apparently has the same effect.
1443
1444 Originally just linked the default location ~/.mail, but I changed to altering the config since ~/.mail since it seems
1445 other things like postfix use that location
1446
1447 based on http://roland.entierement.nu/blog/2010/09/08/gnus-dovecot-offlineimap-search-a-howto.html
1448 other links that poped up contained outdated, innacurate information
1449 http://sachachua.com/blog/2008/05/geek-how-to-use-offlineimap-and-the-dovecot-mail-server-to-read-your-gmail-in-emacs-efficiently/
1450 http://www.emacswiki.org/emacs/JamesFerguson
1451 http://www.sanityinc.com/articles/read-mailing-lists-in-emacs-over-imap/
1452
1453 Within emacs you can move messages between mbox and maildir etc, which is a nice flexibility.
1454
1455
1456
1457 doc group for mbox:
1458 in gnus, do gnus-group-make-doc-group (G f in groups buffer) and point to the file
1459
1460 info about groups created within gnus is stored in ~/.newsrc.eld
1461 also stored is a duplication of what email messages are read/unread,
1462 what newsgroups are subsribed to and read/unread,
1463 probably more stuff, everything that gnus saves.
1464
1465
1466 searching the body of the messages, i cut off after a few minutes.
1467 i can grep the file in just a couple seconds
1468
1469
1470 random side note
1471 we can also get mbox from gmane
1472 http://notmuchmail.org/howto/#index7h2
1473
1474
1475 gnus can't search mboxes except with its builtin search which is extremely slow. mairix can do mbox files from the command
1476 line, but not from within gnus, but from mairix.el, which can then open the results in gnus
1477
1478 mbox can be converted to maildir easily, but gnus loads lots of maildir messages extremely slow. it parses all the
1479 headers and generates a nov file for each.
1480
1481 nnfolder-generate-active-file
1482
1483 to reset things, when changing mail group. I duno all the proper way, but it works to delete
1484 ~/Mail ~/.newsrc.eld ~/.dribble (or something)
1485
1486
1487 ** mail sources vs select methods background
1488 I found this very confusing when first reading through the manual. "mail sources" is a term that does not simply mean
1489 sources of mail, it is much narrower for gnus. sources of mail can be either "mail sources" or select methods. Mail
1490 sources will move mail to ~/Mail (not sure what format), and split it into groups according to variables. You can use
1491 "mail sources" for maildir / imap, but those can also be read via select methods, which do not move the mail from their
1492 location, but use them in their native format. This is what I want to do, and I can simply ignore mail
1493 sources. Confusing terminology is that "fetching mail" "scanning mail", lots of things mail doesn't mean all mail, it
1494 means specifically from "mail sources". The words "articles" and "news" is used in connection with select methods, aka my actual mail.
1495
1496
1497
1498 ** caching background
1499
1500 caching:
1501 there is also ~/News/cache, filled with a bunch of articles, like 300 megs. can't figure out why.
1502 Grepped for caching in the manual, found 2 main things.
1503 cache is for 2 purposes. to cache locally, and to keep articles from expiring, called persistence
1504 gnus-use-cache, which puts things if they are
1505 gnus-cache-enter-articles
1506 things go in cache when they are marked certain ways by default, ticked and dormant
1507 and read articles are moved out of the cache
1508 still no idea why i have a bunch in the cache, but I set a var so that my mail won't get cached
1509 I'm gonna delete the cache, and check on it later see what exactly is going in there
1510 And of course, I moved ~/News to my encrypted drive and symlinked it
1511
1512
1513 * haskell
1514 :LOGBOOK:
1515 :END:
1516
1517 useful comint-shell mode commands. If not prefaced with *, it means it is not in the haskell custom repl
1518 *todo: setup haskell c-t toggle arrow keys
1519 tab completion
1520 C-q insert prev arg
1521 C-( history search
1522 c-m-left/right move to next/prev prompts
1523 *c-enter, multi-line input
1524 *s-delete, send input across windows. (i can implement this)
1525 *c-m-l clear screen
1526 *haskell-process-interrupt, c-cc terminate job (i can implement this maybe)
1527
1528 nice bash/readline functions missing in comint:
1529 yank-nth-arg
1530 operate-get-next
1531 menu-complete
1532
1533 usefull comint commands:
1534 c-cl : list historic command in temp buffer
1535 C-c C-o comint-delete-output
1536 comint-restore-input, todo: put this on a randomish c-c key
1537
1538
1539
1540 todo:
1541 checkout haskell repl functions:
1542 c-cv haskell-check, hlint
1543 C-M-q prog-indent-sexp
1544 c-c. haskell-mode-format-imports
1545 C-c M-/ haskell-doc-check-active
1546 haskell-process-generate-tags
1547 haskell-process-cabal-build
1548 haskell-cabal-command.. or something
1549 haskell-process-restart
1550 C-h v haskell-process-log
1551 C-h v haskell-process-show-debug-tips
1552
1553 various not immediately useful functions:
1554 haskell-process-add-dependency
1555 haskell-process-touch-buffer
1556 haskell-process-cd
1557 haskell-process-unignore
1558 haskell-process-reload-devel-main
1559
1560
1561 rebind
1562 home: C-a haskell-interactive-mode-beginning
1563 c-return: C-j haskell-interactive-mode-newline-indent
1564 up/down: <C-down> haskell-interactive-mode-history-next
1565
1566 todo haskell mode better binds for:
1567 'haskell-process-load-file
1568 'haskell-process-do-type
1569 'haskell-process-do-info
1570 'inferior-haskell-send-decl
1571
1572
1573 commands which don't work in haskell-interactive-mode(hi) vs inferior-haskell-mode(ih, default)
1574 functions not in hi:
1575 inferior-haskell-find-definition, use tags instead
1576 inferior-haskell-find-haddock, todo, test if this works
1577
1578 redefined ih to hi
1579 switch-to-haskell -> 'haskell-interactive-switch
1580 haskell-process-load-file -> inferior-haskell-load-file
1581 haskell-process-do-type -> inferior-haskell-type
1582 switch-to-haskell -> haskell-interactive-switch
1583 inferior-haskell-load-file -> 'haskell-process-load-file
1584
1585
1586 haskell-mode installation from source, based on its readme
1587 in the git directory,
1588 make all
1589
1590 #+begin_src emacs-lisp
1591
1592
1593
1594 ;; remove default option to not link the file
1595 (setq haskell-compile-command "ghc -Wall -ferror-spans -fforce-recomp %s")
1596 (add-hook 'haskell-indentation-mode-hook
1597 (lambda ()
1598 (define-key haskell-indentation-mode-map [?\C-d] nil)
1599 (define-key haskell-indentation-mode-map
1600 (kbd "<deletechar>")
1601 'haskell-indentation-delete-char)))
1602
1603 ;;copied from haskell-mode docs in order to use the new, better, nondefault
1604 ;;interactive mode.
1605 (eval-after-load "haskell-mode"
1606 '(progn
1607 (define-key haskell-mode-map (kbd "C-x C-d") nil)
1608 (define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
1609 (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
1610 (define-key haskell-mode-map (kbd "C-c C-b") 'haskell-interactive-switch)
1611 (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
1612 (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
1613 (define-key haskell-mode-map (kbd "C-c M-.") nil)
1614 (define-key haskell-mode-map (kbd "C-c C-d") nil)))
1615
1616 ;; ghc-mod install http://www.mew.org/~kazu/proj/ghc-mod/en/emacs.html
1617 ;; todo, try this out
1618 ;; (autoload 'ghc-init "ghc" nil t)
1619 ;;(add-hook 'haskell-mode-hook (lambda () (ghc-init) (flymake-mode)))
1620
1621
1622
1623 (add-to-list 'load-path "~/.emacs.d/src/ghci-completion")
1624 ;; from the package readme for ghci-completion
1625 (require 'ghci-completion)
1626 (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)
1627
1628
1629 ;; disable some rebinds. they are set to appropriate keys in the keybinds section
1630 (eval-after-load "haskell-mode"
1631 '(progn
1632 (define-key haskell-mode-map (kbd "C-a") 'nil)
1633 (define-key haskell-mode-map (kbd "C-j") 'nil)))
1634
1635 (defun pretty-lambdas-haskell ()
1636 (font-lock-add-keywords
1637 nil `((,(concat "(?\\(" (regexp-quote "\\") "\\)")
1638 (0 (progn (compose-region (match-beginning 1) (match-end 1)
1639 ,(make-char 'greek-iso8859-7 107))
1640 nil))))))
1641 ;; from haskell-mode manual
1642 (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
1643 (when (window-system)
1644 (add-hook 'haskell-mode-hook 'pretty-lambdas-haskell))
1645
1646 ;; added from haskell-mode website install instructions
1647 ;(load "/usr/share/emacs/site-lisp/haskell-mode/haskell-site-file")
1648 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
1649 ;;the three indentation modules are mutually exclusive - add at most one. Trying out the "most advanced"
1650 (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
1651 ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
1652 ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
1653
1654
1655 ;; todo, set this to some other key
1656 ;; (local-set-key (kbd "C-e") 'my-haskell-load-and-run)
1657
1658 (defun my-haskell-load-and-run ()
1659 "Loads and runs the current Haskell file."
1660 (interactive)
1661 (let ((start-buffer (current-buffer)))
1662 (inferior-haskell-load-and-run inferior-haskell-run-command)
1663 (sleep-for 0 100)
1664 (end-of-buffer)
1665 (pop-to-buffer start-buffer)))
1666
1667 ;; show haskell function in mode line
1668 ;; todo, this broke after updating emacs
1669 ;;(eval-after-load "which-func"
1670 ;; '(add-to-list 'which-func-modes 'haskell-mode))
1671
1672
1673
1674 (add-hook 'interactive-haskell-mode-hook 'ac-haskell-process-setup)
1675 (add-hook 'haskell-interactive-mode-hook 'ac-haskell-process-setup)
1676 (eval-after-load "auto-complete"
1677 '(add-to-list 'ac-modes 'haskell-interactive-mode))
1678
1679 (add-hook 'haskell-mode-hook
1680 (lambda () (define-key haskell-mode-map (kbd "C-(")
1681 (lambda () (interactive)
1682 (basic-save-buffer)
1683 (haskell-compile)
1684 (run-with-timer .3 nil 'repeat-shell)))))
1685 (add-hook 'haskell-cabal-mode-hook
1686 (lambda () (define-key haskell-cabal-mode-map (kbd "C-(") 'haskell-compile)))
1687
1688
1689
1690 (add-hook 'haskell-interactive-mode-hook
1691 (lambda ()
1692 (define-key haskell-interactive-mode-map "\r" nil)
1693 (define-key haskell-interactive-mode-map (kbd "<return>") 'haskell-interactive-mode-return)))
1694 (add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil)))
1695
1696
1697
1698 (add-hook 'haskell-interactive-mode-hook
1699 (lambda ()
1700 (define-key haskell-interactive-mode-map (kbd "<C-M-return>") 'haskell-interactive-mode-newline-indent)))
1701
1702 #+end_src
1703
1704 #+RESULTS:
1705 | (lambda nil (define-key haskell-interactive-mode-map (kbd <C-M-return>) (quote haskell-interactive-mode-newline-indent))) | (lambda nil (define-key haskell-interactive-mode-map \n nil) (define-key haskell-interactive-mode-map (kbd <return>) (quote haskell-interactive-mode-return))) | ac-haskell-process-setup |
1706
1707 * isearch
1708 #+begin_src emacs-lisp
1709 (setq
1710 isearch-allow-scroll t
1711 search-ring-update t) ;; dont start an edit when going to previous search
1712
1713 (defun isearch-yank-regexp (regexp)
1714 "Pull REGEXP into search regexp."
1715 (let ((isearch-regexp nil)) ;; Dynamic binding of global.
1716 (isearch-yank-string regexp))
1717 (isearch-search-and-update))
1718
1719 (defun isearch-yank-symbol (&optional partialp backward)
1720 "Put symbol at current point into search string.
1721
1722 If PARTIALP is non-nil, find all partial matches."
1723 (interactive "P")
1724
1725 (let (from to bound sym)
1726 (setq sym
1727 ; this block taken directly from find-tag-default
1728 ; we couldn't use the function because we need the internal from and to values
1729 (when (or (progn
1730 ;; Look at text around `point'.
1731 (save-excursion
1732 (skip-syntax-backward "w_") (setq from (point)))
1733 (save-excursion
1734 (skip-syntax-forward "w_") (setq to (point)))
1735 (> to from))
1736 ;; Look between `line-beginning-position' and `point'.
1737 (save-excursion
1738 (and (setq bound (line-beginning-position))
1739 (skip-syntax-backward "^w_" bound)
1740 (> (setq to (point)) bound)
1741 (skip-syntax-backward "w_")
1742 (setq from (point))))
1743 ;; Look between `point' and `line-end-position'.
1744 (save-excursion
1745 (and (setq bound (line-end-position))
1746 (skip-syntax-forward "^w_" bound)
1747 (< (setq from (point)) bound)
1748 (skip-syntax-forward "w_")
1749 (setq to (point)))))
1750 (buffer-substring-no-properties from to)))
1751 (cond ((null sym)
1752 (message "No symbol at point"))
1753 ((null backward)
1754 (goto-char (1+ from)))
1755 (t
1756 (goto-char (1- to))))
1757 (isearch-search)
1758 (if partialp
1759 (isearch-yank-string sym)
1760 (isearch-yank-regexp
1761 (concat "\\_<" (regexp-quote sym) "\\_>")))))
1762
1763 (defun isearch-current-symbol (&optional partialp)
1764 "Incremental search forward with symbol under point.
1765
1766 Prefixed with \\[universal-argument] will find all partial
1767 matches."
1768 (interactive "P")
1769 (let ((start (point)))
1770 (isearch-forward-regexp nil 1)
1771 (isearch-yank-symbol partialp)))
1772 ;; todo, make this
1773
1774 (defun isearch-backward-current-symbol (&optional partialp)
1775 "Incremental search backward with symbol under point.
1776
1777 Prefixed with \\[universal-argument] will find all partial
1778 matches."
1779 (interactive "P")
1780 (let ((start (point)))
1781 (isearch-backward-regexp nil 1)
1782 (isearch-yank-symbol partialp)))
1783
1784
1785
1786 ; lets look through emacs starter kit before we throw this out.
1787
1788
1789 ; automatically wrap to the top of the buffer when isearch fails
1790 (defadvice isearch-search (after isearch-no-fail activate)
1791 (unless isearch-success
1792 (ad-disable-advice 'isearch-search 'after 'isearch-no-fail)
1793 (ad-activate 'isearch-search)
1794 (isearch-repeat (if isearch-forward 'forward))
1795 (ad-enable-advice 'isearch-search 'after 'isearch-no-fail)
1796 (ad-activate 'isearch-search)))
1797
1798 ;; Activate occur easily inside isearch
1799 (define-key isearch-mode-map (kbd "C-o")
1800 (lambda () (interactive)
1801 (let ((case-fold-search isearch-case-fold-search))
1802 (occur (if isearch-regexp
1803 isearch-string
1804 (regexp-quote isearch-string))))))
1805
1806
1807 #+end_src
1808
1809 * lisp / elisp mode setings
1810 #+begin_src emacs-lisp
1811
1812 (add-hook 'emacs-lisp-mode-hook 'starter-kit-remove-elc-on-save)
1813 (defun starter-kit-remove-elc-on-save ()
1814 "If you're saving an elisp file, likely the .elc is no longer valid."
1815 (make-local-variable 'after-save-hook)
1816 (add-hook 'after-save-hook
1817 (lambda ()
1818 (if (file-exists-p (concat buffer-file-name "c"))
1819 (delete-file (concat buffer-file-name "c"))))))
1820
1821
1822 (defun emacs-lisp-mode-defaults ()
1823 ;; checkdoc has an annoying feature that wants a header and footer
1824 ;; in every elisp buffer as if they all were packages
1825 ;; todo, see if there is a way
1826 ;; to make checkdoc usable instead of just disabling it as I do here
1827 (if (boundp 'flycheck-checkers)
1828 (setq flycheck-checkers (remove 'emacs-lisp-checkdoc flycheck-checkers)))
1829 (eldoc-mode 1))
1830 (add-hook 'emacs-lisp-mode-hook 'emacs-lisp-mode-defaults)
1831
1832 (define-key lisp-mode-map (kbd "<M-up>") 'backward-up-list)
1833 (define-key lisp-mode-map (kbd "<M-down>") 'down-list)
1834 (define-key emacs-lisp-mode-map (kbd "<M-up>") 'backward-up-list)
1835 (define-key emacs-lisp-mode-map (kbd "<M-down>") 'down-list)
1836 (define-key emacs-lisp-mode-map (kbd "<M-escape>") 'find-function-at-point)
1837
1838 ;; interactive modes don't need whitespace checks
1839 (defun interactive-lisp-coding-defaults ()
1840 (whitespace-mode -1))
1841 (setq prelude-interactive-lisp-coding-hook 'prelude-interactive-lisp-coding-defaults)
1842
1843
1844 ;; ielm is an interactive Emacs Lisp shell
1845 (defun ielm-mode-defaults ()
1846 (run-hooks 'prelude-interactive-lisp-coding-hook)
1847 (turn-on-eldoc-mode))
1848 (add-hook 'ielm-mode-hook 'ielm-mode-defaults)
1849
1850 #+end_src
1851
1852
1853 * java eclim
1854
1855 based on https://github.com/senny/emacs-eclim
1856
1857
1858 eclim: eclipse completion, searching, validation, etc inside emacs
1859 install
1860 #+begin_src sh :tangle no
1861 cd ~/opt
1862 git clone git://github.com/ervandew/eclim.git
1863 cd eclim
1864 pi ant
1865 ant -Declipse.home=/a/opt/eclipse
1866 #+end_src
1867
1868
1869 currently makes emacs hang a bunch. dunno why. just using eclipse instead
1870 #+begin_src emacs-lisp :tangle no
1871 (require 'eclim)
1872 (global-eclim-mode)
1873
1874 ;; just do java
1875 (setq eclim-accepted-file-regexps
1876 '("\\.java"))
1877
1878 (custom-set-variables
1879 '(eclim-eclipse-dirs '("/a/opt/eclipse"))
1880 '(eclim-executable "/a/opt/eclipse/eclim"))
1881
1882 (setq help-at-pt-display-when-idle t)
1883 (setq help-at-pt-timer-delay 0.1)
1884 (help-at-pt-set-timer)
1885
1886 ;; dunno if this line is needed
1887 (require 'eclimd)
1888 (setq eclimd-default-workspace "/a/bin/eclipse-workspace")
1889
1890 ;;add the emacs-eclim source
1891 (require 'ac-emacs-eclim-source)
1892 (add-hook 'java-mode-hook 'ac-emacs-eclim-java-setup)
1893
1894 #+end_src
1895
1896 #+RESULTS:
1897 | ac-emacs-eclim-java-setup |
1898
1899 * mediawiki
1900 #+begin_src emacs-lisp
1901
1902 (add-to-list 'load-path "~/.emacs.d/src/mediawiki-el")
1903 (eval-after-load "mediawiki"
1904 '(progn
1905 (remove-hook 'outline-minor-mode-hook 'mediawiki-outline-magic-keys)
1906 (add-hook 'mediawiki-mode-hook
1907 (lambda () (define-key mediawiki-mode-map (kbd "C-(") 'mediawiki-save-reload)))
1908
1909 ;; mediawiki mode has a bug that it will claim an edit conflict unless you reload after saving.
1910 ;; I also like to save with no edit summary for previewing on my local mw instance
1911 (defun mediawiki-save-reload ()
1912 (interactive)
1913 (and (mediawiki-save "") (mediawiki-reload)))))
1914 #+end_src
1915 * modes with little configuration needed
1916 #+begin_src emacs-lisp
1917
1918 (load-file "/a/h/iank-mod.el")
1919
1920 (require 'ws-butler)
1921 (ws-butler-global-mode)
1922
1923
1924 (require 'nginx-mode)
1925 ;;The mode should automatically activate for files called nginx.conf and files under /etc/nginx - if not, you can add something like this to your init file:
1926 ;;(add-to-list 'auto-mode-alist '("/etc/nginx/sites-available/.*" . nginx-mode))
1927
1928 ;; todo, put this on a hook with prog mode
1929 ;;(highlight-indentation-mode 1)
1930
1931 (add-hook 'auto-revert-tail-mode-hook
1932 (lambda ()
1933 (when (string=
1934 buffer-file-name
1935 "/var/log/cloudman/development/cm-service.log")
1936 (setq-local prev-auto-revert-max 0)
1937 ;; set buffer-local hook
1938 (add-hook 'after-revert-hook 'tail-colorize nil t))))
1939 (defun tail-colorize ()
1940 (ansi-color-apply-on-region prev-auto-revert-max (point-max))
1941 (setq-local prev-auto-revert-max (point-max)))
1942
1943
1944 ;; gnu global
1945 (require 'ggtags)
1946 (add-hook 'c-mode-common-hook
1947 (lambda () (ggtags-mode 1)
1948 (setq c-label-minimum-indentation 0)))
1949
1950 ;; specific to my unusual keybind setup, you may want to
1951 ;; pick different keys
1952 (define-key ggtags-mode-map (kbd "C-M-o") 'ggtags-find-tag-dwim)
1953 (define-key ggtags-mode-map (kbd "C-M-m") 'ggtags-grep)
1954
1955 (defun gtags-update-single(filename)
1956 "Update Gtags database for changes in a single file"
1957 (interactive)
1958 (start-process "update-gtags" "update-gtags" "bash" "-c" (concat "cd " ggtags-project-root " ; gtags --single-update " filename )))
1959
1960 (defun gtags-update-current-file()
1961 (interactive)
1962 (let ((rel-filename (replace-regexp-in-string
1963 ggtags-project-root "."
1964 (buffer-file-name (current-buffer)))))
1965 (gtags-update-single rel-filename)))
1966
1967 (defun gtags-update-hook()
1968 "Update GTAGS file incrementally upon saving a file"
1969 (when (and ggtags-mode ggtags-project-root)
1970 (gtags-update-current-file)))
1971
1972 (add-hook 'after-save-hook 'gtags-update-hook)
1973
1974 ;; i'd like to make some elisp which modifies a keymap to remove
1975 ;; all binds which don't match a predicate.
1976 ;; I tried setting a keymap to a new keymap,
1977 ;; but that didn't register as functional.
1978 ;; so I'd need to modify the list in place.
1979
1980 (require 'magit)
1981
1982
1983 ;; http://ergoemacs.org/emacs/emacs_CSS_colors.html
1984 ;; there's also rainbow mode, which seems to only work for specific colors? it didn't work at all for me in a css file.
1985 ;; todo, do config group on it, and try out one of those colors.
1986 (defun xah-syntax-color-hsl ()
1987 "Syntax color hex color spec such as 「hsl(0,90%,41%)」 in current buffer."
1988 (interactive)
1989 (font-lock-add-keywords
1990 nil
1991 '(("hsl( *\\([0-9]\\{1,3\\}\\) *, *\\([0-9]\\{1,3\\}\\)% *, *\\([0-9]\\{1,3\\}\\)% *)"
1992 (0 (put-text-property
1993 (+ (match-beginning 0) 3)
1994 (match-end 0)
1995 'face (list :background
1996 (concat "#" (mapconcat 'identity
1997 (mapcar
1998 (lambda (x) (format "%02x" (round (* x 255))))
1999 (color-hsl-to-rgb
2000 (/ (string-to-number (match-string-no-properties 1)) 360.0)
2001 (/ (string-to-number (match-string-no-properties 2)) 100.0)
2002 (/ (string-to-number (match-string-no-properties 3)) 100.0)
2003 ) )
2004 "" )) ; "#00aa00"
2005 ))))) )
2006 (font-lock-fontify-buffer)
2007 )
2008
2009 (add-hook 'css-mode-hook 'xah-syntax-color-hsl)
2010 (add-hook 'php-mode-hook 'xah-syntax-color-hsl)
2011 (add-hook 'html-mode-hook 'xah-syntax-color-hsl)
2012
2013
2014 ;; message mode prompted me on first message.
2015 ;; a function which describes options then sets this
2016 ;; the other options were to use smtp directly or pass to another mail client
2017 ;; here we use the standard sendmail interface, which I use postfix for
2018 (setq send-mail-function (quote sendmail-send-it))
2019
2020 (add-to-list 'load-path "~/.emacs.d/src/spray")
2021 (require 'spray)
2022 (global-set-key (kbd "C-M-w") 'spray-mode)
2023 ;; remember, h/l = move. f/s = faster/slower, space = pause, all others quit
2024
2025 ;; delete active selection with self-insert commands
2026 (delete-selection-mode t)
2027
2028 ;; Transparently open compressed files
2029 (auto-compression-mode t)
2030
2031 ;; Highlight matching parenthesesq when the pointq is on them.
2032 ;; not needed since smart paren mode?
2033 ;; (show-paren-mode 1)
2034
2035
2036 ;; not documented, but looking at the source, I find this
2037 ;; stops me from being asked what command on every C-c-c
2038 ;; when doing a latex document.
2039 (setq TeX-command-force "LaTeX")
2040
2041 ;; dot mode, repeats last action
2042 (require 'dot-mode)
2043 (add-hook 'find-file-hooks 'dot-mode-on)
2044
2045
2046 ;; clean up obsolete buffers automatically at midnight
2047 (require 'midnight)
2048
2049
2050 ;; disabled because it takes 400ms on startup
2051 ;; ;; emacs regexes are too limited.
2052 ;; (require 'foreign-regexp)
2053 ;; ;; perl is most powerful, but javascript is pretty close and
2054 ;; ;; I'd rather know javascript stuff than perl
2055 ;; (custom-set-variables
2056 ;; '(foreign-regexp/regexp-type 'javascript) ;; Choose by your preference.
2057 ;; '(reb-re-syntax 'foreign-regexp)) ;; Tell re-builder to use foreign regexp.
2058 ;; ;; it would be nice to add documentation to do this for more commands to that package
2059 ;; ;; disabled because it's too slow. but I'd still m-x it for advanced replacements
2060 ;; ;;(define-key global-map [remap isearch-forward-regexp] 'foreign-regexp/isearch-forward)
2061
2062
2063 ;; saner regex syntax
2064 (require 're-builder)
2065 (setq reb-re-syntax 'string)
2066
2067
2068 ;; use shift + arrow keys to switch between visible buffers
2069 ;; todo, set these keys to something else
2070 (require 'windmove)
2071 (windmove-default-keybindings)
2072
2073
2074 ;; show the name of the current function definition in the modeline
2075 (require 'which-func)
2076 (setq which-func-modes t)
2077 (which-function-mode 1)
2078
2079
2080 ;; enable winner-mode to manage window configurations
2081 (winner-mode +1)
2082
2083 ;; meaningful names for buffers with the same name
2084 (require 'uniquify)
2085 (setq uniquify-buffer-name-style 'forward
2086 uniquify-separator "/"
2087 ;; for sdx work. until I figure out a better way.
2088 ;; maybe something like projectile can do it,
2089 ;; or hacking around the status bar
2090 uniquify-min-dir-content 2
2091 uniquify-after-kill-buffer-p t ; rename after killing uniquified
2092 uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers
2093
2094
2095 ;; makefiles require tabs
2096 ;; todo: find a makefile indent function that works,
2097 ;; best I could find is this one which means don't indent at all
2098 ;;
2099 (add-hook 'makefile-mode-hook
2100 (lambda ()
2101 (setq indent-tabs-mode t)
2102 (setq indent-line-function (lambda () 'no-indent))))
2103
2104
2105 ;; todo, turn on auto-fill just for txt files
2106 ;;(add-hook 'text-mode-hook 'turn-on-auto-fill)
2107 (add-hook 'text-mode-hook 'turn-on-flyspell)
2108
2109
2110 ;; auto indent shell script comments
2111 (setq sh-indent-comment t)
2112
2113 ;; random extra highlights
2114 (require 'volatile-highlights)
2115 (volatile-highlights-mode t)
2116
2117
2118 ;; make help buffers smaller when it makes sense
2119 (temp-buffer-resize-mode 1)
2120
2121
2122 (require 'info+)
2123 ;; based on suggestions in info+.el, I also installed misc-fns, strings, and thingatpt+
2124 ;; remove some bad keybinds from info+
2125 (define-key Info-mode-map [mouse-4] nil)
2126 (define-key Info-mode-map [mouse-5] nil)
2127
2128
2129 (require 'smooth-scroll)
2130 ;; long gnus summary buffers lags too much with this,
2131 ;; but I like it enough to leave it enabled by default
2132 ;; and crank up the step size to be faster
2133 ;; and it doesn't have a way to enable it only for certain modes etc.
2134 ;; todo sometime, make it work for certain modes only
2135 (smooth-scroll-mode t)
2136 ;; its too slow with the default of 2
2137 (setq smooth-scroll/vscroll-step-size 7)
2138 ;; sublimity doesn't work as good going fast by default
2139 ;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location
2140
2141
2142 (setq sh-here-document-word "'EOF'")
2143
2144 (setq tramp-default-method "ssh")
2145 #+end_src
2146 * misc general settings
2147
2148 #+begin_src emacs-lisp
2149
2150 (setq vc-follow-symlinks t)
2151
2152 ;; give us a shell to start instead of scratch
2153 ;;(setq initial-buffer-choice (lambda () (new-shell)))
2154
2155 ;; disable this nasty function, as I always use a gui
2156 (defun suspend-frame() (interactive))
2157
2158 ;; to reopen just ido-switch-buffer (c-l), *scratch*
2159 ;; (kill-buffer "*scratch*")
2160
2161 ;; Seed the random-number generator
2162 (random t)
2163
2164 ;; easier to remember than keybinds
2165 (defalias 'scrypt 'mml-secure-message-encrypt-pgpmime)
2166 (defalias 'sign 'mml-secure-message-sign-pgpmime)
2167 (defun encrypt ()
2168 (interactive)
2169 (mml-secure-message-encrypt-pgpmime 'dontsign))
2170
2171 ;; don't highlight the region.
2172 (set-face-background 'region nil)
2173
2174 ;; this fixes save error for python example code
2175 (define-coding-system-alias 'UTF-8 'utf-8)
2176
2177 ;; i don't use frame titles, but if I ever do
2178 ;; this starter kit setting is probably good
2179 (if window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))))
2180
2181 (set-terminal-coding-system 'utf-8)
2182 (set-keyboard-coding-system 'utf-8)
2183 (prefer-coding-system 'utf-8)
2184
2185 ;; remove ugly 3d box feature
2186 (set-face-attribute 'mode-line nil :box nil)
2187
2188 (add-to-list 'default-frame-alist
2189 '(font . "DejaVu Sans Mono-11"))
2190 ; the default will jump 2 sizes.
2191 (setq text-scale-mode-step 1.1)
2192 (setq font-lock-maximum-decoration t
2193 inhibit-startup-message t
2194 transient-mark-mode t
2195 delete-by-moving-to-trash t
2196 shift-select-mode nil
2197 truncate-partial-width-windows nil
2198 uniquify-buffer-name-style 'forward
2199 oddmuse-directory "~/.emacs.d/oddmuse"
2200 echo-keystrokes 0.1
2201 mark-ring-max 160
2202 sort-fold-case t ; case insensitive line sorting
2203 global-mark-ring-max 1000
2204 ;; the bell seems to lag the ui
2205 ;;visible-bell t
2206 case-replace nil
2207 revert-without-query '(".*")
2208 ;; don't pause display code on input.
2209 ;; smoother display performance at slight cost of input performance
2210 redisplay-dont-pause t
2211 font-lock-maximum-decoration t) ; probably default and not necesary
2212
2213
2214 (setq-default indent-tabs-mode nil ;; don't use tabs to indent
2215 cursor-type 'box
2216 fill-column 72
2217
2218 ;; wrap at word boundaries instead of mid-word
2219 word-wrap t
2220 imenu-auto-rescan t
2221 indicate-empty-lines t) ; mark end of buffer
2222
2223
2224 (blink-cursor-mode '(-4))
2225 (menu-bar-mode -1)
2226 (tool-bar-mode -1)
2227 (set-scroll-bar-mode 'left)
2228
2229
2230 ;; enable various commands
2231 (put 'narrow-to-region 'disabled nil)
2232 (put 'narrow-to-page 'disabled nil)
2233 (put 'narrow-to-defun 'disabled nil)
2234 (put 'upcase-region 'disabled nil)
2235 (put 'downcase-region 'disabled nil)
2236 (put 'scroll-left 'disabled nil)
2237 ;; these from graphene, haven't read about them yet
2238 (put 'ido-complete 'disabled nil)
2239 (put 'ido-exit-minibuffer 'disabled nil)
2240 (put 'dired-find-alternate-file 'disabled nil)
2241 (put 'autopair-newline 'disabled nil)
2242
2243
2244
2245 ;;disable and minimize various prompts/messages
2246 (fset 'yes-or-no-p 'y-or-n-p)
2247 (setq confirm-nonexistent-file-or-buffer nil
2248 inhibit-startup-message t
2249 inhibit-startup-echo-area-message t
2250 inhibit-startup-screen t
2251 compilation-read-command nil ;; just don't compile with unsafe file local vars
2252 kill-buffer-query-functions (remq 'process-kill-buffer-query-function
2253 kill-buffer-query-functions))
2254
2255
2256 ;; exit without bothering me
2257 ;; http://stackoverflow.com/questions/2706527/make-emacs-stop-asking-active-processes-exist-kill-them-and-exit-anyway/2708042#2708042
2258 (add-hook 'comint-exec-hook
2259 (lambda () (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) nil)))
2260 ;; based on save-buffers-kill-emacs help string, don't ask about clients when exiting
2261 ;; apparently this would need to be in some later hook. dunno where is best, but this works
2262 (defadvice save-buffers-kill-emacs (before no-client-prompt-advice activate)
2263 (setq kill-emacs-query-functions (delq 'server-kill-emacs-query-function kill-emacs-query-functions)))
2264
2265
2266
2267 ;; (custom-set-faces
2268 ;; ;; setting header-line-format to " " as a hack for a top margin the oly thning I could find to do a top margin
2269 ;; '(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil))))
2270 ;; ;; don't highlight the region
2271 ;; '(region ((t nil))))
2272 (setq-default header-line-format " ")
2273
2274
2275 (setq initial-scratch-message nil)
2276 #+end_src
2277
2278
2279 vertical margin background.
2280 google turned up: http://lists.gnu.org/archive/html/help-gnu-emacs/2014-03/msg00544.html
2281 the xresource doesn't work for me, probably an xmonad thing.
2282
2283 figured out I needed to customize the header line face. To find the face, M-x list-faces-display or just google / search
2284 info,
2285 then M-x customize-face
2286 header-line
2287 unchecked some stuff so that it inherits from default.
2288
2289 * misc function definitions
2290 #+begin_src emacs-lisp
2291
2292
2293
2294
2295
2296 (defun next-backup-dir ()
2297 "In a directory listing from rsync -n,
2298 Go to the next directory based on where the cursor is."
2299 (interactive)
2300 (let* ((start-col (current-column))
2301 (end-col (progn (skip-chars-forward "^/\n") (current-column)))
2302 (dir (progn
2303 (beginning-of-line 1)
2304 (buffer-substring-no-properties (point) (+ (point) end-col)))))
2305 (message dir)
2306 (forward-line 1)
2307 (while (and (not (eobp))
2308 (string= dir (buffer-substring-no-properties (point) (+ (point) end-col))))
2309 (forward-line 1))
2310 (forward-char-same-line start-col)))
2311 ;; copy paste this for fast keybind
2312 ;;(local-set-key (kbd "<kp-enter>"))
2313
2314
2315 (defun goto-buffer-or-find-file (file-name)
2316 "If buffer is with FILE-NAME exists, go to it, else open the file using full path."
2317 (interactive)
2318 (let ((b (get-buffer (file-name-nondirectory file-name))))
2319 (if b
2320 (switch-to-buffer b)
2321 (find-file file-name))))
2322
2323
2324
2325
2326 ;; todo, i think this is broken. perhaps the last goto-char is not accounting for buffer or something
2327 (defun unpop-global-mark ()
2328 "Unpop off global mark ring. Does nothing if mark ring is empty."
2329 (interactive)
2330 (when global-mark-ring
2331 (setq global-mark-ring (cons (copy-marker (mark-marker)) global-mark-ring))
2332 (let ((lm (car (last global-mark-ring))))
2333 (set-marker (mark-marker) (marker-position lm) (marker-buffer lm)))
2334 (when (null (mark t)) (ding))
2335 (setq global-mark-ring (nbutlast global-mark-ring))
2336 (goto-char (marker-position (mark-marker)))))
2337
2338 (defun indent-buffer ()
2339 "Indents the entire buffer."
2340 (interactive)
2341 (cond ((derived-mode-p 'org-mode)
2342 (org-indent-region (point-min) (point-max)))
2343 ((derived-mode-p 'python-mode)
2344 (py-autopep8))
2345 (t
2346 (indent-region (point-min) (point-max)))))
2347
2348
2349 ;; TODO doesn't work with uniquify
2350 (defun rename-file-and-buffer ()
2351 "Renames current buffer and file it is visiting."
2352 (interactive)
2353 (let ((name (buffer-name))
2354 (filename (buffer-file-name)))
2355 (if (not (and filename (file-exists-p filename)))
2356 (message "Buffer '%s' is not visiting a file!" name)
2357 (let ((new-name (read-file-name "New name: " filename)))
2358 (cond ((get-buffer new-name)
2359 (message "A buffer named '%s' already exists!" new-name))
2360 (t
2361 (rename-file name new-name 1)
2362 (rename-buffer new-name)
2363 (set-visited-file-name new-name)
2364 (set-buffer-modified-p nil)))))))
2365
2366
2367
2368 (defun sudo-edit (&optional arg)
2369 (interactive "P")
2370 (if (or arg (not buffer-file-name))
2371 (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
2372 (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
2373
2374
2375
2376 (defun backward-symbol (arg)
2377 (interactive "p")
2378 (forward-symbol (- arg)))
2379
2380 #+end_src
2381
2382 * mode line
2383 #+begin_src emacs-lisp
2384
2385 ; -----------------------------
2386 ; fixing up the mode line
2387 ; modified from mastering emacs blog
2388 ; ----------------------------
2389
2390 (defvar mode-line-cleaner-alist
2391 `((auto-complete-mode . "")
2392 (yas/minor-mode . "")
2393 (paredit-mode . "")
2394 (auto-fill-function . "")
2395 (eldoc-mode . "")
2396 (abbrev-mode . "")
2397 (flyspell-mode . "")
2398 (glasses-mode . "")
2399 (dot-mode . "")
2400 (yas-global-mode . "")
2401 (yas-minor-mode . "")
2402 (undo-tree-mode . "")
2403 (volatile-highlights-mode . "")
2404 (highlight-symbol-mode . "")
2405 ;; Major modes
2406 (lisp-interaction-mode . "λ")
2407 (hi-lock-mode . "")
2408 (python-mode . "Py")
2409 (emacs-lisp-mode . "EL")
2410 (nxhtml-mode . "nx"))
2411 "Alist for `clean-mode-line'.
2412
2413 When you add a new element to the alist, keep in mind that you
2414 must pass the correct minor/major mode symbol and a string you
2415 want to use in the modeline *in lieu of* the original.")
2416
2417
2418 (defun clean-mode-line ()
2419 (interactive)
2420 (loop for cleaner in mode-line-cleaner-alist
2421 do (let* ((mode (car cleaner))
2422 (mode-str (cdr cleaner))
2423 (old-mode-str (cdr (assq mode minor-mode-alist))))
2424 (when old-mode-str
2425 (setcar old-mode-str mode-str))
2426 ;; major mode
2427 (when (eq mode major-mode)
2428 (setq mode-name mode-str)))))
2429
2430 ; disabled
2431 ; (add-hook 'after-change-major-mode-hook 'clean-mode-line)
2432
2433
2434 ;;; alias the new `flymake-report-status-slim' to
2435 ;;; `flymake-report-status'
2436 (defalias 'flymake-report-status 'flymake-report-status-slim)
2437 (defun flymake-report-status-slim (e-w &optional status)
2438 "Show \"slim\" flymake status in mode line."
2439 (when e-w
2440 (setq flymake-mode-line-e-w e-w))
2441 (when status
2442 (setq flymake-mode-line-status status))
2443 (let* ((mode-line " Φ"))
2444 (when (> (length flymake-mode-line-e-w) 0)
2445 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
2446 (setq mode-line (concat mode-line flymake-mode-line-status))
2447 (setq flymake-mode-line mode-line)
2448 (force-mode-line-update)))
2449
2450
2451 (add-hook 'after-change-major-mode-hook (lambda ()
2452
2453 (setq mode-line-mule-info nil
2454 mode-line-position nil
2455 mode-line-modes nil))) ; todo, make only flymake status show up
2456
2457 #+end_src
2458
2459 * mouse related
2460 ** settings
2461 #+begin_src emacs-lisp
2462 (setq focus-follows-mouse t
2463 mouse-autoselect-window t
2464 xterm-mouse-mode t)
2465 #+end_src
2466 ** move-mouse-to-point
2467 todo, this is buggy with multiple windows open.
2468 #+begin_src emacs-lisp
2469 (defun move-mouse-to-point ()
2470 (interactive)
2471 (let* ((pos (posn-col-row (posn-at-point)))
2472 (x (+ (car pos) 2)) ; no idea why this is off by 1-2
2473 (y (cdr pos)))
2474 (set-mouse-position (selected-frame) x y)))
2475 #+end_src
2476 ** cursor highlight
2477 disabled until fixed
2478 #+begin_src emacs-lisp :tangle no
2479 (defun mouse-follow-cursor ()
2480 ;(if (not (equal this-command last-command)) (print this-command))
2481 ;debug
2482 ; (print this-command)
2483 (when (and this-command (not (string= this-command "show-pointer")))
2484 (let* ((pos (posn-col-row (posn-at-point)))
2485 (x (1+ (car pos))) ; no idea why this is off by 1
2486 (y (cdr pos)))
2487 (setq ignore-mouse-visibility t)
2488 (set-mouse-position (selected-frame) x y))
2489 ;(sleep-for 0 100)
2490 (frame-make-pointer-invisible)))
2491
2492 ; (when this-command
2493 ; (if (string= this-command "show-pointer")
2494 ; (frame-make-pointer-visible)
2495 ;))
2496
2497
2498
2499 (defun show-pointer ()
2500 (interactive)
2501 (if ignore-mouse-visibility
2502 (setq ignore-mouse-visibility nil)
2503 ; (print "visible")
2504 (frame-make-pointer-visible)))
2505
2506 (setq ignore-mouse-visibility t)
2507 ; disabled
2508 ; (global-set-key (kbd "<mouse-movement>") 'show-pointer)
2509
2510 ; (add-hook 'post-command-hook 'mouse-follow-cursor t)
2511
2512
2513 ; status. working, except that all scroll wheel actions send a mouse-movement command before doing their actual command, which makes the pointer flicker.
2514 ; this is just an artifact of xbindkeys. when i do my own mouse chip, it will fix this.
2515
2516 ; we could set track-mouse to nil, then do the command, then set it back. i like that idea a bit better.
2517 ; we could do the same thing in the other case of ignore-mouse-visibility.
2518
2519 ; there are also other issues, it doesn't work with changing buffers on a split screen.
2520 ; i think a good idea along with this would be for the cursor to follow the mouse all the time.
2521 ; i have done code for that in my mouse 1 function,
2522 ; i just need to read it again and try it out.
2523
2524
2525
2526
2527 ; this does not take care of scrolling,
2528 ; a post-command hook function below does,
2529 ; but it breaks when the frame is split.
2530 ; the bug is specifically in mouse-pixel-position
2531 ; todo, fix this eventually
2532 (defun mouse-highlight-event (event)
2533 (interactive "e")
2534 (when (or (not event) (mouse-movement-p event)
2535 (memq (car-safe event) '(switch-frame select-window)))
2536 (let ((pos (posn-point (event-end event))))
2537 (if (eq (overlay-buffer mouse-hi-ov) (current-buffer))
2538 (move-overlay mouse-hi-ov pos (1+ pos))
2539 (delete-overlay mouse-hi-ov)
2540 (setq mouse-hi-ov
2541 (make-overlay pos (1+ pos)))
2542 (overlay-put mouse-hi-ov
2543 'insert-in-front-hooks (list 'mouse-hi-modification))
2544 (overlay-put mouse-hi-ov 'priority 1001))
2545 (cond ((save-excursion (goto-char pos) (eolp))
2546 (overlay-put mouse-hi-ov 'face nil)
2547 (overlay-put mouse-hi-ov 'before-string
2548 (propertize
2549 " "
2550 'cursor t
2551 'face 'mouse-cursor-face)))
2552 (t
2553 (overlay-put mouse-hi-ov 'face 'mouse-cursor-face)
2554 (overlay-put mouse-hi-ov 'before-string nil))))))
2555
2556
2557 ; overlay changed hook function
2558 (defun mouse-hi-modification (ov timing beginning end &optional length)
2559 "Make an overlay of length 1 not expand when text is inserted at the front."
2560 (when timing
2561 (let ((start (overlay-start ov)))
2562 (move-overlay ov start (1+ start)))))
2563
2564
2565
2566
2567 (defun mouse-hi-command-hook ()
2568 ; not sure if I need to deal with case of a nil mouse position in some unforseen situation.
2569 (let ((x-y (cdr (mouse-pixel-position))))
2570 (when (wholenump (car x-y))
2571 (let ((pos (posn-point (posn-at-x-y (car x-y) (cdr x-y) nil t))))
2572 (when pos
2573 (if (eq (overlay-buffer mouse-hi-ov) (current-buffer))
2574 (move-overlay mouse-hi-ov pos (1+ pos))
2575 (delete-overlay mouse-hi-ov)
2576 (setq mouse-hi-ov
2577 (make-overlay pos (1+ pos)))
2578
2579 (overlay-put mouse-hi-ov 'priority 1001))
2580 (cond ((save-excursion (goto-char pos) (eolp))
2581
2582 (overlay-put mouse-hi-ov 'face nil)
2583 (overlay-put mouse-hi-ov 'before-string
2584 (propertize
2585 " "
2586 'cursor t
2587 'face 'mouse-cursor-face)))
2588 (t
2589 (overlay-put mouse-hi-ov 'face 'mouse-cursor-face)
2590 (overlay-put mouse-hi-ov 'before-string nil))))))))
2591 ; (pcase-let ((`(,_ ,x . ,y) (mouse-pixel-position)))
2592 ; (posn-point (posn-at-x-y x y)))))
2593 ; equivalent of above to find pos. todo, learn about the above syntax
2594
2595 (setq mouse-hi-ov (make-overlay 1 1))
2596 (delete-overlay mouse-hi-ov)
2597 ; initialized overlay
2598 ; temporarily set to nil instead of t because it is broken and
2599 ; also has a bug that makes emacs not remember the column when
2600 ; doing up and down movements.
2601 ; it also messes up yas/insert-snippet, dunno why.
2602 ; i should test out whether it is something in the post-command hook
2603 ; (setq track-mouse t)
2604 ;(add-hook 'post-command-hook 'mouse-hi-command-hook)
2605
2606 ;(mouse-hi-command-hook)
2607 ;(setq debug-on-error nil)
2608
2609 #+end_src
2610 ** mouse 1 drag func
2611 :PROPERTIES:
2612
2613 disabled as it breaks in newer emacs versions with this error, when
2614 clicking on info links
2615
2616 "and: Symbol's function definition is void: mouse--remap-link-click-p"
2617
2618 #+begin_src emacs-lisp :tangle no
2619
2620 ; Copied from mouse.el and modified.
2621 ; my modifications have comments prefaced by "ian"
2622 (defun mouse-drag-track (start-event &optional
2623 do-mouse-drag-region-post-process)
2624 "Track mouse drags by highlighting area between point and cursor.
2625 The region will be defined with mark and point.
2626 DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
2627 `mouse-drag-region'."
2628 (mouse-minibuffer-check start-event)
2629 (setq mouse-selection-click-count-buffer (current-buffer))
2630 ; ian. removed as unneeded since I don't use TMM
2631 ;(deactivate-mark)
2632 (let* ((scroll-margin 0) ; Avoid margin scrolling (Bug#9541).
2633 (original-window (selected-window))
2634 ;; We've recorded what we needed from the current buffer and
2635 ;; window, now let's jump to the place of the event, where things
2636 ;; are happening.
2637 (_ (mouse-set-point start-event))
2638 (echo-keystrokes 0)
2639 (start-posn (event-start start-event))
2640 (start-point (posn-point start-posn))
2641 (start-window (posn-window start-posn))
2642 (start-window-start (window-start start-window))
2643 (start-hscroll (window-hscroll start-window))
2644 (bounds (window-edges start-window))
2645 (make-cursor-line-fully-visible nil)
2646 (top (nth 1 bounds))
2647 (bottom (if (window-minibuffer-p start-window)
2648 (nth 3 bounds)
2649 ;; Don't count the mode line.
2650 (1- (nth 3 bounds))))
2651 (on-link (and mouse-1-click-follows-link
2652 ;; Use start-point before the intangibility
2653 ;; treatment, in case we click on a link inside
2654 ;; intangible text.
2655 (mouse-on-link-p start-posn)))
2656 (click-count (1- (event-click-count start-event)))
2657 (remap-double-click (and on-link
2658 (eq mouse-1-click-follows-link 'double)
2659 (= click-count 1)))
2660 ;; Suppress automatic hscrolling, because that is a nuisance
2661 ;; when setting point near the right fringe (but see below).
2662 (auto-hscroll-mode-saved auto-hscroll-mode)
2663 (auto-hscroll-mode nil)
2664 moved-off-start event end end-point)
2665
2666 (setq mouse-selection-click-count click-count)
2667 ;; In case the down click is in the middle of some intangible text,
2668 ;; use the end of that text, and put it in START-POINT.
2669 (if (< (point) start-point)
2670 (goto-char start-point))
2671 (setq start-point (point))
2672 (if remap-double-click
2673 (setq click-count 0))
2674
2675 ;; Activate the region, using `mouse-start-end' to determine where
2676 ;; to put point and mark (e.g., double-click will select a word).
2677 (setq transient-mark-mode
2678 (if (eq transient-mark-mode 'lambda)
2679 '(only)
2680 (cons 'only transient-mark-mode)))
2681 (delete-overlay mouse-hi-ov) ; ian, added this.
2682
2683 (let ((range (mouse-start-end start-point start-point click-count)))
2684 (push-mark (nth 0 range) t t)
2685 (goto-char (nth 1 range)))
2686
2687 ;; Track the mouse until we get a non-movement event.
2688 (track-mouse
2689 (while (progn
2690 (setq event (read-event))
2691 (or (mouse-movement-p event)
2692 (memq (car-safe event) '(switch-frame select-window))))
2693 (unless (memq (car-safe event) '(switch-frame select-window))
2694 ;; Automatic hscrolling did not occur during the call to
2695 ;; `read-event'; but if the user subsequently drags the
2696 ;; mouse, go ahead and hscroll.
2697 (let ((auto-hscroll-mode auto-hscroll-mode-saved))
2698 (redisplay))
2699 (setq end (event-end event)
2700 end-point (posn-point end))
2701 ;; Note whether the mouse has left the starting position.
2702 (unless (eq end-point start-point)
2703 (setq moved-off-start t))
2704 (if (and (eq (posn-window end) start-window)
2705 (integer-or-marker-p end-point))
2706 (mouse--drag-set-mark-and-point start-point
2707 end-point click-count)
2708 (let ((mouse-row (cdr (cdr (mouse-position)))))
2709 (cond
2710 ((null mouse-row))
2711 ((< mouse-row top)
2712 (mouse-scroll-subr start-window (- mouse-row top)
2713 nil start-point))
2714 ((>= mouse-row bottom)
2715 (mouse-scroll-subr start-window (1+ (- mouse-row bottom))
2716 nil start-point))))))
2717 (visible-mark-move-overlays))) ; ian, added this
2718
2719
2720 ;; Handle the terminating event if possible.
2721 (when (consp event)
2722 ;; Ensure that point is on the end of the last event.
2723 (when (and (setq end-point (posn-point (event-end event)))
2724 (eq (posn-window end) start-window)
2725 (integer-or-marker-p end-point)
2726 (/= start-point end-point))
2727 (mouse--drag-set-mark-and-point start-point
2728 end-point click-count))
2729
2730 ;; Find its binding.
2731 (let* ((fun (key-binding (vector (car event))))
2732 (do-multi-click (and (> (event-click-count event) 0)
2733 (functionp fun)
2734 (not (memq fun '(mouse-set-point
2735 mouse-set-region))))))
2736 (if (and (/= (mark) (point))
2737 (not do-multi-click))
2738
2739 ;; If point has moved, finish the drag.
2740 (let* (last-command this-command)
2741 (and mouse-drag-copy-region
2742 do-mouse-drag-region-post-process
2743 (let (deactivate-mark)
2744 (copy-region-as-kill (mark) (point)))))
2745
2746 ;; Otherwise, run binding of terminating up-event.
2747 (if do-multi-click
2748 (goto-char start-point)
2749 (deactivate-mark)
2750 (unless moved-off-start
2751 ;; ian: poping the mark is a poor choice of behavior.
2752 ;; we should delete the mark instead.
2753 ;; The first way I found to delete it is to pop it first
2754 (pop-mark)
2755 (setq mark-ring (nbutlast mark-ring))))
2756
2757 (when (and (functionp fun)
2758 (= start-hscroll (window-hscroll start-window))
2759 ;; Don't run the up-event handler if the window
2760 ;; start changed in a redisplay after the
2761 ;; mouse-set-point for the down-mouse event at
2762 ;; the beginning of this function. When the
2763 ;; window start has changed, the up-mouse event
2764 ;; contains a different position due to the new
2765 ;; window contents, and point is set again.
2766 (or end-point
2767 (= (window-start start-window)
2768 start-window-start)))
2769
2770 (when (and on-link
2771 (= start-point (point))
2772 (mouse--remap-link-click-p start-event event))
2773
2774 ;; If we rebind to mouse-2, reselect previous selected
2775 ;; window, so that the mouse-2 event runs in the same
2776 ;; situation as if user had clicked it directly. Fixes
2777 ;; the bug reported by juri@jurta.org on 2005-12-27.
2778 (if (or (vectorp on-link) (stringp on-link))
2779 (setq event (aref on-link 0))
2780 (select-window original-window)
2781 (setcar event 'mouse-2)
2782 ;; If this mouse click has never been done by the
2783 ;; user, it doesn't have the necessary property to be
2784 ;; interpreted correctly.
2785 (put 'mouse-2 'event-kind 'mouse-click)))
2786 (push event unread-command-events)))))))
2787 #+end_src
2788
2789 ** mouse 3
2790 #+begin_src emacs-lisp :tangle no
2791
2792
2793 (defun mouse3-range-mark (start click click-count)
2794 (let* ((range (mouse-start-end start click click-count))
2795 (beg (nth 0 range))
2796 (end (nth 1 range)))
2797 (cond ((<= click start)
2798 (set-mark beg))
2799 (t
2800 (set-mark end))))
2801 (visible-mark-move-overlays))
2802
2803
2804 (defun mouse3-set-mark (event)
2805 "in development"
2806 (interactive "e")
2807 (mouse-minibuffer-check event)
2808 ;; Use event-end in case called from mouse-drag-region.
2809 ;; If EVENT is a click, event-end and event-start give same value.
2810 (set-mark (posn-point (event-end event)))
2811 (visible-mark-move-overlays))
2812
2813
2814 (defun mouse3-func (start-event)
2815 "in development"
2816 (interactive "e")
2817
2818 (run-hooks 'mouse-leave-buffer-hook)
2819
2820 (mouse-minibuffer-check start-event)
2821 (setq mouse-selection-click-count-buffer (current-buffer))
2822 (push-mark (posn-point (event-end start-event)))
2823
2824 (let* ((scroll-margin 0) ; Avoid margin scrolling (Bug#9541).
2825 (original-window (selected-window))
2826 ;; We've recorded what we needed from the current buffer and
2827 ;; window, now let's jump to the place of the event, where things
2828 ;; are happening.
2829 ;(_ (mouse-set-point start-event)) ; ian: commented, replaced
2830 (echo-keystrokes 0)
2831 (start-posn (event-start start-event))
2832 (start-point (posn-point start-posn))
2833 (start-window (posn-window start-posn))
2834 (start-window-start (window-start start-window))
2835 (start-hscroll (window-hscroll start-window))
2836 (bounds (window-edges start-window))
2837 (make-cursor-line-fully-visible nil)
2838 (top (nth 1 bounds))
2839 (bottom (if (window-minibuffer-p start-window)
2840 (nth 3 bounds)
2841 ;; Don't count the mode line.
2842 (1- (nth 3 bounds))))
2843 (click-count (1- (event-click-count start-event)))
2844 ;; Suppress automatic hscrolling, because that is a nuisance
2845 ;; when setting point near the right fringe (but see below).
2846 (auto-hscroll-mode-saved auto-hscroll-mode)
2847 (auto-hscroll-mode nil)
2848 moved-off-start event end end-point)
2849
2850 (setq mouse-selection-click-count click-count)
2851 ;; In case the down click is in the middle of some intangible text,
2852 ;; use the end of that text, and put it in START-POINT.
2853 (if (< (mark) start-point) ; ian: change point to the mark
2854 (set-mark start-point)
2855 (visible-mark-move-overlays))
2856 (setq start-point (mark))
2857
2858 (delete-overlay mouse-hi-ov) ; ian, added this.
2859
2860 ;; Activate the region, using `mouse-start-end' to determine where
2861 ;; to put point and mark (e.g., double-click will select a word).
2862 (let ((range (mouse-start-end start-point start-point click-count)))
2863 (set-mark (nth 1 range)))
2864 (visible-mark-move-overlays)
2865
2866
2867 ;; Track the mouse until we get a non-movement event.
2868 (track-mouse
2869
2870 (while (progn
2871 (setq event (read-event))
2872 (or (mouse-movement-p event)
2873 (memq (car-safe event) '(switch-frame select-window))))
2874 (unless (memq (car-safe event) '(switch-frame select-window))
2875
2876 ;; Automatic hscrolling did not occur during the call to
2877 ;; `read-event'; but if the user subsequently drags the
2878 ;; mouse, go ahead and hscroll.
2879 (let ((auto-hscroll-mode auto-hscroll-mode-saved))
2880 (redisplay))
2881 (setq end (event-end event)
2882 end-point (posn-point end))
2883 ;; Note whether the mouse has left the starting position.
2884
2885 (unless (eq end-point start-point)
2886 (setq moved-off-start t))
2887 (if (and (eq (posn-window end) start-window)
2888 (integer-or-marker-p end-point))
2889 (mouse3-range-mark start-point end-point click-count); ian, set mark
2890
2891 ; do scrolling if needed
2892 (let ((mouse-row (cdr (cdr (mouse-position)))))
2893 (cond
2894 ((null mouse-row))
2895 ((< mouse-row top)
2896 (mouse-scroll-subr start-window (- mouse-row top)
2897 nil start-point))
2898 ((>= mouse-row bottom)
2899 (mouse-scroll-subr start-window (1+ (- mouse-row bottom))
2900 nil start-point))))))))
2901
2902 ;; Handle the terminating event if possible.
2903 (when (consp event)
2904 ;; Ensure that point is on the end of the last event.
2905 (when (and (setq end-point (posn-point (event-end event)))
2906 (eq (posn-window end) start-window)
2907 (integer-or-marker-p end-point)
2908 (/= start-point end-point))
2909 ;(mouse--drag-set-mark-and-point start-point ; ian, set mark
2910 ;end-point click-count))
2911 (mouse3-range-mark start-point end-point click-count)); ian, set mark
2912
2913 ;; Find its binding.
2914 (let* ((fun (key-binding (vector (car event))))
2915 (do-multi-click (and (> (event-click-count event) 0)
2916 (functionp fun)
2917 (not (memq fun '(mouse3-set-mark))))))
2918 (if (and (/= end-point start-point)
2919 (not do-multi-click))
2920
2921 ;; If point has moved, finish the drag.
2922 (let* (last-command this-command)
2923 (and mouse-drag-copy-region
2924 do-mouse-drag-region-post-process
2925 (let (deactivate-mark)
2926 (copy-region-as-kill (mark) (point)))))
2927
2928 ;; Otherwise, run binding of terminating up-event.
2929 (when do-multi-click
2930 (set-mark start-point)) ; ian, change this. why?
2931 (visible-mark-move-overlays)
2932
2933
2934 (when (and (functionp fun)
2935 (= start-hscroll (window-hscroll start-window))
2936 ;; Don't run the up-event handler if the window
2937 ;; start changed in a redisplay after the
2938 ;; mouse-set-point for the down-mouse event at
2939 ;; the beginning of this function. When the
2940 ;; window start has changed, the up-mouse event
2941 ;; contains a different position due to the new
2942 ;; window contents, and point is set again.
2943 (or end-point
2944 (= (window-start start-window)
2945 start-window-start)))
2946
2947 (push event unread-command-events)))))))
2948
2949 #+end_src
2950
2951
2952
2953
2954
2955 * org mode
2956
2957 #+begin_src emacs-lisp
2958
2959 ;; todo work on org-cycle-emulate-tab
2960
2961 ;; todo, this doesn't work for a non-standard keybind
2962 ;;(setq org-special-ctrl-k t)
2963
2964 ;; todo, generally fix org mode keys
2965 ;; todo, org-mark-element, unbdind from M-h, bind to mark defun key
2966
2967 (org-babel-do-load-languages
2968 'org-babel-load-languages
2969 '((emacs-lisp . t)
2970 (sh . t)))
2971
2972 ;; make shell work like interactive bash shell
2973 (setq org-babel-default-header-args:sh
2974 '((:results . "output") (:shebang . "#!/bin/bash -l")))
2975
2976 ;; my patch to output stderr
2977 (setq org-babel-use-error-buffer nil)
2978
2979 ;
2980 ;; org-mode manual suggests these, but I haven't used them.
2981 ;;(global-set-key "\C-cl" 'org-store-link)
2982 ;;(global-set-key "\C-ca" 'org-agenda)
2983 ;; this got in the way of a haskell mode command
2984 ;;(global-set-key "\C-cb" 'org-iswitchb)
2985
2986
2987
2988 ;; org-src-tab-acts-natively t ; broken option. using next instead, todo fix
2989
2990 (setq org-src-fontify-natively t ; make babel blocks nice
2991 org-adapt-indentation nil
2992 org-src-preserve-indentation t
2993 ;; The most basic logging is to keep track of when a TODO item was finished.
2994 org-log-done 'time
2995 ;; use a drawer to keep the logs tidy
2996 org-log-into-drawer t
2997 org-extend-today-until 0
2998 org-startup-truncated nil
2999 org-clock-persist t
3000 org-clock-mode-line-total 'today
3001 ;; global STYLE property values for completion
3002 org-global-properties (quote (("STYLE_ALL" . "habit")))
3003 org-special-ctrl-a/e t ;; home and end work special in headlines
3004 org-completion-use-ido t
3005 org-catch-invisible-edits 'smart)
3006
3007 ;; non universally recommended settings
3008 (setq
3009 org-default-notes-file (concat org-directory "/a/t.org")
3010 org-agenda-files (quote ("/a/t.org"))
3011 org-mobile-directory "/p/org-mobile"
3012 org-mobile-inbox-for-pull "/p/from-mobile.org"
3013 org-directory "/p")
3014
3015 ;; modeilne populated from (org-clock-get-clocked-time)
3016 ;; which is populated from the var org-clock-total-time
3017 ;; which is populated by a function which starts from (org-clock-get-sum-start)
3018 ;;
3019
3020 (org-clock-persistence-insinuate)
3021
3022
3023 (defun time-to-org-day (time)
3024 (round (time-to-number-of-days
3025 (time-subtract time (list 0 (* 3600 org-extend-today-until) 0)))))
3026
3027
3028 (defun my-org-confirm-babel-evaluate (lang body)
3029 (not (or (string= (buffer-file-name) "/a/t.org")
3030 (string= (buffer-file-name) "/home/ian/.emacs.d/my-init.org")
3031 )))
3032 (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
3033
3034
3035 (defun org-time-stamp-with-time (arg)
3036 (interactive "P")
3037 ;; '(4) is the argument passed by universal prefix
3038 (org-time-stamp (if arg arg '(4)) t))
3039
3040 (defun ian-org-work-time ()
3041 (interactive)
3042 (save-excursion
3043 (set-buffer "t.org")
3044 (goto-char (org-find-entry-with-id "ian-identifier-1"))
3045 (org-clock-in)))
3046
3047 (defun ian-org-idle-time ()
3048 (interactive)
3049 (save-excursion
3050 (goto-char (org-find-entry-with-id "ian-identifier-2"))
3051 (set-buffer "t.org")
3052 (org-clock-in)))
3053
3054
3055
3056 ;; based on http://stackoverflow.com/questions/3758139/variable-pitch-for-org-mode-fixed-pitch-for-tables
3057 ;; keywords: proportional font, monospace
3058
3059 (defun variable-pitch-on ()
3060 (variable-pitch-mode 1))
3061 (add-hook 'fundamental-mode-hook 'variable-pitch-on)
3062 (add-hook 'org-mode-hook 'variable-pitch-on)
3063 (add-hook 'text-mode-hook 'variable-pitch-on)
3064
3065 (set-face-attribute 'org-table nil :family (face-attribute 'fixed-pitch :family))
3066 (set-face-attribute 'org-code nil :family (face-attribute 'fixed-pitch :family))
3067 (set-face-attribute 'org-formula nil :family (face-attribute 'fixed-pitch :family))
3068 (set-face-attribute 'org-link nil :family (face-attribute 'fixed-pitch :family))
3069 (set-face-attribute 'org-block nil :family (face-attribute 'fixed-pitch :family))
3070 (set-face-attribute 'org-block-background nil :family (face-attribute 'fixed-pitch :family))
3071 (set-face-attribute 'org-date nil :family (face-attribute 'fixed-pitch :family))
3072
3073
3074 (defun remove-org-binds ()
3075 (define-key org-mode-map (kbd "<M-return>") nil)
3076 (define-key org-mode-map (kbd "C-'") nil)
3077 (define-key org-mode-map (kbd "C-y") nil)
3078 (define-key org-mode-map (kbd "<C-return>") nil)
3079 (define-key org-mode-map (kbd "<C-M-kp-enter>") nil)
3080 (define-key org-mode-map (kbd "C-,") nil)
3081 (define-key org-mode-map (kbd "C-M-m") nil)
3082 (define-key org-mode-map (kbd "C-k") nil)
3083 (define-key org-mode-map (kbd "C-j") nil)
3084 (define-key org-mode-map (kbd "C-M-i") nil)
3085 (define-key org-mode-map (kbd "C-M-t") nil)
3086 (define-key org-mode-map (kbd "M-a") 'nil)
3087 (define-key org-mode-map (kbd "C-a") nil)
3088 (define-key org-mode-map (kbd "M-e") nil)
3089 (define-key org-mode-map (kbd "C-e") nil)
3090 (define-key org-mode-map (kbd "C-3") nil)
3091 (define-key org-mode-map (kbd "<M-left>") nil)
3092 (define-key org-mode-map (kbd "<M-right>") nil)
3093 (define-key org-mode-map (kbd "<S-return>") nil)
3094 (define-key org-mode-map (kbd "<tab>") nil)
3095 (define-key org-mode-map (kbd "<C-S-down>") nil)
3096 (define-key org-mode-map (kbd "<C-S-up>") nil)
3097 (define-key org-mode-map (kbd "<S-down>") nil)
3098 (define-key org-mode-map (kbd "<S-up>") nil)
3099 (define-key org-mode-map "\t" nil))
3100 (add-hook 'org-mode-hook 'remove-org-binds)
3101
3102 #+end_src
3103
3104
3105 * org drill
3106
3107
3108 #+begin_src emacs-lisp :tangle no
3109
3110 (setq
3111 ;; account actual time, not just scheduled time
3112 org-drill-adjust-intervals-for-early-and-late-repetitions-p t
3113
3114 ;; still show leeches, but warn
3115 org-drill-leech-method (quote warn)
3116 ;; increased from default 20
3117 org-drill-maximum-duration 60
3118 ;; especially when starting, I want to drill hard
3119 org-drill-maximum-items-per-session nil
3120 ;; don't prompt to save buffer, auto-save will do that
3121 org-drill-save-buffers-after-drill-sessions-p nil
3122 ;; this one deals with varying difficulty items better
3123 ;; sm2 is similar, but more simplistic
3124 org-drill-spaced-repetition-algorithm (quote simple8)
3125 )
3126 #+end_src
3127 ;; todo, make the prompting text reflect this number.
3128 ;; org-drill-failure-quality
3129
3130 * os specific settings
3131
3132 disabled cuz I have none yet
3133 #+begin_src emacs-lisp :tangle no
3134 (cond ((eq system-type 'darwin))
3135 ((eq system-type 'gnu/linux))
3136 ((eq system-type 'windows-nt))
3137 (t ))
3138 #+end_src
3139
3140
3141 * prog-mode-defaults
3142
3143 #+begin_src emacs-lisp
3144
3145
3146 (defun prog-mode-defaults ()
3147 "Default coding hook, useful with any programming language."
3148 ;; so that I can do completion before the dialog pops up
3149 (local-set-key (kbd "<tab>") 'auto-complete)
3150 ;; todo, this is causing error message on loading file, prolly not working
3151 ;;(flycheck-mode +1)
3152 (setq ac-sources (delq 'ac-source-dictionary ac-sources))
3153 (highlight-symbol-mode)
3154 (make-local-variable 'column-number-mode)
3155 ;; this says do autofilling using newcomment.el. The "only" is a misnomer.
3156 (set (make-local-variable 'comment-auto-fill-only-comments) t)
3157 (column-number-mode t)
3158 (turn-on-smartparens-mode)
3159
3160 ;; prettify lambdas
3161 (font-lock-add-keywords
3162 nil `(("(\\(lambda\\>\\)"
3163 (0 (progn (compose-region (match-beginning 1) (match-end 1)
3164 ,(make-char 'greek-iso8859-7 107))
3165 nil))))))
3166 (add-hook 'prog-mode-hook 'prog-mode-defaults)
3167
3168 ;; enable flyspell in prog mode. text mode is handled
3169 (add-hook 'prog-mode-hook 'flyspell-prog-mode)
3170
3171
3172
3173 #+end_src
3174
3175 ** yank auto-indent
3176 #+begin_src emacs-lisp
3177 ;; automatically indenting yanked text if in programming-modes
3178 (defvar yank-indent-modes
3179 '(LaTeX-mode TeX-mode)
3180 "Modes in which to indent regions that are yanked (or yank-popped).
3181 Only modes that don't derive from `prog-mode' should be listed here.")
3182
3183 (defvar yank-indent-blacklisted-modes
3184 '(python-mode slim-mode haml-mode)
3185 "Modes for which auto-indenting is suppressed.")
3186
3187 (defvar yank-advised-indent-threshold 2000
3188 "Threshold (# chars) over which indentation does not automatically occur.")
3189
3190 (defun yank-advised-indent-function (beg end)
3191 "Do indentation, as long as the region isn't too large."
3192 (if (<= (- end beg) yank-advised-indent-threshold)
3193 (indent-region beg end nil)))
3194
3195 (defadvice yank (after yank-indent activate)
3196 "If current mode is one of 'yank-indent-modes,
3197 indent yanked text (with prefix arg don't indent)."
3198 (if (and (not (ad-get-arg 0))
3199 (not (member major-mode yank-indent-blacklisted-modes))
3200 (or (derived-mode-p 'prog-mode)
3201 (member major-mode yank-indent-modes)))
3202 (let ((transient-mark-mode nil))
3203 (yank-advised-indent-function (region-beginning) (region-end)))))
3204
3205 (defadvice yank-pop (after yank-pop-indent activate)
3206 "If current mode is one of 'yank-indent-modes,
3207 indent yanked text (with prefix arg don't indent)."
3208 (if (and (not (ad-get-arg 0))
3209 (not (member major-mode yank-indent-blacklisted-modes))
3210 (or (derived-mode-p 'prog-mode)
3211 (member major-mode yank-indent-modes)))
3212 (let ((transient-mark-mode nil))
3213 (yank-advised-indent-function (region-beginning) (region-end)))))
3214
3215 #+end_src
3216
3217
3218 * shell mode
3219 #+begin_src emacs-lisp
3220 ;; avoid stupid git crap like "warning, terminal not fully functional"
3221 (setenv "PAGER" "cat")
3222 ;; don't store successive duplicates in comint command history
3223 (setq comint-input-ignoredups t)
3224
3225 (defun add-mode-line-dirtrack ()
3226 (add-to-list 'mode-line-buffer-identification
3227 '(:propertize (" " default-directory " ") face dired-directory)))
3228 (add-hook 'shell-mode-hook 'add-mode-line-dirtrack)
3229
3230
3231 ;; don't fully understand it, but it works.
3232 ;; http://www.emacswiki.org/emacs/ShellDirtrackByProcfs
3233 (defun track-shell-directory/procfs ()
3234 (shell-dirtrack-mode 0)
3235 (add-hook 'comint-preoutput-filter-functions
3236 (lambda (str)
3237 (prog1 str
3238 (when (string-match comint-prompt-regexp str)
3239 (cd (file-symlink-p
3240 (format "/proc/%s/cwd" (process-id
3241 (get-buffer-process
3242 (current-buffer)))))))))
3243 nil t))
3244 (setq comint-buffer-maximum-size 100000)
3245 (add-to-list 'comint-output-filter-functions 'comint-truncate-buffer)
3246 (defun new-shell ()
3247 (interactive)
3248 (shell (generate-new-buffer-name "*shell*")))
3249 ;;
3250 (defun shell-wrap (prefix)
3251 "wrap the shell function, automatically generate a new name for a prefix arg"
3252 (interactive "P")
3253 (if prefix
3254 (new-shell)
3255 (shell)))
3256
3257 (add-hook 'shell-mode-hook 'track-shell-directory/procfs)
3258 #+end_src
3259 * smartparens
3260 the melpa git version had a catastrophic bug I reported.
3261 downgraded to marmalade version and everything is working fine.
3262 #+begin_src emacs-lisp
3263 (require 'smartparens-config)
3264 (show-smartparens-global-mode t)
3265
3266
3267 (defun gp/sp/pair-on-newline-and-indent (id action context)
3268 "Open a new brace or bracket expression, with relevant newlines and indent. "
3269 (save-excursion
3270 (newline)
3271 (indent-according-to-mode))
3272 (indent-according-to-mode))
3273
3274 ;; when opening a pair, and then inserting a newline, push the closing pair to another newline
3275 (sp-pair "{" nil :post-handlers
3276 '(:add ((lambda (id action context)
3277 (gp/sp/pair-on-newline-and-indent id action context)) (kbd "<return>"))))
3278 (sp-pair "[" nil :post-handlers
3279 '(:add ((lambda (id action context)
3280 (gp/sp/pair-on-newline-and-indent id action context)) (kbd "<return>"))))
3281
3282
3283 ;; in my version, this is not a pairing.
3284 ;; not sure if it is in a future version since I reverted to marmalade
3285 ;; Don't need c-comments in strings -- they frustrate filename globs
3286 ;; (sp-pair "/*" nil :unless '(sp-in-string-p))
3287
3288 ;; Don't need quotes to pair next to words
3289 (sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
3290 (sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
3291
3292
3293 ;; todo, testout these mode specific settings from graphene.
3294 ;; Ruby-specific pairs and handlers
3295 (require 'smartparens-ruby)
3296
3297 ;; Markdown
3298 (sp-local-pair '(markdown-mode gfm-mode) "*" "*"
3299 :unless '(sp-in-string-p)
3300 :actions '(insert wrap))
3301
3302 ;; Except in HTML
3303 (sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p))
3304 ;; CoffeeScript PyStrings
3305 (push 'coffee-mode sp-autoescape-string-quote-if-empty)
3306
3307
3308
3309 #+end_src
3310 * smex
3311 todo; check out smex-show-unbound-commands shows frequently used commands that have no key bindings.
3312 #+begin_src emacs-lisp
3313 ; these must be before smex-initialize
3314 (setq
3315 smex-save-file "~/.emacs.d/.smex-items")
3316
3317 (smex-initialize)
3318 #+end_src
3319 * speedbar
3320 (sr-speedbar-close)
3321 (sr-speedbar-open)
3322
3323 ** todo, disabled cuz of broken package
3324 #+begin_src emacs-lisp :tangle no
3325 (require 'sr-speedbar)
3326 (setq speedbar-hide-button-brackets-flag t ;; didn't notice a diff
3327 speedbar-file-unshown-regexp "flycheck-.*"
3328 sr-speedbar-width 40
3329 sr-speedbar-width-x 40
3330 sr-speedbar-auto-refresh nil
3331 sr-speedbar-skip-other-window-p t
3332 sr-speedbar-right-side nil
3333 speedbar-hide-button-brackets-flag nil)
3334 #+end_src
3335 * spell correction
3336 #+begin_src emacs-lisp
3337 (setq
3338 ispell-program-name "hunspell"
3339 ispell-silently-savep t) ; don't prompt to save personal dictionary
3340
3341 (require 'rw-hunspell)
3342 #+end_src
3343 rw-hunspell sets up hunspell dictionary automagically.
3344
3345
3346 Rant: Hunspell SHOULD be standard. its used by firefox and openoffice and
3347 osx. In contrast, the first few words I added to aspell dictionary were
3348 "emacs" "customizable" and "timestamp". Hunspell already has those,
3349 thank god.
3350
3351 ispell-personal-dictionary does not document where the hunspell
3352 dictionary goes by default, but it is ~/.hunspell_en_US for me
3353
3354
3355 * tex
3356 #+begin_src emacs-lisp
3357 (setq-default TeX-PDF-mode t) ; use pdf
3358
3359 ; more sensible defaults based on info manual quickstart
3360 (setq TeX-auto-save t)
3361 (setq TeX-parse-self t)
3362
3363
3364 #+end_src
3365 * undo tree
3366 #+begin_src emacs-lisp
3367
3368 ;; undo-tree checks for minor modes which override
3369 ;; its minor mode keymap, and sets global keybinds if
3370 ;; that happens. this will prevent that, but I have no
3371 ;; reason to do that, so it is commented.
3372 ;; (defun undo-tree-overridden-undo-bindings-p () nil)
3373
3374 ;; todo, send patch undo-tree-visualize should scroll with the scroll key, instead of just pgup pgdn (aka next/prior)
3375 (global-undo-tree-mode)
3376 ;; disabled due to bug, something like unknown entry in undo tree canary
3377 ;; (setq undo-tree-auto-save-history t)
3378 (setq undo-outer-limit 100000000 ; per undo command
3379 undo-limit 500000000 ; undo history limit
3380 undo-strong-limit 600000000) ; undo history limit plus some extra
3381
3382
3383 #+end_src
3384
3385 * visible mark mode
3386
3387 these colors were better for dark theme
3388 #+begin_src emacs-lisp :tangle no
3389
3390
3391
3392 (defface visible-mark-face1
3393 '((((type tty) (class mono)))
3394 (t (:background "LimeGreen"))) "")
3395 (defface visible-mark-face2
3396 '((((type tty) (class mono)))
3397 (t (:background "red4"))) "")
3398 (defface visible-mark-forward-face1
3399 '((((type tty) (class mono)))
3400 (t (:background "dark magenta"))) "")
3401 (defface visible-mark-active
3402 '((((type tty) (class mono)))
3403 (t (:background "gold"))) "")
3404 (defface mouse-cursor-face
3405 '((((type tty) (class mono)))
3406 (t (:background "DeepPink1"))) "")
3407
3408 #+end_src
3409
3410
3411 #+begin_src emacs-lisp
3412
3413 (add-to-list 'load-path "~/.emacs.d/src/visible-mark")
3414
3415 ;; since it is not easy to change the mark overlay priority, I change this one.
3416 (setq show-paren-priority 999)
3417
3418
3419 (defface visible-mark-active
3420 '((((type tty) (class mono)))
3421 (t (:background "magenta"))) "")
3422
3423
3424
3425 (defface mouse-cursor-face
3426 '((((type tty) (class mono)))
3427 (t (:background "DeepPink1"))) "")
3428
3429
3430 (require 'visible-mark)
3431
3432 (setq visible-mark-faces '(visible-mark-face1 visible-mark-face2))
3433 (setq visible-mark-forward-faces '(visible-mark-forward-face1))
3434
3435
3436 ; highlight the last 2 marks
3437 (setq visible-mark-max 2)
3438 ; highlight 1 forward mark
3439 (setq visible-mark-forward-max 1)
3440 ; globally activate visible-mark-mode
3441 (global-visible-mark-mode +1)
3442
3443
3444 ;; todo, it doesn't seem to be exposed in elisp, but it would be nice
3445 ;; if I could define overlay faces to use inverse foreground color
3446
3447
3448 #+end_src
3449
3450 #+RESULTS:
3451 : t
3452
3453
3454 * key binds. keep at end of file
3455 this should come at the end because it depends on key maps being
3456 created in earlier sections.
3457
3458 ** emacs keys notes
3459 commands not needed in ido mode and their replacement in ido mode
3460 spell check fix -> use current pattern and start new one
3461 narrow -> create subdirectory
3462 org-cycle -> M-s search recently used directory
3463 vert split Window -> create file instead of select match
3464 delete-other-windows -> open dired buffer
3465 delete current window -> delete buffer/file
3466 find file -> search within all subdirectories
3467
3468 forward/back error
3469
3470 buffer select -> toggle find file / buffer
3471 up/down -> next/previous history
3472 forward/back -> ido-forward/back
3473
3474
3475 right keyboard attributes: movement, involve typing words
3476 left keyboard attributes: non-typing universal non-movement
3477
3478
3479
3480
3481 todo
3482 fix global unpop mark ring
3483 setup helm
3484 learn cedet and projectile and helm
3485 setup key for pop-global-mark
3486 try out C-M-\ indent region
3487 set quoted insert to some obscure keybind
3488 make currently overrided M-u uppercase word into something obscure
3489 remember mode
3490 bind shell-command to something better
3491 investigate tags
3492 investigate keys in isearch mode and find file mode
3493 try out occur. M-s o
3494 investigate programming modes. M-g n/b next/previous error. gdb?
3495 investigate org mode keys
3496 learn version control
3497 learn mail
3498 check out imenu
3499 bind capitalize-word to something obscure
3500 sentance/paragraph movement/marking should be swapped with sexp/paren movement based on mode
3501 bind fill-paragraph to something obscure
3502 setup linewise paste
3503 install magit (git control)
3504 magpie expansion provides a completion key for acronym expansion based on buffer text
3505 learn ediff
3506 universal google
3507 figure out auto-indent
3508 learn eshell and prelude settings for it
3509 combine register prefix and c-x prefix
3510 note: remember to think of mouse & foot pedals
3511 commands to change: select other window: C-x o.
3512 ** prefix keybind changes
3513 #+begin_src emacs-lisp
3514
3515
3516 ; prefix key binds.
3517 ; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
3518 ; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
3519 ; so you have to dig into their key maps and redo things.
3520 ; There are 2 simpler alternatives which have their own downsides.
3521 ; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
3522 ; The other is keyboard-translate, which translates the key presses before anything else.
3523 ; The downside is that it translates them when you aren't using them as a prefix.
3524 ; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
3525
3526 ; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
3527 ; (define-key key-translation-map [f12] "\C-c")
3528 ; (define-key key-translation-map "\C-c" [left])
3529
3530
3531 ;idea to remove the hook later since it is only needed at startup.
3532 ; did not work however, and there is not a real need to fix it, so I did not investigate
3533 ;(defun removeSwapHook ()
3534 ; (remove-hook 'buffer-list-update-hook 'myKeySwap)
3535 ; (remove-hook 'change-major-mode-hook 'removeSwapHook))
3536 ;(add-hook 'change-major-mode-hook 'removeSwapHook)
3537
3538
3539 ; went through almost all the relevant standard hooks,
3540 ; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
3541 (add-hook 'buffer-list-update-hook (lambda () (interactive)
3542 (keyboard-translate ?\C-x ?\C-s)
3543 (keyboard-translate ?\C-s ?\C-x)
3544 (keyboard-translate ?\C-c ?\C-d)
3545 (keyboard-translate ?\C-d ?\C-c)))
3546
3547
3548
3549 ; these all don't work
3550 ; don't know why this doesn't error but reversing the keys does
3551 ;(keyboard-translate ?\t ?\M-\t)
3552 ;(keyboard-translate [M-tab] [tab])
3553 ; from what i can tell, it wants to use a keyboard-translate-table,
3554 ; which is a char table, which is a vector indexed by chars,
3555 ; and mod+tab is not a char (it has too many bits), it is an integer
3556 ; it actually says it can hold vectors or strings, but that it is obsolete to do so
3557 ;(characterp ?\M-a)
3558 ;(characterp ?\C-a)
3559
3560
3561
3562 #+end_src
3563
3564 ** named commands
3565 *** tramp sudo
3566 /ssh:host|sudo:host:
3567 when in the same session, you can then do:
3568 /sudo:root@host:
3569
3570 *** org insert table row
3571 [org-shiftmetadown/up]
3572 *** toggle line continuation / truncation / wrap :drill:
3573 SCHEDULED: <2014-04-07 Mon>
3574 :PROPERTIES:
3575 :ID: 5f3f567a-0926-4d92-81f3-4e4cd6070af2
3576 :DRILL_LAST_INTERVAL: 28.6736
3577 :DRILL_REPEATS_SINCE_FAIL: 5
3578 :DRILL_TOTAL_REPEATS: 5
3579 :DRILL_FAILURE_COUNT: 1
3580 :DRILL_AVERAGE_QUALITY: 3.4
3581 :DRILL_EASE: 2.666
3582 :DRILL_LAST_QUALITY: 4
3583 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:37>
3584 :END:
3585 [toggle-truncate-lines]
3586 *** auto-save on/off :drill:
3587 SCHEDULED: <2014-05-13 Tue>
3588 :PROPERTIES:
3589 :ID: 462f859d-1a06-46a3-ac72-6ffe5b4417c9
3590 :DRILL_LAST_INTERVAL: 71.5839
3591 :DRILL_REPEATS_SINCE_FAIL: 4
3592 :DRILL_TOTAL_REPEATS: 4
3593 :DRILL_FAILURE_COUNT: 0
3594 :DRILL_AVERAGE_QUALITY: 4.75
3595 :DRILL_EASE: 4.85
3596 :DRILL_LAST_QUALITY: 5
3597 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:11>
3598 :END:
3599 [my-as-on/my-as-off]
3600 *** toggle menu bar
3601 [menu-bar-mode]
3602 *** show abbreviations :drill:
3603 SCHEDULED: <2014-03-24 Mon>
3604 :PROPERTIES:
3605 :ID: 479a2ced-b952-4088-a6e3-862cd37693a9
3606 :DRILL_LAST_INTERVAL: 32.7466
3607 :DRILL_REPEATS_SINCE_FAIL: 4
3608 :DRILL_TOTAL_REPEATS: 4
3609 :DRILL_FAILURE_COUNT: 0
3610 :DRILL_AVERAGE_QUALITY: 4.0
3611 :DRILL_EASE: 3.204
3612 :DRILL_LAST_QUALITY: 4
3613 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 18:03>
3614 :END:
3615 [list-abbrevs]
3616
3617 *** rename-file-and-buffer
3618 *** ediff-buffers
3619 *** refill-mode
3620 automatically balance a paragraph with newlines
3621 *** executable-make-buffer-file-executable-if-script-p
3622 make a script executable
3623 *** (setq lazy-highlight-cleanup nil)
3624 *** auto-revert-tail-mode
3625 tail a file
3626 *** trash-file-and-buffer
3627 #+begin_src emacs-lisp
3628 (defun trash-file-and-buffer ()
3629 "Removes file connected to current buffer and kills buffer."
3630 (interactive)
3631 (let ((filename (buffer-file-name))
3632 (buffer (current-buffer))
3633 (name (buffer-name)))
3634 (if (not (and filename (file-exists-p filename)))
3635 (error "Buffer '%s' is not visiting a file!" name)
3636 (delete-file filename)
3637 (kill-buffer buffer)
3638 (message "File '%s' successfully removed" filename))))
3639
3640 #+end_src
3641 *** what-line
3642 *** linum-mode
3643 line numbers
3644
3645 *** sgml-pretty-print
3646 format xml in nxml-mode
3647 *** visual-line-mode
3648 toggle word wrap.
3649 ** compound commands
3650 *** C-xc
3651 :PROPERTIES:
3652 :ID: d0802daa-9281-4a9f-ab4a-47d9f7ef7cfd
3653 :END:
3654 exit
3655 *** [C-x x] :drill:
3656 SCHEDULED: <2014-03-24 Mon>
3657 :PROPERTIES:
3658 :ID: 2f7d1353-3c20-4e00-95ea-1f84c4d87fc1
3659 :DRILL_LAST_INTERVAL: 32.7466
3660 :DRILL_REPEATS_SINCE_FAIL: 4
3661 :DRILL_TOTAL_REPEATS: 4
3662 :DRILL_FAILURE_COUNT: 0
3663 :DRILL_AVERAGE_QUALITY: 4.0
3664 :DRILL_EASE: 3.204
3665 :DRILL_LAST_QUALITY: 4
3666 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 18:03>
3667 :END:
3668 save file
3669 *** [C-x e] :drill:
3670 SCHEDULED: <2014-03-27 Thu>
3671 :PROPERTIES:
3672 :ID: b802eeb8-ddcd-4778-844a-b6e737b54d7d
3673 :DRILL_LAST_INTERVAL: 50.6823
3674 :DRILL_REPEATS_SINCE_FAIL: 3
3675 :DRILL_TOTAL_REPEATS: 3
3676 :DRILL_FAILURE_COUNT: 0
3677 :DRILL_AVERAGE_QUALITY: 5.0
3678 :DRILL_EASE: 5.815
3679 :DRILL_LAST_QUALITY: 5
3680 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:41>
3681 :END:
3682 eval last sexp
3683 *** C-x u
3684 [undo-tree-visualize]
3685 *** C-j u/U
3686 [undo-tree save/restore state via register]
3687 *** C-c -
3688 [org insert table horizontal line or create list]
3689 *** [C-x tab] :drill:
3690 SCHEDULED: <2014-03-24 Mon>
3691 :PROPERTIES:
3692 :ID: ceb701d7-3d44-4781-ae23-7309ca887a01
3693 :DRILL_LAST_INTERVAL: 32.7466
3694 :DRILL_REPEATS_SINCE_FAIL: 4
3695 :DRILL_TOTAL_REPEATS: 4
3696 :DRILL_FAILURE_COUNT: 0
3697 :DRILL_AVERAGE_QUALITY: 4.0
3698 :DRILL_EASE: 3.204
3699 :DRILL_LAST_QUALITY: 4
3700 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:50>
3701 :END:
3702 dumb indent
3703
3704 [shift-left and shift-right are default for indenting by tab stop,
3705 and they are only defined as lambdas so I copy them here
3706 to use with up and down.
3707 #+begin_src emacs-lisp
3708 ;; condition cuz emacs24 release doesn't have this yet
3709 (when (boundp 'indent-rigidly-map)
3710 (define-key indent-rigidly-map (kbd "<C-left>")
3711 (lambda (beg end) (interactive "r")
3712 (let* ((current (indent-rigidly--current-indentation beg end))
3713 (next (indent--next-tab-stop current)))
3714 (indent-rigidly beg end (- next current)))))
3715
3716 (define-key indent-rigidly-map (kbd "<C-right>")
3717 (lambda (beg end) (interactive "r")
3718 (let* ((current (indent-rigidly--current-indentation beg end))
3719 (next (indent--next-tab-stop current 'prev)))
3720 (indent-rigidly beg end (- next current))))))
3721 #+end_src
3722 ]
3723 *** C-x *
3724 [calc-dispatch]
3725 *** C-x =
3726 [point information]
3727 *** C-x d
3728 [dired]
3729 *** C-xb
3730 [ibuffer]
3731 #+begin_src emacs-lisp
3732 (global-set-key (kbd "C-x C-b") 'ibuffer)
3733 #+end_src
3734 ** gnus
3735 searching overview.
3736 3 types:
3737 ingroup searching
3738 nnir searching with notmuch, specific group (not sure if it can do multiple)
3739 search all groups with mairix
3740 *** [a]
3741 compose new message
3742 *** [C-c C-c]
3743 send message
3744 *** [s]
3745 save newsrc file, alterations to groups.
3746 *** [g]
3747 gnus refresh / get new
3748 *** [m]
3749 gnus new message
3750 *** [F]
3751 gnus quoted reply all
3752 *** [e]
3753 gnus draft edit message
3754 *** [delete]
3755 gnus delete draft
3756 #+begin_src emacs-lisp
3757 (add-hook 'gnus-startup-hook
3758 (lambda ()
3759 (define-key gnus-summary-mode-map (kbd "<delete>") 'gnus-summary-delete-article)))
3760 #+end_src
3761
3762 *** [b]
3763 mairix search
3764 #+begin_src emacs-lisp
3765 (add-hook 'gnus-startup-hook
3766 (lambda ()
3767 (define-key gnus-group-mode-map "b" 'nnmairix-search)
3768 (define-key gnus-summary-mode-map "b" 'nnmairix-search)))
3769 #+end_src
3770 *** [B m]
3771 move message, or messages in region
3772 *** [#]
3773 mark article, move with B m
3774 *** [B delete]
3775 gnus delete draft
3776 *** [/ plus x a / b]
3777 search current group (or see info manual for more groups),
3778 using the gnus native search (its slow, do a notmuch or mairix search instead)
3779 x= extra (ie. to)
3780 todo; send in patch to make author search to in sent folder
3781 a = author
3782 / = subject
3783 b = body
3784 see C-h m for a full list
3785 *** [ G G ]
3786 do a nnir notmuch search, for the group on the current line
3787 *** [ A T ]
3788 jump to thread from nnir group
3789
3790 *** [marks]
3791 ! = saved for later
3792 E = expired
3793 M-& apply process mark to a non-process mark command
3794 *** [S D e]
3795 edit as new
3796 ** message mode
3797 *** [C-ck]
3798 discard message
3799 ** notmuch
3800 *** [space]
3801 notmuch advance to next message/thread
3802
3803 ** readline / bash / .inputrc
3804 *** [M-0-9]
3805 SCHEDULED: <2014-05-13 Tue>
3806 :PROPERTIES:
3807 :ID: dac68f2e-37c2-448e-861d-0554e51f1414
3808 :DRILL_LAST_INTERVAL: 71.5839
3809 :DRILL_REPEATS_SINCE_FAIL: 4
3810 :DRILL_TOTAL_REPEATS: 4
3811 :DRILL_FAILURE_COUNT: 0
3812 :DRILL_AVERAGE_QUALITY: 4.75
3813 :DRILL_EASE: 4.85
3814 :DRILL_LAST_QUALITY: 5
3815 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
3816 :END:
3817 bash digit-argument
3818
3819 removed drill from all these because I'm using emacs for shell now
3820 *** [C-2]
3821 SCHEDULED: <2014-03-15 Sat>
3822 :PROPERTIES:
3823 :ID: d2e87812-6ab7-432f-ad7c-4281c0e3b86b
3824 :DRILL_LAST_INTERVAL: 12.979
3825 :DRILL_REPEATS_SINCE_FAIL: 3
3826 :DRILL_TOTAL_REPEATS: 3
3827 :DRILL_FAILURE_COUNT: 0
3828 :DRILL_AVERAGE_QUALITY: 3.333
3829 :DRILL_EASE: 2.626
3830 :DRILL_LAST_QUALITY: 3
3831 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:00>
3832 :END:
3833 terminal X paste
3834 *** [C-3]
3835 SCHEDULED: <2014-03-15 Sat>
3836 :PROPERTIES:
3837 :ID: 3b156730-eb92-4149-b4ce-f93a9098d2b4
3838 :DRILL_LAST_INTERVAL: 12.979
3839 :DRILL_REPEATS_SINCE_FAIL: 3
3840 :DRILL_TOTAL_REPEATS: 3
3841 :DRILL_FAILURE_COUNT: 0
3842 :DRILL_AVERAGE_QUALITY: 3.333
3843 :DRILL_EASE: 2.626
3844 :DRILL_LAST_QUALITY: 3
3845 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:00>
3846 :END:
3847 terminal open file manager
3848 *** [C-q]
3849 SCHEDULED: <2014-03-12 Wed>
3850 :PROPERTIES:
3851 :ID: ed6a19de-d000-4469-9dd9-7b9e35f6c751
3852 :DRILL_LAST_INTERVAL: 2.8975
3853 :DRILL_REPEATS_SINCE_FAIL: 2
3854 :DRILL_TOTAL_REPEATS: 10
3855 :DRILL_FAILURE_COUNT: 12
3856 :DRILL_AVERAGE_QUALITY: 2.692
3857 :DRILL_EASE: 2.311
3858 :DRILL_LAST_QUALITY: 3
3859 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:33>
3860 :END:
3861 bash exchange-point-and-mark
3862
3863 *** [C-M-q]
3864 SCHEDULED: <2014-03-14 Fri>
3865 :PROPERTIES:
3866 :ID: 9827eb7e-532e-41fb-8d91-8c95c23553f5
3867 :DRILL_LAST_INTERVAL: 11.6739
3868 :DRILL_REPEATS_SINCE_FAIL: 3
3869 :DRILL_TOTAL_REPEATS: 3
3870 :DRILL_FAILURE_COUNT: 0
3871 :DRILL_AVERAGE_QUALITY: 3.333
3872 :DRILL_EASE: 2.626
3873 :DRILL_LAST_QUALITY: 4
3874 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
3875 :END:
3876 quoted insert
3877 *** [C-w]
3878 SCHEDULED: <2014-04-07 Mon>
3879 :PROPERTIES:
3880 :ID: 58fea89a-def9-4aac-95d4-fdd63fde8097
3881 :DRILL_LAST_INTERVAL: 28.6736
3882 :DRILL_REPEATS_SINCE_FAIL: 5
3883 :DRILL_TOTAL_REPEATS: 5
3884 :DRILL_FAILURE_COUNT: 1
3885 :DRILL_AVERAGE_QUALITY: 3.4
3886 :DRILL_EASE: 2.666
3887 :DRILL_LAST_QUALITY: 4
3888 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
3889 :END:
3890 bash kill-region
3891 *** [C-e]
3892 SCHEDULED: <2014-03-27 Thu>
3893 :PROPERTIES:
3894 :ID: 3ee7662f-3ac7-46ff-afe7-73244656d48b
3895 :DRILL_LAST_INTERVAL: 50.6823
3896 :DRILL_REPEATS_SINCE_FAIL: 3
3897 :DRILL_TOTAL_REPEATS: 3
3898 :DRILL_FAILURE_COUNT: 0
3899 :DRILL_AVERAGE_QUALITY: 5.0
3900 :DRILL_EASE: 5.815
3901 :DRILL_LAST_QUALITY: 5
3902 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
3903 :END:
3904 bash yank-last-arg
3905 *** C-r
3906 :PROPERTIES:
3907 :ID: 579a9008-0758-4ba9-a52f-175f264fe96a
3908 :END:
3909 bash history-search-backward
3910 *** [C-t]
3911 SCHEDULED: <2014-04-04 Fri>
3912 :PROPERTIES:
3913 :ID: 25e737fe-52c4-452b-ab93-037575375579
3914 :DRILL_LAST_INTERVAL: 26.2331
3915 :DRILL_REPEATS_SINCE_FAIL: 5
3916 :DRILL_TOTAL_REPEATS: 5
3917 :DRILL_FAILURE_COUNT: 1
3918 :DRILL_AVERAGE_QUALITY: 3.2
3919 :DRILL_EASE: 2.554
3920 :DRILL_LAST_QUALITY: 4
3921 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
3922 :END:
3923 shell-expand-line, expand like bash does u hit enter
3924 *** [C-a]
3925 SCHEDULED: <2014-04-06 Sun>
3926 :PROPERTIES:
3927 :ID: 384b3337-3cb0-4b3b-8a1a-8ae299ae212b
3928 :DRILL_LAST_INTERVAL: 27.9921
3929 :DRILL_REPEATS_SINCE_FAIL: 5
3930 :DRILL_TOTAL_REPEATS: 5
3931 :DRILL_FAILURE_COUNT: 1
3932 :DRILL_AVERAGE_QUALITY: 3.6
3933 :DRILL_EASE: 2.802
3934 :DRILL_LAST_QUALITY: 5
3935 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:37>
3936 :END:
3937 bash comment-line
3938 *** [C-s]
3939 SCHEDULED: <2014-03-10 Mon>
3940 :PROPERTIES:
3941 :ID: 4b5c71f9-6035-4b92-bcad-e400e5e25d66
3942 :DRILL_LAST_INTERVAL: 8.225
3943 :DRILL_REPEATS_SINCE_FAIL: 3
3944 :DRILL_TOTAL_REPEATS: 7
3945 :DRILL_FAILURE_COUNT: 4
3946 :DRILL_AVERAGE_QUALITY: 2.879
3947 :DRILL_EASE: 2.399
3948 :DRILL_LAST_QUALITY: 4
3949 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 20:57>
3950 :END:
3951 bash yank-nth-arg
3952 yank $1 of last argument, or nth if prefixed with a digit argument
3953 *** [C-d]
3954 SCHEDULED: <2014-03-12 Wed>
3955 :PROPERTIES:
3956 :ID: f5da97c1-6e3c-44dd-a2f1-7dacd7f523da
3957 :DRILL_LAST_INTERVAL: 9.8132
3958 :DRILL_REPEATS_SINCE_FAIL: 3
3959 :DRILL_TOTAL_REPEATS: 7
3960 :DRILL_FAILURE_COUNT: 3
3961 :DRILL_AVERAGE_QUALITY: 3.21
3962 :DRILL_EASE: 2.559
3963 :DRILL_LAST_QUALITY: 4
3964 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:04>
3965 :END:
3966 bash undo
3967 *** [C-f]
3968 SCHEDULED: <2014-05-13 Tue>
3969 :PROPERTIES:
3970 :ID: 0f1def18-0d94-45e7-b258-f621e67cefd7
3971 :DRILL_LAST_INTERVAL: 71.5839
3972 :DRILL_REPEATS_SINCE_FAIL: 4
3973 :DRILL_TOTAL_REPEATS: 4
3974 :DRILL_FAILURE_COUNT: 0
3975 :DRILL_AVERAGE_QUALITY: 4.75
3976 :DRILL_EASE: 4.85
3977 :DRILL_LAST_QUALITY: 5
3978 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:11>
3979 :END:
3980 bash menu-complete
3981 *** [C-g]
3982 SCHEDULED: <2014-03-10 Mon>
3983 :PROPERTIES:
3984 :ID: 263e9479-de1d-4e78-8600-5a0f3a8e2dd9
3985 :DRILL_LAST_INTERVAL: 8.0608
3986 :DRILL_REPEATS_SINCE_FAIL: 3
3987 :DRILL_TOTAL_REPEATS: 8
3988 :DRILL_FAILURE_COUNT: 5
3989 :DRILL_AVERAGE_QUALITY: 2.966
3990 :DRILL_EASE: 2.439
3991 :DRILL_LAST_QUALITY: 4
3992 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:04>
3993 :END:
3994 bash edit-and-execute-command
3995 *** C-z
3996 *** C-x
3997 emacs hard to rebind
3998 looks like it actually wouldn't be that hard.
3999 possibly take the output from bind -p, make all those keys undefined.
4000 *** C-c
4001 quit/cancel
4002 *** C-v
4003 yank, aka paste
4004 *** C-M-v
4005 yank-pop
4006 *** [C-b]
4007 SCHEDULED: <2014-03-14 Fri>
4008 :PROPERTIES:
4009 :ID: 1a688c40-4bba-4053-a28b-0e1e8d3f4985
4010 :DRILL_LAST_INTERVAL: 4.9208
4011 :DRILL_REPEATS_SINCE_FAIL: 2
4012 :DRILL_TOTAL_REPEATS: 8
4013 :DRILL_FAILURE_COUNT: 4
4014 :DRILL_AVERAGE_QUALITY: 3.066
4015 :DRILL_EASE: 2.487
4016 :DRILL_LAST_QUALITY: 3
4017 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:33>
4018 :END:
4019 bash menu-complete-backward
4020 *** tab
4021 completion
4022 *** [C-tab]
4023 SCHEDULED: <2014-03-14 Fri>
4024 :PROPERTIES:
4025 :ID: 75d57537-8a32-4a18-982e-6d6f756a9ba6
4026 :DRILL_LAST_INTERVAL: 12.2744
4027 :DRILL_REPEATS_SINCE_FAIL: 3
4028 :DRILL_TOTAL_REPEATS: 3
4029 :DRILL_FAILURE_COUNT: 2
4030 :DRILL_AVERAGE_QUALITY: 3.667
4031 :DRILL_EASE: 2.855
4032 :DRILL_LAST_QUALITY: 4
4033 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
4034 :END:
4035 terminal find
4036 *** [C-left/right]
4037 SCHEDULED: <2014-03-27 Thu>
4038 :PROPERTIES:
4039 :ID: 5587c07b-c003-470f-bef4-fa55f00524ff
4040 :DRILL_LAST_INTERVAL: 50.6823
4041 :DRILL_REPEATS_SINCE_FAIL: 3
4042 :DRILL_TOTAL_REPEATS: 3
4043 :DRILL_FAILURE_COUNT: 0
4044 :DRILL_AVERAGE_QUALITY: 5.0
4045 :DRILL_EASE: 5.815
4046 :DRILL_LAST_QUALITY: 5
4047 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:41>
4048 :END:
4049 forward/backward-word
4050
4051 *** [C-u]
4052 SCHEDULED: <2014-03-19 Wed>
4053 :PROPERTIES:
4054 :ID: b5342b6b-f14f-4a6b-99d8-110fdef243f2
4055 :DRILL_LAST_INTERVAL: 24.3844
4056 :DRILL_REPEATS_SINCE_FAIL: 5
4057 :DRILL_TOTAL_REPEATS: 5
4058 :DRILL_FAILURE_COUNT: 2
4059 :DRILL_AVERAGE_QUALITY: 3.0
4060 :DRILL_EASE: 2.456
4061 :DRILL_LAST_QUALITY: 3
4062 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:51>
4063 :END:
4064 bash backward-kill-word
4065 *** [C-i]
4066 SCHEDULED: <2014-03-14 Fri>
4067 :PROPERTIES:
4068 :ID: 6e306a04-8f21-4142-8c00-8a87a3544d6e
4069 :DRILL_LAST_INTERVAL: 11.6739
4070 :DRILL_REPEATS_SINCE_FAIL: 3
4071 :DRILL_TOTAL_REPEATS: 3
4072 :DRILL_FAILURE_COUNT: 0
4073 :DRILL_AVERAGE_QUALITY: 3.333
4074 :DRILL_EASE: 2.626
4075 :DRILL_LAST_QUALITY: 4
4076 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 20:58>
4077 :END:
4078 terminal find up
4079 [ terminal crap, duplicate of tab ]
4080 *** [C-o]
4081 SCHEDULED: <2014-03-15 Sat>
4082 :PROPERTIES:
4083 :ID: 40b6d9ce-2427-4905-b444-d6d90c5a4da4
4084 :DRILL_LAST_INTERVAL: 23.5247
4085 :DRILL_REPEATS_SINCE_FAIL: 4
4086 :DRILL_TOTAL_REPEATS: 4
4087 :DRILL_FAILURE_COUNT: 0
4088 :DRILL_AVERAGE_QUALITY: 3.5
4089 :DRILL_EASE: 2.73
4090 :DRILL_LAST_QUALITY: 3
4091 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:25>
4092 :END:
4093 bash operate-and-get-next, submit and bring up next item in history
4094 *** [C-p]
4095 SCHEDULED: <2014-03-11 Tue>
4096 :PROPERTIES:
4097 :ID: 4956027e-c5da-48de-8925-6f6b6dd98cec
4098 :DRILL_LAST_INTERVAL: 1.575
4099 :DRILL_REPEATS_SINCE_FAIL: 1
4100 :DRILL_TOTAL_REPEATS: 9
4101 :DRILL_FAILURE_COUNT: 8
4102 :DRILL_AVERAGE_QUALITY: 2.597
4103 :DRILL_EASE: 2.265
4104 :DRILL_LAST_QUALITY: 3
4105 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:38>
4106 :END:
4107 bash dabbrev-expand,
4108 complete historical command names
4109 *** C-h
4110 terminal incompatible junk
4111 *** [C-k]
4112 SCHEDULED: <2014-05-09 Fri>
4113 :PROPERTIES:
4114 :ID: f91ff161-8d8c-4f47-beb5-09f86bf774d5
4115 :DRILL_LAST_INTERVAL: 67.6174
4116 :DRILL_REPEATS_SINCE_FAIL: 4
4117 :DRILL_TOTAL_REPEATS: 4
4118 :DRILL_FAILURE_COUNT: 1
4119 :DRILL_AVERAGE_QUALITY: 4.75
4120 :DRILL_EASE: 4.85
4121 :DRILL_LAST_QUALITY: 5
4122 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
4123 :END:
4124 bash kill-line, to end of line
4125 *** [C-l]
4126 SCHEDULED: <2014-05-13 Tue>
4127 :PROPERTIES:
4128 :ID: 4798acc1-4fc8-406e-bc95-8131cfa255a5
4129 :DRILL_LAST_INTERVAL: 71.5839
4130 :DRILL_REPEATS_SINCE_FAIL: 4
4131 :DRILL_TOTAL_REPEATS: 4
4132 :DRILL_FAILURE_COUNT: 0
4133 :DRILL_AVERAGE_QUALITY: 4.75
4134 :DRILL_EASE: 4.85
4135 :DRILL_LAST_QUALITY: 5
4136 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:12>
4137 :END:
4138 bash clear screen
4139 *** [C-m]
4140 SCHEDULED: <2014-03-14 Fri>
4141 :PROPERTIES:
4142 :ID: 119a0a90-9253-4131-b0c8-5aa7d8cf2259
4143 :DRILL_LAST_INTERVAL: 11.6739
4144 :DRILL_REPEATS_SINCE_FAIL: 3
4145 :DRILL_TOTAL_REPEATS: 3
4146 :DRILL_FAILURE_COUNT: 0
4147 :DRILL_AVERAGE_QUALITY: 3.333
4148 :DRILL_EASE: 2.626
4149 :DRILL_LAST_QUALITY: 4
4150 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 20:58>
4151 :END:
4152 [--------]
4153 #+begin_src emacs-lisp
4154 (add-hook 'comint-mode-hook
4155 (lambda ()
4156 (define-key comint-mode-map "\C-m" nil)))
4157
4158 #+end_src
4159 *** [C-space]
4160 SCHEDULED: <2014-03-12 Wed>
4161 :PROPERTIES:
4162 :ID: 803e2480-4e11-41d0-a261-4f5930a7f9a9
4163 :DRILL_LAST_INTERVAL: 10.0687
4164 :DRILL_REPEATS_SINCE_FAIL: 3
4165 :DRILL_TOTAL_REPEATS: 6
4166 :DRILL_FAILURE_COUNT: 1
4167 :DRILL_AVERAGE_QUALITY: 2.875
4168 :DRILL_EASE: 2.397
4169 :DRILL_LAST_QUALITY: 3
4170 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:06>
4171 :END:
4172 bash set mark
4173 *** [C-delete]
4174 SCHEDULED: <2014-03-15 Sat>
4175 :PROPERTIES:
4176 :ID: 3d0c188b-3cf0-4f0a-83c8-78f6e4040ee5
4177 :DRILL_LAST_INTERVAL: 24.4352
4178 :DRILL_REPEATS_SINCE_FAIL: 4
4179 :DRILL_TOTAL_REPEATS: 4
4180 :DRILL_FAILURE_COUNT: 0
4181 :DRILL_AVERAGE_QUALITY: 3.75
4182 :DRILL_EASE: 2.929
4183 :DRILL_LAST_QUALITY: 4
4184 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:44>
4185 :END:
4186 bash delete word
4187 ** isearch
4188 *** [C-w] :drill:
4189 SCHEDULED: <2014-03-27 Thu>
4190 :PROPERTIES:
4191 :ID: f0e2b6e2-809b-40c2-8d72-0f7e35eda9b3
4192 :DRILL_LAST_INTERVAL: 50.6823
4193 :DRILL_REPEATS_SINCE_FAIL: 3
4194 :DRILL_TOTAL_REPEATS: 3
4195 :DRILL_FAILURE_COUNT: 0
4196 :DRILL_AVERAGE_QUALITY: 5.0
4197 :DRILL_EASE: 5.815
4198 :DRILL_LAST_QUALITY: 5
4199 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
4200 :END:
4201 paste word/char under cursor into isearch
4202 *** [M-n/p] :drill:
4203 SCHEDULED: <2014-03-27 Thu>
4204 :PROPERTIES:
4205 :ID: b3692e47-458e-41a0-b2be-c5f61b4eadbd
4206 :DRILL_LAST_INTERVAL: 50.6823
4207 :DRILL_REPEATS_SINCE_FAIL: 3
4208 :DRILL_TOTAL_REPEATS: 3
4209 :DRILL_FAILURE_COUNT: 0
4210 :DRILL_AVERAGE_QUALITY: 5.0
4211 :DRILL_EASE: 5.815
4212 :DRILL_LAST_QUALITY: 5
4213 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:41>
4214 :END:
4215 next/previous isearch history
4216 *** [C-o] :drill:
4217 SCHEDULED: <2014-03-11 Tue>
4218 :PROPERTIES:
4219 :ID: 8e36b562-7e0c-45e6-a41b-3cd96c134b33
4220 :DRILL_LAST_INTERVAL: 19.9622
4221 :DRILL_REPEATS_SINCE_FAIL: 4
4222 :DRILL_TOTAL_REPEATS: 4
4223 :DRILL_FAILURE_COUNT: 0
4224 :DRILL_AVERAGE_QUALITY: 3.5
4225 :DRILL_EASE: 2.73
4226 :DRILL_LAST_QUALITY: 4
4227 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:30>
4228 :END:
4229 isearch-occur
4230 Activate occur easily inside isearch
4231 [
4232 from starter-kit
4233 #+begin_src emacs-lisp
4234 (define-key isearch-mode-map (kbd "C-o")
4235 (lambda () (interactive)
4236 (let ((case-fold-search isearch-case-fold-search))
4237 (occur (if isearch-regexp
4238 isearch-string
4239 (regexp-quote isearch-string))))))
4240 #+end_src
4241 ]
4242 *** [m-r]
4243 #+begin_src emacs-lisp
4244 (defun my-isearch-toggle-regexp ()
4245 (interactive)
4246 (isearch-toggle-regexp)
4247 (cond (isearch-regexp
4248 (global-set-key (kbd "C-r") 'isearch-backward-regexp)
4249 (define-key global-map (kbd "<kp-add>") 'isearch-forward-regexp))
4250 (t
4251 (global-set-key (kbd "C-r") 'isearch-backward)
4252 (define-key global-map (kbd "<kp-add>") 'isearch-forward))))
4253 (define-key isearch-mode-map (kbd "M-r") 'my-isearch-toggle-regexp)
4254 #+end_src
4255
4256 ** icomplete
4257 *** C-. C-,
4258 icomplete-forward/backward-completions
4259
4260 ** ido
4261 *** [C-j] :drill:
4262 SCHEDULED: <2014-04-01 Tue>
4263 :PROPERTIES:
4264 :ID: 9cc3392d-00a1-4564-8c57-b418a20d9235
4265 :DRILL_LAST_INTERVAL: 22.6411
4266 :DRILL_REPEATS_SINCE_FAIL: 5
4267 :DRILL_TOTAL_REPEATS: 6
4268 :DRILL_FAILURE_COUNT: 1
4269 :DRILL_AVERAGE_QUALITY: 2.833
4270 :DRILL_EASE: 2.378
4271 :DRILL_LAST_QUALITY: 3
4272 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:34>
4273 :END:
4274 ido-find-file create file
4275 *** [//] :drill:
4276 SCHEDULED: <2014-03-27 Thu>
4277 :PROPERTIES:
4278 :ID: 18ce7d51-93ca-4d41-8e8d-1958cff9c726
4279 :DRILL_LAST_INTERVAL: 50.6823
4280 :DRILL_REPEATS_SINCE_FAIL: 3
4281 :DRILL_TOTAL_REPEATS: 3
4282 :DRILL_FAILURE_COUNT: 0
4283 :DRILL_AVERAGE_QUALITY: 5.0
4284 :DRILL_EASE: 5.815
4285 :DRILL_LAST_QUALITY: 5
4286 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
4287 :END:
4288 ido goto root
4289 *** [C-k] :drill:
4290 :PROPERTIES:
4291 :ID: af4cc865-fe0c-424b-aa5b-2097320d6fb6
4292 :DRILL_LAST_INTERVAL: 0.0
4293 :DRILL_REPEATS_SINCE_FAIL: 0
4294 :DRILL_TOTAL_REPEATS: 5
4295 :DRILL_FAILURE_COUNT: 2
4296 :DRILL_AVERAGE_QUALITY: 3.083
4297 :DRILL_EASE: 2.496
4298 :DRILL_LAST_QUALITY: 2
4299 :DRILL_LAST_REVIEWED: <2014-04-14 Mon 11:31>
4300 :END:
4301 ido kill buffer/file
4302 *** [C-d] :drill:
4303 SCHEDULED: <2014-04-04 Fri>
4304 :PROPERTIES:
4305 :ID: c93d6e0c-ae33-45aa-9610-ce33cfc406a0
4306 :DRILL_LAST_INTERVAL: 25.8141
4307 :DRILL_REPEATS_SINCE_FAIL: 5
4308 :DRILL_TOTAL_REPEATS: 5
4309 :DRILL_FAILURE_COUNT: 1
4310 :DRILL_AVERAGE_QUALITY: 3.0
4311 :DRILL_EASE: 2.456
4312 :DRILL_LAST_QUALITY: 3
4313 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:37>
4314 :END:
4315 ido open dired buffer
4316 *** [M-d] :drill:
4317 SCHEDULED: <2014-03-11 Tue>
4318 :PROPERTIES:
4319 :ID: 8eab4299-207f-4a4a-a698-38f31cb5ff1b
4320 :DRILL_LAST_INTERVAL: 1.7651
4321 :DRILL_REPEATS_SINCE_FAIL: 1
4322 :DRILL_TOTAL_REPEATS: 6
4323 :DRILL_FAILURE_COUNT: 6
4324 :DRILL_AVERAGE_QUALITY: 2.583
4325 :DRILL_EASE: 2.258
4326 :DRILL_LAST_QUALITY: 3
4327 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:38>
4328 :END:
4329 ido search within all subdirectories
4330 *** [M-m] :drill:
4331 SCHEDULED: <2014-03-10 Mon>
4332 :PROPERTIES:
4333 :ID: cb7f6420-1f70-4ddb-ad73-83c3b22ef0e2
4334 :DRILL_LAST_INTERVAL: 7.6174
4335 :DRILL_REPEATS_SINCE_FAIL: 3
4336 :DRILL_TOTAL_REPEATS: 8
4337 :DRILL_FAILURE_COUNT: 4
4338 :DRILL_AVERAGE_QUALITY: 2.583
4339 :DRILL_EASE: 2.257
4340 :DRILL_LAST_QUALITY: 3
4341 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:01>
4342 :END:
4343 ido create subdirectory
4344 *** [M-s] :drill:
4345 SCHEDULED: <2014-04-01 Tue>
4346 :PROPERTIES:
4347 :ID: eb798918-4dd2-40e1-9d08-82ade145869d
4348 :DRILL_LAST_INTERVAL: 23.2268
4349 :DRILL_REPEATS_SINCE_FAIL: 5
4350 :DRILL_TOTAL_REPEATS: 6
4351 :DRILL_FAILURE_COUNT: 4
4352 :DRILL_AVERAGE_QUALITY: 3.083
4353 :DRILL_EASE: 2.496
4354 :DRILL_LAST_QUALITY: 3
4355 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:34>
4356 :END:
4357 ido search recently used directories
4358 *** [M-n/p] :drill:
4359 SCHEDULED: <2014-03-14 Fri>
4360 :PROPERTIES:
4361 :ID: db965c9e-feb0-4213-b631-7cfa0208cfdb
4362 :DRILL_LAST_INTERVAL: 23.0811
4363 :DRILL_REPEATS_SINCE_FAIL: 4
4364 :DRILL_TOTAL_REPEATS: 4
4365 :DRILL_FAILURE_COUNT: 1
4366 :DRILL_AVERAGE_QUALITY: 3.75
4367 :DRILL_EASE: 2.929
4368 :DRILL_LAST_QUALITY: 4
4369 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:36>
4370 :END:
4371 ido next/previous recently used directory
4372 *** [C-s]
4373 **** TODO implement this keybind, normally ctrl-space
4374 ido use current pattern and start a new one
4375 ** info
4376 *** [[]]
4377 goto next-prev node regardless of structure
4378 *** [f]
4379 goto cross reference
4380 *** [x]
4381 Info-follow-nearest-node
4382 #+begin_src emacs-lisp
4383 (define-key Info-mode-map "x" 'Info-follow-nearest-node)
4384 #+end_src
4385 m, f, n, p or ^ command, depending on where you click.
4386 ** auto-complete
4387 *** [S-return] :drill:
4388 SCHEDULED: <2014-03-11 Tue>
4389 :PROPERTIES:
4390 :ID: b9e47939-8033-4adc-8bf4-734b25f4fc47
4391 :DRILL_LAST_INTERVAL: 2.0943
4392 :DRILL_REPEATS_SINCE_FAIL: 1
4393 :DRILL_TOTAL_REPEATS: 7
4394 :DRILL_FAILURE_COUNT: 3
4395 :DRILL_AVERAGE_QUALITY: 2.633
4396 :DRILL_EASE: 2.282
4397 :DRILL_LAST_QUALITY: 3
4398 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:38>
4399 :END:
4400 ac-expand, then select next candidates
4401 *** [C-s] :drill:
4402 SCHEDULED: <2014-03-14 Fri>
4403 :PROPERTIES:
4404 :ID: 828416d4-7ce4-4817-aede-068b80f3041f
4405 :DRILL_LAST_INTERVAL: 23.0811
4406 :DRILL_REPEATS_SINCE_FAIL: 4
4407 :DRILL_TOTAL_REPEATS: 4
4408 :DRILL_FAILURE_COUNT: 1
4409 :DRILL_AVERAGE_QUALITY: 3.75
4410 :DRILL_EASE: 2.929
4411 :DRILL_LAST_QUALITY: 4
4412 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:38>
4413 :END:
4414 ac filter completions
4415 ** agenda
4416 *** [t] :drill:
4417 SCHEDULED: <2014-03-22 Sat>
4418 :PROPERTIES:
4419 :ID: 173e9cec-e401-4f03-90cc-72cba462b2f2
4420 :DRILL_LAST_INTERVAL: 31.1381
4421 :DRILL_REPEATS_SINCE_FAIL: 4
4422 :DRILL_TOTAL_REPEATS: 4
4423 :DRILL_FAILURE_COUNT: 0
4424 :DRILL_AVERAGE_QUALITY: 3.75
4425 :DRILL_EASE: 2.929
4426 :DRILL_LAST_QUALITY: 3
4427 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:50>
4428 :END:
4429 agenda cycle todo state
4430 ** org
4431 *** [C-c / t] :drill:
4432 SCHEDULED: <2014-03-13 Thu>
4433 :PROPERTIES:
4434 :ID: a5775c4f-c5d3-4024-a280-6628c5e7ab39
4435 :DRILL_LAST_INTERVAL: 10.7692
4436 :DRILL_REPEATS_SINCE_FAIL: 3
4437 :DRILL_TOTAL_REPEATS: 6
4438 :DRILL_FAILURE_COUNT: 1
4439 :DRILL_AVERAGE_QUALITY: 3.167
4440 :DRILL_EASE: 2.537
4441 :DRILL_LAST_QUALITY: 4
4442 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
4443 :END:
4444 show todo items
4445 *** [S-<tab>] :drill:
4446 SCHEDULED: <2014-03-27 Thu>
4447 :PROPERTIES:
4448 :ID: 1c1a4061-5cff-4826-aec2-8f677aab33a9
4449 :DRILL_LAST_INTERVAL: 50.6823
4450 :DRILL_REPEATS_SINCE_FAIL: 3
4451 :DRILL_TOTAL_REPEATS: 3
4452 :DRILL_FAILURE_COUNT: 0
4453 :DRILL_AVERAGE_QUALITY: 5.0
4454 :DRILL_EASE: 5.815
4455 :DRILL_LAST_QUALITY: 5
4456 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:44>
4457 :END:
4458 org-shifttab global visibility cycle / move table cell
4459 *** [C-cs] :drill:
4460 SCHEDULED: <2014-03-14 Fri>
4461 :PROPERTIES:
4462 :ID: 9ba74a38-655c-4f96-8443-b574ee25c544
4463 :DRILL_LAST_INTERVAL: 5.238
4464 :DRILL_REPEATS_SINCE_FAIL: 2
4465 :DRILL_TOTAL_REPEATS: 7
4466 :DRILL_FAILURE_COUNT: 2
4467 :DRILL_AVERAGE_QUALITY: 2.801
4468 :DRILL_EASE: 2.362
4469 :DRILL_LAST_QUALITY: 3
4470 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:33>
4471 :END:
4472 schedule todo item
4473 *** [C-cx p] :drill:
4474 SCHEDULED: <2014-03-15 Sat>
4475 :PROPERTIES:
4476 :ID: 4b486f48-219d-4517-96c2-83ef839abda5
4477 :DRILL_LAST_INTERVAL: 24.4352
4478 :DRILL_REPEATS_SINCE_FAIL: 4
4479 :DRILL_TOTAL_REPEATS: 4
4480 :DRILL_FAILURE_COUNT: 0
4481 :DRILL_AVERAGE_QUALITY: 3.75
4482 :DRILL_EASE: 2.929
4483 :DRILL_LAST_QUALITY: 4
4484 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:39>
4485 :END:
4486 org set property
4487 *** [C-c -] :drill:
4488 SCHEDULED: <2014-03-24 Mon>
4489 :PROPERTIES:
4490 :ID: 60e57e56-d815-4d9b-ba78-2a56164db209
4491 :DRILL_LAST_INTERVAL: 32.7466
4492 :DRILL_REPEATS_SINCE_FAIL: 4
4493 :DRILL_TOTAL_REPEATS: 4
4494 :DRILL_FAILURE_COUNT: 0
4495 :DRILL_AVERAGE_QUALITY: 4.0
4496 :DRILL_EASE: 3.204
4497 :DRILL_LAST_QUALITY: 4
4498 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:52>
4499 :END:
4500 org insert horizontal line
4501 *** [C-cq] :drill:
4502 SCHEDULED: <2014-03-24 Mon>
4503 :PROPERTIES:
4504 :ID: 6987ba15-fbc0-459b-bc27-cf9016baebc3
4505 :DRILL_LAST_INTERVAL: 32.7466
4506 :DRILL_REPEATS_SINCE_FAIL: 4
4507 :DRILL_TOTAL_REPEATS: 4
4508 :DRILL_FAILURE_COUNT: 0
4509 :DRILL_AVERAGE_QUALITY: 4.0
4510 :DRILL_EASE: 3.204
4511 :DRILL_LAST_QUALITY: 4
4512 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:50>
4513 :END:
4514 org tag
4515 ** calc
4516 i'd like to drill these sometime when I have space in my head, or I
4517 plan to use calc.
4518 *** space
4519 [enter input to the stack, or duplicate top stack item]
4520 *** C-M-i
4521 [cycle 3 elements on stack]
4522 *** tab
4523 [cycle 2 elements on stack]
4524 *** n
4525 [negate]
4526 *** _
4527 [begin negative number]
4528 *** /
4529 [reciprocal]
4530 *** x
4531 [calc named command]
4532 *** M-delete
4533 [delete 2nd from top of stack]
4534 *** C-u [-]0-9
4535 [0=whole stack, 1-9=that many, -1-9=that element]
4536 *** delete
4537 [remove from the top of the stack]
4538 *** '
4539 [algebraic mode. infix expressions are calculated when input to the stack]
4540 *** m a
4541 [auto algebraic mode]
4542 *** $,$$,$$$
4543 [top x of stack reference]
4544 *** s s/t/r/u
4545 [store to variable: store, top, retrieve, unstore. the quick variables 0-9 don't need s prefix]
4546 *** U/D
4547 [undo/redo]
4548 *** t p/n/]/y
4549 [trail prev/next/end/yankh]
4550 *** `
4551 [calc edit mode, to edit the top of stack]
4552
4553 ** single/special keys
4554 :PROPERTIES:
4555 :ID: beginning-of-keybind-table-data
4556 :END:
4557 *** [tab key]
4558 :PROPERTIES:
4559 :CUSTOM_ID: 6c10a716-1d8e-4ce4-8e26-64468f19c17a
4560 :END:
4561 isearch
4562 #+begin_src emacs-lisp
4563 (define-key isearch-mode-map (kbd "<tab>") 'isearch-query-replace)
4564 #+end_src
4565 *** tab
4566 :PROPERTIES:
4567 :ID: d93321a4-6732-421f-9c03-0073c4cbfdcb
4568 :CUSTOM_ID: 51ece189-1840-41a1-8ca0-19f9a0481895
4569 :END:
4570 isearch-forward
4571 #+begin_src emacs-lisp
4572 ;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs
4573 (global-set-key (kbd "<kp-add>") 'isearch-forward)
4574 (define-key isearch-mode-map "\t" nil)
4575 (define-key isearch-mode-map (kbd "<kp-add>") 'isearch-repeat-forward)
4576 ;; get rid of the standard completion binding, always use auto-complete
4577 ;; this didn't work very well
4578 ;;(global-set-key (kbd "TAB") 'auto-complete)
4579 (define-key global-map [remap completion-at-point] 'auto-complete)
4580
4581 #+end_src
4582
4583 *** end
4584 :PROPERTIES:
4585 :ID: 7e71b6fe-dcef-4f91-87d9-d996ddf7db5d
4586 :CUSTOM_ID: 00d589b7-2b8e-494c-b761-3afefebe6ec6
4587 :END:
4588 move-end-of-line
4589 #+begin_src emacs-lisp
4590 ;; taken from emacs wiki, along with home function
4591 ;; http://www.emacswiki.org/emacs/BackToIndentationOrBeginning
4592 (defun point-in-comment ()
4593 "Determine if the point is inside a comment"
4594 (interactive)
4595 (let ((syn (syntax-ppss)))
4596 (and (nth 8 syn)
4597 (not (nth 3 syn)))))
4598 (defun end-of-code-or-line (arg)
4599 "Move to end of line, or before start of comments depending on situation.
4600 Toggle back and forth positions if we are already at one.
4601 Comments are recognized in any mode that sets syntax-ppss
4602 properly."
4603 (interactive "P")
4604 (when (catch 'bol
4605 (let ((start (point))
4606 (bol (save-excursion
4607 (beginning-of-line)
4608 (point)))
4609 (eol (progn (move-end-of-line arg) (point))))
4610 (while (point-in-comment)
4611 (backward-char)
4612 (when (= (point) bol)
4613 (throw 'bol t)))
4614 (throw 'bol (and (not (= eol start)) (>= start (point))))))
4615 (move-end-of-line arg)))
4616
4617 (global-set-key (kbd "<end>") 'end-of-code-or-line)(add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "<end>") 'org-end-of-line)))
4618 #+end_src
4619
4620 *** home
4621 :PROPERTIES:
4622 :ID: f52de4a4-212c-4133-9038-2b652c739ad2
4623 :CUSTOM_ID: 7800e455-c3f6-4a8f-8907-b2292449ab67
4624 :END:
4625 back-to-indentation
4626 #+begin_src emacs-lisp
4627 (defun back-to-indentation-or-beginning ()
4628 (interactive)
4629 (if (= (point) (progn (back-to-indentation) (point)))
4630 (if (derived-mode-p 'org-mode)
4631 (org-beginning-of-line)
4632 (beginning-of-line))))
4633 (global-set-key (kbd "<home>") 'back-to-indentation-or-beginning)
4634
4635 #+end_src
4636
4637 *** [s-tab]
4638 :PROPERTIES:
4639 :CUSTOM_ID: 3072901e-5cf3-4d6e-9ac8-3ef64a5f6ad2
4640 :END:
4641 indent-buffer
4642 [
4643 #+begin_src emacs-lisp
4644 (global-set-key (kbd "<S-iso-lefttab>") 'indent-buffer)
4645 #+end_src
4646 ]
4647 *** [s-delete]
4648 :PROPERTIES:
4649 :CUSTOM_ID: e53728b6-054d-4443-a03e-6cf02d13724d
4650 :END:
4651 send-shell
4652 #+begin_src emacs-lisp
4653
4654 (global-set-key (kbd "<S-delete>") 'send-shell)
4655
4656 ;; optional variables used by send-shell
4657 (setq shell-send-yank-key nil)
4658
4659 (defun repeat-shell ()
4660 (interactive)
4661 "Repeat the last command in shell-mode, displaying the window if needed."
4662 (let ((shell-buffer (get-buffer "*shell*")))
4663 (if shell-buffer
4664 (buffer-window-show shell-buffer)
4665 (let ((original-buffer (current-buffer)))
4666 (funcall 'shell)
4667 (setq shell-buffer (current-buffer))
4668 (switch-to-buffer original-buffer)))
4669 (with-current-buffer shell-buffer
4670 (goto-char (point-max))
4671 (call-interactively 'comint-previous-input)
4672 ;; the t flag makes the buffer advance
4673 (comint-send-input nil t))))
4674
4675 (setq compilation-filenames '("Makefile" "makefile"))
4676
4677 (defun get-nearest-compilation-file ()
4678 "Search for the compilation file traversing up the directory tree."
4679 (interactive)
4680 (let ((dir default-directory)
4681 (parent-dir (file-name-directory (directory-file-name default-directory)))
4682 (nearest-compilation-file 'nil))
4683 (while (and (not (string= dir parent-dir))
4684 (not nearest-compilation-file))
4685 (dolist (filename compilation-filenames)
4686 (setq file-path (concat dir filename))
4687 (when (file-readable-p file-path)
4688 (setq nearest-compilation-file file-path)))
4689 (setq dir parent-dir
4690 parent-dir (file-name-directory (directory-file-name parent-dir))))
4691 nearest-compilation-file))
4692 (defun run ()
4693 (interactive)
4694 "call run-fun if it is set, else run make if there is a makefile,
4695 else save and repeat last shell command.
4696 run-fun is meant to store file local variables, which show how to
4697 do the main thing we want on this file, generally compile and
4698 run.
4699
4700 example of setting it in a file:
4701 ;; Local Variables:
4702 ;; run-fun: merge-test
4703 ;; End: "
4704 (basic-save-buffer)
4705 (if (and (boundp 'run-fun) run-fun)
4706 (funcall run-fun)
4707 (let ((makefile (get-nearest-compilation-file)))
4708 (if (and makefile (stringp mode-name) (string= mode-name "C/l"))
4709 (compile (format
4710 "make -f %s" (get-nearest-compilation-file)))
4711 (repeat-shell)))))
4712
4713
4714 (defun send-shell ()
4715 (interactive)
4716 (send-shell-buffer "*shell*" 'shell (kbd "C-v")))
4717
4718 (defun send-python ()
4719 (interactive)
4720 (send-shell-buffer "*Python*" 'py-shell (kbd "C-v")))
4721
4722
4723 (defun send-shell-buffer (buffer-name &optional init shell-send-yank-key)
4724 "Send current line or region to shell-mode buffer.
4725 When in shell-mode, copy the current line to the
4726 most recently visited visible window.
4727
4728 SHELL-SEND-YANK-KEY: key to use instead
4729 of yank to paste into recent window. This allows compatibility with
4730 modes like org-mode which have their own yank function."
4731 (if (string= (buffer-name) buffer-name)
4732 ;; this section is copied out of comint-send-input
4733 (progn
4734 (let ((proc (get-buffer-process (current-buffer))))
4735 (if (not proc) (user-error "Current buffer has no process")
4736 (widen)
4737
4738 (let* ((pmark (process-mark proc))
4739 (intxt (if (>= (point) (marker-position pmark))
4740 (progn (if comint-eol-on-send (end-of-line))
4741 (buffer-substring pmark (point)))
4742 (let ((copy (funcall comint-get-old-input)))
4743 (goto-char pmark)
4744 (insert copy)
4745 copy))))
4746
4747 (if (= (length intxt) 0)
4748 (kill-new (comint-previous-matching-input-string "." 1))
4749 (kill-new intxt)))))
4750 (kill-append "\n" nil)
4751 (select-window (previous-window nil nil 'visible))
4752 (if (and (boundp 'shell-send-yank-key) shell-send-yank-key)
4753 (call-interactively (global-key-binding shell-send-yank-key))
4754 (yank))
4755 (select-window (next-window nil nil 'visible)))
4756 (let (start end)
4757 (if mark-active
4758 (setq start (mark)
4759 end (point))
4760 (setq start (save-excursion (beginning-of-line) (point))
4761 end (save-excursion (end-of-line) (point)))
4762 (let (line-move-visual)
4763 (call-interactively 'next-line)))
4764 (send-comint-input buffer-name start end init))))
4765
4766 ;; supporting functions
4767
4768
4769 (defun send-comint-input (buffer-name start end &optional init)
4770 "Input the region to BUFFER-NAME, assuming it is a comint-derived buffer.
4771 Show BUFFER-NAME if it is not show.
4772 Call INIT if BUFFER-NAME does not exist."
4773 (let ((input (filter-buffer-substring start end))
4774 (buffer (get-buffer buffer-name)))
4775 (unless buffer
4776 (message "nobuffer")
4777 ;; save-excursion etc. don't work for (shell), so I do this instead
4778 (if init (let ((original-buffer (current-buffer)))
4779 (funcall init (and (boundp 'send-shell-buffer-name) send-shell-buffer-name))
4780 (switch-to-buffer original-buffer)
4781 (setq buffer (get-buffer buffer-name)))
4782 (error "No existing buffer found and no init function argument. ")))
4783 (buffer-window-show buffer)
4784 (with-current-buffer buffer
4785 (let ((proc (get-buffer-process buffer)))
4786 (goto-char (process-mark proc))
4787 (insert input)
4788 (comint-send-input nil t)))))
4789
4790 (defun buffer-window-show (&optional buffer action)
4791 "Like temp-buffer-window-show, but removed stuff
4792 relevant to it being temp or help."
4793 (let (window frame)
4794 (with-current-buffer buffer
4795 (when (let ((window-combination-limit
4796 ;; When `window-combination-limit' equals
4797 ;; `temp-buffer' or `temp-buffer-resize' and
4798 ;; `temp-buffer-resize-mode' is enabled in this
4799 ;; buffer bind it to t so resizing steals space
4800 ;; preferably from the window that was split.
4801 (if (or (eq window-combination-limit 'temp-buffer)
4802 (and (eq window-combination-limit
4803 'temp-buffer-resize)
4804 temp-buffer-resize-mode))
4805 t
4806 window-combination-limit)))
4807 ;; debug
4808 ;;(message "window-combination-limit")
4809 ;;(print window-combination-limit)
4810 (setq window (display-buffer buffer action)))
4811 (setq frame (window-frame window))
4812 (unless (eq frame (selected-frame))
4813 (raise-frame frame))
4814 (setq minibuffer-scroll-window window)
4815 (set-window-hscroll window 0)
4816 ;; Return the window.
4817 window))))
4818
4819
4820 ;; when poping help, etc, allow reusing a window in a different frame if it is visible
4821 ;; figured this out after spending quite a while reading doc string for display-buffer
4822 ;; which is the main function which uses this.
4823 ;; it will use other vars or its arg to override this,
4824 ;; but those things are often nil.
4825 ;; aha moments in reading it: ACTION = (FUNCTION-or-FUNCTIONLIST ALIST)
4826 ;; FRAME adds an association to ACTION's alist, but it's not used if ACTION arg is nil.
4827 (setq display-buffer-fallback-action `(,(car display-buffer-fallback-action) . '(reusable-frames . visible)))
4828 ;; stop splitting windows verticallly when I open a buffer or shell
4829 (setq split-height-threshold nil)
4830 #+end_src
4831
4832 *** s-left arrow
4833 :PROPERTIES:
4834 :CUSTOM_ID: d8c473ac-5507-4a6b-9e5a-46558c17b09f
4835 :END:
4836 shell
4837 #+begin_src emacs-lisp
4838 (global-set-key (kbd "<S-kp-equal>") 'shell-wrap)
4839 #+end_src
4840 *** s-right arrow
4841 :PROPERTIES:
4842 :CUSTOM_ID: 2365f5a7-b89a-4a97-b272-ac8ae9c2cc66
4843 :END:
4844 previous-buffer
4845 #+begin_src emacs-lisp
4846 (global-set-key (kbd "<S-kp-divide>") 'previous-buffer)
4847 #+end_src
4848 *** esc
4849 :PROPERTIES:
4850 :CUSTOM_ID: 60a56803-f38d-4d0a-8ed5-1c94ba97b6f6
4851 :END:
4852 *** return
4853 :PROPERTIES:
4854 :CUSTOM_ID: fab6adea-ed20-45ab-a0a3-776c68d5c3a5
4855 :END:
4856 new line
4857
4858 #+begin_src emacs-lisp
4859 ;; todo, this doesn't set the keybind for the help minibuffer
4860 (when (boundp 'icomplete-minibuffer-map)
4861 (define-key icomplete-minibuffer-map (kbd "C-j") 'exit-minibuffer)
4862 (define-key icomplete-minibuffer-map (kbd "<return>")
4863 'minibuffer-force-complete-and-exit))
4864
4865 (add-hook 'ido-setup-hook
4866 (lambda()
4867 (define-key ido-completion-map (kbd "<return>") 'ido-exit-minibuffer)))
4868 (define-key minibuffer-local-completion-map (kbd "<return>") 'exit-minibuffer)
4869
4870
4871 (define-key isearch-mode-map (kbd "<return>") 'isearch-exit)
4872 (define-key isearch-mode-map "\r" nil)
4873
4874
4875 (global-set-key (kbd "<return>") 'indent-new-comment-line)
4876 (define-key ac-completing-map (kbd "<return>") nil)
4877 (define-key ac-completing-map "\r" nil)
4878 (define-key minibuffer-local-map "\r" nil)
4879 (define-key minibuffer-local-map (kbd "<return>") 'exit-minibuffer)
4880 (define-key minibuffer-local-map (kbd "C-j") 'exit-minibuffer)
4881 (define-key minibuffer-local-must-match-map (kbd "C-j") 'exit-minibuffer)
4882 (define-key minibuffer-local-must-match-map "\r" nil)
4883 (define-key minibuffer-local-must-match-map (kbd "<return>")
4884 'minibuffer-complete-and-exit)
4885
4886 (add-hook 'Man-mode-hook
4887 (lambda ()
4888 (define-key Man-mode-map "\r" nil)
4889 (define-key Man-mode-map "x" 'man-follow)))
4890
4891 (add-hook 'comint-mode-hook
4892 (lambda ()
4893 (define-key comint-mode-map "\r" nil)
4894 (define-key comint-mode-map (kbd "<return>") 'comint-send-input)))
4895
4896 (add-hook 'org-mode-hook
4897 (lambda ()
4898 (define-key org-mode-map "\r" nil)
4899 (define-key org-mode-map (kbd "<return>") 'org-return-indent)))
4900
4901 (add-hook 'comint-mode-hook
4902 (lambda ()
4903 (define-key comint-mode-map "\C-m" nil)
4904 (define-key comint-mode-map "\C-d" nil)))
4905 ;; use space instead of enter in calc mode,
4906 ;; cuz it is not easy to rebind enter in calc mode
4907 #+end_src
4908
4909 *** [s-return] :drill:
4910 SCHEDULED: <2014-03-10 Mon>
4911 :PROPERTIES:
4912 auto-correct-prev-word
4913 :ID: db46193b-f202-4927-bc76-2ad74d9f0ed7
4914 :CUSTOM_ID: 819cfb55-3a2f-4f20-8591-f819d1a6869a
4915 :DRILL_LAST_INTERVAL: 7.9493
4916 :DRILL_REPEATS_SINCE_FAIL: 3
4917 :DRILL_TOTAL_REPEATS: 7
4918 :DRILL_FAILURE_COUNT: 4
4919 :DRILL_AVERAGE_QUALITY: 2.696
4920 :DRILL_EASE: 2.312
4921 :DRILL_LAST_QUALITY: 3
4922 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:05>
4923 :END:
4924 auto-correct-prev-word
4925 [
4926 #+begin_src emacs-lisp
4927 (global-set-key (kbd "<S-return>") 'flyspell-auto-correct-previous-word)
4928 #+end_src
4929 ]
4930
4931 *** down arrow
4932 :PROPERTIES:
4933 :CUSTOM_ID: 7a868484-9c63-4a73-abda-7751cb2c02be
4934 :END:
4935 mark
4936 #+begin_src emacs-lisp
4937 (global-set-key (kbd "<kp-enter>") 'set-mark-command)
4938 #+end_src
4939 *** s-down arrow
4940 :PROPERTIES:
4941 :CUSTOM_ID: 097b97e0-8ad8-40f7-8388-c4ace1706b38
4942 :END:
4943 extended command
4944 #+begin_src emacs-lisp
4945 (global-set-key (kbd "<S-kp-enter>") 'smex)
4946 #+end_src
4947 *** s-up arrow
4948
4949 ** mouse
4950 *** [mouse-2 mode line] :drill:
4951 SCHEDULED: <2014-03-17 Mon>
4952 :PROPERTIES:
4953 :ID: d79167ad-9782-40b3-8e40-55aaa8428dec
4954 :CUSTOM_ID: 69aaa631-6fb5-4beb-b2d8-c0f3d92c0a98
4955 :DRILL_LAST_INTERVAL: 15.2345
4956 :DRILL_REPEATS_SINCE_FAIL: 4
4957 :DRILL_TOTAL_REPEATS: 7
4958 :DRILL_FAILURE_COUNT: 2
4959 :DRILL_AVERAGE_QUALITY: 2.893
4960 :DRILL_EASE: 2.405
4961 :DRILL_LAST_QUALITY: 3
4962 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:06>
4963 :END:
4964 mouse-delete-other-windows
4965 *** C-mouse-2 mode line
4966 :PROPERTIES:
4967 :CUSTOM_ID: 501479ab-e1e2-497e-bd86-071f8afa3378
4968 :END:
4969 mouse-split-window-horizontally
4970 *** M-mouse-2 mode line
4971 :PROPERTIES:
4972 :CUSTOM_ID: 8de14d73-499e-406a-b5c4-e295e53d3f4c
4973 :END:
4974 *** S-mouse-2 mode line
4975 :PROPERTIES:
4976 :CUSTOM_ID: f389cdbb-186a-4cad-af45-b3c75a508275
4977 :END:
4978 *** C-M-mouse-2 mode line
4979 :PROPERTIES:
4980 :CUSTOM_ID: cb2be69c-f86c-4120-b7f2-1c09b7bcd816
4981 :END:
4982 *** C-S-mouse2 mode line
4983 :PROPERTIES:
4984 :CUSTOM_ID: 7b4eced3-ce5e-49ce-8bfe-8823e8f5f93e
4985 :END:
4986 *** [mouse-3 mode line] :drill:
4987 SCHEDULED: <2014-03-19 Wed>
4988 :PROPERTIES:
4989 :ID: 324e43e7-d468-4edc-b892-c1e249ff49fa
4990 :CUSTOM_ID: 917a1844-8c38-4f31-8616-50fc81334f2c
4991 :DRILL_LAST_INTERVAL: 27.607
4992 :DRILL_REPEATS_SINCE_FAIL: 4
4993 :DRILL_TOTAL_REPEATS: 4
4994 :DRILL_FAILURE_COUNT: 0
4995 :DRILL_AVERAGE_QUALITY: 3.5
4996 :DRILL_EASE: 2.73
4997 :DRILL_LAST_QUALITY: 3
4998 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:50>
4999 :END:
5000 mouse-delete-window
5001 *** C-mouse-3 mode line
5002 :PROPERTIES:
5003 :CUSTOM_ID: b36a218f-6a92-4594-940b-13ffdf79cc9c
5004 :END:
5005 *** M-mouse-3 mode line
5006 :PROPERTIES:
5007 :CUSTOM_ID: 11c48311-05a4-440e-b742-ec397f22f479
5008 :END:
5009 *** S-mouse-3 mode line
5010 :PROPERTIES:
5011 :CUSTOM_ID: 03768943-d8cd-4dcb-bc48-393e9a6bb31f
5012 :END:
5013 *** C-M-mouse-3 mode line
5014 :PROPERTIES:
5015 :CUSTOM_ID: ab213201-bab7-4d30-8f61-fee80e7f2c6f
5016 :END:
5017 *** C-S-mouse-3 mode line
5018 :PROPERTIES:
5019 :CUSTOM_ID: 0bcac7a3-2943-49b7-b281-d834d374caf9
5020 :END:
5021 *** mouse-1
5022 :PROPERTIES:
5023 :CUSTOM_ID: 4e60e2e4-8c2f-4450-8060-2d793ede530c
5024 :END:
5025 set cursor/mark
5026 *** [C-mouse-1] :drill:
5027 SCHEDULED: <2014-03-15 Sat>
5028 :PROPERTIES:
5029 :CUSTOM_ID: b661f84f-57df-4095-9dc1-d1a876a53ee5
5030 :ID: 6b82708e-d5de-48cc-8abd-225186eb8729
5031 :DRILL_LAST_INTERVAL: 24.4352
5032 :DRILL_REPEATS_SINCE_FAIL: 4
5033 :DRILL_TOTAL_REPEATS: 4
5034 :DRILL_FAILURE_COUNT: 0
5035 :DRILL_AVERAGE_QUALITY: 3.75
5036 :DRILL_EASE: 2.929
5037 :DRILL_LAST_QUALITY: 4
5038 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 18:03>
5039 :END:
5040 buffer list context menu
5041 *** M-mouse-1
5042 :PROPERTIES:
5043 :CUSTOM_ID: c71c8a71-7027-44f3-be19-1d3c18ff5129
5044 :END:
5045 *** S-mouse-1
5046 :PROPERTIES:
5047 :CUSTOM_ID: 84507cd6-8a75-4754-bf9e-5a30f57fa4ac
5048 :END:
5049 *** C-M-mouse-1
5050 :PROPERTIES:
5051 :CUSTOM_ID: 95eea58e-82b0-48a3-a7c8-0d17c50b7c2e
5052 :END:
5053 *** C-S-mouse-1
5054 :PROPERTIES:
5055 :CUSTOM_ID: 2d450c06-d9aa-4751-a926-0922c0c3a402
5056 :END:
5057 *** mouse-2
5058 :PROPERTIES:
5059 :CUSTOM_ID: 086b0b50-054f-462d-92fa-b27852f887b0
5060 :END:
5061 paste
5062 *** C-mouse-2
5063 :PROPERTIES:
5064 :CUSTOM_ID: 48b8de22-6638-44da-986f-16e0e69312dd
5065 :END:
5066 *** M-mouse-2
5067 :PROPERTIES:
5068 :CUSTOM_ID: fb315a27-6351-4ce2-9692-589608793c43
5069 :END:
5070 *** S-mouse-2
5071 :PROPERTIES:
5072 :CUSTOM_ID: 7cc73036-844b-44d3-afe1-1e76ee626b53
5073 :END:
5074 *** C-M-mouse-2
5075 :PROPERTIES:
5076 :CUSTOM_ID: 85f35287-5130-47ab-832d-af78dc2a3e70
5077 :END:
5078 *** C-S-mouse-2
5079 :PROPERTIES:
5080 :CUSTOM_ID: a27ad43f-3be2-4155-9a9f-c144170372ce
5081 :END:
5082 *** mouse-3
5083 :PROPERTIES:
5084 :CUSTOM_ID: 0481632e-9c50-4328-9365-c4b5bf967b66
5085 :END:
5086 set-mark
5087 #+begin_src emacs-lisp
5088 (define-key global-map [down-mouse-3] 'mouse3-func)
5089 (global-set-key [mouse-3] 'mouse3-set-mark)
5090 (global-set-key [drag-mouse-3] 'mouse3-set-mark)
5091 #+end_src
5092 *** [C-mouse-3] :drill:
5093 SCHEDULED: <2014-03-13 Thu>
5094 :PROPERTIES:
5095 :ID: b075e62c-55c6-46f5-a23a-4c4c5b9f267e
5096 :CUSTOM_ID: 9623c78f-7705-4cbe-a990-c24eb1067377
5097 :DRILL_LAST_INTERVAL: 22.1939
5098 :DRILL_REPEATS_SINCE_FAIL: 4
5099 :DRILL_TOTAL_REPEATS: 4
5100 :DRILL_FAILURE_COUNT: 0
5101 :DRILL_AVERAGE_QUALITY: 3.5
5102 :DRILL_EASE: 2.73
5103 :DRILL_LAST_QUALITY: 4
5104 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:38>
5105 :END:
5106 global menu
5107 *** M-mouse-3
5108 :PROPERTIES:
5109 :CUSTOM_ID: fb6f4840-7e44-4c94-b913-f2014fda3325
5110 :END:
5111 *** S-mouse-3
5112 :PROPERTIES:
5113 :CUSTOM_ID: a6d91332-c731-474c-9959-ddd03e8b2786
5114 :END:
5115 *** C-M-mouse-3
5116 :PROPERTIES:
5117 :CUSTOM_ID: 6b4d0e4d-1a2c-4e42-a925-e39548c4e264
5118 :END:
5119 *** C-S-mouse-3
5120 :PROPERTIES:
5121 :CUSTOM_ID: a983a7c5-c17e-4e08-b3e2-a45a44d7a2b6
5122 :END:
5123 *** [mouse-9]
5124 :PROPERTIES:
5125 :CUSTOM_ID: efaec161-b279-4129-86fd-b410430926e4
5126 :END:
5127 move-mouse-to-point
5128 [
5129 #+begin_src emacs-lisp
5130 (global-set-key (kbd "<mouse-6>") 'move-mouse-to-point)
5131 #+end_src
5132 ]
5133 *** C-mouse-9
5134 :PROPERTIES:
5135 :CUSTOM_ID: e055ae8a-cc94-4e0f-9e98-9cb62453b8d6
5136 :END:
5137 *** M-mouse-9
5138 :PROPERTIES:
5139 :CUSTOM_ID: 7d1c03a9-b153-47dc-a037-7ee333ca8da9
5140 :END:
5141 *** S-mouse-9
5142 :PROPERTIES:
5143 :CUSTOM_ID: 8f688d00-8cdb-4163-818c-a0cfba3b1c0a
5144 :END:
5145 *** C-M-mouse-9
5146 :PROPERTIES:
5147 :CUSTOM_ID: 90ce7df8-2346-4203-8ced-5da51c7c1bfc
5148 :END:
5149 *** C-S-mouse-9
5150 :PROPERTIES:
5151 :CUSTOM_ID: 0afdad0a-f9c4-4bfa-baa8-cc20d6cab628
5152 :END:
5153 *** mouse-8
5154 :PROPERTIES:
5155 :CUSTOM_ID: ea9d2415-0fd7-4f83-9867-a7a81899e74b
5156 :END:
5157 *** C-mouse-8
5158 :PROPERTIES:
5159 :CUSTOM_ID: dc2428d2-412c-4811-8327-3bb70bfa0e76
5160 :END:
5161 *** M-mouse-8
5162 :PROPERTIES:
5163 :CUSTOM_ID: 530ed41d-6ed6-4bcd-9df7-58ddbfe8b44a
5164 :END:
5165 *** S-mouse-8
5166 :PROPERTIES:
5167 :CUSTOM_ID: c7d388c3-f4a6-4489-b23a-20ebb7515430
5168 :END:
5169 *** C-M-mouse-8
5170 :PROPERTIES:
5171 :CUSTOM_ID: fc6ac9e8-fd9a-4270-9cd8-26713d6bc40f
5172 :END:
5173 *** C-S-mouse-8
5174 :PROPERTIES:
5175 :CUSTOM_ID: 401503ad-3750-4002-a28e-1f1345412bc6
5176 :END:
5177 *** 1/kp-end
5178 :PROPERTIES:
5179 :CUSTOM_ID: c306a3ef-4b81-4d54-a914-99f312d8f92f
5180 :END:
5181 *** C-1/kp-end
5182 :PROPERTIES:
5183 :CUSTOM_ID: 11059916-0a48-4f08-b85a-9b82243e4145
5184 :END:
5185 *** M-1/kp-end
5186 :PROPERTIES:
5187 :CUSTOM_ID: fddd8716-5b16-484e-9d70-358fea201d99
5188 :END:
5189 *** S-1/kp-end
5190 :PROPERTIES:
5191 :CUSTOM_ID: c6a7978b-a5cf-4ae7-b1d2-57ea72adb487
5192 :END:
5193 *** C-M-1/kp-end
5194 :PROPERTIES:
5195 :CUSTOM_ID: 376b8b84-ae1b-4bff-b1c8-263049186637
5196 :END:
5197 *** C-S-1/kp-end
5198 :PROPERTIES:
5199 :CUSTOM_ID: 4e8081cb-5692-4d2e-8657-c6c7931046fd
5200 :END:
5201 *** 2/kp-down
5202 :PROPERTIES:
5203 :CUSTOM_ID: a1108fd9-0df0-43ac-9dbb-0402d24f5b57
5204 :END:
5205 *** C-2/kp-down
5206 :PROPERTIES:
5207 :CUSTOM_ID: e9fe4916-14f5-4dc6-8dba-ed982b7172a1
5208 :END:
5209 *** M-2/kp-down
5210 :PROPERTIES:
5211 :CUSTOM_ID: 50db5a06-452e-491f-875b-3de936a4d04a
5212 :END:
5213 #+begin_src emacs-lisp
5214 ;; for when we have a standard keyboard which is not remapped
5215 (global-set-key (kbd "M-2") 'smex)
5216
5217 #+end_src
5218
5219 *** S-2/kp-down
5220 :PROPERTIES:
5221 :CUSTOM_ID: c3ad691b-0082-46f3-8588-ef2223eab643
5222 :END:
5223 *** C-M-2/kp-down
5224 :PROPERTIES:
5225 :CUSTOM_ID: 90963055-086b-4d96-8131-d890ff3cb597
5226 :END:
5227 *** C-S-2/kp-down
5228 :PROPERTIES:
5229 :CUSTOM_ID: 4d13741e-2207-4d2c-a719-e818bb9f3419
5230 :END:
5231 *** 3/kp-next
5232 :PROPERTIES:
5233 :CUSTOM_ID: b441f9e2-d035-4907-b947-0f3b4d6d062d
5234 :END:
5235 *** C-3/kp-next
5236 :PROPERTIES:
5237 :CUSTOM_ID: 3ea6ff26-4db4-46c8-b681-e08acd9b6a06
5238 :END:
5239 *** M-3/kp-next
5240 :PROPERTIES:
5241 :CUSTOM_ID: a376d2fb-999d-48fd-8c9e-36b7661c5ba7
5242 :END:
5243 *** S-3/kp-next
5244 :PROPERTIES:
5245 :CUSTOM_ID: 50b8356c-7ba5-4e89-b4d6-618f6c571678
5246 :END:
5247 *** C-M-3/kp-next
5248 :PROPERTIES:
5249 :CUSTOM_ID: cd997379-f611-4d06-91c7-ed6cabb618ee
5250 :END:
5251 *** C-S-3/kp-next
5252 :PROPERTIES:
5253 :CUSTOM_ID: 1c8941c9-3025-4dff-bcf3-09d8de44f44f
5254 :END:
5255 *** 4/kp-left
5256 :PROPERTIES:
5257 :ID: bef4fed5-5338-4c66-a759-13dc20ab9bfb
5258 :CUSTOM_ID: c44d0f65-9502-4cc6-9642-96d907f6b093
5259 :END:
5260 indent-region
5261 #+begin_src emacs-lisp
5262 (global-set-key (kbd "<kp-left>") 'indent-region)
5263 #+end_src
5264 *** C-4/kp-left
5265 :PROPERTIES:
5266 :CUSTOM_ID: dd0cd32a-1d62-4b19-9d4f-ee242fb7c7b9
5267 :END:
5268 *** M-4/kp-left
5269 :PROPERTIES:
5270 :CUSTOM_ID: 4f7c3799-28a7-4fc2-85fc-16d768d2047c
5271 :END:
5272 *** S-4/kp-left
5273 :PROPERTIES:
5274 :CUSTOM_ID: f84a7347-f88a-4888-bf5d-e15b98b5c3a2
5275 :END:
5276 *** C-M-4/kp-left
5277 :PROPERTIES:
5278 :CUSTOM_ID: 74a1afca-bd24-469b-93e9-7a9681a9e467
5279 :END:
5280 *** C-S-4/kp-left
5281 :PROPERTIES:
5282 :CUSTOM_ID: 6c822a4a-0e64-430b-8d21-46b387911f2f
5283 :END:
5284 *** 5/kp-begin
5285 :PROPERTIES:
5286 :ID: 0e93f6a0-3d6f-45b1-b14e-10abbdfa3ee4
5287 :CUSTOM_ID: 2458c6bc-7113-4d4b-bbdf-206e1cb842a7
5288 :END:
5289 mark-defun
5290 #+begin_src emacs-lisp
5291 (global-set-key (kbd "<kp-begin>") 'mark-defun)
5292 #+end_src
5293 *** C-5/kp-begin
5294 :PROPERTIES:
5295 :CUSTOM_ID: 39588066-77b8-4863-be0d-0f1fad8f0e2a
5296 :END:
5297 *** M-5/kp-begin
5298 :PROPERTIES:
5299 :CUSTOM_ID: b3542b42-9d71-4a3f-92b1-f79f275bcf52
5300 :END:
5301 *** S-5/kp-begin
5302 :PROPERTIES:
5303 :CUSTOM_ID: 66aed3e7-d7bb-4393-a95b-b90b3a410684
5304 :END:
5305 *** C-M-5/kp-begin
5306 :PROPERTIES:
5307 :CUSTOM_ID: 1060d464-eed3-4a17-a5c4-d8e8941f6925
5308 :END:
5309 *** C-S-5/kp-begin
5310 :PROPERTIES:
5311 :CUSTOM_ID: efd7867a-a87f-43ef-a849-0e4029431d7f
5312 :END:
5313 *** 6/kp-right
5314 :PROPERTIES:
5315 :ID: d156225a-b48e-45e2-80a7-ea1a7dbbc794
5316 :CUSTOM_ID: 3b79bc58-6067-43bd-9471-9d592744a25a
5317 :END:
5318 ibuffer
5319 #+begin_src emacs-lisp
5320 (global-set-key (kbd "<kp-right>") 'ibuffer)
5321 #+end_src
5322 *** C-6/kp-right
5323 :PROPERTIES:
5324 :CUSTOM_ID: 5592b3d3-7ade-4486-ac94-aed0aa3d78f5
5325 :END:
5326 *** M-6/kp-right
5327 :PROPERTIES:
5328 :CUSTOM_ID: c76bedd9-90a7-41fe-9327-607f88f60a3a
5329 :END:
5330 *** S-6/kp-right
5331 :PROPERTIES:
5332 :CUSTOM_ID: 8bbda9a2-7909-44fb-af24-a86dbbd5d16f
5333 :END:
5334 *** C-M-6/kp-right
5335 :PROPERTIES:
5336 :CUSTOM_ID: 7c5838f6-5cc9-4bbc-bd07-403cc009cf35
5337 :END:
5338 *** C-S-6/kp-right
5339 :PROPERTIES:
5340 :CUSTOM_ID: c6f2edc9-ffd3-400f-8014-bb92ea6e520b
5341 :END:
5342 *** 7/kp-home
5343 :PROPERTIES:
5344 :CUSTOM_ID: c98ba390-f2e3-4c14-8d41-142b54e76d77
5345 :END:
5346 *** C-7/kp-home
5347 :PROPERTIES:
5348 :CUSTOM_ID: 5597d00f-4a89-4af2-aac1-98808763744c
5349 :END:
5350 *** M-7/kp-home
5351 :PROPERTIES:
5352 :CUSTOM_ID: 5cbafd0e-0c8f-4e14-a24e-f847c341e5c1
5353 :END:
5354 *** S-7/kp-home
5355 :PROPERTIES:
5356 :CUSTOM_ID: 92f7d836-ae32-4bba-9120-72e747feb832
5357 :END:
5358 *** C-M-7/kp-home
5359 :PROPERTIES:
5360 :CUSTOM_ID: 30170d01-412e-4098-b27e-ed9294d8cf92
5361 :END:
5362 *** C-S-7/kp-home
5363 :PROPERTIES:
5364 :CUSTOM_ID: 81300d39-e60e-4b09-865e-584153f3b827
5365 :END:
5366 *** 8/kp-up
5367 :PROPERTIES:
5368 :CUSTOM_ID: 0591db2b-6c5c-4438-9451-dcd686170c9d
5369 :END:
5370 *** C-8/kp-up
5371 :PROPERTIES:
5372 :CUSTOM_ID: 028ad953-1641-4f0c-83c2-72787310e447
5373 :END:
5374 *** M-8/kp-up
5375 :PROPERTIES:
5376 :CUSTOM_ID: 7c55f717-1093-48a7-b764-8f788540a4d7
5377 :END:
5378 *** S-8/kp-up
5379 :PROPERTIES:
5380 :CUSTOM_ID: f477fa15-3f04-48f6-a66a-4ba6eb0475f1
5381 :END:
5382 *** C-M-8/kp-up
5383 :PROPERTIES:
5384 :CUSTOM_ID: f280c9ab-49a8-4399-987b-bfde07c339be
5385 :END:
5386 *** C-S-8/kp-up
5387 :PROPERTIES:
5388 :CUSTOM_ID: 68a316aa-a05d-4ab0-87e4-88e8f2613795
5389 :END:
5390 *** 9/kp-prior
5391 :PROPERTIES:
5392 :ID: f3c60889-d948-4144-b5b0-04aeeec95309
5393 :CUSTOM_ID: a3b51adb-4405-4d9f-9b88-a8faa479fbe7
5394 :END:
5395 delete-horizontal-space
5396 #+begin_src emacs-lisp
5397 (global-set-key (kbd "<kp-prior>") 'delete-horizontal-space)
5398 #+end_src
5399 *** C-9/kp-prior
5400 :PROPERTIES:
5401 :CUSTOM_ID: 2683f49c-a465-42d0-b85b-6aa345ac2213
5402 :END:
5403 *** M-9/kp-prior
5404 :PROPERTIES:
5405 :CUSTOM_ID: 91b0ee09-9eba-4b60-b05f-720eaca53065
5406 :END:
5407 *** S-9/kp-prior
5408 :PROPERTIES:
5409 :CUSTOM_ID: b79e626c-4425-409f-92ce-b88335629c34
5410 :END:
5411 *** C-M-9/kp-prior
5412 :PROPERTIES:
5413 :CUSTOM_ID: 4838285f-905b-4e18-8605-ff24a20ce9e1
5414 :END:
5415 *** C-S-9/kp-prior
5416 :PROPERTIES:
5417 :CUSTOM_ID: 763edfac-da7d-4360-a383-6a7f42cc2e02
5418 :END:
5419 *** 10/kp-insert
5420 :PROPERTIES:
5421 :CUSTOM_ID: 57e1a794-26f8-4fb6-b753-ef1ad1ff0af9
5422 :END:
5423 *** C-10/kp-insert
5424 :PROPERTIES:
5425 :CUSTOM_ID: 32426751-f87b-4fd5-b435-914ac8f54e5f
5426 :END:
5427 *** M-10/kp-insert
5428 :PROPERTIES:
5429 :CUSTOM_ID: 1b83659c-61dc-425f-bead-fc2a0d198dde
5430 :END:
5431 *** S-10/kp-insert
5432 :PROPERTIES:
5433 :CUSTOM_ID: d2f07180-2d20-4633-9c79-78f4d992f7a6
5434 :END:
5435 *** C-M-10/kp-insert
5436 :PROPERTIES:
5437 :CUSTOM_ID: 1f6eabdc-703c-4a05-829c-553ccf7d082d
5438 :END:
5439 *** C-S-10/kp-insert
5440 :PROPERTIES:
5441 :CUSTOM_ID: bb361418-370f-4b15-b7e1-8e85c7a6f032
5442 :END:
5443 *** 11/kp-subtract
5444 :PROPERTIES:
5445 :CUSTOM_ID: 0f84dddc-a1d2-428d-8c17-cf9ddbd24784
5446 :END:
5447 *** C-11/kp-subtract
5448 :PROPERTIES:
5449 :CUSTOM_ID: 4c3309ee-eb67-43ff-bc4a-44574b1c5e0f
5450 :END:
5451 *** M-11/kp-subtract
5452 :PROPERTIES:
5453 :CUSTOM_ID: e95a2822-5f0d-4b32-a17f-15d4650e086f
5454 :END:
5455 *** S-11/kp-subtract
5456 :PROPERTIES:
5457 :CUSTOM_ID: 667a9853-38c6-4bb2-8c01-6a30075929b4
5458 :END:
5459 *** C-M-11/kp-subtract
5460 :PROPERTIES:
5461 :CUSTOM_ID: d5b17698-9bfe-4bd7-af26-b5dd51684e7d
5462 :END:
5463 *** C-S-11/kp-subtract
5464 :PROPERTIES:
5465 :CUSTOM_ID: cfde57be-a728-4955-8b96-9ae5aa1cce01
5466 :END:
5467 *** 12/kp-add
5468 :PROPERTIES:
5469 :CUSTOM_ID: 5e7a0116-a847-4fec-81ed-a0286bb08ac5
5470 :END:
5471 *** C-12/kp-add
5472 :PROPERTIES:
5473 :CUSTOM_ID: 41dcdb69-8436-495b-9e55-a0cd623ac5aa
5474 :END:
5475 *** M-12/kp-add
5476 :PROPERTIES:
5477 :CUSTOM_ID: ebda57a2-cab3-4fed-b3b0-014a7e60c96f
5478 :END:
5479 *** S-12/kp-add
5480 :PROPERTIES:
5481 :CUSTOM_ID: 7e4c6085-cfbe-4c05-9edb-2aec2325f7b9
5482 :END:
5483 *** C-M-12/kp-add
5484 :PROPERTIES:
5485 :CUSTOM_ID: 7904cafb-7371-4bc9-a661-262d78f8f9b8
5486 :END:
5487 *** C-S-12/kp-add
5488 :PROPERTIES:
5489 :CUSTOM_ID: dcf498f0-5bcf-4402-bce0-561c11effb38
5490 :END:
5491 *** scroll
5492 :PROPERTIES:
5493 :CUSTOM_ID: 33433f0f-5b0e-46ba-8452-d2a51e54769b
5494 :END:
5495 up/dn / scroll
5496 on standard mouse, this scrolls,
5497 because we have the accuracy to pick things up and
5498 down easier, and because it is familiar.
5499 *** [C-scroll] :drill:
5500 SCHEDULED: <2014-03-27 Thu>
5501 :PROPERTIES:
5502 cycle recent buffers
5503 :ID: 678b14e8-e991-46da-84a0-50d142ecbbba
5504 :CUSTOM_ID: 16506ba5-e8f2-4aec-bc1b-d2854d4e504c
5505 :DRILL_LAST_INTERVAL: 50.6823
5506 :DRILL_REPEATS_SINCE_FAIL: 3
5507 :DRILL_TOTAL_REPEATS: 3
5508 :DRILL_FAILURE_COUNT: 0
5509 :DRILL_AVERAGE_QUALITY: 5.0
5510 :DRILL_EASE: 5.815
5511 :DRILL_LAST_QUALITY: 5
5512 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:36>
5513 :END:
5514 cursor up/down fast
5515 [
5516 #+begin_src emacs-lisp
5517 ;; compiling warns that next-line should be called interactively,
5518 ;; but we would have to do something dumb, like give it a
5519 ;; vector of keys in order to supply the 8 argument
5520 (defun down-fast ()
5521 (interactive)
5522 (next-line 8))
5523 (defun up-fast ()
5524 (interactive)
5525 (next-line -8))
5526
5527 (global-set-key (kbd "<C-up>") 'up-fast)
5528 (global-set-key (kbd "<C-down>") 'down-fast)
5529
5530 (add-hook 'comint-mode-hook
5531 (lambda ()
5532 (define-key comint-mode-map (kbd "<C-mouse-4>") 'comint-previous-prompt)
5533 (define-key comint-mode-map (kbd "<C-mouse-5>") 'comint-next-prompt)))
5534 #+end_src
5535 ]
5536
5537 *** [M-scroll]
5538 :PROPERTIES:
5539 :CUSTOM_ID: e1e2e253-450d-4620-af9e-78d378f49ad5
5540 :END:
5541 forward/back s-exp
5542 [
5543 #+begin_src emacs-lisp
5544 (global-set-key (kbd "<M-mouse-4>") 'backward-sexp)
5545 (global-set-key (kbd "<M-mouse-5>") 'forward-sexp)
5546 #+end_src
5547 ]
5548 *** [S-scroll] :drill:
5549 SCHEDULED: <2014-03-22 Sat>
5550 :PROPERTIES:
5551 expand region
5552 :ID: c2da442e-b8c0-4b8a-899f-989af89bd857
5553 :CUSTOM_ID: 74b2196a-345d-453a-b7be-1915360eb201
5554 :DRILL_LAST_INTERVAL: 27.0855
5555 :DRILL_REPEATS_SINCE_FAIL: 5
5556 :DRILL_TOTAL_REPEATS: 5
5557 :DRILL_FAILURE_COUNT: 2
5558 :DRILL_AVERAGE_QUALITY: 3.4
5559 :DRILL_EASE: 2.666
5560 :DRILL_LAST_QUALITY: 4
5561 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 02:26>
5562 :END:
5563 expand/contract region
5564 [
5565 #+begin_src emacs-lisp
5566 (global-set-key (kbd "<S-mouse-13>") 'my-contract-region)
5567 (global-set-key (kbd "<S-mouse-14>") 'er/expand-region)
5568 (global-set-key (kbd "<S-mouse-4>") 'my-contract-region)
5569 (global-set-key (kbd "<S-mouse-5>") 'er/expand-region)
5570 (global-set-key (kbd "<S-up>") 'my-contract-region)
5571 (global-set-key (kbd "<S-down>") 'er/expand-region)
5572
5573 (defun my-contract-region (arg)
5574 (interactive "p")
5575 (let ((current-prefix-arg '-))
5576 (call-interactively 'er/expand-region)))
5577 #+end_src
5578 ]
5579 *** [C-M-scroll] :drill:
5580 SCHEDULED: <2014-03-27 Thu>
5581 :PROPERTIES:
5582 scroll
5583 :ID: b94d89ed-5a06-4916-b5f5-e0bf1a552362
5584 :CUSTOM_ID: bd2ca117-408c-49fc-a5ac-a938be21dfc0
5585 :DRILL_LAST_INTERVAL: 50.6823
5586 :DRILL_REPEATS_SINCE_FAIL: 3
5587 :DRILL_TOTAL_REPEATS: 3
5588 :DRILL_FAILURE_COUNT: 0
5589 :DRILL_AVERAGE_QUALITY: 5.0
5590 :DRILL_EASE: 5.815
5591 :DRILL_LAST_QUALITY: 5
5592 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
5593 :END:
5594 scroll
5595 [
5596 background: I originally tried to make c-scroll be scroll
5597 , but this made
5598 for better compatibility with the standard mouse
5599 #+begin_src emacs-lisp
5600 (global-set-key (kbd "<C-M-mouse-4>") 'mwheel-scroll)
5601 (global-set-key (kbd "<C-M-mouse-5>") 'mwheel-scroll)
5602 ; (require 'smooth-scroll)
5603 ; (smooth-scroll-mode nil)
5604 ; (global-set-key (kbd "<C-M-mouse-4>") 'scroll-up-1)
5605 ;(global-set-key (kbd "<C-M-mouse-5>") 'scroll-down-1)
5606 #+end_src
5607 ]
5608 *** [C-S-scroll] :drill:
5609 SCHEDULED: <2014-03-18 Tue>
5610 :PROPERTIES:
5611 zoom
5612 :ID: 368f60cb-91e5-4694-b342-e0049e5d3e2c
5613 :CUSTOM_ID: a69254a4-cf2d-450f-b477-2694b44a7e0d
5614 :DRILL_LAST_INTERVAL: 9.2113
5615 :DRILL_REPEATS_SINCE_FAIL: 3
5616 :DRILL_TOTAL_REPEATS: 7
5617 :DRILL_FAILURE_COUNT: 3
5618 :DRILL_AVERAGE_QUALITY: 2.943
5619 :DRILL_EASE: 2.429
5620 :DRILL_LAST_QUALITY: 3
5621 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:34>
5622 :END:
5623 increase / decrease text size
5624 [
5625 #+begin_src emacs-lisp
5626 (global-set-key (kbd "<C-S-mouse-4>") 'text-scale-increase)
5627 (global-set-key (kbd "<C-S-mouse-5>") 'text-scale-decrease)
5628 (global-set-key (kbd "<C-S-mouse-13>") 'text-scale-increase)
5629 (global-set-key (kbd "<C-S-mouse-14>") 'text-scale-decrease)
5630 (global-set-key (kbd "<C-S-down>") 'text-scale-increase)
5631 (global-set-key (kbd "<C-S-up>") 'text-scale-decrease)
5632 #+end_src
5633 ]
5634 *** left-scroll
5635 :PROPERTIES:
5636 :CUSTOM_ID: d2d5c5c7-f0de-4e08-953b-d41d3e282ba7
5637 :END:
5638 left/right
5639 *** [C-left-scroll] :drill:
5640 SCHEDULED: <2014-03-27 Thu>
5641 :PROPERTIES:
5642 :CUSTOM_ID: 7bb95aa5-381e-454a-a6c6-aaeec728db08
5643 :ID: 04bdffa0-52fe-4d90-a222-a6e41d75b13b
5644 :DRILL_LAST_INTERVAL: 50.6823
5645 :DRILL_REPEATS_SINCE_FAIL: 3
5646 :DRILL_TOTAL_REPEATS: 3
5647 :DRILL_FAILURE_COUNT: 0
5648 :DRILL_AVERAGE_QUALITY: 5.0
5649 :DRILL_EASE: 5.815
5650 :DRILL_LAST_QUALITY: 5
5651 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:35>
5652 :END:
5653 back / forward word
5654 #+begin_src emacs-lisp
5655 (global-set-key (kbd "<C-left>") 'backward-symbol)
5656 (global-set-key (kbd "<C-right>") 'forward-symbol)
5657 #+end_src
5658 *** [M-left-scroll] :drill:
5659 :PROPERTIES:
5660 winner undo redo
5661 :CUSTOM_ID: 49db3764-b154-4cfc-8d0d-f0e0451815e3
5662 :ID: 97ef29fd-aea5-49ce-aff2-7a8c8d1b3d5d
5663 :DRILL_LAST_INTERVAL: 0.0
5664 :DRILL_REPEATS_SINCE_FAIL: 0
5665 :DRILL_TOTAL_REPEATS: 9
5666 :DRILL_FAILURE_COUNT: 10
5667 :DRILL_AVERAGE_QUALITY: 2.518
5668 :DRILL_EASE: 2.225
5669 :DRILL_LAST_QUALITY: 2
5670 :DRILL_LAST_REVIEWED: <2014-04-14 Mon 11:30>
5671 :END:
5672
5673 *** S-left-scroll
5674 :PROPERTIES:
5675 :CUSTOM_ID: ca5cdcd4-b3da-4d7b-86ab-4c7c0ac2caf7
5676 :END:
5677 ---
5678 unreachable
5679 *** C-M-left-scroll
5680 unreachable
5681 *** C-S-left-scroll
5682 :PROPERTIES:
5683 :CUSTOM_ID: 7b4f1f49-6d93-4210-a30c-8278d6e63655
5684 :ID: b6ea3b66-d9a6-4a33-ae1c-0464d118f006
5685 :END:
5686 unreachable
5687 ** left primary
5688 *** [C-2] :drill:
5689 SCHEDULED: <2014-04-04 Fri>
5690 :PROPERTIES:
5691 :ID: 845cf47f-22d5-4100-837d-fbc066e33c9c
5692 :CUSTOM_ID: 4f29b011-3844-4a4a-b75d-cdf8f49e9adb
5693 :DRILL_LAST_INTERVAL: 26.3927
5694 :DRILL_REPEATS_SINCE_FAIL: 5
5695 :DRILL_TOTAL_REPEATS: 6
5696 :DRILL_FAILURE_COUNT: 2
5697 :DRILL_AVERAGE_QUALITY: 3.25
5698 :DRILL_EASE: 2.58
5699 :DRILL_LAST_QUALITY: 4
5700 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
5701 :END:
5702 narrow-to-defun/subtree
5703 [
5704 #+begin_src emacs-lisp
5705 (global-unset-key (kbd "C-2"))
5706 (defun copy-symbol (&optional arg)
5707 "Copy symbol at point into kill-ring"
5708 (interactive "P")
5709 (kill-new (thing-at-point 'symbol)))
5710
5711 (global-set-key (kbd "C-2") 'copy-symbol)
5712
5713 (global-set-key (kbd "C-4") 'narrow-to-defun)
5714 (add-hook 'org-mode-hook
5715 (lambda () (local-set-key (kbd "C-4") 'org-narrow-to-subtree)))
5716 #+end_src
5717 ]
5718 *** M-2
5719 :PROPERTIES:
5720 :CUSTOM_ID: 53ecfda2-d9f6-4882-b7a2-9b3c859e3bcb
5721 :END:
5722 *** [C-M-2]
5723 :PROPERTIES:
5724 :CUSTOM_ID: 33c4996d-92bc-4df0-b005-11553677be13
5725 :END:
5726 ---
5727 [
5728 #+begin_src emacs-lisp
5729 (global-unset-key (kbd "C-M-2"))
5730 #+end_src
5731 ]
5732 *** C-S-2
5733 :PROPERTIES:
5734 :CUSTOM_ID: 43af8e87-216d-47f7-9779-48ef66c7ca5f
5735 :END:
5736 *** [C-3] :drill:
5737 SCHEDULED: <2014-03-27 Thu>
5738 :PROPERTIES:
5739 :ID: 9495ba60-017a-49b0-b0b6-366c3334e909
5740 :CUSTOM_ID: 7851a05e-7177-4a8f-af5a-3325a8f116fe
5741 :DRILL_LAST_INTERVAL: 50.6823
5742 :DRILL_REPEATS_SINCE_FAIL: 3
5743 :DRILL_TOTAL_REPEATS: 3
5744 :DRILL_FAILURE_COUNT: 0
5745 :DRILL_AVERAGE_QUALITY: 5.0
5746 :DRILL_EASE: 5.815
5747 :DRILL_LAST_QUALITY: 5
5748 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:41>
5749 :END:
5750 dot-mode-execute
5751 [
5752 #+begin_src emacs-lisp
5753 (global-set-key (kbd "C-3") 'dot-mode-execute)
5754 #+end_src
5755 ]
5756 *** M-3
5757 :PROPERTIES:
5758 :CUSTOM_ID: ddceb843-06db-4078-914f-da225cac107e
5759 :END:
5760 *** [C-M-3] :drill:
5761 SCHEDULED: <2014-03-11 Tue>
5762 :PROPERTIES:
5763 :CUSTOM_ID: 9a00e17f-a1c9-48fc-b03b-c6a1a3cbda1c
5764 :ID: 75be5945-8bc4-4041-a44f-de2d9af66f4f
5765 :DRILL_LAST_INTERVAL: 19.6736
5766 :DRILL_REPEATS_SINCE_FAIL: 4
5767 :DRILL_TOTAL_REPEATS: 5
5768 :DRILL_FAILURE_COUNT: 1
5769 :DRILL_AVERAGE_QUALITY: 3.4
5770 :DRILL_EASE: 2.666
5771 :DRILL_LAST_QUALITY: 4
5772 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:48>
5773 :END:
5774 recenter-top-bottom
5775 [
5776 #+begin_src emacs-lisp
5777 (global-set-key (kbd "C-M-3") 'recenter-top-bottom)
5778 #+end_src
5779 ]
5780 *** C-S-3
5781 :PROPERTIES:
5782 :CUSTOM_ID: 224cf9b0-2e12-4cc7-a7e1-746784c87777
5783 :END:
5784 *** [C-q] :drill:
5785 SCHEDULED: <2014-03-27 Thu>
5786 :PROPERTIES:
5787 :ID: e7f30a61-8557-4b7e-898c-96db9d649f39
5788 :CUSTOM_ID: 679fd3cd-c43b-409c-be36-4175a5f27cd3
5789 :DRILL_LAST_INTERVAL: 50.6823
5790 :DRILL_REPEATS_SINCE_FAIL: 3
5791 :DRILL_TOTAL_REPEATS: 3
5792 :DRILL_FAILURE_COUNT: 0
5793 :DRILL_AVERAGE_QUALITY: 5.0
5794 :DRILL_EASE: 5.815
5795 :DRILL_LAST_QUALITY: 5
5796 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:42>
5797 :END:
5798 org-cycle, comint previous arg
5799 [
5800 #+begin_src emacs-lisp
5801 (add-hook 'org-mode-hook
5802 (lambda () (define-key org-mode-map (kbd "C-q") 'org-cycle)))
5803 (define-key widget-keymap (kbd "C-q") 'widget-forward)
5804 (add-hook 'comint-mode-hook
5805 (lambda () (define-key comint-mode-map (kbd "C-q") 'comint-insert-previous-argument)))
5806 #+end_src
5807 ]
5808 *** [M-q] :drill:
5809 SCHEDULED: <2014-03-19 Wed>
5810 :PROPERTIES:
5811 org-archive-to-archive-sibling
5812 :CUSTOM_ID: 72bada0e-5d62-4a8f-ae62-4972778ff1bc
5813 :ID: 4c8104f4-9251-4915-b076-6989c7cce3be
5814 :DRILL_LAST_INTERVAL: 10.3717
5815 :DRILL_REPEATS_SINCE_FAIL: 4
5816 :DRILL_TOTAL_REPEATS: 8
5817 :DRILL_FAILURE_COUNT: 6
5818 :DRILL_AVERAGE_QUALITY: 2.6
5819 :DRILL_EASE: 2.266
5820 :DRILL_LAST_QUALITY: 3
5821 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:35>
5822 :END:
5823 org-archive-to-archive-sibling
5824 [
5825 #+begin_src emacs-lisp
5826 (global-set-key (kbd "M-q") 'org-archive-to-archive-sibling)
5827 #+end_src
5828 ]
5829
5830 *** [C-M-q] :drill:
5831 SCHEDULED: <2014-03-12 Wed>
5832 :PROPERTIES:
5833 :ID: ab67e1da-41dd-40bd-96c1-556cafc6b630
5834 :DRILL_LAST_INTERVAL: 9.9427
5835 :DRILL_REPEATS_SINCE_FAIL: 3
5836 :DRILL_TOTAL_REPEATS: 6
5837 :DRILL_FAILURE_COUNT: 2
5838 :DRILL_AVERAGE_QUALITY: 3.104
5839 :DRILL_EASE: 2.506
5840 :DRILL_LAST_QUALITY: 4
5841 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 20:57>
5842 :CUSTOM_ID: 1f5e9b63-7ce0-445c-a426-b41839585d38
5843 :END:
5844 quoted-insert
5845 [
5846 #+begin_src emacs-lisp
5847 (global-set-key (kbd "C-M-q") 'quoted-insert)
5848 #+end_src
5849 ]
5850 *** C-S-q
5851 :PROPERTIES:
5852 :CUSTOM_ID: c16f1753-126b-499b-af0e-669129ccd3ea
5853 :END:
5854 *** [C-w]
5855 :PROPERTIES:
5856 :CUSTOM_ID: 20005b6d-9a9d-4b58-882c-7ce860c7a395
5857 :END:
5858 goto-t.org
5859 [
5860 #+begin_src emacs-lisp
5861 (global-set-key (kbd "C-w") (lambda () (interactive) (goto-buffer-or-find-file "/a/t.org")))
5862 #+end_src
5863 ]
5864 *** [M-w] :drill:
5865 SCHEDULED: <2014-03-18 Tue>
5866 :PROPERTIES:
5867 org-clock-in
5868 :ID: c271d82d-e40a-43c3-9c16-753633c1fc14
5869 :CUSTOM_ID: 331da6e5-7936-4663-8f58-9d8601b5915c
5870 :DRILL_LAST_INTERVAL: 41.7787
5871 :DRILL_REPEATS_SINCE_FAIL: 3
5872 :DRILL_TOTAL_REPEATS: 3
5873 :DRILL_FAILURE_COUNT: 0
5874 :DRILL_AVERAGE_QUALITY: 4.667
5875 :DRILL_EASE: 4.583
5876 :DRILL_LAST_QUALITY: 4
5877 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:36>
5878 :END:
5879 org-clock-in
5880 [
5881 #+begin_src emacs-lisp
5882 (global-set-key (kbd "M-w") 'org-clock-in)
5883 #+end_src
5884 ]
5885 *** C-M-w
5886 :PROPERTIES:
5887 :CUSTOM_ID: cede4936-de2f-404f-a0e6-264f08215a7c
5888 :END:
5889 *** C-S-w
5890 :PROPERTIES:
5891 :CUSTOM_ID: 3465b986-717a-43b4-910f-3d187789c027
5892 :END:
5893 *** [C-e]
5894 copy-line
5895 [
5896 #+begin_src emacs-lisp
5897 ; todo, make repeated calls to this append the kills
5898 (defun copy-line (&optional arg)
5899 "Copy lines (as many as prefix argument) in the kill ring.
5900 Ease of use features:
5901 - Move to start of next line.
5902 - Appends the copy on sequential calls.
5903 - Use newline as last char even on the last line of the buffer.
5904 - If region is active, copy its lines."
5905 (interactive "p")
5906 (let ((beg (line-beginning-position))
5907 (end (line-end-position (or arg 1))))
5908 (when mark-active
5909 (if (> (point) (mark))
5910 (setq beg (save-excursion (goto-char (mark)) (line-beginning-position)))
5911 (setq end (save-excursion (goto-char (mark)) (line-end-position)))))
5912 (if (eq last-command 'copy-line)
5913 (kill-append (buffer-substring beg end) (< end beg))
5914 (kill-ring-save beg end)))
5915 (kill-append "\n" nil)
5916 ;; dun need cuz I have yank-better
5917 ;;(beginning-of-line (or (and arg (1+ arg)) 2))
5918 (if (and arg (not (= 1 arg))) (message "%d lines copied" arg)))
5919
5920 (global-set-key (kbd "C-e") 'copy-line)
5921 #+end_src
5922 :PROPERTIES:
5923 :ID: 4ff8e0ad-15c0-4cb0-b6cc-314e7b5f80c0
5924 :CUSTOM_ID: 24e34f4b-d1e8-4380-933f-ab1f78ebc782
5925 :DRILL_LAST_INTERVAL: 2.4849
5926 :DRILL_REPEATS_SINCE_FAIL: 1
5927 :DRILL_TOTAL_REPEATS: 1
5928 :DRILL_FAILURE_COUNT: 0
5929 :DRILL_AVERAGE_QUALITY: 5.0
5930 :DRILL_EASE: 5.815
5931 :DRILL_LAST_QUALITY: 5
5932 :DRILL_LAST_REVIEWED: <2014-01-11 Sat 01:30>
5933 :END:
5934 ]
5935 *** [M-e] :drill:
5936 SCHEDULED: <2014-04-01 Tue>
5937 :PROPERTIES:
5938 org-clock-in-last
5939 :ID: 39424175-21e2-4126-9a51-dea451497841
5940 :CUSTOM_ID: 0a771449-0cd5-4dc9-82ca-bcac5f7abd17
5941 :DRILL_LAST_INTERVAL: 36.7949
5942 :DRILL_REPEATS_SINCE_FAIL: 4
5943 :DRILL_TOTAL_REPEATS: 4
5944 :DRILL_FAILURE_COUNT: 0
5945 :DRILL_AVERAGE_QUALITY: 4.0
5946 :DRILL_EASE: 3.204
5947 :DRILL_LAST_QUALITY: 3
5948 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:48>
5949 :END:
5950 org-clock-in-last
5951 [
5952 #+begin_src emacs-lisp
5953 (global-set-key (kbd "M-e") 'org-clock-in-last)
5954 #+end_src
5955 ]
5956 *** C-M-e
5957 :PROPERTIES:
5958 :CUSTOM_ID: 4a7a4324-e03d-43dc-8e9c-9622788519fb
5959 :END:
5960 *** C-S-e
5961 :PROPERTIES:
5962 :CUSTOM_ID: e202e1d5-b7ac-4171-b86a-b77592344f30
5963 :END:
5964 *** [C-r] :drill:
5965 SCHEDULED: <2014-04-07 Mon>
5966 :PROPERTIES:
5967 isearch-backward
5968 :ID: 39bcde9c-2b49-401e-9e81-ee42941233bf
5969 :CUSTOM_ID: 5c55f461-f43f-493d-81eb-1ca747175ef1
5970 :DRILL_LAST_INTERVAL: 42.8284
5971 :DRILL_REPEATS_SINCE_FAIL: 4
5972 :DRILL_TOTAL_REPEATS: 4
5973 :DRILL_FAILURE_COUNT: 0
5974 :DRILL_AVERAGE_QUALITY: 4.5
5975 :DRILL_EASE: 4.122
5976 :DRILL_LAST_QUALITY: 5
5977 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:51>
5978 :END:
5979 isearch-backward
5980 [
5981 #+begin_src emacs-lisp
5982 (global-set-key (kbd "C-r") 'isearch-backward)
5983 (add-hook 'comint-mode-hook
5984 (lambda ()
5985 (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
5986
5987 #+end_src
5988 ]
5989 *** [M-r] :drill:
5990 SCHEDULED: <2014-04-30 Wed>
5991 :PROPERTIES:
5992 org-clock-out
5993 :ID: dc2c7192-6cfb-4c06-bd17-ff2cef3b05a6
5994 :CUSTOM_ID: dd9575bd-e471-418e-9519-4fc2b874ddcd
5995 :DRILL_LAST_INTERVAL: 59.1432
5996 :DRILL_REPEATS_SINCE_FAIL: 4
5997 :DRILL_TOTAL_REPEATS: 4
5998 :DRILL_FAILURE_COUNT: 0
5999 :DRILL_AVERAGE_QUALITY: 4.25
6000 :DRILL_EASE: 3.59
6001 :DRILL_LAST_QUALITY: 3
6002 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
6003 :END:
6004 org-clock-out
6005 [
6006 #+begin_src emacs-lisp
6007 (global-set-key (kbd "M-r") 'org-clock-out)
6008 #+end_src
6009 ]
6010 *** C-M-r
6011 *** C-S-r
6012 :PROPERTIES:
6013 :CUSTOM_ID: 05e2290b-0d2c-407c-9bf0-adc7a008336b
6014 :END:
6015 *** [C-a] :drill:
6016 SCHEDULED: <2014-03-15 Sat>
6017 :PROPERTIES:
6018 copy-all
6019 :CUSTOM_ID: db4b76df-9420-4256-8242-dc44b56d55d7
6020 :ID: f6b2b504-b88d-418b-b6b0-5e0e582bd205
6021 :DRILL_LAST_INTERVAL: 24.4352
6022 :DRILL_REPEATS_SINCE_FAIL: 4
6023 :DRILL_TOTAL_REPEATS: 4
6024 :DRILL_FAILURE_COUNT: 0
6025 :DRILL_AVERAGE_QUALITY: 3.75
6026 :DRILL_EASE: 2.929
6027 :DRILL_LAST_QUALITY: 4
6028 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:39>
6029 :END:
6030 copy buffer
6031 [
6032 #+begin_src emacs-lisp
6033 (defun copy-all ()
6034 "Copy entire buffer to clipboard"
6035 (interactive)
6036 (clipboard-kill-ring-save (point-min) (point-max)))
6037 (global-set-key (kbd "C-a") 'copy-all)
6038 #+end_src
6039 ]
6040 *** [M-a] :drill:
6041 SCHEDULED: <2014-03-27 Thu>
6042 :PROPERTIES:
6043 kmacro-start-macro-or-in...
6044 :ID: 4019514b-abb1-464e-b4c9-d9ca39af2a82
6045 :CUSTOM_ID: e865a1e5-55bf-4a98-a0d0-cb05a88de352
6046 :DRILL_LAST_INTERVAL: 50.6823
6047 :DRILL_REPEATS_SINCE_FAIL: 3
6048 :DRILL_TOTAL_REPEATS: 3
6049 :DRILL_FAILURE_COUNT: 0
6050 :DRILL_AVERAGE_QUALITY: 5.0
6051 :DRILL_EASE: 5.815
6052 :DRILL_LAST_QUALITY: 5
6053 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
6054 :END:
6055 macro record
6056 [
6057 #+begin_src emacs-lisp
6058 (global-set-key (kbd "M-a") 'kmacro-start-macro-or-insert-counter)
6059
6060 #+end_src
6061 ]
6062 *** [C-M-a] :drill:
6063 SCHEDULED: <2014-03-27 Thu>
6064 :PROPERTIES:
6065 kmacro-end-or-call-macro
6066 :ID: 10cdc522-2bea-4601-acf9-ec81a52a34d8
6067 :CUSTOM_ID: c6278a5a-024f-4c80-a8d4-65f127fd24a8
6068 :DRILL_LAST_INTERVAL: 50.6823
6069 :DRILL_REPEATS_SINCE_FAIL: 3
6070 :DRILL_TOTAL_REPEATS: 3
6071 :DRILL_FAILURE_COUNT: 0
6072 :DRILL_AVERAGE_QUALITY: 5.0
6073 :DRILL_EASE: 5.815
6074 :DRILL_LAST_QUALITY: 5
6075 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:35>
6076 :END:
6077 macro end / call
6078 [
6079 #+begin_src emacs-lisp
6080 (global-set-key (kbd "C-M-a") 'kmacro-end-or-call-macro)
6081 (add-hook 'perl-mode-hook (lambda () (define-key perl-mode-map (kbd "C-M-a") nil)))
6082 (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-M-a") nil)))
6083 (add-hook 'c-mode-hook
6084 (lambda () (define-key c-mode-map (kbd "C-M-a") nil)))
6085
6086 #+end_src
6087 ]
6088 *** C-S-a
6089 :PROPERTIES:
6090 :CUSTOM_ID: 649a3fe7-3932-475a-b23c-28db9874de27
6091 :END:
6092 *** C-s
6093 :PROPERTIES:
6094 C-x prefix
6095 :ID: e05a67d7-f7ee-4b23-afb1-0053d5eefb4c
6096 :CUSTOM_ID: 01da04da-cdba-493f-892b-c4c064cf937e
6097 :END:
6098 c-x prefix
6099
6100 *** M-s
6101 :PROPERTIES:
6102 :CUSTOM_ID: 5e4bf939-90a1-4ace-a7bf-add95c8596d2
6103 :END:
6104 *** [C-M-s] :drill:
6105 SCHEDULED: <2014-03-18 Tue>
6106 :PROPERTIES:
6107 split-window-vertically
6108 :ID: 18a271e1-c1d2-45e6-aed3-6b81b4b6ea71
6109 :CUSTOM_ID: 4b33022d-27f0-4d21-9931-2e2e692790e8
6110 :DRILL_LAST_INTERVAL: 26.5334
6111 :DRILL_REPEATS_SINCE_FAIL: 4
6112 :DRILL_TOTAL_REPEATS: 4
6113 :DRILL_FAILURE_COUNT: 0
6114 :DRILL_AVERAGE_QUALITY: 3.75
6115 :DRILL_EASE: 2.929
6116 :DRILL_LAST_QUALITY: 3
6117 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:46>
6118 :END:
6119 split-window-vertically
6120 [
6121 #+begin_src emacs-lisp
6122 (global-set-key (kbd "C-M-s") 'split-window-vertically)
6123 #+end_src
6124 ]
6125 *** C-S-s
6126 :PROPERTIES:
6127 :CUSTOM_ID: 901a2445-200c-42f2-91c6-4309d71b39dd
6128 :END:
6129 *** C-d
6130 :PROPERTIES:
6131 :CUSTOM_ID: b699614a-9994-4fe7-b2c6-f0fe81b7ad2b
6132 :END:
6133 C-c prefix
6134 *** [M-d] :drill:
6135 SCHEDULED: <2014-04-05 Sat>
6136 :PROPERTIES:
6137 whitespace-cleanup
6138 :ID: 58f5421a-9df0-44cd-acb9-d018ccdba58c
6139 :CUSTOM_ID: 06bcc5e2-f3a7-41c6-a793-ac6c9813fb6e
6140 :DRILL_LAST_INTERVAL: 27.3693
6141 :DRILL_REPEATS_SINCE_FAIL: 5
6142 :DRILL_TOTAL_REPEATS: 6
6143 :DRILL_FAILURE_COUNT: 2
6144 :DRILL_AVERAGE_QUALITY: 3.417
6145 :DRILL_EASE: 2.676
6146 :DRILL_LAST_QUALITY: 4
6147 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
6148 :END:
6149 whitespace-cleanup
6150 [
6151 #+begin_src emacs-lisp
6152 (global-set-key (kbd "M-d") 'whitespace-cleanup)
6153 #+end_src
6154 ]
6155 *** [C-M-d] :drill:
6156 SCHEDULED: <2014-03-19 Wed>
6157 :PROPERTIES:
6158 swap buffer
6159 :CUSTOM_ID: 8cf6053d-792b-4abd-a3a6-66efd7fbee68
6160 :ID: 747aabec-b164-4813-93c8-92d5c8778635
6161 :DRILL_LAST_INTERVAL: 9.5325
6162 :DRILL_REPEATS_SINCE_FAIL: 4
6163 :DRILL_TOTAL_REPEATS: 10
6164 :DRILL_FAILURE_COUNT: 8
6165 :DRILL_AVERAGE_QUALITY: 2.636
6166 :DRILL_EASE: 2.284
6167 :DRILL_LAST_QUALITY: 3
6168 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:35>
6169 :END:
6170 swap buffer across windows
6171 [
6172 from http://www.emacswiki.org/emacs/TransposeWindows
6173 #+begin_src emacs-lisp
6174 (setq swapping-buffer nil)
6175 (setq swapping-window nil)
6176 (defun swap-buffers-in-windows ()
6177 "Swap buffers between two windows"
6178 (interactive)
6179 (if (and swapping-window
6180 swapping-buffer)
6181 (let ((this-buffer (current-buffer))
6182 (this-window (selected-window)))
6183 (if (and (window-live-p swapping-window)
6184 (buffer-live-p swapping-buffer))
6185 (progn (switch-to-buffer swapping-buffer)
6186 (select-window swapping-window)
6187 (switch-to-buffer this-buffer)
6188 (select-window this-window)
6189 (message "Swapped buffers."))
6190 (message "Old buffer/window killed. Aborting."))
6191 (setq swapping-buffer nil)
6192 (setq swapping-window nil))
6193 (progn
6194 (setq swapping-buffer (current-buffer))
6195 (setq swapping-window (selected-window))
6196 (message "Buffer and window marked for swapping."))))
6197
6198 (global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)
6199 #+end_src
6200 ]
6201 *** C-S-d
6202 :PROPERTIES:
6203 :CUSTOM_ID: d3166178-3d87-4caa-a937-9797fc2b6a39
6204 :END:
6205 *** [C-f]
6206 :PROPERTIES:
6207 :CUSTOM_ID: 2695ed8a-e0d3-4e84-8688-98e3c50723b0
6208 :END:
6209 kill-whole-line
6210 [
6211 #+begin_src emacs-lisp
6212 (global-set-key (kbd "C-f") 'kill-whole-line-wrapper)
6213 (defun kill-whole-line-wrapper (&optional arg)
6214 "If we are at the end of the file, kill backwards instead of doing nothing."
6215 (interactive "P")
6216 (if (= (point) (point-max))
6217 (kill-whole-line -1)
6218 (kill-whole-line arg)))
6219 #+end_src
6220 ]
6221 *** M-f
6222 :PROPERTIES:
6223 :CUSTOM_ID: 869f0aec-c739-4fb7-8e3a-8b55ab637765
6224 :END:
6225 *** [C-M-f]
6226 :PROPERTIES:
6227 :CUSTOM_ID: e7e4dd0b-418f-48ee-b366-9e733e3bec61
6228 :END:
6229 kill rest of line
6230 [
6231 #+begin_src emacs-lisp
6232
6233 (add-hook 'org-mode-hook
6234 (lambda ()
6235 (define-key org-mode-map (kbd "C-M-f") 'org-kill-line)))
6236
6237 (global-set-key (kbd "C-M-f") 'kill-line)
6238 #+end_src
6239 ]
6240 *** C-S-f
6241 :PROPERTIES:
6242 :CUSTOM_ID: a59eb2ca-9439-4836-81f9-384bc8c07739
6243 :END:
6244 *** [C-g]
6245 SCHEDULED: <2014-01-13 Mon>
6246 :PROPERTIES:
6247 other-window / cancel
6248 :ID: a4e9c495-02c1-432e-beba-12a9d4d61e8a
6249 :CUSTOM_ID: 4af40595-7010-4be6-8cfe-a43797ca6e33
6250 :DRILL_LAST_INTERVAL: 2.4849
6251 :DRILL_REPEATS_SINCE_FAIL: 1
6252 :DRILL_TOTAL_REPEATS: 1
6253 :DRILL_FAILURE_COUNT: 0
6254 :DRILL_AVERAGE_QUALITY: 5.0
6255 :DRILL_EASE: 5.815
6256 :DRILL_LAST_QUALITY: 5
6257 :DRILL_LAST_REVIEWED: <2014-01-11 Sat 01:41>
6258 :END:
6259 cancel / other window
6260 [
6261 #+begin_src emacs-lisp
6262 (global-set-key (kbd "C-g") 'other-window)
6263 #+end_src
6264 ]
6265 *** [M-g] :drill:
6266 SCHEDULED: <2014-03-13 Thu>
6267 :PROPERTIES:
6268 abort-recursive-edit
6269 :ID: 1e8e0c57-2885-4c0c-9b94-3ec0c02b706e
6270 :CUSTOM_ID: fb0b343f-fdff-463a-94f4-3152191e17c4
6271 :DRILL_LAST_INTERVAL: 22.1939
6272 :DRILL_REPEATS_SINCE_FAIL: 4
6273 :DRILL_TOTAL_REPEATS: 4
6274 :DRILL_FAILURE_COUNT: 0
6275 :DRILL_AVERAGE_QUALITY: 3.5
6276 :DRILL_EASE: 2.73
6277 :DRILL_LAST_QUALITY: 4
6278 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:33>
6279 :END:
6280 abort-recursive-edit
6281 [
6282 #+begin_src emacs-lisp
6283 (global-set-key (kbd "M-g") 'abort-recursive-edit)
6284 #+end_src
6285 ]
6286 *** [C-M-g]
6287 :PROPERTIES:
6288 :CUSTOM_ID: 327e18af-30b7-47e5-aa53-5f678788b4c1
6289 :END:
6290 gnus
6291 [
6292 #+begin_src emacs-lisp
6293 (global-set-key (kbd "C-M-g") 'gnus)
6294 #+end_src
6295 ]
6296 *** C-S-g
6297 :PROPERTIES:
6298 :CUSTOM_ID: 1d4edc55-7b30-4648-b869-b82f8f1d7b1a
6299 :END:
6300 *** C-z
6301 :PROPERTIES:
6302 undo-tree-undo
6303 :ID: 42d7f2bf-3ba3-488b-b501-bd4680dbb8de
6304 :CUSTOM_ID: 707c4938-a790-4da9-8230-61855ea57d09
6305 :END:
6306 [
6307 #+begin_src emacs-lisp
6308 (global-set-key (kbd "C-z") 'undo-tree-undo)
6309 #+end_src
6310 ]
6311 *** M-z
6312 :PROPERTIES:
6313 :CUSTOM_ID: a01c110e-9970-4571-84ab-379eecc7dd31
6314 :END:
6315 *** [C-M-z]
6316 *** C-S-z
6317 :PROPERTIES:
6318 :CUSTOM_ID: 3d56370d-11cd-4026-8e6b-3ae9b7b51714
6319 :END:
6320 *** C-x
6321 :PROPERTIES:
6322 :CUSTOM_ID: ec1403d3-528e-41b1-a195-5563bc93e124
6323 :END:
6324 kill-region
6325 #+begin_src emacs-lisp
6326 (global-set-key (kbd "C-s") 'kill-region)
6327 #+end_src
6328 *** [M-x] :drill:
6329 SCHEDULED: <2014-03-31 Mon>
6330 :PROPERTIES:
6331 :CUSTOM_ID: bb7c95d5-dd97-439d-bf1f-cdac98d11543
6332 :ID: 909cf249-c2f2-4251-bf18-c990ca9c6ff9
6333 :DRILL_LAST_INTERVAL: 21.5453
6334 :DRILL_REPEATS_SINCE_FAIL: 4
6335 :DRILL_TOTAL_REPEATS: 4
6336 :DRILL_FAILURE_COUNT: 0
6337 :DRILL_AVERAGE_QUALITY: 3.25
6338 :DRILL_EASE: 2.58
6339 :DRILL_LAST_QUALITY: 3
6340 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:33>
6341 :END:
6342 append-next-kill
6343 [
6344 #+begin_src emacs-lisp
6345 (global-set-key (kbd "M-x") 'append-next-kill)
6346 #+end_src
6347 ]
6348 *** [C-M-x] :drill:
6349 SCHEDULED: <2014-03-17 Mon>
6350 :PROPERTIES:
6351 append-next-kill
6352 :ID: b2b60fb4-95a3-4311-8ccd-7132f03ac9a8
6353 :CUSTOM_ID: c988370e-602c-431c-80a9-608459583f8b
6354 :DRILL_LAST_INTERVAL: 26.0772
6355 :DRILL_REPEATS_SINCE_FAIL: 4
6356 :DRILL_TOTAL_REPEATS: 4
6357 :DRILL_FAILURE_COUNT: 1
6358 :DRILL_AVERAGE_QUALITY: 3.5
6359 :DRILL_EASE: 2.73
6360 :DRILL_LAST_QUALITY: 3
6361 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:49>
6362 :END:
6363 cut-to-register
6364 [
6365 #+begin_src emacs-lisp
6366 ;; same args as copy-to-register
6367 (defun cut-to-register (register start end &optional delete-flag region)
6368 (interactive (list (register-read-with-preview "Cut to register: ")
6369 (region-beginning)
6370 (region-end)
6371 current-prefix-arg
6372 t))
6373 (copy-to-register register start end t region))
6374
6375 (global-set-key (kbd "C-M-x") 'cut-to-register)
6376 #+end_src
6377 ]
6378 *** C-S-x
6379 :PROPERTIES:
6380 :CUSTOM_ID: 0ce7383c-0776-407e-9ac5-981d1476f541
6381 :END:
6382 *** C-c
6383 :PROPERTIES:
6384 :ID: 5416e482-6f36-4d35-84c3-49bb184a53e9
6385 :CUSTOM_ID: 400f06e1-8e45-443c-8d7b-3d1bb1176aab
6386 :END:
6387 copy
6388 #+begin_src emacs-lisp
6389 (global-set-key (kbd "C-d") 'kill-ring-save)
6390 (add-hook 'c-mode-hook
6391 (lambda () (define-key c-mode-map (kbd "C-d") nil)))
6392 (add-hook 'comint-mode-hook
6393 (lambda ()
6394 (define-key comint-mode-map (kbd "C-d") nil)))
6395 ;; the base map is shared by many c-modes, like java
6396 (add-hook 'c-mode-hook
6397 (lambda ()
6398 (define-key c-mode-base-map "\C-d" nil)
6399 (define-key c-mode-base-map (kbd "<deletechar>") 'c-electric-delete-forward)))
6400
6401 #+end_src
6402 *** [M-c] :drill:
6403 SCHEDULED: <2014-03-24 Mon>
6404 :PROPERTIES:
6405 org-capture
6406 :ID: bf1cb358-ec72-425d-aebb-0c1f0ece7717
6407 :CUSTOM_ID: f4c3317a-a317-4d04-8cb7-e46d0716bf1d
6408 :DRILL_LAST_INTERVAL: 32.7466
6409 :DRILL_REPEATS_SINCE_FAIL: 4
6410 :DRILL_TOTAL_REPEATS: 4
6411 :DRILL_FAILURE_COUNT: 0
6412 :DRILL_AVERAGE_QUALITY: 4.0
6413 :DRILL_EASE: 3.204
6414 :DRILL_LAST_QUALITY: 4
6415 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:53>
6416 :END:
6417 org-capture
6418 [
6419 #+begin_src emacs-lisp
6420 (define-key global-map "\M-c" 'org-capture)
6421 #+end_src
6422 ]
6423 *** [C-M-c] :drill:
6424 SCHEDULED: <2014-03-24 Mon>
6425 :PROPERTIES:
6426 copy-to-register
6427 :ID: 956fd2ec-ad26-4842-b56c-f2165648c461
6428 :CUSTOM_ID: 0a151d99-47ae-4e8f-8407-82e77d24a3e7
6429 :DRILL_LAST_INTERVAL: 32.7466
6430 :DRILL_REPEATS_SINCE_FAIL: 4
6431 :DRILL_TOTAL_REPEATS: 4
6432 :DRILL_FAILURE_COUNT: 0
6433 :DRILL_AVERAGE_QUALITY: 4.0
6434 :DRILL_EASE: 3.204
6435 :DRILL_LAST_QUALITY: 4
6436 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:51>
6437 :END:
6438 copy-to-register
6439 [
6440 #+begin_src emacs-lisp
6441 (global-set-key (kbd "C-M-c") 'copy-to-register)
6442 #+end_src
6443 ]
6444 *** C-S-c
6445 :PROPERTIES:
6446 :CUSTOM_ID: b78d717f-cfb3-477a-b951-63f523635f5c
6447 :END:
6448 *** C-v
6449 :PROPERTIES:
6450 :CUSTOM_ID: 16411f68-7fe0-49e8-9a73-212471594f9e
6451 :END:
6452 yank
6453 #+begin_src emacs-lisp
6454 (global-set-key (kbd "C-v") 'yank-better)
6455
6456
6457
6458 (defun yank-better (arg)
6459 "Paste, linewise if our kill ends with a newline.
6460 I change the behavior of plain prefix. It makes it not do linewise paste,
6461 because sometimes you want to yank pop and a linewise paste screws that up.
6462 c-u with no number normally makes the point go before the yank.
6463 That is pointless for me, as it would be just as easier and less
6464 thought to pop the mark after yanking cuz it is set to before the mark."
6465 (interactive "*P")
6466 (if (and (not (equal arg '(4))) (string-suffix-p "\n" (current-kill 0 t)))
6467 (beginning-of-line))
6468 (if (and (stringp mode-name) (string= mode-name "Org"))
6469 (call-interactively 'org-yank)
6470 (setq this-command 'yank)
6471 (call-interactively 'yank (and (not (equal arg '(4)))))))
6472
6473 (put 'yank-better 'delete-selection 'yank)
6474 #+end_src
6475 *** [M-v] :drill:
6476 SCHEDULED: <2014-03-11 Tue>
6477 :PROPERTIES:
6478 insert-register
6479 :ID: 7e21df8d-fdf7-47ed-8648-f9d182445145
6480 :CUSTOM_ID: d67f6371-a13f-4a75-8d8c-e4013ff4e131
6481 :DRILL_LAST_INTERVAL: 2.2172
6482 :DRILL_REPEATS_SINCE_FAIL: 1
6483 :DRILL_TOTAL_REPEATS: 5
6484 :DRILL_FAILURE_COUNT: 2
6485 :DRILL_AVERAGE_QUALITY: 2.84
6486 :DRILL_EASE: 2.381
6487 :DRILL_LAST_QUALITY: 3
6488 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:38>
6489 :END:
6490 insert-register
6491 [
6492 #+begin_src emacs-lisp
6493 (global-set-key (kbd "M-v") 'insert-register)
6494 #+end_src
6495 ]
6496 *** [C-M-v] :drill:
6497 SCHEDULED: <2014-05-13 Tue>
6498 :PROPERTIES:
6499 yank pop
6500 :ID: e05d9d8f-1387-44b3-b348-a45cf6083bd2
6501 :CUSTOM_ID: 25f86658-9999-40f7-b3a4-615981751b93
6502 :DRILL_LAST_INTERVAL: 71.5839
6503 :DRILL_REPEATS_SINCE_FAIL: 4
6504 :DRILL_TOTAL_REPEATS: 4
6505 :DRILL_FAILURE_COUNT: 0
6506 :DRILL_AVERAGE_QUALITY: 4.75
6507 :DRILL_EASE: 4.85
6508 :DRILL_LAST_QUALITY: 5
6509 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
6510 :END:
6511 yank-pop
6512 [
6513 #+begin_src emacs-lisp
6514 (global-set-key (kbd "C-M-v") 'yank-pop)
6515 #+end_src
6516 ]
6517 *** C-S-v
6518 :PROPERTIES:
6519 :CUSTOM_ID: 6732ed10-a473-445d-b14a-5f4c17c6a3ef
6520 :END:
6521 *** [C-b] :drill:
6522 SCHEDULED: <2014-03-27 Thu>
6523 :PROPERTIES:
6524 delete-other-windows
6525 :ID: c9309da7-6801-4d94-a21e-140f4b258c28
6526 :CUSTOM_ID: e682305e-0110-4d2f-afbd-2c401bcb9313
6527 :DRILL_LAST_INTERVAL: 50.6823
6528 :DRILL_REPEATS_SINCE_FAIL: 3
6529 :DRILL_TOTAL_REPEATS: 3
6530 :DRILL_FAILURE_COUNT: 0
6531 :DRILL_AVERAGE_QUALITY: 5.0
6532 :DRILL_EASE: 5.815
6533 :DRILL_LAST_QUALITY: 5
6534 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:34>
6535 :END:
6536 delete-other-windows
6537 [
6538 #+begin_src emacs-lisp
6539 (global-set-key (kbd "C-b") 'delete-other-windows)
6540 #+end_src
6541 ]
6542 *** [M-b] :drill:
6543 SCHEDULED: <2014-04-07 Mon>
6544 :PROPERTIES:
6545 isearch-backward-current-symbol
6546 :CUSTOM_ID: 05e3d0db-36dc-455f-8bed-f87886ca6004
6547 :ID: 0272efdb-eb85-485c-b24f-410ceabeb330
6548 :DRILL_LAST_INTERVAL: 28.6736
6549 :DRILL_REPEATS_SINCE_FAIL: 5
6550 :DRILL_TOTAL_REPEATS: 5
6551 :DRILL_FAILURE_COUNT: 1
6552 :DRILL_AVERAGE_QUALITY: 3.4
6553 :DRILL_EASE: 2.666
6554 :DRILL_LAST_QUALITY: 4
6555 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
6556 :END:
6557 isearch-backward-current-symbol
6558 [
6559 #+begin_src emacs-lisp
6560 (global-set-key (kbd "M-b") 'isearch-backward-current-symbol)
6561 #+end_src
6562 ]
6563 *** [C-M-b] :drill:
6564 SCHEDULED: <2014-04-04 Fri>
6565 :PROPERTIES:
6566 isearch-current-symbol
6567 :ID: 235b96a8-e724-419d-8d07-8d0a021213eb
6568 :CUSTOM_ID: 6c63790c-28c1-4b73-96e2-ee859f57e734
6569 :DRILL_LAST_INTERVAL: 40.0706
6570 :DRILL_REPEATS_SINCE_FAIL: 4
6571 :DRILL_TOTAL_REPEATS: 4
6572 :DRILL_FAILURE_COUNT: 0
6573 :DRILL_AVERAGE_QUALITY: 3.75
6574 :DRILL_EASE: 2.929
6575 :DRILL_LAST_QUALITY: 3
6576 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 02:26>
6577 :END:
6578 isearch-current-symbol
6579 [
6580 #+begin_src emacs-lisp
6581 (global-set-key (kbd "C-M-b") 'isearch-current-symbol)
6582 #+end_src
6583 ]
6584 *** C-S-b
6585 :PROPERTIES:
6586 :CUSTOM_ID: a220d7e0-12df-4d37-a57a-266785e7f3c5
6587 :END:
6588 *** [C-tab] :drill:
6589 SCHEDULED: <2014-03-27 Thu>
6590 :PROPERTIES:
6591 yas-insert-snippet
6592 :CUSTOM_ID: edc45592-c69f-4439-8305-48f2c65696c3
6593 :ID: 92eac3e1-0675-4746-a130-7539f9bc213a
6594 :DRILL_LAST_INTERVAL: 50.6823
6595 :DRILL_REPEATS_SINCE_FAIL: 3
6596 :DRILL_TOTAL_REPEATS: 3
6597 :DRILL_FAILURE_COUNT: 0
6598 :DRILL_AVERAGE_QUALITY: 5.0
6599 :DRILL_EASE: 5.815
6600 :DRILL_LAST_QUALITY: 5
6601 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:42>
6602 :END:
6603 ---
6604 [
6605 in terminal, it's just TAB, duplicate keybind.
6606 ]
6607 *** [M-tab] :drill:
6608 SCHEDULED: <2014-03-14 Fri>
6609 :PROPERTIES:
6610 indent line
6611 :ID: 35b77d8a-9e69-4f8e-a2ac-c78fcf6dc1f5
6612 :CUSTOM_ID: 71264957-45fd-455a-a6d1-b08823c02d25
6613 :DRILL_LAST_INTERVAL: 23.0811
6614 :DRILL_REPEATS_SINCE_FAIL: 4
6615 :DRILL_TOTAL_REPEATS: 4
6616 :DRILL_FAILURE_COUNT: 1
6617 :DRILL_AVERAGE_QUALITY: 3.75
6618 :DRILL_EASE: 2.929
6619 :DRILL_LAST_QUALITY: 4
6620 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:35>
6621 :END:
6622 ---
6623 [
6624 in terminal it's duplicated of C-M-i
6625 ]
6626 *** C-M-tab
6627 :PROPERTIES:
6628 :CUSTOM_ID: 33b76824-317c-4657-8a5b-2b126b8f7fc9
6629 :END:
6630 *** C-S-tab
6631 :PROPERTIES:
6632 :CUSTOM_ID: 89d1aeca-47ed-4e4a-89d2-ff70c06e08c8
6633 :END:
6634 *** [C-delete] :drill:
6635 SCHEDULED: <2014-05-13 Tue>
6636 :PROPERTIES:
6637 kill-symbol
6638 :ID: bb7ae41f-8fab-42ee-9338-33dd22d7f173
6639 :CUSTOM_ID: 2688b61d-9fdd-44af-b9bd-b126f0da00bd
6640 :DRILL_LAST_INTERVAL: 71.5839
6641 :DRILL_REPEATS_SINCE_FAIL: 4
6642 :DRILL_TOTAL_REPEATS: 4
6643 :DRILL_FAILURE_COUNT: 0
6644 :DRILL_AVERAGE_QUALITY: 4.75
6645 :DRILL_EASE: 4.85
6646 :DRILL_LAST_QUALITY: 5
6647 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:12>
6648 :END:
6649 kill-symbol
6650 [
6651 #+begin_src emacs-lisp
6652 (global-set-key (kbd "<C-delete>") 'kill-symbol)
6653 (defun kill-symbol (arg)
6654 (interactive "p")
6655 (kill-region (point) (save-excursion (forward-symbol arg) (point))))
6656
6657 #+end_src
6658 ]
6659 *** M-delete
6660 :PROPERTIES:
6661 :CUSTOM_ID: 60747222-b0e5-4983-9bed-e6d44f65483a
6662 :END:
6663 *** [C-M-delete] :drill:
6664 SCHEDULED: <2014-03-24 Mon>
6665 :PROPERTIES:
6666 kill-sexp
6667 kill-sexp
6668 :CUSTOM_ID: 21876759-a8e6-4896-8a08-eda40d0eaff3
6669 :ID: 7f2797e1-dd39-4d0a-8b87-264e2757543b
6670 :DRILL_LAST_INTERVAL: 28.5089
6671 :DRILL_REPEATS_SINCE_FAIL: 5
6672 :DRILL_TOTAL_REPEATS: 5
6673 :DRILL_FAILURE_COUNT: 2
6674 :DRILL_AVERAGE_QUALITY: 3.6
6675 :DRILL_EASE: 2.802
6676 :DRILL_LAST_QUALITY: 4
6677 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 02:27>
6678 :END:
6679 kill-sexp
6680 [
6681 #+begin_src emacs-lisp
6682 (global-set-key (kbd "<C-M-delete>") 'kill-sexp)
6683 #+end_src
6684 ]
6685 *** C-S-delete
6686 :PROPERTIES:
6687 :CUSTOM_ID: 696e9e0f-f717-44cd-90e7-a73d76a58162
6688 :END:
6689
6690 *** [C-left-arrow] :drill:
6691 SCHEDULED: <2014-03-15 Sat>
6692 :PROPERTIES:
6693 compile
6694 :ID: fbc09f29-fb89-479f-b509-255352e4e9d1
6695 :CUSTOM_ID: b15da91f-0786-49d1-b0b9-331b3b94f6ae
6696 :DRILL_LAST_INTERVAL: 24.2738
6697 :DRILL_REPEATS_SINCE_FAIL: 4
6698 :DRILL_TOTAL_REPEATS: 4
6699 :DRILL_FAILURE_COUNT: 1
6700 :DRILL_AVERAGE_QUALITY: 4.0
6701 :DRILL_EASE: 3.204
6702 :DRILL_LAST_QUALITY: 5
6703 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:24>
6704 :END:
6705 compile / comint search
6706 [
6707 #+begin_src emacs-lisp
6708 (defun set-p (var)
6709 (and (bound-and-true-p var)
6710 (not (eq var 'unset))))
6711 (global-set-key (kbd "C-(") 'run)
6712
6713 ;; make compile work from the gtags root dir
6714 (defadvice compile (before pre-compile-advice activate)
6715 (basic-save-buffer)
6716 (when (set-p ggtags-project-root)
6717 (setq-local compile-saved-dir default-directory)
6718 (setq default-directory ggtags-project-root)))
6719 (defadvice compile (after post-compile-advice activate)
6720 (when (bound-and-true-p compile-saved-dir)
6721 (setq default-directory compile-saved-dir)))
6722
6723
6724 (add-hook 'c-mode-hook (lambda () (define-key c-mode-map (kbd "C-(") 'compile)))
6725 (add-hook 'comint-mode-hook
6726 (lambda ()
6727 (define-key isearch-mode-map (kbd "C-(") 'isearch-repeat-backward)
6728 (define-key comint-mode-map (kbd "C-(") 'isearch-backward)))
6729
6730 #+end_src
6731 ]
6732 *** M-left-arrow
6733 :PROPERTIES:
6734 :CUSTOM_ID: 73085b60-95f3-44bf-af71-70d6a7f9b9c6
6735 :END:
6736 *** [C-M-left-arrow] :drill:
6737 SCHEDULED: <2014-03-10 Mon>
6738 :PROPERTIES:
6739 org-shiftup
6740 :CUSTOM_ID: 13faf5d4-34be-4363-948d-4ff04a9f570b
6741 :ID: 39390478-6d33-460e-ab47-0dc6ac4c5249
6742 :DRILL_LAST_INTERVAL: 7.6079
6743 :DRILL_REPEATS_SINCE_FAIL: 3
6744 :DRILL_TOTAL_REPEATS: 7
6745 :DRILL_FAILURE_COUNT: 6
6746 :DRILL_AVERAGE_QUALITY: 2.886
6747 :DRILL_EASE: 2.402
6748 :DRILL_LAST_QUALITY: 3
6749 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:01>
6750 :END:
6751 org-shiftup
6752 [
6753 #+begin_src emacs-lisp
6754 (add-hook 'org-mode-hook
6755 (lambda () (define-key org-mode-map (kbd "C-M-(") 'org-shiftup)))
6756 #+end_src
6757 ]
6758 *** C-S-left-arrow
6759 :PROPERTIES:
6760 :CUSTOM_ID: 4e3a7ead-efb5-46d8-9465-1867d47e5ec2
6761 :END:
6762 *** [C-right-arrow] :drill:
6763 SCHEDULED: <2014-05-13 Tue>
6764 :PROPERTIES:
6765 paste selection
6766 :CUSTOM_ID: 3f3cac16-097d-451a-a14a-da7717d06730
6767 :ID: 1b0ac338-d87b-4a37-b192-bc4305a337cc
6768 :DRILL_LAST_INTERVAL: 71.5839
6769 :DRILL_REPEATS_SINCE_FAIL: 4
6770 :DRILL_TOTAL_REPEATS: 4
6771 :DRILL_FAILURE_COUNT: 0
6772 :DRILL_AVERAGE_QUALITY: 4.75
6773 :DRILL_EASE: 4.85
6774 :DRILL_LAST_QUALITY: 5
6775 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:11>
6776 :END:
6777 keyboard-yank-primary
6778 [
6779 #+begin_src emacs-lisp
6780 (defun keyboard-yank-primary ()
6781 (interactive)
6782 (let ((mouse-yank-at-point t))
6783 (mouse-yank-primary nil)))
6784 ;; paste selection
6785 (global-set-key (kbd "C-)") 'keyboard-yank-primary)
6786 #+end_src
6787 ]
6788 *** M-right-arrow
6789 :PROPERTIES:
6790 :CUSTOM_ID: 97a4513f-6837-47c5-9e2b-354542d67d29
6791 :END:
6792 *** C-M-right-arrow
6793 :PROPERTIES:
6794 org-shiftdown
6795 :CUSTOM_ID: 34e66314-1d97-4eeb-b704-fe0733849ae4
6796 :END:
6797 [
6798 #+begin_src emacs-lisp
6799 (add-hook 'org-mode-hook
6800 (lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
6801 #+end_src
6802 ]
6803 *** C-S-right-arrow
6804 :PROPERTIES:
6805 :CUSTOM_ID: f441e351-ccd7-4ac1-9a4d-a0a1dd17b73e
6806 :END:
6807 *** [C-backspace] :drill:
6808 SCHEDULED: <2014-05-13 Tue>
6809 :PROPERTIES:
6810 backward-kill-symbol
6811 :CUSTOM_ID: 85bb4701-42e6-4617-8de8-dfb1f03b0358
6812 :ID: 9c0e1f0a-7b45-4670-86a2-9df945142cbe
6813 :DRILL_LAST_INTERVAL: 71.5839
6814 :DRILL_REPEATS_SINCE_FAIL: 4
6815 :DRILL_TOTAL_REPEATS: 4
6816 :DRILL_FAILURE_COUNT: 0
6817 :DRILL_AVERAGE_QUALITY: 4.75
6818 :DRILL_EASE: 4.85
6819 :DRILL_LAST_QUALITY: 5
6820 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:12>
6821 :END:
6822 backward-kill-symbol
6823 [
6824 #+begin_src emacs-lisp
6825 (global-set-key (kbd "<C-backspace>") 'backward-kill-symbol)
6826 (add-hook 'comint-mode-hook
6827 (lambda ()
6828 (define-key comint-mode-map (kbd "<C-backspace>") 'backward-kill-word)))
6829 (defun backward-kill-symbol (arg)
6830 (interactive "p")
6831 (kill-region (point) (save-excursion (backward-symbol arg) (point))))
6832 #+end_src
6833 ]
6834 *** M-backspace
6835 :PROPERTIES:
6836 :CUSTOM_ID: d4b3e996-208a-4b6d-a747-076e56bd7da3
6837 :END:
6838 *** [C-M-backspace] :drill:
6839 SCHEDULED: <2014-03-18 Tue>
6840 :PROPERTIES:
6841 :ID: 1030c81d-2cc2-42ba-8aa5-fe98271a00f2
6842 :DRILL_LAST_INTERVAL: 26.5334
6843 :DRILL_REPEATS_SINCE_FAIL: 4
6844 :DRILL_TOTAL_REPEATS: 4
6845 :DRILL_FAILURE_COUNT: 0
6846 :DRILL_AVERAGE_QUALITY: 3.75
6847 :DRILL_EASE: 2.929
6848 :DRILL_LAST_QUALITY: 3
6849 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:46>
6850 :CUSTOM_ID: 606b0991-7431-4a8a-a909-b872e104cc88
6851 :END:
6852 backward-kill-sexp
6853 [
6854 #+begin_src emacs-lisp
6855 (global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
6856 #+end_src
6857 ]
6858 *** C-S-backspace
6859 :PROPERTIES:
6860 :CUSTOM_ID: 9c826109-76fd-403e-b15e-ceee5f925f6c
6861 :END:
6862 *** C-f7
6863 :PROPERTIES:
6864 :CUSTOM_ID: 8e4b9a2c-35ff-4300-91ff-65d19d6b2fde
6865 :END:
6866 *** M-f7
6867 :PROPERTIES:
6868 :CUSTOM_ID: 390a5b78-f5fe-41b6-bb36-ea9c81806989
6869 :END:
6870 *** C-M-f7
6871 :PROPERTIES:
6872 :CUSTOM_ID: a8e9d8e4-4f29-4da6-a7b8-3d136a3e1c18
6873 :END:
6874 *** C-S-f7
6875 :PROPERTIES:
6876 :CUSTOM_ID: 60bb5cd8-aeb3-4014-81f2-4cee72e9547c
6877 :END:
6878
6879 ** right primary
6880 *** [C-*] :drill:
6881 SCHEDULED: <2014-03-16 Sun>
6882 :PROPERTIES:
6883 split-window-horizontally
6884 :ID: c9f11b06-583f-48e5-8d0a-56107feb0010
6885 :CUSTOM_ID: f745b337-8b65-44cc-849a-5e0953c9ebd9
6886 :DRILL_LAST_INTERVAL: 13.9711
6887 :DRILL_REPEATS_SINCE_FAIL: 4
6888 :DRILL_TOTAL_REPEATS: 6
6889 :DRILL_FAILURE_COUNT: 3
6890 :DRILL_AVERAGE_QUALITY: 2.982
6891 :DRILL_EASE: 2.447
6892 :DRILL_LAST_QUALITY: 4
6893 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:04>
6894 :END:
6895 split-window-horizontally
6896 [
6897 #+begin_src emacs-lisp
6898 (global-set-key (kbd "C-*") 'split-window-horizontally)
6899 #+end_src
6900 ]
6901 *** M-*
6902 *** [C-M-*] :drill:
6903 SCHEDULED: <2014-03-17 Mon>
6904 :PROPERTIES:
6905 calc-dispatch
6906 :CUSTOM_ID: 5dbe3437-7364-4802-b558-00b2d5faacf6
6907 :ID: 2cffe3fb-a21a-4a49-83f8-65218c7a45a2
6908 :DRILL_LAST_INTERVAL: 15.2345
6909 :DRILL_REPEATS_SINCE_FAIL: 4
6910 :DRILL_TOTAL_REPEATS: 7
6911 :DRILL_FAILURE_COUNT: 2
6912 :DRILL_AVERAGE_QUALITY: 2.893
6913 :DRILL_EASE: 2.405
6914 :DRILL_LAST_QUALITY: 3
6915 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
6916 :END:
6917 calc-dispatch
6918 [
6919 #+begin_src emacs-lisp
6920 (global-set-key (kbd "C-M-*") 'calc-dispatch)
6921 #+end_src
6922 ]
6923 *** C-S-*
6924 :PROPERTIES:
6925 :CUSTOM_ID: 8c414142-8a42-46df-9ab2-898f1be636c8
6926 :END:
6927 *** [C-9] :drill:
6928 SCHEDULED: <2014-03-27 Thu>
6929 :PROPERTIES:
6930 :ID: eda4444e-f1c4-4db7-918d-96789f6a0b2b
6931 :CUSTOM_ID: 43d14154-2722-4ba5-b547-1b78c6274ebf
6932 :DRILL_LAST_INTERVAL: 50.6823
6933 :DRILL_REPEATS_SINCE_FAIL: 3
6934 :DRILL_TOTAL_REPEATS: 3
6935 :DRILL_FAILURE_COUNT: 0
6936 :DRILL_AVERAGE_QUALITY: 5.0
6937 :DRILL_EASE: 5.815
6938 :DRILL_LAST_QUALITY: 5
6939 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:40>
6940 :END:
6941 delete-window-or-exit
6942 [
6943 #+begin_src emacs-lisp
6944 (global-set-key (kbd "C-9") 'delete-window-or-exit)
6945
6946 (defun delete-window-or-exit ()
6947 "Delete window or exit emacs."
6948 (interactive)
6949 (if (condition-case nil (delete-window) (error t))
6950 (if (or (boundp 'server-process) (> (length (frame-list)) 1))
6951 (delete-frame)
6952 (save-buffers-kill-terminal t))))
6953
6954 #+end_src
6955 ]
6956 *** [M-9] :drill:
6957 SCHEDULED: <2014-03-12 Wed>
6958 :PROPERTIES:
6959 kill-buffer-and-window
6960 :CUSTOM_ID: 9dc95338-4321-4354-9de2-69409f383a10
6961 :ID: 24b7dd06-c5cc-4264-954f-d8190d44c1bf
6962 :DRILL_LAST_INTERVAL: 20.7344
6963 :DRILL_REPEATS_SINCE_FAIL: 4
6964 :DRILL_TOTAL_REPEATS: 4
6965 :DRILL_FAILURE_COUNT: 0
6966 :DRILL_AVERAGE_QUALITY: 3.75
6967 :DRILL_EASE: 2.928
6968 :DRILL_LAST_QUALITY: 5
6969 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:33>
6970 :END:
6971 kill-buffer
6972 [
6973 #+begin_src emacs-lisp
6974 (defun kill-buffer-no-ido ()
6975 "kill-buffer, avoid the ido remapping"
6976 (interactive)
6977 (kill-buffer))
6978 (global-set-key (kbd "M-9") 'kill-buffer-no-ido)
6979 #+end_src
6980 ]
6981 strangely, in simple mode, this is overridden.
6982 I found this map to override, but it didn't work, so it seems its being bound some other way.
6983 I did a grep of the emacs sources, but couldn't find anything.
6984 (define-key universal-argument-map [?9] nil)
6985
6986 *** [C-M-9] :drill:
6987 SCHEDULED: <2014-03-17 Mon>
6988 :PROPERTIES:
6989 kill client buffer
6990 :ID: 2046ac28-1c06-410b-bdd9-39eaeada50c0
6991 :CUSTOM_ID: ffe9f636-31e5-48ba-b8fe-7c158ace744c
6992 :DRILL_LAST_INTERVAL: 25.6978
6993 :DRILL_REPEATS_SINCE_FAIL: 4
6994 :DRILL_TOTAL_REPEATS: 4
6995 :DRILL_FAILURE_COUNT: 0
6996 :DRILL_AVERAGE_QUALITY: 4.0
6997 :DRILL_EASE: 3.204
6998 :DRILL_LAST_QUALITY: 5
6999 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:41>
7000 :END:
7001 end server edit
7002 ,save & kill buffer it was opened externally via emacsclient
7003
7004 [
7005 #+begin_src emacs-lisp
7006 (defun server-edit-save ()
7007 (interactive)
7008 (save-buffer)
7009 (server-edit))
7010 (global-set-key (kbd "C-M-9") 'server-edit-save)
7011 #+end_src
7012 ]
7013 *** C-S-9
7014 :PROPERTIES:
7015 :CUSTOM_ID: 56d86cb3-cb86-42d8-9516-d7f2e086d88a
7016 :END:
7017 *** [C-u] :drill:
7018 SCHEDULED: <2014-03-27 Thu>
7019 :PROPERTIES:
7020 :ID: a254c137-8a33-440d-b71e-5fbf9a21e2f5
7021 :CUSTOM_ID: 327992c0-6eba-4935-aec1-49871c2a8619
7022 :DRILL_LAST_INTERVAL: 50.6823
7023 :DRILL_REPEATS_SINCE_FAIL: 3
7024 :DRILL_TOTAL_REPEATS: 3
7025 :DRILL_FAILURE_COUNT: 0
7026 :DRILL_AVERAGE_QUALITY: 5.0
7027 :DRILL_EASE: 5.815
7028 :DRILL_LAST_QUALITY: 5
7029 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:45>
7030 :END:
7031 universal-argument
7032 *** M-u
7033 *** [C-M-u] :drill:
7034 SCHEDULED: <2014-03-27 Thu>
7035 :PROPERTIES:
7036 search-keybind
7037 :ID: a2e31aed-143f-4aa2-841b-857729417993
7038 :CUSTOM_ID: 62735d64-b89a-46b7-b32e-2453b651039d
7039 :DRILL_LAST_INTERVAL: 50.6823
7040 :DRILL_REPEATS_SINCE_FAIL: 3
7041 :DRILL_TOTAL_REPEATS: 3
7042 :DRILL_FAILURE_COUNT: 0
7043 :DRILL_AVERAGE_QUALITY: 5.0
7044 :DRILL_EASE: 5.815
7045 :DRILL_LAST_QUALITY: 5
7046 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:43>
7047 :END:
7048 search-keybind
7049 [
7050 #+begin_src emacs-lisp
7051 (global-set-key (kbd "C-M-u") 'search-keybind)
7052
7053 (defun search-keybind (regexp &optional nlines)
7054 (interactive (occur-read-primary-args))
7055 (save-excursion
7056 (describe-bindings)
7057 (set-buffer "*Help*")
7058 (occur regexp)
7059 (delete-windows-on "*Help*")
7060 ))
7061 #+end_src
7062 ]
7063 *** C-S-u
7064 :PROPERTIES:
7065 :CUSTOM_ID: 7f72dfa0-ba8e-4cd5-b25b-8ff6066464e6
7066 :END:
7067 *** C-i
7068 :PROPERTIES:
7069 :CUSTOM_ID: 3124e200-1d6e-4ad2-9a36-0d03e1e7dc38
7070 :END:
7071 -----
7072 *** M-i
7073 :PROPERTIES:
7074 :CUSTOM_ID: 95ab2045-88bf-4656-b8b1-6cebc87b89e0
7075 :END:
7076 *** [C-M-i] :drill:
7077 SCHEDULED: <2014-03-17 Mon>
7078 :PROPERTIES:
7079 query-replace-regexp
7080 :CUSTOM_ID: a3260b61-7c51-4d97-9a91-3ed702c5ae29
7081 :ID: 93f569b8-4bc8-49e1-a38e-ced3d3198ce8
7082 :DRILL_LAST_INTERVAL: 26.3579
7083 :DRILL_REPEATS_SINCE_FAIL: 4
7084 :DRILL_TOTAL_REPEATS: 4
7085 :DRILL_FAILURE_COUNT: 1
7086 :DRILL_AVERAGE_QUALITY: 4.0
7087 :DRILL_EASE: 3.204
7088 :DRILL_LAST_QUALITY: 4
7089 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:45>
7090 :END:
7091 query-replace-regexp
7092 [
7093 #+begin_src emacs-lisp
7094 (global-set-key (kbd "C-M-i") 'query-replace-regexp)
7095 (add-hook 'flyspell-mode-hook
7096 (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
7097 (add-hook 'text-mode-hook
7098 (lambda () (define-key text-mode-map (kbd "C-M-i") nil)))
7099
7100 #+end_src
7101 ]
7102 *** C-S-i
7103 :PROPERTIES:
7104 :CUSTOM_ID: 076edcc2-040e-4371-9851-4e587766e1fe
7105 :END:
7106 *** [C-o] :drill:
7107 SCHEDULED: <2014-05-13 Tue>
7108 :PROPERTIES:
7109 occur
7110 :ID: a502687a-24b4-4b73-9abc-bc85b89ab235
7111 :CUSTOM_ID: 82215193-63b3-4d63-8f70-d11a328fe72d
7112 :DRILL_LAST_INTERVAL: 71.5839
7113 :DRILL_REPEATS_SINCE_FAIL: 4
7114 :DRILL_TOTAL_REPEATS: 4
7115 :DRILL_FAILURE_COUNT: 0
7116 :DRILL_AVERAGE_QUALITY: 4.75
7117 :DRILL_EASE: 4.85
7118 :DRILL_LAST_QUALITY: 5
7119 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
7120 :END:
7121 occur
7122 [
7123 #+begin_src emacs-lisp
7124 (global-set-key (kbd "C-o") 'occur)
7125 #+end_src
7126 ]
7127 *** M-o
7128 :PROPERTIES:
7129 :CUSTOM_ID: 8c58b99d-b1e4-4270-8d4a-8ae72e2a6470
7130 :END:
7131 *** [C-M-o] :drill:
7132 SCHEDULED: <2014-03-12 Wed>
7133 :PROPERTIES:
7134 ido-goto-symbol
7135 :CUSTOM_ID: 05d1ef50-43ee-46d7-b1ad-dd952543ab45
7136 :ID: 6dfcaa31-d223-4a14-904e-2f2395b2cf75
7137 :DRILL_LAST_INTERVAL: 10.3122
7138 :DRILL_REPEATS_SINCE_FAIL: 4
7139 :DRILL_TOTAL_REPEATS: 9
7140 :DRILL_FAILURE_COUNT: 9
7141 :DRILL_AVERAGE_QUALITY: 2.994
7142 :DRILL_EASE: 2.453
7143 :DRILL_LAST_QUALITY: 4
7144 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
7145 :END:
7146 ido-goto-symbol
7147 [
7148 #+begin_src emacs-lisp
7149 (global-set-key (kbd "C-M-o") 'ido-goto-symbol)
7150 #+end_src
7151 ]
7152 *** C-S-o
7153 :PROPERTIES:
7154 :CUSTOM_ID: 7eacf048-4da8-4b2b-8a51-a4772111e285
7155 :END:
7156 *** [C-p] :drill:
7157 SCHEDULED: <2014-03-15 Sat>
7158 :PROPERTIES:
7159 move-mouse-to-point
7160 :ID: 6b1abcf6-7f95-45c4-a87f-0e86c43c5af1
7161 :CUSTOM_ID: 9c2e2ba9-f34e-48fe-b4ff-b9826882c1cc
7162 :DRILL_LAST_INTERVAL: 23.5247
7163 :DRILL_REPEATS_SINCE_FAIL: 4
7164 :DRILL_TOTAL_REPEATS: 4
7165 :DRILL_FAILURE_COUNT: 0
7166 :DRILL_AVERAGE_QUALITY: 3.5
7167 :DRILL_EASE: 2.73
7168 :DRILL_LAST_QUALITY: 3
7169 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:41>
7170 :END:
7171 move-mouse-to-point
7172 [
7173 #+begin_src emacs-lisp
7174 (global-set-key (kbd "C-p") 'move-mouse-to-point)
7175 #+end_src
7176 ]
7177 *** M-p
7178 *** [C-M-p] :drill:leech:
7179 :PROPERTIES:
7180 delete-horizontal-space
7181 :ID: e2972d5b-28e7-46aa-896f-66d68a6df0de
7182 :CUSTOM_ID: d55616d3-a3f6-4e83-8807-748578a7b726
7183 :DRILL_LAST_INTERVAL: 0.0
7184 :DRILL_REPEATS_SINCE_FAIL: 0
7185 :DRILL_TOTAL_REPEATS: 10
7186 :DRILL_FAILURE_COUNT: 16
7187 :DRILL_AVERAGE_QUALITY: 2.433
7188 :DRILL_EASE: 2.18
7189 :DRILL_LAST_QUALITY: 2
7190 :DRILL_LAST_REVIEWED: <2014-04-14 Mon 11:31>
7191 :END:
7192 delete-horizontal-space
7193 [
7194 #+begin_src emacs-lisp
7195 (global-set-key (kbd "C-M-p") 'delete-horizontal-space)
7196 #+end_src
7197 ]
7198 *** C-S-p
7199 :PROPERTIES:
7200 :CUSTOM_ID: f0cffe8d-d2cb-4f5d-a3f2-fa900e093ef7
7201 :END:
7202 *** [C-j] :drill:
7203 SCHEDULED: <2014-03-15 Sat>
7204 pop-to-mark
7205 [
7206 #+begin_src emacs-lisp
7207 (defun my-pop-to-mark-command ()
7208 "Jump to mark, and pop a new position for mark off the ring.
7209 \(Does not affect global mark ring\)."
7210 (interactive)
7211 (pop-to-mark-command)
7212 (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
7213 (org-show-context 'mark-goto)))
7214
7215 (global-set-key (kbd "C-j") 'my-pop-to-mark-command)
7216 (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)
7217 (add-hook 'ido-setup-hook
7218 (lambda () (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)))
7219 (add-hook 'lisp-interaction-mode-hook
7220 (lambda ()
7221 (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
7222
7223 #+end_src
7224 ]
7225 *** [M-j] :drill:
7226 SCHEDULED: <2014-03-13 Thu>
7227 :PROPERTIES:
7228 previous-error
7229 :ID: cb5f0e6f-815d-488f-bfb2-5d31bd5dc215
7230 :CUSTOM_ID: 474a3e12-95ac-4f43-b83a-36716f3e6f76
7231 :DRILL_LAST_INTERVAL: 21.5453
7232 :DRILL_REPEATS_SINCE_FAIL: 4
7233 :DRILL_TOTAL_REPEATS: 4
7234 :DRILL_FAILURE_COUNT: 0
7235 :DRILL_AVERAGE_QUALITY: 3.25
7236 :DRILL_EASE: 2.58
7237 :DRILL_LAST_QUALITY: 3
7238 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:39>
7239 :END:
7240 previous-error
7241 [
7242 #+begin_src emacs-lisp
7243 (global-set-key (kbd "M-j") 'previous-error)
7244 #+end_src
7245 ]
7246 *** [C-M-j]
7247
7248 register prefix
7249 [
7250 :PROPERTIES:
7251 :CUSTOM_ID: ebcf7c71-3c93-431b-af6b-7c5df7f2945e
7252 :ID: d2604f6e-341d-4d57-91c8-ec6f2cdeb901
7253 :DRILL_LAST_INTERVAL: 23.5247
7254 :DRILL_REPEATS_SINCE_FAIL: 4
7255 :DRILL_TOTAL_REPEATS: 4
7256 :DRILL_FAILURE_COUNT: 0
7257 :DRILL_AVERAGE_QUALITY: 3.5
7258 :DRILL_EASE: 2.73
7259 :DRILL_LAST_QUALITY: 3
7260 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:45>
7261 :END:
7262 #+begin_src emacs-lisp
7263 (define-key global-map (kbd "C-M-j") ctl-x-r-map)
7264 (define-key ctl-x-r-map "m" 'kmacro-to-register)
7265 #+end_src
7266 ]
7267
7268 *** C-S-j
7269 :PROPERTIES:
7270 :CUSTOM_ID: 381a6c7c-e763-4d9a-86f5-55a5e0afcee1
7271 :END:
7272 *** [C-k] :drill:
7273 SCHEDULED: <2014-05-13 Tue>
7274 :PROPERTIES:
7275 jump to register
7276 :CUSTOM_ID: 25a7ba1c-ddf3-47f1-9516-914a552e7a36
7277 :ID: 095be13e-f98c-4f42-9353-08329fa47d06
7278 :DRILL_LAST_INTERVAL: 71.5839
7279 :DRILL_REPEATS_SINCE_FAIL: 4
7280 :DRILL_TOTAL_REPEATS: 4
7281 :DRILL_FAILURE_COUNT: 0
7282 :DRILL_AVERAGE_QUALITY: 4.75
7283 :DRILL_EASE: 4.85
7284 :DRILL_LAST_QUALITY: 5
7285 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
7286 :END:
7287 jump-to-register
7288 [
7289 #+begin_src emacs-lisp
7290
7291 (global-set-key (kbd "C-k") 'jump-to-register)
7292 #+end_src
7293 ]
7294 *** [M-k] :drill:
7295 SCHEDULED: <2014-03-15 Sat>
7296 :PROPERTIES:
7297 next-error
7298 :ID: c9f19dcc-4c14-4bdd-b350-c426dff14189
7299 :CUSTOM_ID: a96691bb-9e4c-414b-a093-d9961d453e21
7300 :DRILL_LAST_INTERVAL: 24.4352
7301 :DRILL_REPEATS_SINCE_FAIL: 4
7302 :DRILL_TOTAL_REPEATS: 4
7303 :DRILL_FAILURE_COUNT: 0
7304 :DRILL_AVERAGE_QUALITY: 3.75
7305 :DRILL_EASE: 2.929
7306 :DRILL_LAST_QUALITY: 4
7307 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:40>
7308 :END:
7309 next-error
7310 [
7311 #+begin_src emacs-lisp
7312 (global-set-key (kbd "M-k") 'next-error)
7313 #+end_src
7314 ]
7315 *** [C-M-k] :drill:
7316 SCHEDULED: <2014-03-21 Fri>
7317 :PROPERTIES:
7318 man
7319 :CUSTOM_ID: f61ea4ea-4597-422e-b7e3-d3cfad82603d
7320 :ID: 4c874a82-22dd-4bc2-a0ac-24420c30b888
7321 :DRILL_LAST_INTERVAL: 29.8228
7322 :DRILL_REPEATS_SINCE_FAIL: 4
7323 :DRILL_TOTAL_REPEATS: 4
7324 :DRILL_FAILURE_COUNT: 0
7325 :DRILL_AVERAGE_QUALITY: 4.25
7326 :DRILL_EASE: 3.589
7327 :DRILL_LAST_QUALITY: 5
7328 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:46>
7329 :END:
7330 man
7331 [
7332 #+begin_src emacs-lisp
7333 (global-set-key (kbd "C-M-k") 'man)
7334 #+end_src
7335 ]
7336 *** C-S-k
7337 :PROPERTIES:
7338 :CUSTOM_ID: da51b99a-1782-45ad-92be-f4c0a645bea8
7339 :END:
7340 *** [C-l] :drill:
7341 SCHEDULED: <2014-05-13 Tue>
7342 :PROPERTIES:
7343 ido-switch-buffer
7344 :ID: 3c7fabd9-572d-4945-ab4b-d7a8dc2cd9c5
7345 :CUSTOM_ID: 8a7572bd-4b5e-4464-b937-3d35adb1783f
7346 :DRILL_LAST_INTERVAL: 71.5839
7347 :DRILL_REPEATS_SINCE_FAIL: 4
7348 :DRILL_TOTAL_REPEATS: 4
7349 :DRILL_FAILURE_COUNT: 0
7350 :DRILL_AVERAGE_QUALITY: 4.75
7351 :DRILL_EASE: 4.85
7352 :DRILL_LAST_QUALITY: 5
7353 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
7354 :END:
7355 ido-switch-buffer
7356 [
7357 #+begin_src emacs-lisp
7358 (global-set-key (kbd "C-l") 'ido-switch-buffer)
7359 #+end_src
7360 ]
7361 *** M-l
7362 :PROPERTIES:
7363 :CUSTOM_ID: 27f47c6c-36ad-430e-b4b0-5e96b635bf36
7364 :END:
7365
7366 *** [C-M-l] :drill:
7367 SCHEDULED: <2014-04-04 Fri>
7368 :PROPERTIES:
7369 move cursor top bottom mid
7370 :ID: 37a3ccad-9b61-44b0-bddb-219a024cd963
7371 :CUSTOM_ID: 24b660d4-3ec4-4416-8a6a-b8224ed1ee8b
7372 :DRILL_LAST_INTERVAL: 25.8141
7373 :DRILL_REPEATS_SINCE_FAIL: 5
7374 :DRILL_TOTAL_REPEATS: 5
7375 :DRILL_FAILURE_COUNT: 1
7376 :DRILL_AVERAGE_QUALITY: 3.0
7377 :DRILL_EASE: 2.456
7378 :DRILL_LAST_QUALITY: 3
7379 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
7380 :END:
7381 move cursor top bottom mid, comint clear screen
7382 [
7383 #+begin_src emacs-lisp
7384 (global-set-key (kbd "C-M-l") 'move-to-window-line-top-bottom)
7385 #+end_src
7386 ]
7387 *** C-S-l
7388 :PROPERTIES:
7389 :CUSTOM_ID: c355178f-c9b4-4ae7-9627-b4117fef45b9
7390 :END:
7391 *** [C-;] :drill:
7392 SCHEDULED: <2014-03-19 Wed>
7393 :PROPERTIES:
7394 comment-dwim
7395 :CUSTOM_ID: 7e3710eb-5460-4460-8bf0-488302e4ce35
7396 :ID: 1c1b7a4a-484b-4faf-ae20-65d096ff2574
7397 :DRILL_LAST_INTERVAL: 27.9041
7398 :DRILL_REPEATS_SINCE_FAIL: 4
7399 :DRILL_TOTAL_REPEATS: 4
7400 :DRILL_FAILURE_COUNT: 0
7401 :DRILL_AVERAGE_QUALITY: 4.0
7402 :DRILL_EASE: 3.204
7403 :DRILL_LAST_QUALITY: 4
7404 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:45>
7405 :END:
7406 used in flyspell, not sure what for, otherwise unbound
7407 *** M-;
7408 :PROPERTIES:
7409 :CUSTOM_ID: 211e76d9-d89a-4cc6-abce-69397d456fda
7410 :END:
7411 comment-dwim
7412 *** [C-M-;] :drill:
7413 SCHEDULED: <2014-04-07 Mon>
7414 :PROPERTIES:
7415 comment-current-line-dwim
7416 :ID: 9ff312cc-f460-4f5d-9e4b-37f7ed538209
7417 :CUSTOM_ID: 28680a96-5223-4632-80b9-b1facdd541e7
7418 :DRILL_LAST_INTERVAL: 42.8284
7419 :DRILL_REPEATS_SINCE_FAIL: 4
7420 :DRILL_TOTAL_REPEATS: 4
7421 :DRILL_FAILURE_COUNT: 0
7422 :DRILL_AVERAGE_QUALITY: 4.5
7423 :DRILL_EASE: 4.122
7424 :DRILL_LAST_QUALITY: 5
7425 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:51>
7426 :END:
7427 comment-current-line-dwim
7428 [
7429 #+begin_src emacs-lisp
7430 (defun comment-current-line-dwim ()
7431 "Comment or uncomment the current line."
7432 (interactive)
7433 (save-excursion
7434 (push-mark (beginning-of-line) t t)
7435 (end-of-line)
7436 (comment-dwim nil))
7437 (move-beginning-of-line 2))
7438 (global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
7439 #+end_src
7440 ]
7441 *** C-S-;
7442 :PROPERTIES:
7443 :CUSTOM_ID: c9f00d6c-f9d2-420f-a08e-21ea78023066
7444 :END:
7445 *** [C-m]
7446 :PROPERTIES:
7447 :CUSTOM_ID: deee53ba-dfa2-4910-894c-55ae98d11aa4
7448 :END:
7449 *** M-m
7450 :PROPERTIES:
7451 :CUSTOM_ID: f7237459-96b6-4de9-937f-5fbfa9ca5b1e
7452 :END:
7453 *** [C-M-m] :drill:
7454 SCHEDULED: <2014-03-11 Tue>
7455 :PROPERTIES:
7456 recursive grep
7457 :CUSTOM_ID: f283f705-cba0-45db-b80f-5d20415b2eee
7458 :ID: b952fa90-b492-4f85-9d8e-5cd24c060b94
7459 :DRILL_LAST_INTERVAL: 9.1491
7460 :DRILL_REPEATS_SINCE_FAIL: 3
7461 :DRILL_TOTAL_REPEATS: 7
7462 :DRILL_FAILURE_COUNT: 3
7463 :DRILL_AVERAGE_QUALITY: 2.924
7464 :DRILL_EASE: 2.42
7465 :DRILL_LAST_QUALITY: 3
7466 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:05>
7467 :END:
7468 recursive grep
7469 [
7470 #+begin_src emacs-lisp
7471 (define-key global-map (kbd "C-M-m") 'rgrep)
7472 #+end_src
7473 ]
7474 *** C-S-m
7475 :PROPERTIES:
7476 :CUSTOM_ID: dd3136a5-5383-4fc7-8c9f-fcbaba251a76
7477 :END:
7478 *** [C-,] :drill:
7479 SCHEDULED: <2014-05-13 Tue>
7480 :PROPERTIES:
7481 ido-find-file
7482 :CUSTOM_ID: 6cbf3a85-f260-453a-920b-850ff5e986b1
7483 :ID: df0f3769-bcfc-4cb9-8943-bb86dafb2711
7484 :DRILL_LAST_INTERVAL: 71.5839
7485 :DRILL_REPEATS_SINCE_FAIL: 4
7486 :DRILL_TOTAL_REPEATS: 4
7487 :DRILL_FAILURE_COUNT: 0
7488 :DRILL_AVERAGE_QUALITY: 4.75
7489 :DRILL_EASE: 4.85
7490 :DRILL_LAST_QUALITY: 5
7491 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
7492 :END:
7493 ido-find-file
7494 [
7495 #+begin_src emacs-lisp
7496 (global-set-key (kbd "C-,") 'ido-find-file)
7497 (add-hook 'flyspell-mode-hook
7498 (lambda () (define-key flyspell-mode-map (kbd "C-,") nil)))
7499 #+end_src
7500 ]
7501 *** M-,
7502 *** [C-M-,] :drill:
7503 SCHEDULED: <2014-03-19 Wed>
7504 :PROPERTIES:
7505 find-file-in-project
7506 :ID: fca85295-0567-4443-ac74-a54b93a2e603
7507 :CUSTOM_ID: bfdf6111-029d-462b-bcca-50a3ed2162d5
7508 :DRILL_LAST_INTERVAL: 24.3844
7509 :DRILL_REPEATS_SINCE_FAIL: 5
7510 :DRILL_TOTAL_REPEATS: 5
7511 :DRILL_FAILURE_COUNT: 2
7512 :DRILL_AVERAGE_QUALITY: 3.0
7513 :DRILL_EASE: 2.456
7514 :DRILL_LAST_QUALITY: 3
7515 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:51>
7516 :END:
7517 find-file-in-project
7518 [
7519 #+begin_src emacs-lisp
7520 (global-set-key (kbd "C-M-,") 'find-file-in-project)
7521 #+end_src
7522 ]
7523 *** C-S-,
7524 :PROPERTIES:
7525 :CUSTOM_ID: 74a86b9e-9a56-4f5e-a6eb-9f2cd09da613
7526 :END:
7527 *** [C-.] :drill:
7528 SCHEDULED: <2014-03-27 Thu>
7529 :PROPERTIES:
7530 recentf-ido-find-file
7531 :CUSTOM_ID: 0675c171-8677-44a8-882c-e7ed42715e31
7532 :ID: a600d171-1964-4a81-a39e-cfac4716f96d
7533 :DRILL_LAST_INTERVAL: 50.6823
7534 :DRILL_REPEATS_SINCE_FAIL: 3
7535 :DRILL_TOTAL_REPEATS: 3
7536 :DRILL_FAILURE_COUNT: 0
7537 :DRILL_AVERAGE_QUALITY: 5.0
7538 :DRILL_EASE: 5.815
7539 :DRILL_LAST_QUALITY: 5
7540 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:41>
7541 :END:
7542 find recent file
7543 [
7544 Taken from starter kit.
7545 #+begin_src emacs-lisp
7546 (defun recentf-ido-find-file ()
7547 "Find a recent file using Ido."
7548 (interactive)
7549 (let* ((file-assoc-list
7550 (mapcar (lambda (x)
7551 (cons (file-name-nondirectory x)
7552 x))
7553 recentf-list))
7554 (filename-list
7555 (remove-duplicates (mapcar #'car file-assoc-list)
7556 :test #'string=))
7557 (filename (ido-completing-read "Choose recent file: "
7558 filename-list
7559 nil
7560 t)))
7561 (when filename
7562 (find-file (cdr (assoc filename
7563 file-assoc-list))))))
7564
7565 (add-hook 'flyspell-mode-hook
7566 (lambda () (define-key flyspell-mode-map (kbd "C-.") nil)))
7567 (define-key dot-mode-map (kbd "C-.") nil)
7568 (global-set-key (kbd "C-.") 'recentf-ido-find-file)
7569 (add-hook 'php-mode-hook
7570 (lambda () (define-key php-mode-map (kbd "C-.") nil)))
7571 #+end_src
7572 ]
7573 *** M-.
7574 *** C-M-.
7575 :PROPERTIES:
7576 :CUSTOM_ID: 824d422c-67b6-4d68-af11-6a2135e528f5
7577 :END:
7578 -
7579 [
7580 #+begin_src emacs-lisp
7581 (define-key dot-mode-map (kbd "C-M-.") nil)
7582 ;; (global-set-key (kbd "C-M-.") 'execute-extended-command)
7583 #+end_src
7584 ]
7585 *** C-S-.
7586 :PROPERTIES:
7587 :CUSTOM_ID: 346effe7-027b-4c4a-a236-3bc6ef541a0c
7588 :END:
7589 *** [C-/] :drill:
7590 :PROPERTIES:
7591 :CUSTOM_ID: 941a7fa8-84b9-434d-89a0-1487385ec479
7592 :ID: 1bf4af8d-58bb-4b58-af60-2ed87f32f4eb
7593 :END:
7594 join lines
7595 [
7596 #+begin_src emacs-lisp
7597 (defun vim-style-join-line ()
7598 (interactive)
7599 (join-line '(4)))
7600 (global-set-key (kbd "C-/") 'vim-style-join-line)
7601 (define-key undo-tree-map (kbd "C-/") nil)
7602 #+end_src
7603 ]
7604 *** M-/
7605 :PROPERTIES:
7606 :CUSTOM_ID: f65acefa-7e11-438e-a59c-42a9c7c71607
7607 :END:
7608 *** [C-M-/] :drill:
7609 :PROPERTIES:
7610 :CUSTOM_ID: 37f67593-4f60-4d3b-9aad-6c9bc4882443
7611 :ID: c41dd5ab-619f-40fe-9471-9ba59d0fef46
7612 :END:
7613 copy-variable
7614 [
7615 #+begin_src emacs-lisp
7616 (defun copy-variable (variable)
7617 (interactive
7618 (let ((v (variable-at-point))
7619 (enable-recursive-minibuffers t)
7620 val)
7621 (setq val (completing-read (if (symbolp v)
7622 (format
7623 "Describe variable (default %s): " v)
7624 "Describe variable: ")
7625 obarray
7626 (lambda (vv)
7627 (or (get vv 'variable-documentation)
7628 (and (boundp vv) (not (keywordp vv)))))
7629 t nil nil
7630 (if (symbolp v) (symbol-name v))))
7631 (list (if (equal val "")
7632 v (intern val)))))
7633 (kill-new (symbol-value variable)))
7634 (global-set-key (kbd "C-M-/") 'copy-variable)
7635
7636 #+end_src
7637 ]
7638 *** C-S-/
7639 :PROPERTIES:
7640 :CUSTOM_ID: ff612b05-8a3f-4599-a95b-f8af19b71b47
7641 :END:
7642 *** [C-8] :drill:
7643 SCHEDULED: <2014-03-13 Thu>
7644 :PROPERTIES:
7645 calc-embedded-word
7646 :CUSTOM_ID: 251c4a1a-a683-4804-a706-d0d3752e42fa
7647 :ID: 8084cd41-1833-4e16-ac01-60a5738d0bf3
7648 :DRILL_LAST_INTERVAL: 22.2211
7649 :DRILL_REPEATS_SINCE_FAIL: 4
7650 :DRILL_TOTAL_REPEATS: 4
7651 :DRILL_FAILURE_COUNT: 1
7652 :DRILL_AVERAGE_QUALITY: 3.5
7653 :DRILL_EASE: 2.73
7654 :DRILL_LAST_QUALITY: 3
7655 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:35>
7656 :END:
7657 calc-embedded-word
7658 [
7659 #+begin_src emacs-lisp
7660 (global-set-key (kbd "C-8") 'calc-embedded-word)
7661 #+end_src
7662 ]
7663 *** M-8
7664 :PROPERTIES:
7665 :CUSTOM_ID: 34f4f850-c3e4-4724-aabc-08eee19f034a
7666 :END:
7667 *** C-M-8
7668 :PROPERTIES:
7669 :CUSTOM_ID: 52191c76-756e-4dcc-87a5-2b84c550db5f
7670 :END:
7671 *** C-S-8
7672 :PROPERTIES:
7673 :CUSTOM_ID: 3f677c1a-7011-467e-ae4c-4b944807376b
7674 :END:
7675 *** [C-up-arrow] :drill:
7676 SCHEDULED: <2014-03-14 Fri>
7677 :PROPERTIES:
7678 back defun/headline
7679 :CUSTOM_ID: f47d312a-063d-42ed-a352-176298a2cb0c
7680 :ID: 93fe8dac-4206-4131-9264-3411e6467b01
7681 :DRILL_LAST_INTERVAL: 23.4066
7682 :DRILL_REPEATS_SINCE_FAIL: 5
7683 :DRILL_TOTAL_REPEATS: 5
7684 :DRILL_FAILURE_COUNT: 3
7685 :DRILL_AVERAGE_QUALITY: 3.2
7686 :DRILL_EASE: 2.554
7687 :DRILL_LAST_QUALITY: 4
7688 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 18:04>
7689 :END:
7690 org prev headline
7691 [
7692 #+begin_src emacs-lisp
7693 (define-key undo-tree-map "\C-_" nil)
7694 ;; disabled just because i don't want to accidentally hit it
7695 (define-key global-map "\C-_" nil)
7696 (global-set-key (kbd "<C-_>") 'beginning-of-defun)
7697
7698 (add-hook 'org-mode-hook
7699 (lambda ()
7700 (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
7701
7702 #+end_src
7703
7704
7705 ]
7706 *** M-up-arrow
7707 :PROPERTIES:
7708 :CUSTOM_ID: 30f87801-2c2d-4722-9348-fb38ea6c09b0
7709 :END:
7710 *** C-M-up-arrow
7711 *** C-S-up-arrow :drill:
7712 winner undo
7713 [
7714 #+begin_src emacs-lisp
7715 (global-set-key (kbd "<C-S-_>") 'winner-undo)
7716 #+end_src
7717 ]
7718 *** [C-down-arrow] :drill:
7719 SCHEDULED: <2014-03-13 Thu>
7720 :PROPERTIES:
7721 forward dfun/headline
7722 :CUSTOM_ID: 27435136-b3d7-4f25-aa85-2a7363a7f366
7723 :ID: da405d83-b0af-4778-9703-a3f109a1233d
7724 :DRILL_LAST_INTERVAL: 10.7692
7725 :DRILL_REPEATS_SINCE_FAIL: 3
7726 :DRILL_TOTAL_REPEATS: 6
7727 :DRILL_FAILURE_COUNT: 1
7728 :DRILL_AVERAGE_QUALITY: 3.167
7729 :DRILL_EASE: 2.537
7730 :DRILL_LAST_QUALITY: 4
7731 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:09>
7732 :END:
7733 org next headline
7734 [
7735 #+begin_src emacs-lisp
7736 (global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
7737
7738 (add-hook 'org-mode-hook
7739 (lambda ()
7740 (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
7741
7742 #+end_src
7743
7744
7745 ]
7746 *** M-down-arrow
7747 *** [C-M-down-arrow] :drill:
7748 SCHEDULED: <2014-03-20 Thu>
7749 :PROPERTIES:
7750 toggle-mark-activation
7751 :ID: c57f3bab-8ea1-423d-b759-e1ec2586753c
7752 :CUSTOM_ID: 3bcb35fd-6d54-4213-b94f-2739c0bc0041
7753 :DRILL_LAST_INTERVAL: 17.6506
7754 :DRILL_REPEATS_SINCE_FAIL: 4
7755 :DRILL_TOTAL_REPEATS: 7
7756 :DRILL_FAILURE_COUNT: 4
7757 :DRILL_AVERAGE_QUALITY: 3.661
7758 :DRILL_EASE: 2.851
7759 :DRILL_LAST_QUALITY: 5
7760 :DRILL_LAST_REVIEWED: <2014-03-02 Sun 21:10>
7761 :END:
7762 toggle-mark-activation
7763 [
7764 #+begin_src emacs-lisp
7765 (defun toggle-mark-activation ()
7766 (interactive)
7767 (if mark-active
7768 (deactivate-mark t)
7769 (activate-mark)))
7770
7771 (global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
7772 #+end_src
7773 ]
7774 winner redo
7775 [
7776 #+begin_src emacs-lisp
7777 (global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
7778 #+end_src
7779 ]
7780
7781 *** [C-S-down-arrow] :drill:
7782 SCHEDULED: <2014-03-19 Wed>
7783 :PROPERTIES:
7784 smex-major-mode-commands
7785 :CUSTOM_ID: 1434bdd0-c5a8-4c96-9b92-9474e88fd1c5
7786 :ID: 1e992e46-ec69-416c-b7d7-7c87da109b43
7787 :DRILL_LAST_INTERVAL: 24.3844
7788 :DRILL_REPEATS_SINCE_FAIL: 5
7789 :DRILL_TOTAL_REPEATS: 5
7790 :DRILL_FAILURE_COUNT: 2
7791 :DRILL_AVERAGE_QUALITY: 3.0
7792 :DRILL_EASE: 2.456
7793 :DRILL_LAST_QUALITY: 3
7794 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 02:28>
7795 :END:
7796 m-x for major mode
7797 [
7798 #+begin_src emacs-lisp
7799 (global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
7800 #+end_src
7801 ]
7802 *** C-lbracket
7803 :PROPERTIES:
7804 :CUSTOM_ID: 9d9916dd-3280-47dd-aab1-cd28d5ebfe15
7805 :END:
7806 ----
7807 *** M-lbracket
7808 *** [C-M-lbracket] :drill:
7809 SCHEDULED: <2014-03-15 Sat>
7810 :PROPERTIES:
7811 scroll-right
7812 :CUSTOM_ID: 7411b1a5-c8fa-4bcc-8788-798e5635dd62
7813 :ID: 0bf13532-1df9-4eb3-953c-10901f2a5da5
7814 :DRILL_LAST_INTERVAL: 23.5247
7815 :DRILL_REPEATS_SINCE_FAIL: 4
7816 :DRILL_TOTAL_REPEATS: 4
7817 :DRILL_FAILURE_COUNT: 0
7818 :DRILL_AVERAGE_QUALITY: 3.5
7819 :DRILL_EASE: 2.73
7820 :DRILL_LAST_QUALITY: 3
7821 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:25>
7822 :END:
7823 scroll-right
7824 [
7825 #+begin_src emacs-lisp
7826 (global-set-key (kbd "C-M-[") 'scroll-right)
7827 #+end_src
7828 ]
7829 *** C-S-lbracket
7830 *** [C-rbracket]
7831 :PROPERTIES:
7832 :CUSTOM_ID: 21b38c6b-3a46-4a08-8eca-d44abb148287
7833 :END:
7834 fill-paragraph
7835 #+begin_src emacs-lisp
7836 (global-set-key (kbd "C-]") 'fill-paragraph)
7837 #+end_src
7838 *** M-rbracket
7839 *** [C-M-rbracket] :drill:
7840 SCHEDULED: <2014-03-15 Sat>
7841 :PROPERTIES:
7842 scroll-left
7843 :CUSTOM_ID: c9c18f48-d0ca-4a1b-a751-7165f40118a3
7844 :ID: ff008422-b6f5-4770-9e53-e6acdac90b45
7845 :DRILL_LAST_INTERVAL: 24.4352
7846 :DRILL_REPEATS_SINCE_FAIL: 4
7847 :DRILL_TOTAL_REPEATS: 4
7848 :DRILL_FAILURE_COUNT: 0
7849 :DRILL_AVERAGE_QUALITY: 3.75
7850 :DRILL_EASE: 2.929
7851 :DRILL_LAST_QUALITY: 4
7852 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:44>
7853 :END:
7854 scroll-left
7855 [
7856 #+begin_src emacs-lisp
7857 (global-set-key (kbd "C-M-]") 'scroll-left)
7858 #+end_src
7859 ]
7860 *** C-S-rbracket
7861 :PROPERTIES:
7862 :CUSTOM_ID: d42245ca-3246-477b-bda9-8776cd668cd1
7863 :END:
7864 *** [C-return] :drill:
7865 SCHEDULED: <2014-03-12 Wed>
7866 :PROPERTIES:
7867 newline next line
7868 :ID: 20e450f0-6467-40f2-bd1b-b4038693e73f
7869 :CUSTOM_ID: baf7ea5a-d16d-4fee-a6ce-542cc11beb97
7870 :DRILL_LAST_INTERVAL: 20.7344
7871 :DRILL_REPEATS_SINCE_FAIL: 4
7872 :DRILL_TOTAL_REPEATS: 4
7873 :DRILL_FAILURE_COUNT: 0
7874 :DRILL_AVERAGE_QUALITY: 3.75
7875 :DRILL_EASE: 2.928
7876 :DRILL_LAST_QUALITY: 5
7877 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:29>
7878 :END:
7879 newline-anywhere
7880 [
7881 #+begin_src emacs-lisp
7882 (defun newline-anywhere ()
7883 "Add a newline from anywhere in the line."
7884 (interactive)
7885 (end-of-line)
7886 (newline-and-indent))
7887 (global-set-key (kbd "<C-return>") 'newline-anywhere)
7888
7889 #+end_src
7890 ]
7891 *** [M-return] :drill:
7892 SCHEDULED: <2014-03-11 Tue>
7893 :PROPERTIES:
7894 non-indented newline
7895 :ID: 4fc4d372-765e-4e2e-87f4-0a0e1fd93f34
7896 :CUSTOM_ID: e6895ad3-a2c8-46c8-abbc-1bba94a88596
7897 :DRILL_LAST_INTERVAL: 19.9622
7898 :DRILL_REPEATS_SINCE_FAIL: 4
7899 :DRILL_TOTAL_REPEATS: 4
7900 :DRILL_FAILURE_COUNT: 0
7901 :DRILL_AVERAGE_QUALITY: 3.5
7902 :DRILL_EASE: 2.73
7903 :DRILL_LAST_QUALITY: 4
7904 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:30>
7905 :END:
7906 plain newline
7907 [
7908 #+begin_src emacs-lisp
7909 (defun plain-newline ()
7910 (interactive)
7911 (insert "\n"))
7912 (global-set-key (kbd "<M-return>") 'plain-newline)
7913 #+end_src
7914 ]
7915
7916 *** C-M-return
7917 :PROPERTIES:
7918 open newline on previous line
7919 :CUSTOM_ID: 2a8fc6ea-a550-4437-9e35-3b3f2776788a
7920 :END:
7921 [
7922 #+begin_src emacs-lisp
7923 (defun newline-anywhere-previous ()
7924 "Add a newline from anywhere in the line."
7925 (interactive)
7926 (forward-line -1)
7927 (end-of-line)
7928 (newline-and-indent))
7929 (global-set-key (kbd "<C-M-return>") 'newline-anywhere-previous)
7930 #+end_src
7931 ]
7932 *** C-S-return
7933 :PROPERTIES:
7934 :CUSTOM_ID: 787cc59e-ce0f-4291-a9d5-fd4e14b0b83b
7935 :END:
7936 *** [C-space] :drill:
7937 SCHEDULED: <2014-03-18 Tue>
7938 :PROPERTIES:
7939 org-edit-special
7940 :CUSTOM_ID: 132daa1a-8e5f-47f1-a28d-35bee873aeac
7941 :ID: 3204f2ca-10b2-469b-8b70-fb660e35478a
7942 :DRILL_LAST_INTERVAL: 41.7787
7943 :DRILL_REPEATS_SINCE_FAIL: 3
7944 :DRILL_TOTAL_REPEATS: 3
7945 :DRILL_FAILURE_COUNT: 0
7946 :DRILL_AVERAGE_QUALITY: 4.667
7947 :DRILL_EASE: 4.583
7948 :DRILL_LAST_QUALITY: 4
7949 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:44>
7950 :END:
7951 org-edit-special
7952 [
7953 #+begin_src emacs-lisp
7954 ;; (kbd "<C-space>") does not work, (kbd "C-SPC") should work
7955 (add-hook 'org-mode-hook
7956 (lambda ()
7957 (define-key org-mode-map (kbd "C-SPC") 'org-edit-special)
7958 ;; org-src-mode-map is broken in git version of emacs.
7959 ;; temporarily use this for exiting edit-special mode.
7960 (global-set-key (kbd "C-M--") 'org-edit-src-exit)
7961 (define-key org-src-mode-map (kbd "C-SPC") 'org-edit-src-exit)))
7962 #+end_src
7963 ]
7964 *** M-space
7965 :PROPERTIES:
7966 :CUSTOM_ID: bbffb12e-03f2-4a26-a9e4-fd263ad6b518
7967 :END:
7968 *** C-M-space
7969 :PROPERTIES:
7970 spell check word
7971 :CUSTOM_ID: 02359b66-bf6e-4f41-9f03-e83fcbe3e68c
7972 :END:
7973 [
7974 before or under cursor
7975 #+begin_src emacs-lisp
7976 (global-set-key (kbd "C-M-SPC") 'ispell-word)
7977 #+end_src
7978 ]
7979 *** C-S-space
7980 :PROPERTIES:
7981 :CUSTOM_ID: a28e904f-f2bd-48d3-9718-af3f541e611e
7982 :END:
7983 ** left secondary
7984 *** C-=
7985 :PROPERTIES:
7986 :CUSTOM_ID: 6b01dcdd-d1c1-4e3f-9e28-9c3574682f95
7987 :END:
7988 *** M-=
7989 :PROPERTIES:
7990 :CUSTOM_ID: 6a63486f-ea5b-4ece-a535-5277022e0cde
7991 :END:
7992 *** C-M-=
7993 :PROPERTIES:
7994 :CUSTOM_ID: 1e245ef6-5bdb-4f99-b8e2-f5d45a7c0847
7995 :END:
7996 *** C-S-=
7997 :PROPERTIES:
7998 :CUSTOM_ID: 0f9aa2b8-83c7-433c-80e0-f90ee802365f
7999 :END:
8000 *** C-1
8001 :PROPERTIES:
8002 :CUSTOM_ID: 06374c1c-025b-47c2-90b2-82f37031093b
8003 :END:
8004 *** M-1
8005 :PROPERTIES:
8006 :CUSTOM_ID: 51810ebd-52f3-4e68-9434-e2347a834787
8007 :END:
8008 *** C-M-1
8009 :PROPERTIES:
8010 :CUSTOM_ID: 9207526f-a925-4ecc-bd30-98cbd580d67a
8011 :END:
8012 *** C-S-1
8013 :PROPERTIES:
8014 :CUSTOM_ID: 58a7a929-50b5-4393-9b08-59ad2039b263
8015 :END:
8016 *** C-4
8017 :PROPERTIES:
8018 :CUSTOM_ID: 24a0c3c4-bce7-4a94-8a31-e5259387c573
8019 :END:
8020 *** M-4
8021 :PROPERTIES:
8022 :CUSTOM_ID: 2d4fa927-2140-424b-9990-e8f2c3424e57
8023 :END:
8024 *** C-M-4 :drill:
8025 widen
8026 [
8027 :PROPERTIES:
8028 :CUSTOM_ID: 3ff50f5f-f286-4a73-962b-58dbcf3b09b1
8029 :ID: addc832b-5547-4d45-a1f5-3e9283920612
8030 :END:
8031 #+begin_src emacs-lisp
8032 (global-set-key (kbd "C-M-4") 'widen)
8033 #+end_src
8034 ]
8035 *** C-S-4
8036 :PROPERTIES:
8037 :CUSTOM_ID: ba9ed568-7ba1-4283-b4c7-57fcb9a5a477
8038 :END:
8039 *** C-5
8040 :PROPERTIES:
8041 :CUSTOM_ID: 83bc2d8a-a225-4b6f-ab98-f47aa6d1e73f
8042 :END:
8043 *** M-5
8044 :PROPERTIES:
8045 :CUSTOM_ID: 1b8f04c3-91b5-43cd-8a1a-94c8105eff24
8046 :END:
8047 *** C-M-5
8048 :PROPERTIES:
8049 :CUSTOM_ID: fab28de6-7fe4-45d7-a856-5d29a9085f5d
8050 :END:
8051 *** C-S-5
8052 :PROPERTIES:
8053 :CUSTOM_ID: b22cdf04-bc77-493b-a65c-5992befc1a62
8054 :END:
8055 *** [C-tab-key] :drill:
8056 SCHEDULED: <2014-03-12 Wed>
8057 :PROPERTIES:
8058 query-replace
8059 :CUSTOM_ID: 68313551-90cd-47a6-8170-1745348add17
8060 :ID: 5b315ca6-c623-4b23-bef3-31b325591d01
8061 :DRILL_LAST_INTERVAL: 20.9905
8062 :DRILL_REPEATS_SINCE_FAIL: 4
8063 :DRILL_TOTAL_REPEATS: 4
8064 :DRILL_FAILURE_COUNT: 2
8065 :DRILL_AVERAGE_QUALITY: 3.5
8066 :DRILL_EASE: 2.73
8067 :DRILL_LAST_QUALITY: 3
8068 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 16:32>
8069 :END:
8070 query-replace
8071 [
8072 #+begin_src emacs-lisp
8073
8074 (global-set-key (kbd "<C-kp-add>") 'query-replace)
8075 #+end_src
8076 ]
8077 *** M-tab-key
8078 *** C-M-tab-key
8079 *** C-S-tab-key
8080 *** [C-t] :drill:
8081 SCHEDULED: <2014-03-24 Mon>
8082 :PROPERTIES:
8083 org change todo state
8084 :ID: b9a6ec32-9b64-403f-be09-73769f778d1f
8085 :CUSTOM_ID: aaac3048-9125-4fd5-b8f2-21bafcc1ff1c
8086 :DRILL_LAST_INTERVAL: 32.7466
8087 :DRILL_REPEATS_SINCE_FAIL: 4
8088 :DRILL_TOTAL_REPEATS: 4
8089 :DRILL_FAILURE_COUNT: 0
8090 :DRILL_AVERAGE_QUALITY: 4.0
8091 :DRILL_EASE: 3.204
8092 :DRILL_LAST_QUALITY: 4
8093 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:53>
8094 :END:
8095 org cycle todo / toggle comint motion
8096 [
8097 #+begin_src emacs-lisp
8098 (add-hook 'org-mode-hook
8099 (lambda ()
8100 (define-key org-mode-map (kbd "C-t") 'org-todo)))
8101
8102 (defun my-comint-previous-input (arg)
8103 (interactive "*p")
8104 (if (comint-after-pmark-p)
8105 (comint-previous-input arg)
8106 (forward-line -1)))
8107
8108 (defun my-comint-next-input (arg)
8109 (interactive "*p")
8110 (if (comint-after-pmark-p)
8111 (comint-next-input arg)
8112 (forward-line)))
8113
8114 (add-hook 'comint-mode-hook
8115 (lambda ()
8116 (define-key comint-mode-map (kbd "C-t") 'comint-toggle-arrow-keys)
8117 (define-key comint-mode-map (kbd "<up>") 'my-comint-previous-input)
8118 (define-key comint-mode-map (kbd "<down>") 'my-comint-next-input)))
8119
8120
8121 (defun comint-toggle-arrow-keys ()
8122 (interactive)
8123 (toggle-arrow-keys comint-mode-map))
8124
8125 (setq-default comint-arrow-movement nil)
8126 (defun toggle-arrow-keys (map)
8127 (cond ((lookup-key map (kbd "<up>"))
8128 (setq-local comint-arrow-movement t)
8129 (define-key map (kbd "<up>") nil)
8130 (define-key map (kbd "<down>") nil))
8131 (t
8132 (setq-local comint-arrow-movement nil)
8133 (define-key map (kbd "<up>") 'my-comint-previous-input)
8134 (define-key map (kbd "<down>") 'my-comint-next-input)
8135 (goto-char (point-max)))))
8136
8137 (defun ian-sign-email ()
8138 (interactive)
8139 (insert "Ian Kelling
8140 https://iankelling.org"))
8141
8142 (eval-after-load "message"
8143 '(define-key message-mode-map (kbd "C-t") 'ian-sign-email))
8144 #+end_src
8145 Thanks for the update. I will be enjoying it.
8146
8147 #+RESULTS:
8148 : comint-toggle-arrow-keys
8149 ]
8150 *** M-t
8151 :PROPERTIES:
8152 :CUSTOM_ID: 4542dc3a-d876-4726-8c8e-61c7c9cecd64
8153 :END:
8154 *** [C-M-t] :drill:
8155 SCHEDULED: <2014-03-15 Sat>
8156 :PROPERTIES:
8157 org insert timestamp
8158 :ID: ed43d561-cf73-4123-8cf2-12e184f99e0f
8159 :CUSTOM_ID: 5bc609b1-9428-4b82-a55d-811fefe65331
8160 :DRILL_LAST_INTERVAL: 23.5247
8161 :DRILL_REPEATS_SINCE_FAIL: 4
8162 :DRILL_TOTAL_REPEATS: 4
8163 :DRILL_FAILURE_COUNT: 0
8164 :DRILL_AVERAGE_QUALITY: 3.5
8165 :DRILL_EASE: 2.73
8166 :DRILL_LAST_QUALITY: 3
8167 :DRILL_LAST_REVIEWED: <2014-02-19 Wed 17:41>
8168 :END:
8169 org timestamp
8170 [
8171 #+begin_src emacs-lisp
8172 (global-set-key (kbd "C-M-t") 'org-time-stamp-with-time)
8173 #+end_src
8174 ]
8175 *** C-S-t
8176 :PROPERTIES:
8177 :CUSTOM_ID: 6a6fcd06-5822-4a3d-8e2e-1fc0f64357b2
8178 :END:
8179 *** C-home
8180 :PROPERTIES:
8181 :CUSTOM_ID: 1919659a-b466-4519-9276-8bf06a916066
8182 :END:
8183 start of buffer
8184 *** M-home
8185 :PROPERTIES:
8186 :CUSTOM_ID: 29a3b536-201d-4499-b131-afe58e6f45b4
8187 :END:
8188 *** C-M-home
8189 :PROPERTIES:
8190 :CUSTOM_ID: d9df9b43-357a-43e1-bb1c-47d61f095738
8191 :END:
8192 *** C-S-home
8193 :PROPERTIES:
8194 :CUSTOM_ID: a91ee772-a59c-4083-a65c-6f9b294b517c
8195 :END:
8196 *** C-end
8197 :PROPERTIES:
8198 :CUSTOM_ID: 0a7bd629-cbcc-4761-8fe2-cc9370b985a4
8199 :END:
8200 end of buffer
8201 *** M-end
8202 :PROPERTIES:
8203 :CUSTOM_ID: 1c215db5-a50c-4718-868a-871d69acf117
8204 :END:
8205 *** C-M-end
8206 :PROPERTIES:
8207 :CUSTOM_ID: cf2df317-a0b1-41e6-9919-67e77bb796f8
8208 :END:
8209 *** C-S-end
8210 :PROPERTIES:
8211 :CUSTOM_ID: a4721bb0-9cbc-4f3c-b292-645d5121c839
8212 :END:
8213 *** C-f9
8214 :PROPERTIES:
8215 :CUSTOM_ID: 014536d9-68e3-46f5-9594-e74fe64f4d9e
8216 :END:
8217 *** M-f9
8218 :PROPERTIES:
8219 :CUSTOM_ID: 6dee0f1b-3680-4a72-8a80-e31b9c7c219d
8220 :END:
8221 *** C-M-f9
8222 :PROPERTIES:
8223 :CUSTOM_ID: f5e835dd-e2b8-42eb-b7f1-9ec76c7dfcb8
8224 :END:
8225 *** C-S-f9
8226 :PROPERTIES:
8227 :CUSTOM_ID: c3aba493-9e85-40b7-989d-7e17ba2b55a7
8228 :END:
8229 ** right secondary
8230 *** C-6
8231 :PROPERTIES:
8232 :CUSTOM_ID: e44e584b-d925-4036-9ad5-a90d02e74bef
8233 :END:
8234 save-buffers-kill-emacs
8235 [
8236 #+begin_src emacs-lisp
8237 (global-set-key (kbd "C-6") 'save-buffers-kill-emacs)
8238 #+end_src
8239 ]
8240 *** M-6
8241 *** [C-M-6] :drill:
8242 :PROPERTIES:
8243 :CUSTOM_ID: da73de75-0914-4f48-81d5-9b408433b14b
8244 :ID: bcf78e2e-810e-4a6d-9056-bd488aaa373b
8245 :END:
8246 insert-small-copyright
8247 [
8248 #+begin_src emacs-lisp
8249 (defun insert-small-copyright ()
8250 (interactive)
8251 (beginning-of-line)
8252 (let ((beg (point)))
8253 (insert "Copyright (C) 2016 Ian Kelling\nThis program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>")
8254 (comment-region beg (point))))
8255
8256 (global-set-key (kbd "C-M-6") 'insert-small-copyright)
8257 #+end_src
8258 ]
8259 *** C-S-6
8260 *** C-7
8261 *** M-7
8262 *** [C-M-7] :drill:
8263 :PROPERTIES:
8264 :CUSTOM_ID: a68c6b8e-9911-475e-ab35-e239771fe881
8265 :ID: ae9704b8-1492-4dc0-806a-dd3407526733
8266 :END:
8267 insert-full-copyright
8268 [
8269 #+begin_src emacs-lisp
8270 (defun insert-full-copyright ()
8271 (interactive)
8272 (beginning-of-line)
8273 (let ((beg (point)))
8274 (insert "Copyright (C) 2016 Ian Kelling\n")
8275 (insert "\n")
8276 (insert "This program is free software: you can redistribute it and/or modify\n")
8277 (insert "it under the terms of the GNU General Public License as published by\n")
8278 (insert "the Free Software Foundation, either version 3 of the License, or\n")
8279 (insert "(at your option) any later version.\n")
8280 (insert "\n")
8281 (insert "This program is distributed in the hope that it will be useful,\n")
8282 (insert "but WITHOUT ANY WARRANTY; without even the implied warranty of\n")
8283 (insert "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")
8284 (insert "GNU General Public License for more details.\n")
8285 (insert "\n")
8286 (insert "You should have received a copy of the GNU General Public License\n")
8287 (insert "along with this program. If not, see <http://www.gnu.org/licenses/>.\n")
8288 (comment-region beg (point))))
8289
8290 (global-set-key (kbd "C-M-7") 'insert-full-copyright)
8291
8292 #+end_src
8293 ]
8294 *** C-S-7
8295 :PROPERTIES:
8296 :CUSTOM_ID: 05f5737b-a320-403c-a8f1-fa0a02f679e1
8297 :END:
8298 *** C-0
8299 :PROPERTIES:
8300 :CUSTOM_ID: 96ae2fcc-3a0c-40c4-aef8-06aff3fd42be
8301 :END:
8302 text-scale-reset
8303 [
8304 #+begin_src emacs-lisp
8305 (defun text-scale-reset ()
8306 (interactive)
8307 (text-scale-set 0))
8308 (global-set-key (kbd "C-0") 'text-scale-reset)
8309 #+end_src
8310 ]
8311 *** M-0
8312 :PROPERTIES:
8313 :CUSTOM_ID: c5735fdf-d0d9-468c-917c-3936e409a2bc
8314 :END:
8315 *** C-M-0
8316 :PROPERTIES:
8317 :CUSTOM_ID: 0e7f83a5-600e-4016-af98-95904300c016
8318 :END:
8319 insert-apache
8320 [
8321 #+begin_src emacs-lisp
8322 (defun insert-apache ()
8323 (interactive)
8324 (beginning-of-line)
8325 (let ((beg (point)))
8326 (insert "Copyright (C) 2016 Ian Kelling\n")
8327 (insert "\n")
8328 (insert "Licensed under the Apache License, Version 2.0 (the \"License\");\n")
8329 (insert "you may not use this file except in compliance with the License.\n")
8330 (insert "You may obtain a copy of the License at\n")
8331 (insert "\n")
8332 (insert " http://www.apache.org/licenses/LICENSE-2.0\n")
8333 (insert "\n")
8334 (insert "Unless required by applicable law or agreed to in writing, software\n")
8335 (insert "distributed under the License is distributed on an \"AS IS\" BASIS,\n")
8336 (insert "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n")
8337 (insert "See the License for the specific language governing permissions and\n")
8338 (insert "limitations under the License.\n")
8339 (comment-region beg (point))))
8340 (global-set-key (kbd "C-M-0") 'insert-apache)
8341 #+end_src
8342 ]
8343
8344 *** C-S-0
8345 :PROPERTIES:
8346 :CUSTOM_ID: d1706bc7-7cf0-4b49-87d0-15bf76eaca5f
8347 :END:
8348 *** C--
8349 :PROPERTIES:
8350 :CUSTOM_ID: 3713b701-b31a-4612-b663-f232005b4122
8351 :END:
8352 *** M--
8353 :PROPERTIES:
8354 :CUSTOM_ID: ca833b78-b279-4d1f-b1c9-6c70fdf20f57
8355 :END:
8356 *** C-M--
8357 :PROPERTIES:
8358 :CUSTOM_ID: 6febc7ea-9cc7-488c-af34-538b8e69633b
8359 :END:
8360 org-edit-src-exit
8361 *** C-S--
8362 :PROPERTIES:
8363 :CUSTOM_ID: c73af1d7-61f2-4c1b-935e-43f077d8d915
8364 :END:
8365 *** [C-y] :drill:
8366 SCHEDULED: <2014-03-27 Thu>
8367 :PROPERTIES:
8368 :ID: 4c0f74f8-04ed-40d8-8ec3-6e2bed03c2b9
8369 :CUSTOM_ID: 97aee7f1-3647-4602-a65a-45e8a3aa3a7c
8370 :DRILL_LAST_INTERVAL: 50.6823
8371 :DRILL_REPEATS_SINCE_FAIL: 3
8372 :DRILL_TOTAL_REPEATS: 3
8373 :DRILL_FAILURE_COUNT: 0
8374 :DRILL_AVERAGE_QUALITY: 5.0
8375 :DRILL_EASE: 5.815
8376 :DRILL_LAST_QUALITY: 5
8377 :DRILL_LAST_REVIEWED: <2014-02-04 Tue 11:45>
8378 :END:
8379 undo-tree-redo
8380 [
8381 #+begin_src emacs-lisp
8382 (global-set-key (kbd "C-y") 'undo-tree-redo)
8383 #+end_src
8384
8385 ]
8386 *** M-y
8387 :PROPERTIES:
8388 :CUSTOM_ID: 35072ca8-7fd6-4a64-bc7a-2636de575bd1
8389 :END:
8390 *** C-M-y
8391 *** C-S-y
8392 :PROPERTIES:
8393 :CUSTOM_ID: 964fa784-37e3-48c6-af4b-c7e91f67a93a
8394 :END:
8395 *** C-\
8396 :PROPERTIES:
8397 sr-speedbar-toggle
8398 :CUSTOM_ID: b8ad3ee9-7bf6-4069-a300-49cd298008a7
8399 :END:
8400 [
8401 #+begin_src emacs-lisp
8402 (global-set-key (kbd "C-\\") 'sr-speedbar-toggle)
8403 #+end_src
8404 ]
8405 *** M-\
8406 :PROPERTIES:
8407 :CUSTOM_ID: c1d53d84-b8a9-49cb-bfd6-4420931c8873
8408 :END:
8409 *** [C-M-\] :drill:
8410 SCHEDULED: <2014-03-21 Fri>
8411 :PROPERTIES:
8412 mark-defun
8413 :ID: d45bce17-45bc-41f0-8994-aa7bc3b2fa92
8414 :CUSTOM_ID: 6a583354-48f8-4503-bf87-b8ba56411435
8415 :DRILL_LAST_INTERVAL: 11.7003
8416 :DRILL_REPEATS_SINCE_FAIL: 4
8417 :DRILL_TOTAL_REPEATS: 9
8418 :DRILL_FAILURE_COUNT: 6
8419 :DRILL_AVERAGE_QUALITY: 2.815
8420 :DRILL_EASE: 2.369
8421 :DRILL_LAST_QUALITY: 3
8422 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:36>
8423 :END:
8424 mark-defun
8425 [
8426 #+begin_src emacs-lisp
8427 (global-set-key (kbd "C-M-\\") 'mark-defun)
8428 #+end_src
8429 ]
8430 *** C-S-\
8431 :PROPERTIES:
8432 :CUSTOM_ID: 30edfb48-852f-4f2c-ba38-2635927d4950
8433 :END:
8434 *** C-h
8435 :PROPERTIES:
8436 :CUSTOM_ID: 3c5f241f-fc62-459d-ab85-6b7c1fb04801
8437 :END:
8438 help-prefix
8439
8440 *** M-h
8441 :PROPERTIES:
8442 :CUSTOM_ID: 6df13b90-490b-4cca-a49d-4f2e3ce5bea3
8443 :END:
8444 *** C-M-h
8445 :PROPERTIES:
8446 :CUSTOM_ID: 47f0d1f3-78ea-49d7-a6d7-06627ca745bd
8447 :END:
8448 *** C-S-h
8449 :PROPERTIES:
8450 :CUSTOM_ID: 3be3db5c-9905-474b-b773-1aee515625f5
8451 :END:
8452 *** C-'
8453 :PROPERTIES:
8454 :CUSTOM_ID: 9f252721-a2d5-46c6-b268-8ed597256229
8455 :END:
8456 eval-expression
8457 [
8458 #+begin_src emacs-lisp
8459 (global-set-key (kbd "C-'") 'eval-expression)
8460 #+end_src
8461 ]
8462 *** M-'
8463 :PROPERTIES:
8464 :CUSTOM_ID: f00b9c88-68bb-4831-872f-afb5ff82c104
8465 :END:
8466 *** C-M-'
8467 :PROPERTIES:
8468 :CUSTOM_ID: 0d39d36c-115a-4570-b4b1-818718409a49
8469 :END:
8470 *** C-S-'
8471 :PROPERTIES:
8472 :CUSTOM_ID: 230f50ef-48fd-4f13-aa62-e4a492c4515d
8473 :END:
8474 *** [C-n] :drill:
8475 SCHEDULED: <2014-04-07 Mon>
8476 :PROPERTIES:
8477 unpop-to-mark-command
8478 :CUSTOM_ID: 52ebb720-589b-485c-89dc-0dfb78e6dad4
8479 :ID: 32f1c87d-ee1f-4117-8059-32fd8facbeff
8480 :DRILL_LAST_INTERVAL: 42.8284
8481 :DRILL_REPEATS_SINCE_FAIL: 4
8482 :DRILL_TOTAL_REPEATS: 4
8483 :DRILL_FAILURE_COUNT: 0
8484 :DRILL_AVERAGE_QUALITY: 4.5
8485 :DRILL_EASE: 4.122
8486 :DRILL_LAST_QUALITY: 5
8487 :DRILL_LAST_REVIEWED: <2014-02-23 Sun 01:51>
8488 :END:
8489 unpop to mark
8490 [
8491 #+begin_src emacs-lisp
8492 (defun unpop-to-mark-command ()
8493 "Unpop off mark ring. Does nothing if mark ring is empty."
8494 (interactive)
8495 (when mark-ring
8496 (let ((pos (marker-position (car (last mark-ring)))))
8497 (if (not (= (point) pos))
8498 (goto-char pos)
8499 (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring))
8500 (set-marker (mark-marker) pos)
8501 (setq mark-ring (nbutlast mark-ring))
8502 (goto-char (marker-position (car (last mark-ring))))))))
8503
8504 (global-set-key (kbd "C-n") 'unpop-to-mark-command)
8505 #+end_src
8506 ]
8507 *** M-n
8508 :PROPERTIES:
8509 :CUSTOM_ID: 00c2ab64-696d-4492-8236-f7ebc12e4a93
8510 :END:
8511 *** [C-M-n] :drill:
8512 SCHEDULED: <2014-03-17 Mon>
8513 :PROPERTIES:
8514 narrow-to-region
8515 :ID: 59e48dcc-434b-4c96-bdb3-c083c41ae8b3
8516 :CUSTOM_ID: 43997316-8d3f-4750-873b-ade09628fdd5
8517 :DRILL_LAST_INTERVAL: 7.6409
8518 :DRILL_REPEATS_SINCE_FAIL: 3
8519 :DRILL_TOTAL_REPEATS: 8
8520 :DRILL_FAILURE_COUNT: 4
8521 :DRILL_AVERAGE_QUALITY: 2.59
8522 :DRILL_EASE: 2.261
8523 :DRILL_LAST_QUALITY: 3
8524 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:34>
8525 :END:
8526 narrow-to-region
8527 [
8528 #+begin_src emacs-lisp
8529 (global-set-key (kbd "C-M-n") 'narrow-to-region)
8530 #+end_src
8531 ]
8532 *** C-S-n
8533 :PROPERTIES:
8534 :CUSTOM_ID: f01c2c61-f606-49ea-885a-63a831eaae3d
8535 :END:
8536 *** C-rshift
8537 *** M-rshift
8538 *** C-M-rshift
8539 *** C-S-rshift
8540 *** [C-escape] :drill:
8541 SCHEDULED: <2014-04-05 Sat>
8542 :PROPERTIES:
8543 find-tag
8544 :ID: a6dd7e4c-1831-4493-bbfd-557dc2f9c856
8545 :CUSTOM_ID: 6901fa1b-c827-4525-b24b-bdb8fe5f638b
8546 :DRILL_LAST_INTERVAL: 27.3693
8547 :DRILL_REPEATS_SINCE_FAIL: 5
8548 :DRILL_TOTAL_REPEATS: 6
8549 :DRILL_FAILURE_COUNT: 2
8550 :DRILL_AVERAGE_QUALITY: 3.417
8551 :DRILL_EASE: 2.676
8552 :DRILL_LAST_QUALITY: 4
8553 :DRILL_LAST_REVIEWED: <2014-03-09 Sun 18:37>
8554 :END:
8555 find-tag
8556 [
8557 #+begin_src emacs-lisp
8558 (global-set-key (kbd "<C-escape>") 'find-tag)
8559 #+end_src
8560 ]
8561 *** M-escape
8562 :PROPERTIES:
8563 :ID: 7224837b-addc-4c82-8313-467c6dcb7a52
8564 :CUSTOM_ID: f505f1b9-82f6-4139-9e3e-78df548175ec
8565 :END:
8566 *** C-M-escape
8567 :PROPERTIES:
8568 :CUSTOM_ID: d77136c5-4aec-4f02-8b4b-e417249fbac1
8569 :END:
8570 *** C-S-escape
8571 :PROPERTIES:
8572 :CUSTOM_ID: d61ae40a-3f2d-4ef6-a515-8864a7d7c8ea
8573 :END:
8574 * keybind table src
8575 :PROPERTIES:
8576 :CUSTOM_ID: ff8f3092-187a-4b2c-940f-01743f7a51b6
8577 :END:
8578 not necessary to have at the end, but its convenient to have it next
8579 to its output.
8580 #+NAME: keybind-table-generator
8581 #+BEGIN_SRC emacs-lisp :results silent
8582 (defun org-custom-id-get (&optional pom create prefix)
8583 "Get the CUSTOM_ID property of the entry at point-or-marker POM.
8584 If POM is nil, refer to the entry at point.
8585 If the entry does not have a CUSTOM_ID, the function returns nil.
8586 However, when CREATE is non nil, create an ID if none is present already.
8587 PREFIX will be passed through to `org-id-new'.
8588 In any case, the CUSTOM_ID of the entry is returned."
8589 (org-with-point-at pom
8590 (let ((id (org-entry-get nil "CUSTOM_ID")))
8591 (cond
8592 ((and id (stringp id) (string-match "\\S-" id))
8593 id)
8594 (create
8595 (setq id (org-id-new prefix))
8596 (org-entry-put pom "CUSTOM_ID" id)
8597 (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
8598 id)))))
8599
8600 (defun get-title()
8601 (interactive)
8602 (let ((title (plist-get (cadr (org-element-at-point)) ':title)))
8603 ;; remove brackets from [title]
8604 (string-match "[^[ ][^]]*" title)
8605 (setq title (match-string 0 title))
8606 (print title)
8607 title))
8608
8609
8610 (defun org-dblock-write:keybind-dblock (arg)
8611 (let (output)
8612 (save-excursion
8613 (goto-char (org-find-entry-with-id "beginning-of-keybind-table-data"))
8614 (let* ((table-level (org-current-level))
8615 (keybind-level (1+ table-level))
8616 (prefixes (list "C-M-S-" "C-M-" "C-S-" "M-S-" "M-" "C-" "S-"))
8617 table-title
8618 previous-prefixes
8619 )
8620 (while (>= (org-current-level) table-level)
8621 (setq table-title (get-title))
8622 (outline-next-heading)
8623 (let (found-prefixes
8624 found-all-prefixes)
8625 ;; go through the first few elements of the table to find out what column headings aka prefixes it should have
8626 (save-excursion
8627 (while (not found-all-prefixes)
8628 (let ((prefixes-copy prefixes)
8629 current-prefix
8630 found-prefix)
8631 (while (and prefixes-copy (not found-prefix))
8632 (setq current-prefix (car prefixes-copy))
8633 (when (and (> (length (get-title)) (length current-prefix))
8634 (string= (substring (get-title) 0 (length current-prefix)) current-prefix))
8635 (setq found-prefix t))
8636 (setq prefixes-copy (cdr prefixes-copy)))
8637 (unless found-prefix
8638 (setq current-prefix ""))
8639 (if (and found-prefixes (string= (car (last found-prefixes)) current-prefix))
8640 (setq found-all-prefixes t)
8641 (push current-prefix found-prefixes)))
8642 (outline-next-heading)))
8643 (setq found-prefixes (reverse found-prefixes))
8644
8645 ;; start a new table or repeat the prefixes in the current table
8646
8647 (if (or (not previous-prefixes) (equal previous-prefixes found-prefixes))
8648 (setq output (concat output "|-|\n| "))
8649 (setq output (concat output "|-|\n\n|-|\n| ")))
8650 (setq output (concat output table-title " | "))
8651 (setq previous-prefixes found-prefixes)
8652
8653 ;; add the prefixes
8654 (dolist (prefix found-prefixes)
8655 (setq output (concat output prefix "|")))
8656 (setq output (concat output "\n|-|\n"))
8657
8658
8659 (let (subtree-end)
8660 (while (>= (org-current-level) keybind-level)
8661 (dotimes (i (length found-prefixes))
8662 ;; add keybind name
8663 (when (= i 0)
8664 (setq output (concat output "| " (substring (get-title) (length (car found-prefixes))) " | ")))
8665 ;; add keybinds by searching for regex [keybind] to the start of the next heading
8666 (save-excursion
8667 (outline-next-heading)
8668 (setq subtree-end (point)))
8669 ;; skip over scheduled line
8670 (re-search-forward "^SCHEDULED:" subtree-end t)
8671
8672 ;; see comment after source block to understand this regex
8673 (re-search-forward "^\\s-*\\([^*: ].*?$\\)" subtree-end t)
8674 (let ((m (match-string 1)))
8675 (when m
8676 (setq output (concat output "[[#" (org-custom-id-get (point) 'create) "][" m "]]")))
8677 (setq output (concat output " | ")))
8678 ;; advance to next keybind
8679 (outline-next-heading))
8680 (setq output (concat output "\n"))
8681 ))))))
8682 (setq output (concat output "|-|"))
8683 (insert output))
8684 (org-table-map-tables 'org-table-align 'quietly))
8685
8686
8687 #+END_SRC
8688 after source block due to bad parsing of comments in non emacs lisp mode
8689 some easily forgotten regex elements. whitespace: \\s-
8690 non-greedy star: *?
8691 subexpression for close bracket char or nothing: \\(\\]\\|\\)
8692
8693 * keybind tables
8694 dunno why but it takes doing ctrl-c twice to update this
8695 #+BEGIN: keybind-dblock
8696 |---------------------+------------------------|
8697 | single/special keys | |
8698 |---------------------+------------------------|
8699 | tab key | [[#6c10a716-1d8e-4ce4-8e26-64468f19c17a][isearch]] |
8700 | tab | [[#51ece189-1840-41a1-8ca0-19f9a0481895][isearch-forward]] |
8701 | end | [[#00d589b7-2b8e-494c-b761-3afefebe6ec6][move-end-of-line]] |
8702 | home | [[#7800e455-c3f6-4a8f-8907-b2292449ab67][back-to-indentation]] |
8703 | s-tab | [[#3072901e-5cf3-4d6e-9ac8-3ef64a5f6ad2][indent-buffer]] |
8704 | s-delete | [[#e53728b6-054d-4443-a03e-6cf02d13724d][send-shell]] |
8705 | s-left arrow | [[#d8c473ac-5507-4a6b-9e5a-46558c17b09f][shell]] |
8706 | s-right arrow | [[#2365f5a7-b89a-4a97-b272-ac8ae9c2cc66][previous-buffer]] |
8707 | esc | |
8708 | return | [[#fab6adea-ed20-45ab-a0a3-776c68d5c3a5][new line]] |
8709 | s-return | [[#819cfb55-3a2f-4f20-8591-f819d1a6869a][auto-correct-prev-word]] |
8710 | down arrow | [[#7a868484-9c63-4a73-abda-7751cb2c02be][mark]] |
8711 | s-down arrow | [[#097b97e0-8ad8-40f7-8388-c4ace1706b38][extended command]] |
8712 | s-up arrow | |
8713 |---------------------+------------------------|
8714
8715 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------------+-------------|
8716 | mouse | | C- | M- | S- | C-M- | C-S- |
8717 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------------+-------------|
8718 | mouse-2 mode line | [[#69aaa631-6fb5-4beb-b2d8-c0f3d92c0a98][mouse-delete-other-windows]] | [[#501479ab-e1e2-497e-bd86-071f8afa3378][mouse-split-window-horizontally]] | | | | |
8719 | mouse-3 mode line | [[#917a1844-8c38-4f31-8616-50fc81334f2c][mouse-delete-window]] | | | | | |
8720 | mouse-1 | [[#4e60e2e4-8c2f-4450-8060-2d793ede530c][set cursor/mark]] | [[#b661f84f-57df-4095-9dc1-d1a876a53ee5][buffer list context menu]] | | | | |
8721 | mouse-2 | [[#086b0b50-054f-462d-92fa-b27852f887b0][paste]] | | | | | |
8722 | mouse-3 | [[#0481632e-9c50-4328-9365-c4b5bf967b66][set-mark]] | [[#9623c78f-7705-4cbe-a990-c24eb1067377][global menu]] | | | | |
8723 | mouse-9 | [[#efaec161-b279-4129-86fd-b410430926e4][move-mouse-to-point]] | | | | | |
8724 | mouse-8 | | | | | | |
8725 | 1/kp-end | | | | | | |
8726 | 2/kp-down | | | | | | |
8727 | 3/kp-next | | | | | | |
8728 | 4/kp-left | [[#c44d0f65-9502-4cc6-9642-96d907f6b093][indent-region]] | | | | | |
8729 | 5/kp-begin | [[#2458c6bc-7113-4d4b-bbdf-206e1cb842a7][mark-defun]] | | | | | |
8730 | 6/kp-right | [[#3b79bc58-6067-43bd-9471-9d592744a25a][ibuffer]] | | | | | |
8731 | 7/kp-home | | | | | | |
8732 | 8/kp-up | | | | | | |
8733 | 9/kp-prior | [[#a3b51adb-4405-4d9f-9b88-a8faa479fbe7][delete-horizontal-space]] | | | | | |
8734 | 10/kp-insert | | | | | | |
8735 | 11/kp-subtract | | | | | | |
8736 | 12/kp-add | | | | | | |
8737 | scroll | [[#33433f0f-5b0e-46ba-8452-d2a51e54769b][up/dn / scroll]] | [[#16506ba5-e8f2-4aec-bc1b-d2854d4e504c][cycle recent buffers]] | [[#e1e2e253-450d-4620-af9e-78d378f49ad5][forward/back s-exp]] | [[#74b2196a-345d-453a-b7be-1915360eb201][expand region]] | [[#bd2ca117-408c-49fc-a5ac-a938be21dfc0][scroll]] | [[#a69254a4-cf2d-450f-b477-2694b44a7e0d][zoom]] |
8738 | left-scroll | [[#d2d5c5c7-f0de-4e08-953b-d41d3e282ba7][left/right]] | [[#7bb95aa5-381e-454a-a6c6-aaeec728db08][back / forward word]] | [[#49db3764-b154-4cfc-8d0d-f0e0451815e3][winner undo redo]] | [[#ca5cdcd4-b3da-4d7b-86ab-4c7c0ac2caf7][---]] | [[#32c00bb2-3e5a-4670-8849-04d23b9f8364][forward/back sexp]] | [[#7b4f1f49-6d93-4210-a30c-8278d6e63655][unreachable]] |
8739 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------------+-------------|
8740
8741 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8742 | left primary | C- | M- | C-M- | C-S- |
8743 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8744 | 2 | [[#4f29b011-3844-4a4a-b75d-cdf8f49e9adb][narrow-to-defun/subtree]] | | [[#33c4996d-92bc-4df0-b005-11553677be13][---]] | |
8745 | 3 | [[#7851a05e-7177-4a8f-af5a-3325a8f116fe][dot-mode-execute]] | | [[#9a00e17f-a1c9-48fc-b03b-c6a1a3cbda1c][recenter-top-bottom]] | |
8746 | q | [[#679fd3cd-c43b-409c-be36-4175a5f27cd3][org-cycle, comint previous arg]] | [[#72bada0e-5d62-4a8f-ae62-4972778ff1bc][org-archive-to-archive-sibling]] | [[#1f5e9b63-7ce0-445c-a426-b41839585d38][quoted-insert]] | |
8747 | w | [[#20005b6d-9a9d-4b58-882c-7ce860c7a395][goto-t.org]] | [[#331da6e5-7936-4663-8f58-9d8601b5915c][org-clock-in]] | | |
8748 | e | [[#24e34f4b-d1e8-4380-933f-ab1f78ebc782][copy-line]] | [[#0a771449-0cd5-4dc9-82ca-bcac5f7abd17][org-clock-in-last]] | | |
8749 | r | [[#5c55f461-f43f-493d-81eb-1ca747175ef1][isearch-backward]] | [[#dd9575bd-e471-418e-9519-4fc2b874ddcd][org-clock-out]] | | |
8750 | a | [[#db4b76df-9420-4256-8242-dc44b56d55d7][copy-all]] | [[#e865a1e5-55bf-4a98-a0d0-cb05a88de352][kmacro-start-macro-or-in...]] | [[#c6278a5a-024f-4c80-a8d4-65f127fd24a8][kmacro-end-or-call-macro]] | |
8751 | s | [[#01da04da-cdba-493f-892b-c4c064cf937e][C-x prefix]] | | [[#4b33022d-27f0-4d21-9931-2e2e692790e8][split-window-vertically]] | |
8752 | d | [[#b699614a-9994-4fe7-b2c6-f0fe81b7ad2b][C-c prefix]] | [[#06bcc5e2-f3a7-41c6-a793-ac6c9813fb6e][whitespace-cleanup]] | [[#8cf6053d-792b-4abd-a3a6-66efd7fbee68][swap buffer]] | |
8753 | f | [[#2695ed8a-e0d3-4e84-8688-98e3c50723b0][kill-whole-line]] | | [[#e7e4dd0b-418f-48ee-b366-9e733e3bec61][kill rest of line]] | |
8754 | g | [[#4af40595-7010-4be6-8cfe-a43797ca6e33][other-window / cancel]] | [[#fb0b343f-fdff-463a-94f4-3152191e17c4][abort-recursive-edit]] | [[#327e18af-30b7-47e5-aa53-5f678788b4c1][gnus]] | |
8755 | z | [[#707c4938-a790-4da9-8230-61855ea57d09][undo-tree-undo]] | | | |
8756 | x | [[#ec1403d3-528e-41b1-a195-5563bc93e124][kill-region]] | [[#bb7c95d5-dd97-439d-bf1f-cdac98d11543][append-next-kill]] | [[#c988370e-602c-431c-80a9-608459583f8b][append-next-kill]] | |
8757 | c | [[#400f06e1-8e45-443c-8d7b-3d1bb1176aab][copy]] | [[#f4c3317a-a317-4d04-8cb7-e46d0716bf1d][org-capture]] | [[#0a151d99-47ae-4e8f-8407-82e77d24a3e7][copy-to-register]] | |
8758 | v | [[#16411f68-7fe0-49e8-9a73-212471594f9e][yank]] | [[#d67f6371-a13f-4a75-8d8c-e4013ff4e131][insert-register]] | [[#25f86658-9999-40f7-b3a4-615981751b93][yank pop]] | |
8759 | b | [[#e682305e-0110-4d2f-afbd-2c401bcb9313][delete-other-windows]] | [[#05e3d0db-36dc-455f-8bed-f87886ca6004][isearch-backward-current-symbol]] | [[#6c63790c-28c1-4b73-96e2-ee859f57e734][isearch-current-symbol]] | |
8760 | tab | [[#edc45592-c69f-4439-8305-48f2c65696c3][yas-insert-snippet]] | [[#71264957-45fd-455a-a6d1-b08823c02d25][indent line]] | | |
8761 | delete | [[#2688b61d-9fdd-44af-b9bd-b126f0da00bd][kill-symbol]] | | [[#21876759-a8e6-4896-8a08-eda40d0eaff3][kill-sexp]] | |
8762 | left-arrow | [[#b15da91f-0786-49d1-b0b9-331b3b94f6ae][compile]] | | [[#13faf5d4-34be-4363-948d-4ff04a9f570b][org-shiftup]] | |
8763 | right-arrow | [[#3f3cac16-097d-451a-a14a-da7717d06730][paste selection]] | | [[#34e66314-1d97-4eeb-b704-fe0733849ae4][org-shiftdown]] | |
8764 | backspace | [[#85bb4701-42e6-4617-8de8-dfb1f03b0358][backward-kill-symbol]] | | [[#606b0991-7431-4a8a-a909-b872e104cc88][backward-kill-sexp]] | |
8765 | f7 | | | | |
8766 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8767 | right primary | C- | M- | C-M- | C-S- |
8768 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8769 | * | [[#f745b337-8b65-44cc-849a-5e0953c9ebd9][split-window-horizontally]] | | [[#5dbe3437-7364-4802-b558-00b2d5faacf6][calc-dispatch]] | |
8770 | 9 | [[#43d14154-2722-4ba5-b547-1b78c6274ebf][delete-window-or-exit]] | [[#9dc95338-4321-4354-9de2-69409f383a10][kill-buffer-and-window]] | [[#ffe9f636-31e5-48ba-b8fe-7c158ace744c][kill client buffer]] | |
8771 | u | [[#327992c0-6eba-4935-aec1-49871c2a8619][universal-argument]] | | [[#62735d64-b89a-46b7-b32e-2453b651039d][search-keybind]] | |
8772 | i | [[#3124e200-1d6e-4ad2-9a36-0d03e1e7dc38][-----]] | | [[#a3260b61-7c51-4d97-9a91-3ed702c5ae29][query-replace-regexp]] | |
8773 | o | [[#82215193-63b3-4d63-8f70-d11a328fe72d][occur]] | | [[#05d1ef50-43ee-46d7-b1ad-dd952543ab45][ido-goto-symbol]] | |
8774 | p | [[#9c2e2ba9-f34e-48fe-b4ff-b9826882c1cc][move-mouse-to-point]] | | [[#d55616d3-a3f6-4e83-8807-748578a7b726][delete-horizontal-space]] | |
8775 | j | [[#ebcf7c71-3c93-431b-af6b-7c5df7f2945e][register prefix]] | [[#474a3e12-95ac-4f43-b83a-36716f3e6f76][previous-error]] | | |
8776 | k | [[#25a7ba1c-ddf3-47f1-9516-914a552e7a36][jump to register]] | [[#a96691bb-9e4c-414b-a093-d9961d453e21][next-error]] | [[#f61ea4ea-4597-422e-b7e3-d3cfad82603d][man]] | |
8777 | l | [[#8a7572bd-4b5e-4464-b937-3d35adb1783f][ido-switch-buffer]] | | [[#24b660d4-3ec4-4416-8a6a-b8224ed1ee8b][move cursor top bottom mid]] | |
8778 | ; | [[#7e3710eb-5460-4460-8bf0-488302e4ce35][comment-dwim]] | | [[#28680a96-5223-4632-80b9-b1facdd541e7][comment-current-line-dwim]] | |
8779 | m | [[#deee53ba-dfa2-4910-894c-55ae98d11aa4][pop-to-mark]] | | [[#f283f705-cba0-45db-b80f-5d20415b2eee][recursive grep]] | |
8780 | , | [[#6cbf3a85-f260-453a-920b-850ff5e986b1][ido-find-file]] | | [[#bfdf6111-029d-462b-bcca-50a3ed2162d5][find-file-in-project]] | |
8781 | . | [[#0675c171-8677-44a8-882c-e7ed42715e31][recentf-ido-find-file]] | | [[#824d422c-67b6-4d68-af11-6a2135e528f5][-]] | |
8782 | / | [[#941a7fa8-84b9-434d-89a0-1487385ec479][join lines]] | | [[#37f67593-4f60-4d3b-9aad-6c9bc4882443][copy-variable]] | |
8783 | 8 | [[#251c4a1a-a683-4804-a706-d0d3752e42fa][calc-embedded-word]] | | | |
8784 | up-arrow | [[#f47d312a-063d-42ed-a352-176298a2cb0c][back defun/headline]] | | | |
8785 | down-arrow | [[#27435136-b3d7-4f25-aa85-2a7363a7f366][forward dfun/headline]] | | [[#3bcb35fd-6d54-4213-b94f-2739c0bc0041][toggle-mark-activation]] | [[#1434bdd0-c5a8-4c96-9b92-9474e88fd1c5][smex-major-mode-commands]] |
8786 | lbracket | [[#9d9916dd-3280-47dd-aab1-cd28d5ebfe15][----]] | | [[#7411b1a5-c8fa-4bcc-8788-798e5635dd62][scroll-right]] | |
8787 | rbracket | [[#21b38c6b-3a46-4a08-8eca-d44abb148287][fill-paragraph]] | | [[#c9c18f48-d0ca-4a1b-a751-7165f40118a3][scroll-left]] | |
8788 | return | [[#baf7ea5a-d16d-4fee-a6ce-542cc11beb97][newline next line]] | [[#e6895ad3-a2c8-46c8-abbc-1bba94a88596][non-indented newline]] | [[#2a8fc6ea-a550-4437-9e35-3b3f2776788a][open newline on previous line]] | |
8789 | space | [[#132daa1a-8e5f-47f1-a28d-35bee873aeac][org-edit-special]] | | [[#02359b66-bf6e-4f41-9f03-e83fcbe3e68c][spell check word]] | |
8790 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8791 | left secondary | C- | M- | C-M- | C-S- |
8792 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8793 | = | | | | |
8794 | 1 | | | | |
8795 | 4 | | | [[#3ff50f5f-f286-4a73-962b-58dbcf3b09b1][widen]] | |
8796 | 5 | | | | |
8797 | tab-key | [[#68313551-90cd-47a6-8170-1745348add17][query-replace]] | | | |
8798 | t | [[#aaac3048-9125-4fd5-b8f2-21bafcc1ff1c][org change todo state]] | | [[#5bc609b1-9428-4b82-a55d-811fefe65331][org insert timestamp]] | |
8799 | home | [[#1919659a-b466-4519-9276-8bf06a916066][start of buffer]] | | | |
8800 | end | [[#0a7bd629-cbcc-4761-8fe2-cc9370b985a4][end of buffer]] | | | |
8801 | f9 | | | | |
8802 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8803 | right secondary | C- | M- | C-M- | C-S- |
8804 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8805 | 6 | [[#e44e584b-d925-4036-9ad5-a90d02e74bef][save-buffers-kill-emacs]] | | [[#da73de75-0914-4f48-81d5-9b408433b14b][insert-small-copyright]] | |
8806 | 7 | | | [[#a68c6b8e-9911-475e-ab35-e239771fe881][insert-full-copyright]] | |
8807 | 0 | | | | |
8808 | - | | | | |
8809 | y | [[#97aee7f1-3647-4602-a65a-45e8a3aa3a7c][undo-tree-redo]] | | | |
8810 | \ | [[#b8ad3ee9-7bf6-4069-a300-49cd298008a7][sr-speedbar-toggle]] | | [[#6a583354-48f8-4503-bf87-b8ba56411435][mark-defun]] | |
8811 | h | [[#3c5f241f-fc62-459d-ab85-6b7c1fb04801][help-prefix]] | | | |
8812 | ' | [[#9f252721-a2d5-46c6-b268-8ed597256229][eval-expression]] | | | |
8813 | n | [[#52ebb720-589b-485c-89dc-0dfb78e6dad4][unpop-to-mark-command]] | | [[#43997316-8d3f-4750-873b-ade09628fdd5][narrow-to-region]] | |
8814 | rshift | | | | |
8815 | escape | [[#6901fa1b-c827-4525-b24b-bdb8fe5f638b][find-tag]] | | | |
8816 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
8817 #+END:
8818
8819 * persistent registers
8820 This needs to be at the end, because I visit a file, thus setting a
8821 mode, and the mode hook needs to be setup before that.
8822
8823 I'm using persistent registers instead of bookmarks. I dun use them
8824 much, so the added hassle of having to set it within this file is
8825 worth the benefit of only having one concept in my mind.
8826 #+begin_src emacs-lisp
8827 (dolist
8828 (r `(
8829 (?i (file . ,"~/.emacs.d/my-init.org"))
8830 (?t (file . ,"/a/x.txt"))
8831 ))
8832 (set-register (car r) (cadr r)))
8833 #+end_src
8834
8835 * keybind notes
8836 common keys, which would be better off doing swaps than rebinds:
8837 c-x prefix -> c-s
8838 c-c prefix -> c-d
8839 yank c-y -> c-c
8840 search c-s -> kp-add
8841 kill line c-k -> c-f
8842 undo c-_ -> c-z
8843 set-mark-command c-@ -> kp-enter
8844 quoted-insert c-q -> c-m-q
8845 recenter-top-bottom c-l -> c-m-3
8846 kill-region c-w -> c-x
8847
8848 commands to make less accessible
8849 narrow-to-defun/subtree -> M-2 maybe
8850 occur
8851
8852 command to make more accessible, ...
8853
8854
8855 * misc useful functions I'd rather have in a list than burried
8856 #+begin_src emacs-lisp :tangle no
8857 ;; these are usefull with (goto-char)
8858 ;; find named entity, other than headline
8859 (org-find-entry-with-id "string-number-or-symbol")
8860
8861 (org-find-exact-headline-in-buffer "heading" nil t)
8862
8863 (byte-recompile-file (expand-file-name "~/.emacs.d/my-init.el") t 0)
8864 (byte-recompile-directory (expand-file-name "~/.emacs.d") 0)
8865 (byte-recompile-directory (expand-file-name "~/.emacs.d/src/haskell-mode") 0)
8866
8867 ;; remove any indent level which is throughout the buffer
8868 (org-do-remove-indentation)
8869
8870 #+end_src
8871
8872 * TESTING / DEVELOPMENT AREA
8873
8874 :PROPERTIES:
8875 :tangle: no
8876 :END:
8877 ** new
8878 #+begin_src emacs-lisp
8879
8880
8881 #+end_src
8882
8883 ** key logging
8884 this article convinced me that trying to experiment with modal editing is a waste.
8885 http://chrisdone.com/posts/speculations-on-exclusive-editing
8886 I want to record my emacs commands simply to find optimiaztions, like if I often do some M-x command and should bind it
8887 to a key.
8888
8889
8890 #+begin_src emacs-lisp :tangle no
8891
8892 (setq keylog-list nil)
8893 (setq keylog-mode nil)
8894
8895 (defun keylog-save ()
8896
8897 ;; Check that the lock file does not exist
8898 (when (keyfreq-file-is-unlocked)
8899 ;; Lock the file
8900 (keyfreq-file-claim-lock)
8901
8902 ;; Check that we have the lock
8903 (if (eq (keyfreq-file-owner) (emacs-pid))
8904 (unwind-protect
8905 (progn
8906 ;; Load values and merge them with the current keyfreq-table
8907 (keyfreq-table-load table)
8908
8909 ;; Write the new frequencies
8910 (with-temp-file keyfreq-file
8911 (prin1 (cdr (keyfreq-list table 'no-sort)) (current-buffer))))
8912
8913 ;; Release the lock and reset the hash table.
8914 (keyfreq-file-release-lock)
8915 (clrhash table))
8916 )))
8917
8918 (defun my-keylogger-function ()
8919 (setq keylog-list (cons (list (current-time) current-prefix-arg this-command) keylog-list)))
8920 (add-hook 'pre-command-hook 'my-keylogger-function)
8921
8922 #+end_src
8923
8924 in a lisp expression, ; \\[ throws off forward-sexp
8925 when not in emacs lisp mode,
8926 even with (with-syntax-table emacs-lisp-mode-syntax-table
8927 forward-sexp)
8928 which is found in preceding-sexp
8929 potentially a bug, either in with-syntax-table, or
8930 in scan-lists, which is implemented in C
8931
8932
8933
8934
8935 why did it go to the init file?
8936 change EDITOR to emacsclient
8937 xserver-xorg-core=2:1.14.3-3ubuntu2
8938 (setq-default header-line-format nil) ; Copy mode-line
8939 (setq-default mode-line-format nil) ;
8940
8941
8942 #+RESULTS:
8943 : set-food-completions
8944
8945
8946
8947 useless gnus group keys:
8948 a
8949 c
8950
8951
8952 (add-to-list 'load-path "~/.emacs.d/emacs/site-lisp/org")
8953
8954 #+begin_src emacs-lisp
8955 (add-hook 'org-mode-hook
8956 (lambda () (define-key org-mode-map (kbd "C-y") nil)))
8957
8958 #+end_src
8959
8960
8961
8962
8963 (defun comint-send-string (process string)
8964 "Like `process-send-string', but also does extra bookkeeping for Comint mode."
8965 (if process
8966 (with-current-buffer (if (processp process)
8967 (process-buffer process)
8968 (get-buffer process))
8969 (comint-snapshot-last-prompt))
8970 (comint-snapshot-last-prompt))
8971 (process-send-string process string))
8972
8973
8974 * python
8975 todo: get smart-operator to work
8976 todo, checkout https://github.com/python-rope/ropemacs refactoring python,
8977 todo, try py-autopep8, autoformatter
8978 todo, check out some python linting stuff. pychecker is one, others are in *packages*
8979 todo, finish reading through python-mode.el functions
8980 ;; todo, figure out multi-line input in shell mode
8981
8982
8983 usefull m-x commands:
8984 m-x py-describe-mode: doc for mode which is extensive
8985 m-x py-sort-imports
8986 m-x py-guess-indent-offset: setup indent for code i didn't write
8987
8988 possibly usefull commands:
8989 found via looking through python-mode.el, quit like 1/4 through, cuz its tedious, last spot was at:
8990 (defun py-comment-region (beg end &optional arg)
8991 after finding py-describe-mode, it seemed to do a good job of documenting all the most important stuff
8992
8993 py-switch-to-python
8994 python-shell-completion-complete-or-indent may be usefull to get completion working in the shell
8995 py-insert-default-shebang
8996 py-electric-*
8997 py-indent-line-outmost
8998 py-newline-and-close-block
8999 py-indent-and-forward (indent line, move to next)
9000 py-fill-*
9001 py-which-function (for showing in the modeline)
9002 py-help-at-point
9003 py-execute-import-or-reload
9004 py-execute-def-or-class
9005 various pdb functions
9006
9007
9008 installing jedi
9009 #+begin_src sh :tangle no
9010 pi python-pip
9011 s pip install jedi virtualenv
9012 #+end_src
9013 then do m-x jedi:install-server
9014
9015
9016
9017 disabled because it takes 152 ms to load,
9018 and I don't know how to do it conditioally
9019 #+begin_src emacs-lisp :tangle no
9020
9021 ;; change from default python3 to be compatibile with Pywikibot
9022 (setq py-shell-name "/usr/bin/python")
9023 (require 'python-mode)
9024
9025 (setq py-autopep8-options '("--max-line-length=110"))
9026
9027 (defun py-execute-block-or-clause-create-shell ()
9028 (interactive)
9029 (cond ((get-buffer "*Python*")
9030 (py--execute-prepare "block-or-clause")
9031 (py-execute-block-or-clause)
9032 (call-interactively 'next-line))
9033 (t
9034 (py-shell)
9035 ;; py-shell starts the shell but not display the buffer on the first run
9036 ;; subsequent runs, it does. I grabbed this command from inside to
9037 ;; do just the relevant part from the second run, as a hack.
9038 ;; todo: report a bug on this
9039 (py--shell-manage-windows py-buffer-name))))
9040 (setq py-tab-shifts-region-p t)
9041 (setq py-tab-indents-region-p t)
9042
9043 (defun py-run ()
9044 "default action to run the current buffer"
9045 (basic-save-buffer)
9046 (py-execute-buffer))
9047
9048
9049 (add-hook 'python-mode-hook
9050 (lambda ()
9051 (setq run-fun 'py-run)
9052 (define-key python-mode-map (kbd "C-M-a") nil)
9053 (define-key python-mode-map (kbd "C-M-d") nil)
9054 (define-key python-mode-map (kbd "C-M-e") nil)
9055 (define-key python-mode-map (kbd "C-M-h") nil)
9056 (define-key python-mode-map (kbd "C-M-i") nil)
9057 (define-key python-mode-map (kbd "C-M-u") nil)
9058 (define-key python-mode-map (kbd "C-M-x") nil)
9059 (define-key python-mode-map (kbd "<tab>") 'indent-for-tab-command)
9060 (define-key python-mode-map (kbd "C-j") nil)
9061 (define-key python-mode-map (kbd "<C-backspace>") nil)
9062 ;;(define-key python-mode-map (kbd "C-(") (lambda () (interactive) (basic-save-buffer) (py-execute-buffer)))
9063 ;; fix default return bindings
9064 (define-key python-mode-map (kbd "C-j") nil)
9065 (define-key python-mode-map (kbd "RET") nil)
9066 (define-key python-mode-map (kbd "<return>") 'py-newline-and-indent)
9067 (define-key python-mode-map (kbd "<M-tab>") 'py-indent-line)
9068 (define-key python-mode-map (kbd "C-M-(") 'py-shift-left)
9069 (define-key python-mode-map (kbd "C-M-)") 'py-shift-right)
9070 (define-key python-mode-map (kbd "<home>") 'py-beginning-of-line)
9071 (define-key python-mode-map (kbd "<end>") 'py-end-of-line)
9072 (define-key python-mode-map (kbd "C-t") 'py-execute-block-or-clause-create-shell)
9073 (define-key python-mode-map (kbd "<S-delete>") 'py-ian-execute-line-or-region)
9074 ;; python mode adds these to this list, which is normally empty.
9075 ;; it makes my send-python function not reuse an existing python shell window
9076 ;; there are other ways to override this, but I don't know of any other value of
9077 ;; having this set.
9078 (setq same-window-buffer-names (delete "*Python*" same-window-buffer-names))
9079 (setq same-window-buffer-names (delete "*IPython*" same-window-buffer-names))))
9080
9081 ;; i dunno, why, but this didn't work:
9082 ;; and we can't eval-after-load cuz it is part of the greater python mode file
9083 (add-hook 'py-shell-hook
9084 (lambda ()
9085 (define-key py-shell-map "\r" nil)
9086 (define-key py-shell-map (kbd "<return>") 'comint-send-input)
9087 (define-key py-shell-map (kbd "C-t") 'py-shell-toggle-arrow-keys)
9088 (define-key py-shell-map "\C-d" nil)
9089 (define-key py-shell-map (kbd "<up>") 'my-comint-previous-input)
9090 (define-key py-shell-map (kbd "<down>") 'my-comint-next-input)))
9091
9092
9093 (defun py-ian-execute-line-or-region ()
9094 (interactive)
9095 (cond ((get-buffer "*Python*")
9096 (if mark-active
9097 (py-execute-region)
9098 (py-execute-statement))
9099 (call-interactively 'next-line))
9100 (t (py-shell))))
9101
9102 ;; http://tkf.github.io/emacs-jedi/latest/
9103 (add-hook 'python-mode-hook 'jedi:setup)
9104 (setq jedi:complete-on-dot t)
9105
9106 (defun py-shell-toggle-arrow-keys ()
9107 (interactive)
9108 (toggle-arrow-keys py-shell-map))
9109
9110 #+end_src
9111
9112
9113 ;; py-shell window stuff
9114 ;; it splits the window if the shell is in a different frame
9115 ;; which seems to be a bug, but it can be fixed with this option
9116 ;; (setq py-keep-windows-configuration 'force)
9117 ;; however, with py-execute-block-or-clause, if the shell is in a different frame,
9118 ;; you get errors "buffer is read only", when the point is near the beginning of a command
9119 ;; todo: test with emacs -Q and file a bug
9120 ;; if you execute py-execute-... without a python shell open,
9121 ;; it starts one, doesn't display it, and subsequent py-execute commands
9122 ;; give error "buffer is read only"
9123 ;; these functions fix / improve these problems
9124
9125
9126 ** initial python-mode setup
9127
9128 python-mode seems to be the most canonical package, based on
9129 https://docs.python.org/devguide/emacs.html
9130 much more feature rich than the emacs built in one.
9131
9132 getting it, it wants you to setup an account on launchpad by default,
9133 there is some way to get anonymous bzr access, but google didn't answer it right away,
9134 so fuck it, ill go the happy path.
9135
9136 based on error messages,
9137 add public ssh key to https://launchpad.net/people/+me
9138 bzr launchpad-login iank
9139 cd ~/.emacs.d/src/
9140 bzr branch lp:python-mode
9141
9142 add lines from INSTALL to init
9143
9144
9145 ** background on packages
9146 jedi appears most popular based on github stats
9147 pysmell appears dead
9148 ac-python appears dead
9149 https://github.com/proofit404/anaconda-mode seems to be kicking along
9150
9151
9152 ** misc notes:
9153
9154 python-mode has a TON of functions that are just aliases or verbatim wrappers of other functions.
9155 also has undocumented/unused vars all around. it is quite annoying.
9156
9157 the dedicated argument to py-shell does nothing,
9158 and py-dedicated-shell just sets that, so it is a waste
9159
9160
9161 ** background on sending to python shell
9162
9163 using the builtin python execute shell functions, sending one line doesn't really work well.
9164 The bulit in functions don't wait for further input if a block is not closed.
9165 And doing a copy/paste thing gets messed up because of indents.
9166 With some hacking, I could probably do copy/paste and remove indents, only to a
9167 certain level if we have entered a block and are waiting to finish it.
9168 But just doing the builtin execute block is a decent work around.
9169
9170
9171 Here is the scrapped function for single line built in sending to shell.
9172
9173
9174 (setq w32-enable-num-lock nil)
9175 (global-set-key (kbd "<num_lock>") 'left-char)
9176
9177
9178 (defun sqlup-find-correct-keywords ()
9179 "If emacs is handling the logic for syntax highlighting of SQL keywords, then we piggyback on top of that logic. If not, we use an sql-mode function to create a list of regular expressions and use that."
9180 (mapcar 'car (sql-add-product-keywords sql-product '())))
9181
9182
9183 largest subarray sum, array of pos and neg ints.