move most of init into normal .el file
[dot-emacs] / my-init.org
1 #+title: My Personal Init Customization
2 #+OPTIONS: toc:nil num:nil ^:nil
3
4
5
6 * key binds. keep at end of file
7 this should come at the end because it depends on key maps being
8 created in earlier sections.
9
10 ** emacs keys notes
11 commands not needed in ido mode and their replacement in ido mode
12 spell check fix -> use current pattern and start new one
13 narrow -> create subdirectory
14 org-cycle -> M-s search recently used directory
15 vert split Window -> create file instead of select match
16 delete-other-windows -> open dired buffer
17 delete current window -> delete buffer/file
18 find file -> search within all subdirectories
19
20 forward/back error
21
22 buffer select -> toggle find file / buffer
23 up/down -> next/previous history
24 forward/back -> ido-forward/back
25
26
27 right keyboard attributes: movement, involve typing words
28 left keyboard attributes: non-typing universal non-movement
29
30
31
32
33 todo
34 fix global unpop mark ring
35 setup helm
36 learn cedet and projectile and helm
37 setup key for pop-global-mark
38 try out C-M-\ indent region
39 set quoted insert to some obscure keybind
40 make currently overrided M-u uppercase word into something obscure
41 remember mode
42 bind shell-command to something better
43 investigate tags
44 investigate keys in isearch mode and find file mode
45 try out occur. M-s o
46 investigate programming modes. M-g n/b next/previous error. gdb?
47 investigate org mode keys
48 learn version control
49 learn mail
50 check out imenu
51 bind capitalize-word to something obscure
52 sentance/paragraph movement/marking should be swapped with sexp/paren movement based on mode
53 bind fill-paragraph to something obscure
54 setup linewise paste
55 install magit (git control)
56 magpie expansion provides a completion key for acronym expansion based on buffer text
57 learn ediff
58 universal google
59 figure out auto-indent
60 learn eshell and prelude settings for it
61 combine register prefix and c-x prefix
62 note: remember to think of mouse & foot pedals
63 commands to change: select other window: C-x o.
64 ** prefix keybind changes
65 #+begin_src emacs-lisp
66
67
68 ; prefix key binds.
69 ; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
70 ; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
71 ; so you have to dig into their key maps and redo things.
72 ; There are 2 simpler alternatives which have their own downsides.
73 ; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
74 ; The other is keyboard-translate, which translates the key presses before anything else.
75 ; The downside is that it translates them when you aren't using them as a prefix.
76 ; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
77
78 ; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
79 ; (define-key key-translation-map [f12] "\C-c")
80 ; (define-key key-translation-map "\C-c" [left])
81
82
83 ;idea to remove the hook later since it is only needed at startup.
84 ; did not work however, and there is not a real need to fix it, so I did not investigate
85 ;(defun removeSwapHook ()
86 ; (remove-hook 'buffer-list-update-hook 'myKeySwap)
87 ; (remove-hook 'change-major-mode-hook 'removeSwapHook))
88 ;(add-hook 'change-major-mode-hook 'removeSwapHook)
89
90
91 ; went through almost all the relevant standard hooks,
92 ; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
93 (add-hook 'buffer-list-update-hook (lambda () (interactive)
94 (keyboard-translate ?\C-x ?\C-s)
95 (keyboard-translate ?\C-s ?\C-x)
96 (keyboard-translate ?\C-c ?\C-d)
97 (keyboard-translate ?\C-d ?\C-c)))
98
99
100
101 ; these all don't work
102 ; don't know why this doesn't error but reversing the keys does
103 ;(keyboard-translate ?\t ?\M-\t)
104 ;(keyboard-translate [M-tab] [tab])
105 ; from what i can tell, it wants to use a keyboard-translate-table,
106 ; which is a char table, which is a vector indexed by chars,
107 ; and mod+tab is not a char (it has too many bits), it is an integer
108 ; it actually says it can hold vectors or strings, but that it is obsolete to do so
109 ;(characterp ?\M-a)
110 ;(characterp ?\C-a)
111
112
113
114 #+end_src
115
116 ** named commands
117 *** gdb
118 gdb-many-windows
119 *** tramp sudo
120 /ssh:host|sudo:host:
121 when in the same session, you can then do:
122 /sudo:root@host:
123
124 *** org insert table row
125 [org-shiftmetadown/up]
126 *** toggle line continuation / truncation / wrap
127 toggle-truncate-lines
128 *** auto-save on/off
129 my-as-on/my-as-off
130 *** toggle menu bar
131 menu-bar-mode
132 *** show abbreviations
133 list-abbrevs
134
135 *** rename-file-and-buffer
136 *** ediff-buffers
137 *** refill-mode
138 automatically balance a paragraph with newlines
139 *** executable-make-buffer-file-executable-if-script-p
140 make a script executable
141 *** (setq lazy-highlight-cleanup nil)
142 keep search highlight on after search is done
143 *** auto-revert-tail-mode
144 tail a file
145 *** trash-file-and-buffer
146 #+begin_src emacs-lisp
147 (defun trash-file-and-buffer ()
148 "Removes file connected to current buffer and kills buffer."
149 (interactive)
150 (let ((filename (buffer-file-name))
151 (buffer (current-buffer))
152 (name (buffer-name)))
153 (if (not (and filename (file-exists-p filename)))
154 (error "Buffer '%s' is not visiting a file!" name)
155 (delete-file filename)
156 (kill-buffer buffer)
157 (message "File '%s' successfully removed" filename))))
158
159 #+end_src
160 *** what-line
161 *** linum-mode
162 line numbers
163
164 *** sgml-pretty-print
165 format xml in nxml-mode
166 *** visual-line-mode
167 toggle word wrap.
168 ** compound commands
169 *** C-xc
170 exit0
171 *** C-x s
172 save file
173 *** C-x e
174 eval last sexp
175 *** C-x u
176 [undo-tree-visualize]
177 *** C-j u/U
178 [undo-tree save/restore state via register]
179 *** C-c -
180 [org insert table horizontal line or create list]
181 *** C-x tab
182 indent/dedent region
183
184 [shift-left and shift-right are default for indenting by tab stop,
185 and they are only defined as lambdas so I copy them here
186 to use with up and down.
187 #+begin_src emacs-lisp
188 ;; condition cuz emacs24 release doesn't have this yet
189 (when (boundp 'indent-rigidly-map)
190 (define-key indent-rigidly-map (kbd "<C-left>")
191 (lambda (beg end) (interactive "r")
192 (let* ((current (indent-rigidly--current-indentation beg end))
193 (next (indent--next-tab-stop current)))
194 (indent-rigidly beg end (- next current)))))
195
196 (define-key indent-rigidly-map (kbd "<C-right>")
197 (lambda (beg end) (interactive "r")
198 (let* ((current (indent-rigidly--current-indentation beg end))
199 (next (indent--next-tab-stop current 'prev)))
200 (indent-rigidly beg end (- next current))))))
201 #+end_src
202 *** C-x *
203 [calc-dispatch]
204 *** C-x =
205 [point information]
206 *** C-x d
207 [dired]
208 *** C-xb
209 [ibuffer]
210 #+begin_src emacs-lisp
211 (global-set-key (kbd "C-x C-b") 'ibuffer)
212 #+end_src
213
214 *** C-x r c
215 rectangular clear, replace area with whitespace
216 ** gnus
217 searching overview.
218 3 types:
219 ingroup searching
220 nnir searching with notmuch, specific group (not sure if it can do multiple)
221 search all groups with mairix
222 *** a]
223 compose new message
224 *** C-c C-c]
225 send message
226 *** s]
227 save newsrc file, alterations to groups.
228 *** g]
229 gnus refresh / get new
230 *** m]
231 gnus new message
232 *** F]
233 gnus quoted reply all
234 *** e]
235 gnus draft edit message
236 *** delete]
237 gnus delete draft
238 #+begin_src emacs-lisp
239 (add-hook 'gnus-startup-hook
240 (lambda ()
241 (define-key gnus-summary-mode-map (kbd "<delete>") 'gnus-summary-delete-article)))
242 #+end_src
243
244 *** b]
245 mairix search
246 #+begin_src emacs-lisp
247 (add-hook 'gnus-startup-hook
248 (lambda ()
249 (define-key gnus-group-mode-map "b" 'nnmairix-search)
250 (define-key gnus-summary-mode-map "b" 'nnmairix-search)))
251 #+end_src
252 *** B m]
253 move message, or messages in region
254 *** #]
255 mark article, move with B m
256 *** B delete]
257 gnus delete draft
258 *** / plus x a / b]
259 search current group (or see info manual for more groups),
260 using the gnus native search (its slow, do a notmuch or mairix search instead)
261 x= extra (ie. to)
262 todo; send in patch to make author search to in sent folder
263 a = author
264 / = subject
265 b = body
266 see C-h m for a full list
267 *** G G ]
268 do a nnir notmuch search, for the group on the current line
269 *** A T ]
270 jump to thread from nnir group
271
272 *** marks]
273 ! = saved for later
274 E = expired
275 M-& apply process mark to a non-process mark command
276 *** S D e]
277 edit as new
278 *** T k / C-M-k
279 maybe rebind this to a shorter keybind, like del
280 gnus-summary-kill-thread
281 ** message mode
282 *** C-ck]
283 discard message
284 ** notmuch
285 *** space]
286 notmuch advance to next message/thread
287
288 ** readline / bash / .inputrc
289 *** C-m
290 [--------]
291 #+begin_src emacs-lisp
292 (add-hook 'comint-mode-hook
293 (lambda ()
294 (define-key comint-mode-map "\C-m" nil)))
295 #+end_src
296 terminal crap, duplicate of enter
297
298 ** isearch
299 *** C-w
300 paste word/char under cursor into isearch
301 *** M-n/p
302 next/previous isearch history
303 *** C-o
304 isearch-occur
305 Activate occur easily inside isearch
306 from starter-kit
307 #+begin_src emacs-lisp
308 (define-key isearch-mode-map (kbd "C-o")
309 (lambda () (interactive)
310 (let ((case-fold-search isearch-case-fold-search))
311 (occur (if isearch-regexp
312 isearch-string
313 (regexp-quote isearch-string))))))
314 #+end_src
315 *** m-r
316 #+begin_src emacs-lisp
317 (defun my-isearch-toggle-regexp ()
318 (interactive)
319 (isearch-toggle-regexp)
320 (cond (isearch-regexp
321 (global-set-key (kbd "C-r") 'isearch-backward-regexp)
322 (define-key global-map (kbd "<f12>") 'isearch-forward-regexp)
323 (define-key global-map (kbd "<kp-add>") 'isearch-forward-regexp))
324 (t
325 (global-set-key (kbd "C-r") 'isearch-backward)
326 (define-key global-map (kbd "<f12>") 'isearch-forward)
327 (define-key global-map (kbd "<kp-add>") 'isearch-forward))))
328 (define-key isearch-mode-map (kbd "M-r") 'my-isearch-toggle-regexp)
329 #+end_src
330
331 ** icomplete
332 *** C-. C-,
333 icomplete-forward/backward-completions
334
335 ** info
336 *** [, ]
337 forward / previous node, descend/ascend tree as needed
338 *** x
339 Info-follow-nearest-node
340 #+begin_src emacs-lisp
341 (define-key Info-mode-map "x" 'Info-follow-nearest-node)
342 #+end_src
343 m, f, n, p or ^ command, depending on where you click.
344 ** auto-complete
345 *** S-return
346 select next completion candidate
347 ac-expand
348 ** agenda
349 *** t]
350 agenda cycle todo state
351 ** org
352 *** C-c / t]
353 make just todo items visible
354 *** S-<tab>
355 org-shifttab global visibility cycle / move table cell
356 *** C-cs]
357 schedule todo item
358 *** C-cx p]
359 org set property
360 *** C-c -]
361 org insert horizontal line
362 *** C-cq]
363 org tag
364 ** calc
365 i'd like to drill these sometime when I have space in my head, or I
366 plan to use calc.
367 *** space
368 [enter input to the stack, or duplicate top stack item]
369 *** C-M-i
370 [cycle 3 elements on stack]
371 *** tab
372 [cycle 2 elements on stack]
373 *** n
374 [negate]
375 *** _
376 [begin negative number]
377 *** /
378 [reciprocal]
379 *** x
380 [calc named command]
381 *** M-delete
382 [delete 2nd from top of stack]
383 *** C-u [-]0-9
384 [0=whole stack, 1-9=that many, -1-9=that element]
385 *** delete
386 [remove from the top of the stack]
387 *** '
388 [algebraic mode. infix expressions are calculated when input to the stack]
389 *** m a
390 [auto algebraic mode]
391 *** $,$$,$$$
392 [top x of stack reference]
393 *** s s/t/r/u
394 [store to variable: store, top, retrieve, unstore. the quick variables 0-9 don't need s prefix]
395 *** U/D
396 [undo/redo]
397 *** t p/n/]/y
398 [trail prev/next/end/yankh]
399 *** `
400 [calc edit mode, to edit the top of stack]
401
402 ** single/special keys
403 *** tab
404 isearch
405 #+begin_src emacs-lisp
406 (define-key isearch-mode-map (kbd "<tab>") 'isearch-query-replace)
407 #+end_src
408 *** f12
409 isearch-forward
410 #+begin_src emacs-lisp
411 ;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs
412 (global-set-key (kbd "<kp-add>") 'isearch-forward)
413 (global-set-key (kbd "<f12>") 'isearch-forward)
414 (define-key isearch-mode-map "\t" nil)
415 (define-key isearch-mode-map (kbd "<kp-add>") 'isearch-repeat-forward)
416 (define-key isearch-mode-map (kbd "<f12>") 'isearch-repeat-forward)
417 ;; get rid of the standard completion binding, always use auto-complete
418 ;; this didn't work very well
419 ;;(global-set-key (kbd "TAB") 'auto-complete)
420 (define-key global-map [remap completion-at-point] 'auto-complete)
421
422 #+end_src
423
424 *** end
425 move-end-of-line
426 #+begin_src emacs-lisp
427 ;; taken from emacs wiki, along with home function
428 ;; http://www.emacswiki.org/emacs/BackToIndentationOrBeginning
429 (defun point-in-comment ()
430 "Determine if the point is inside a comment"
431 (interactive)
432 (let ((syn (syntax-ppss)))
433 (and (nth 8 syn)
434 (not (nth 3 syn)))))
435 (defun end-of-code-or-line (arg)
436 "Move to end of line, or before start of comments depending on situation.
437 Toggle back and forth positions if we are already at one.
438 Comments are recognized in any mode that sets syntax-ppss
439 properly."
440 (interactive "P")
441 (when (catch 'bol
442 (let ((start (point))
443 (bol (save-excursion
444 (beginning-of-line)
445 (point)))
446 (eol (progn (move-end-of-line arg) (point))))
447 (while (point-in-comment)
448 (backward-char)
449 (when (= (point) bol)
450 (throw 'bol t)))
451 (throw 'bol (and (not (= eol start)) (>= start (point))))))
452 (move-end-of-line arg)))
453
454 (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)))
455 #+end_src
456
457 *** home
458 back-to-indentation
459 #+begin_src emacs-lisp
460 (defun back-to-indentation-or-beginning ()
461 (interactive)
462 (if (= (point) (progn (back-to-indentation) (point)))
463 (if (derived-mode-p 'org-mode)
464 (org-beginning-of-line)
465 (beginning-of-line))))
466 (global-set-key (kbd "<home>") 'back-to-indentation-or-beginning)
467
468 #+end_src
469
470 *** s-tab
471 indent-buffer
472 #+begin_src emacs-lisp
473 (global-set-key (kbd "<S-iso-lefttab>") 'indent-buffer)
474 #+end_src
475 *** s-delete
476 send-shell
477 #+begin_src emacs-lisp
478
479 (global-set-key (kbd "<S-delete>") 'send-shell)
480
481 ;; optional variables used by send-shell
482 (setq shell-send-yank-key nil)
483
484 (defun repeat-shell ()
485 (interactive)
486 "Repeat the last command in shell-mode, displaying the window if needed."
487 (let ((shell-buffer (get-buffer "*shell*")))
488 (if shell-buffer
489 (buffer-window-show shell-buffer)
490 (let ((original-buffer (current-buffer)))
491 (funcall 'shell)
492 (setq shell-buffer (current-buffer))
493 (switch-to-buffer original-buffer)))
494 (with-current-buffer shell-buffer
495 (goto-char (point-max))
496 (call-interactively 'comint-previous-input)
497 ;; the t flag makes the buffer advance
498 (comint-send-input nil t))))
499
500 (setq compilation-filenames '("Makefile" "makefile"))
501
502 (defun get-nearest-compilation-file ()
503 "Search for the compilation file traversing up the directory tree."
504 (interactive)
505 (let ((dir default-directory)
506 (parent-dir (file-name-directory (directory-file-name default-directory)))
507 (nearest-compilation-file 'nil))
508 (while (and (not (string= dir parent-dir))
509 (not nearest-compilation-file))
510 (dolist (filename compilation-filenames)
511 (setq file-path (concat dir filename))
512 (when (file-readable-p file-path)
513 (setq nearest-compilation-file file-path)))
514 (setq dir parent-dir
515 parent-dir (file-name-directory (directory-file-name parent-dir))))
516 nearest-compilation-file))
517 (defun run ()
518 (interactive)
519 "call run-fun if it is set, else run make if there is a makefile,
520 else save and repeat last shell command.
521 run-fun is meant to store file local variables, which show how to
522 do the main thing we want on this file, generally compile and
523 run.
524
525 example of setting it in a file:
526 ;; Local Variables:
527 ;; run-fun: merge-test
528 ;; End: "
529 (basic-save-buffer)
530 (if (and (boundp 'run-fun) run-fun)
531 (funcall run-fun)
532 (let ((makefile (get-nearest-compilation-file)))
533 (if (and makefile (stringp mode-name) (string= mode-name "C/l"))
534 (compile (format
535 "make -f %s" (get-nearest-compilation-file)))
536 (repeat-shell)))))
537
538
539 (defun send-shell ()
540 (interactive)
541 (send-shell-buffer "*shell*" 'shell (kbd "C-v")))
542
543 (defun send-python ()
544 (interactive)
545 (send-shell-buffer "*Python*" 'py-shell (kbd "C-v")))
546
547
548 (defun send-shell-buffer (buffer-name &optional init shell-send-yank-key)
549 "Send current line or region to shell-mode buffer.
550 When in shell-mode, copy the current line to the
551 most recently visited visible window.
552
553 SHELL-SEND-YANK-KEY: key to use instead
554 of yank to paste into recent window. This allows compatibility with
555 modes like org-mode which have their own yank function."
556 (if (string= (buffer-name) buffer-name)
557 ;; this section is copied out of comint-send-input
558 (progn
559 (let ((proc (get-buffer-process (current-buffer))))
560 (if (not proc) (user-error "Current buffer has no process")
561 (widen)
562
563 (let* ((pmark (process-mark proc))
564 (intxt (if (>= (point) (marker-position pmark))
565 (progn (if comint-eol-on-send (end-of-line))
566 (buffer-substring pmark (point)))
567 (let ((copy (funcall comint-get-old-input)))
568 (goto-char pmark)
569 (insert copy)
570 copy))))
571
572 (if (= (length intxt) 0)
573 (kill-new (comint-previous-matching-input-string "." 1))
574 (kill-new intxt)))))
575 (kill-append "\n" nil)
576 (select-window (previous-window nil nil 'visible))
577 (if (and (boundp 'shell-send-yank-key) shell-send-yank-key)
578 (call-interactively (global-key-binding shell-send-yank-key))
579 (yank))
580 (select-window (next-window nil nil 'visible)))
581 (let (start end)
582 (if mark-active
583 (setq start (mark)
584 end (point))
585 (setq start (save-excursion (beginning-of-line) (point))
586 end (save-excursion (end-of-line) (point)))
587 (let (line-move-visual)
588 (call-interactively 'next-line)))
589 (send-comint-input buffer-name start end init))))
590
591 ;; supporting functions
592 (defun send-comint-input (buffer-name start end &optional init)
593 "Input the region to BUFFER-NAME, assuming it is a comint-derived buffer.
594 Show BUFFER-NAME if it is not show.
595 Call INIT if BUFFER-NAME does not exist."
596 (let ((input (filter-buffer-substring start end)))
597 (send-comint-string buffer-name input init)))
598
599 (defun send-comint-string (buffer-name string &optional init)
600 "Input the string to BUFFER-NAME, assuming it is a comint-derived buffer.
601 Show BUFFER-NAME if it is not show.
602 Call INIT if BUFFER-NAME does not exist."
603 (let ((buffer (get-buffer buffer-name)))
604 (unless buffer
605 (message "nobuffer")
606 ;; save-excursion etc. don't work for (shell), so I do this instead
607 (if init (let ((original-buffer (current-buffer)))
608 (funcall init (and (boundp 'send-shell-buffer-name) send-shell-buffer-name))
609 (switch-to-buffer original-buffer)
610 (setq buffer (get-buffer buffer-name)))
611 (error "No existing buffer found and no init function argument. ")))
612 (buffer-window-show buffer)
613 (with-current-buffer buffer
614 (let ((proc (get-buffer-process buffer)))
615 (goto-char (process-mark proc))
616 (insert string)
617 (comint-send-input nil t)))))
618
619 (defun buffer-window-show (&optional buffer action)
620 "Like temp-buffer-window-show, but removed stuff
621 relevant to it being temp or help."
622 (let (window frame)
623 (with-current-buffer buffer
624 (when (let ((window-combination-limit
625 ;; When `window-combination-limit' equals
626 ;; `temp-buffer' or `temp-buffer-resize' and
627 ;; `temp-buffer-resize-mode' is enabled in this
628 ;; buffer bind it to t so resizing steals space
629 ;; preferably from the window that was split.
630 (if (or (eq window-combination-limit 'temp-buffer)
631 (and (eq window-combination-limit
632 'temp-buffer-resize)
633 temp-buffer-resize-mode))
634 t
635 window-combination-limit)))
636 ;; debug
637 ;;(message "window-combination-limit")
638 ;;(print window-combination-limit)
639 (setq window (display-buffer buffer action)))
640 (setq frame (window-frame window))
641 (unless (eq frame (selected-frame))
642 (raise-frame frame))
643 (setq minibuffer-scroll-window window)
644 (set-window-hscroll window 0)
645 ;; Return the window.
646 window))))
647
648
649 ;; when poping help, etc, allow reusing a window in a different frame if it is visible
650 ;; figured this out after spending quite a while reading doc string for display-buffer
651 ;; which is the main function which uses this.
652 ;; it will use other vars or its arg to override this,
653 ;; but those things are often nil.
654 ;; aha moments in reading it: ACTION = (FUNCTION-or-FUNCTIONLIST ALIST)
655 ;; FRAME adds an association to ACTION's alist, but it's not used if ACTION arg is nil.
656 (setq display-buffer-fallback-action `(,(car display-buffer-fallback-action) . '(reusable-frames . visible)))
657 ;; stop splitting windows verticallly when I open a buffer or shell
658 (setq split-height-threshold nil)
659 #+end_src
660
661 *** s-left arrow
662 shell
663 #+begin_src emacs-lisp
664 (global-set-key (kbd "<S-kp-equal>") 'shell-wrap)
665 (global-set-key (kbd "<S-left>") 'shell-wrap)
666 #+end_src
667 *** s-right arrow
668 previous-buffer
669 #+begin_src emacs-lisp
670 (global-set-key (kbd "<S-kp-divide>") 'previous-buffer)
671 #+end_src
672 *** esc
673 *** return
674 new line
675
676 #+begin_src emacs-lisp
677 ;; todo, this doesn't set the keybind for the help minibuffer
678
679
680 (global-set-key (kbd "\r") 'indent-new-comment-line)
681
682 ;; don't use enter for autocomplete, we use tab or something
683 (define-key ac-completing-map (kbd "<return>") nil)
684 (define-key ac-completing-map "\r" nil)
685
686 (add-hook 'org-mode-hook
687 (lambda ()
688 ;; copied from org-mode, replace org-enter with org-enter-indent
689 (org-defkey org-mode-map "\C-m" 'org-return-indent)))
690
691
692 (add-hook 'comint-mode-hook
693 (lambda ()
694 (define-key comint-mode-map "\r" nil)
695 (define-key comint-mode-map (kbd "<return>") 'comint-send-input)))
696
697 (add-hook 'comint-mode-hook
698 (lambda ()
699 (define-key comint-mode-map "\C-m" nil)
700 (define-key comint-mode-map "\C-d" nil)))
701
702 #+end_src
703
704 *** s-return
705 auto-correct-prev-word
706 #+begin_src emacs-lisp
707 (global-set-key (kbd "<S-return>") 'flyspell-auto-correct-previous-word)
708 #+end_src
709
710 *** down arrow
711 mark
712 #+begin_src emacs-lisp
713 (global-set-key (kbd "<kp-enter>") 'set-mark-command)
714 #+end_src
715 *** s-down arrow
716 extended command
717 #+begin_src emacs-lisp
718 (global-set-key (kbd "<S-kp-enter>") 'smex)
719 #+end_src
720 *** s-up arrow
721
722 ** mouse
723 *** mouse-2 mode line
724 mouse-delete-other-windows
725 *** C-mouse-2 mode line
726 mouse-split-window-horizontally
727 *** M-mouse-2 mode line
728 *** S-mouse-2 mode line
729 *** C-M-mouse-2 mode line
730 *** C-S-mouse2 mode line
731 *** mouse-3 mode line
732 mouse-delete-window
733 *** C-mouse-3 mode line
734 *** M-mouse-3 mode line
735 *** S-mouse-3 mode line
736 *** C-M-mouse-3 mode line
737 *** C-S-mouse-3 mode line
738 *** mouse-1
739 set cursor/mark
740 *** C-mouse-1
741 buffer list context menu
742 *** M-mouse-1
743 *** S-mouse-1
744 *** C-M-mouse-1
745 *** C-S-mouse-1
746 *** mouse-2
747 paste
748 *** C-mouse-2
749 *** M-mouse-2
750 *** S-mouse-2
751 *** C-M-mouse-2
752 *** C-S-mouse-2
753 *** mouse-3
754 set-mark
755 #+begin_src emacs-lisp
756 (define-key global-map [down-mouse-3] 'mouse3-func)
757 (global-set-key [mouse-3] 'mouse3-set-mark)
758 (global-set-key [drag-mouse-3] 'mouse3-set-mark)
759 #+end_src
760 *** C-mouse-3
761 global menu
762 *** M-mouse-3
763 *** S-mouse-3
764 *** C-M-mouse-3
765 *** C-S-mouse-3
766 *** mouse-9
767 move-mouse-to-point
768 #+begin_src emacs-lisp
769 (global-set-key (kbd "<mouse-6>") 'move-mouse-to-point)
770 #+end_src
771 *** C-mouse-9
772 *** M-mouse-9
773 *** S-mouse-9
774 *** C-M-mouse-9
775 *** C-S-mouse-9
776 *** mouse-8
777 *** C-mouse-8
778 *** M-mouse-8
779 *** S-mouse-8
780 *** C-M-mouse-8
781 *** C-S-mouse-8
782 *** 1/kp-end
783 *** C-1/kp-end
784 *** M-1/kp-end
785 *** S-1/kp-end
786 *** C-M-1/kp-end
787 *** C-S-1/kp-end
788 *** 2/kp-down
789 *** C-2/kp-down
790 *** M-2/kp-down
791 smex
792 #+begin_src emacs-lisp
793 ;; for when we have a standard keyboard which is not remapped
794 (global-set-key (kbd "M-2") 'smex)
795
796 #+end_src
797
798 *** S-2/kp-down
799 *** C-M-2/kp-down
800 *** C-S-2/kp-down
801 *** 3/kp-next
802 *** C-3/kp-next
803 *** M-3/kp-next
804 *** S-3/kp-next
805 *** C-M-3/kp-next
806 *** C-S-3/kp-next
807 *** 4/kp-left
808 indent-region
809 #+begin_src emacs-lisp
810 (global-set-key (kbd "<kp-left>") 'indent-region)
811 #+end_src
812 *** C-4/kp-left
813 *** M-4/kp-left
814 *** S-4/kp-left
815 *** C-M-4/kp-left
816 *** C-S-4/kp-left
817 *** 5/kp-begin
818 mark-defun
819 #+begin_src emacs-lisp
820 (global-set-key (kbd "<kp-begin>") 'mark-defun)
821 #+end_src
822 *** C-5/kp-begin
823 *** M-5/kp-begin
824 *** S-5/kp-begin
825 *** C-M-5/kp-begin
826 *** C-S-5/kp-begin
827 *** 6/kp-right
828 ibuffer
829 #+begin_src emacs-lisp
830 (global-set-key (kbd "<kp-right>") 'ibuffer)
831 #+end_src
832 *** C-6/kp-right
833 *** M-6/kp-right
834 *** S-6/kp-right
835 *** C-M-6/kp-right
836 *** C-S-6/kp-right
837 *** 7/kp-home
838 *** C-7/kp-home
839 *** M-7/kp-home
840 *** S-7/kp-home
841 *** C-M-7/kp-home
842 *** C-S-7/kp-home
843 *** 8/kp-up
844 *** C-8/kp-up
845 *** M-8/kp-up
846 *** S-8/kp-up
847 *** C-M-8/kp-up
848 *** C-S-8/kp-up
849 *** 9/kp-prior
850 delete-horizontal-space
851 #+begin_src emacs-lisp
852 (global-set-key (kbd "<kp-prior>") 'delete-horizontal-space)
853 #+end_src
854 *** C-9/kp-prior
855 *** M-9/kp-prior
856 *** S-9/kp-prior
857 *** C-M-9/kp-prior
858 *** C-S-9/kp-prior
859 *** 10/kp-insert
860 *** C-10/kp-insert
861 *** M-10/kp-insert
862 *** S-10/kp-insert
863 *** C-M-10/kp-insert
864 *** C-S-10/kp-insert
865 *** 11/kp-subtract
866 *** C-11/kp-subtract
867 *** M-11/kp-subtract
868 *** S-11/kp-subtract
869 *** C-M-11/kp-subtract
870 *** C-S-11/kp-subtract
871 *** 12/kp-add
872 *** C-12/kp-add
873 *** M-12/kp-add
874 *** S-12/kp-add
875 *** C-M-12/kp-add
876 *** C-S-12/kp-add
877 *** scroll
878 up/dn / scroll
879 on standard mouse, this scrolls,
880 because we have the accuracy to pick things up and
881 down easier, and because it is familiar.
882 *** C-scroll
883 cursor up/down fast
884 #+begin_src emacs-lisp
885 ;; compiling warns that next-line should be called interactively,
886 ;; but we would have to do something dumb, like give it a
887 ;; vector of keys in order to supply the 8 argument
888 (defun down-fast ()
889 (interactive)
890 (next-line 8))
891 (defun up-fast ()
892 (interactive)
893 (next-line -8))
894
895 (global-set-key (kbd "<C-up>") 'up-fast)
896 (global-set-key (kbd "<C-down>") 'down-fast)
897
898 (add-hook 'comint-mode-hook
899 (lambda ()
900 (define-key comint-mode-map (kbd "<C-mouse-4>") 'comint-previous-prompt)
901 (define-key comint-mode-map (kbd "<C-mouse-5>") 'comint-next-prompt)))
902 #+end_src
903
904 *** M-scroll
905 forward/back s-exp
906 #+begin_src emacs-lisp
907 (global-set-key (kbd "<M-mouse-4>") 'backward-sexp)
908 (global-set-key (kbd "<M-mouse-5>") 'forward-sexp)
909 #+end_src
910 *** S-scroll
911 expand/contract region
912 #+begin_src emacs-lisp
913 (global-set-key (kbd "<S-mouse-13>") 'my-contract-region)
914 (global-set-key (kbd "<S-mouse-14>") 'er/expand-region)
915 (global-set-key (kbd "<S-mouse-4>") 'my-contract-region)
916 (global-set-key (kbd "<S-mouse-5>") 'er/expand-region)
917 (global-set-key (kbd "<S-up>") 'my-contract-region)
918 (global-set-key (kbd "<S-down>") 'er/expand-region)
919
920 (defun my-contract-region (arg)
921 (interactive "p")
922 (let ((current-prefix-arg '-))
923 (call-interactively 'er/expand-region)))
924 #+end_src
925 *** C-M-scroll
926 scroll
927 background: I originally tried to make c-scroll be scroll
928 , but this made
929 for better compatibility with the standard mouse
930 #+begin_src emacs-lisp
931 (global-set-key (kbd "<C-M-mouse-4>") 'mwheel-scroll)
932 (global-set-key (kbd "<C-M-mouse-5>") 'mwheel-scroll)
933 ; (require 'smooth-scroll)
934 ; (smooth-scroll-mode nil)
935 ; (global-set-key (kbd "<C-M-mouse-4>") 'scroll-up-1)
936 ;(global-set-key (kbd "<C-M-mouse-5>") 'scroll-down-1)
937 #+end_src
938 *** C-S-scroll
939 increase / decrease text size
940 #+begin_src emacs-lisp
941 (global-set-key (kbd "<C-S-mouse-4>") 'text-scale-increase)
942 (global-set-key (kbd "<C-S-mouse-5>") 'text-scale-decrease)
943 (global-set-key (kbd "<C-S-mouse-13>") 'text-scale-increase)
944 (global-set-key (kbd "<C-S-mouse-14>") 'text-scale-decrease)
945 (global-set-key (kbd "<C-S-down>") 'text-scale-increase)
946 (global-set-key (kbd "<C-S-up>") 'text-scale-decrease)
947 #+end_src
948 *** left-scroll
949 left/right
950 *** C-left-scroll
951 back / forward word
952 #+begin_src emacs-lisp
953 (global-set-key (kbd "<C-left>") 'backward-symbol)
954 (global-set-key (kbd "<C-right>") 'forward-symbol)
955 #+end_src
956 *** M-left-scroll
957 ---
958 unreachable
959 *** S-left-scroll
960 ---
961 unreachable
962 *** C-M-left-scroll
963 ---
964 unreachable
965 *** C-S-left-scroll
966 ---
967 unreachable
968 ** left primary
969
970 *** C-2
971 copy-symbol
972 #+begin_src emacs-lisp
973 (global-unset-key (kbd "C-2"))
974 (defun copy-symbol (&optional arg)
975 "Copy symbol at point into kill-ring"
976 (interactive "P")
977 (kill-new (thing-at-point 'symbol)))
978
979 (global-set-key (kbd "C-2") 'copy-symbol)
980 #+end_src
981 *** M-2
982 shell-cd-to-file
983 #+begin_src emacs-lisp
984
985 (defun shell-cd-to-file ()
986 (interactive)
987 (let ((file (buffer-file-name)))
988 (if file
989 (send-comint-string "*shell*"
990 (concat "c " (file-name-directory file))
991 'shell)
992 (message "%s" "shell-cd-to-file: buffer has no file name"))))
993 (global-set-key (kbd "M-2") 'shell-cd-to-file)
994 #+end_src
995 *** C-M-2
996 ---
997 #+begin_src emacs-lisp
998 (global-unset-key (kbd "C-M-2"))
999 #+end_src
1000 *** C-S-2
1001 *** C-3
1002 dot-mode-execute
1003 #+begin_src emacs-lisp
1004 (global-set-key (kbd "C-3") 'dot-mode-execute)
1005 #+end_src
1006 *** M-3
1007 *** C-M-3
1008 recenter-top-bottom
1009 #+begin_src emacs-lisp
1010 (global-set-key (kbd "C-M-3") 'recenter-top-bottom)
1011 #+end_src
1012 *** C-S-3
1013 *** C-q
1014 org-cycle, comint previous arg
1015 #+begin_src emacs-lisp
1016 (global-set-key (kbd "C-q") 'outline-cycle)
1017 (add-hook 'org-mode-hook
1018 (lambda () (define-key org-mode-map (kbd "C-q") 'org-cycle)))
1019 (define-key widget-keymap (kbd "C-q") 'widget-forward)
1020 (add-hook 'comint-mode-hook
1021 (lambda () (define-key comint-mode-map (kbd "C-q") 'comint-insert-previous-argument)))
1022 #+end_src
1023 *** M-q
1024 org-archive-to-archive-sibling
1025 #+begin_src emacs-lisp
1026 (global-set-key (kbd "M-q") 'org-archive-to-archive-sibling)
1027 #+end_src
1028 *** C-M-q
1029 quoted-insert
1030 #+begin_src emacs-lisp
1031 (global-set-key (kbd "C-M-q") 'quoted-insert)
1032 #+end_src
1033 *** C-S-q
1034 *** C-w
1035 goto-t.org
1036 #+begin_src emacs-lisp
1037 (global-set-key (kbd "C-w") (lambda () (interactive) (goto-buffer-or-find-file "/a/t.org")))
1038 #+end_src
1039 *** M-w
1040 org-clock-in
1041 #+begin_src emacs-lisp
1042 (global-set-key (kbd "M-w") 'org-clock-in)
1043 #+end_src
1044 *** C-M-w
1045 *** C-S-w
1046 *** C-e
1047 copy-line
1048 #+begin_src emacs-lisp
1049 ;; todo, make repeated calls to this append the kills
1050 (defun copy-line (&optional arg)
1051 "Copy lines (as many as prefix argument) in the kill ring.
1052 Ease of use features:
1053 - Move to start of next line.
1054 - Appends the copy on sequential calls.
1055 - Use newline as last char even on the last line of the buffer.
1056 - If region is active, copy its lines."
1057 (interactive "p")
1058 (let ((beg (line-beginning-position))
1059 (end (line-end-position (or arg 1))))
1060 (when mark-active
1061 (if (> (point) (mark))
1062 (setq beg (save-excursion (goto-char (mark)) (line-beginning-position)))
1063 (setq end (save-excursion (goto-char (mark)) (line-end-position)))))
1064 (if (eq last-command 'copy-line)
1065 (kill-append (buffer-substring beg end) (< end beg))
1066 (kill-ring-save beg end)))
1067 (kill-append "\n" nil)
1068 ;; dun need cuz I have yank-better
1069 ;;(beginning-of-line (or (and arg (1+ arg)) 2))
1070 (if (and arg (not (= 1 arg))) (message "%d lines copied" arg)))
1071
1072 (global-set-key (kbd "C-e") 'copy-line)
1073 #+end_src
1074 *** M-e
1075 org-clock-in-last
1076 #+begin_src emacs-lisp
1077 (global-set-key (kbd "M-e") 'org-clock-in-last)
1078 #+end_src
1079 *** C-M-e
1080 *** C-S-e
1081 *** C-r
1082 isearch-backward
1083 #+begin_src emacs-lisp
1084 (global-set-key (kbd "C-r") 'isearch-backward)
1085 (add-hook 'comint-mode-hook
1086 (lambda ()
1087 (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
1088 #+end_src
1089 *** M-r
1090 org-clock-out
1091 #+begin_src emacs-lisp
1092 (global-set-key (kbd "M-r") 'org-clock-out)
1093 #+end_src
1094 *** C-M-r
1095 *** C-S-r
1096 *** C-a
1097 copy buffer
1098 #+begin_src emacs-lisp
1099 (defun copy-all ()
1100 "Copy entire buffer to clipboard"
1101 (interactive)
1102 (clipboard-kill-ring-save (point-min) (point-max)))
1103 (global-set-key (kbd "C-a") 'copy-all)
1104 #+end_src
1105 *** M-a
1106 macro record
1107 #+begin_src emacs-lisp
1108 (global-set-key (kbd "M-a") 'kmacro-start-macro-or-insert-counter)
1109 #+end_src
1110 *** C-M-a
1111 macro end / call
1112 #+begin_src emacs-lisp
1113 (global-set-key (kbd "C-M-a") 'kmacro-end-or-call-macro)
1114 (add-hook 'perl-mode-hook (lambda () (define-key perl-mode-map (kbd "C-M-a") nil)))
1115 (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-M-a") nil)))
1116 (add-hook 'c++-mode-hook
1117 (lambda () (define-key c++-mode-map (kbd "C-M-a") nil)))
1118 (add-hook 'c-mode-hook
1119 (lambda () (define-key c-mode-map (kbd "C-M-a") nil)))
1120
1121
1122 #+end_src
1123 *** C-S-a
1124 *** C-s
1125 c-x prefix
1126
1127 *** M-s
1128 *** C-M-s
1129 split-window-vertically
1130 #+begin_src emacs-lisp
1131 (global-set-key (kbd "C-M-s") 'split-window-vertically)
1132 #+end_src
1133 *** C-S-s
1134 *** C-d
1135 C-c prefix
1136 *** M-d
1137 *** C-M-d
1138 swap buffer across windows
1139 from http://www.emacswiki.org/emacs/TransposeWindows
1140 #+begin_src emacs-lisp
1141 (setq swapping-buffer nil)
1142 (setq swapping-window nil)
1143 (defun swap-buffers-in-windows ()
1144 "Swap buffers between two windows"
1145 (interactive)
1146 (if (and swapping-window
1147 swapping-buffer)
1148 (let ((this-buffer (current-buffer))
1149 (this-window (selected-window)))
1150 (if (and (window-live-p swapping-window)
1151 (buffer-live-p swapping-buffer))
1152 (progn (switch-to-buffer swapping-buffer)
1153 (select-window swapping-window)
1154 (switch-to-buffer this-buffer)
1155 (select-window this-window)
1156 (message "Swapped buffers."))
1157 (message "Old buffer/window killed. Aborting."))
1158 (setq swapping-buffer nil)
1159 (setq swapping-window nil))
1160 (progn
1161 (setq swapping-buffer (current-buffer))
1162 (setq swapping-window (selected-window))
1163 (message "Buffer and window marked for swapping."))))
1164
1165 (global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)
1166 #+end_src
1167 *** C-S-d
1168 *** C-f]
1169 kill-whole-line
1170 #+begin_src emacs-lisp
1171 (global-set-key (kbd "C-f") 'kill-whole-line-wrapper)
1172 (defun kill-whole-line-wrapper (&optional arg)
1173 "If we are at the end of the file, kill backwards instead of doing nothing."
1174 (interactive "P")
1175 (if (= (point) (point-max))
1176 (kill-whole-line -1)
1177 (kill-whole-line arg)))
1178 #+end_src
1179 *** M-f]
1180 print-var-at-point
1181 #+begin_src emacs-lisp
1182 (defun print-var-at-point ()
1183 (interactive)
1184 (let ((v (variable-at-point)))
1185 (if (symbolp v)
1186 (message "%s: %s" v (symbol-value v))
1187 (message "no symbol found at point"))))
1188 (global-set-key (kbd "M-f") 'print-var-at-point)
1189 #+end_src
1190
1191 *** C-M-f]
1192 kill rest of line
1193 #+begin_src emacs-lisp
1194
1195 (add-hook 'org-mode-hook
1196 (lambda ()
1197 (define-key org-mode-map (kbd "C-M-f") 'org-kill-line)))
1198
1199 (global-set-key (kbd "C-M-f") 'kill-line)
1200 #+end_src
1201 *** C-S-f
1202 *** C-g]
1203 cancel / other window
1204 #+begin_src emacs-lisp
1205 (global-set-key (kbd "C-g") 'other-window)
1206 #+end_src
1207 *** M-g]
1208 abort-recursive-edit
1209 #+begin_src emacs-lisp
1210 (global-set-key (kbd "M-g") 'abort-recursive-edit)
1211 #+end_src
1212 *** C-M-g]
1213 gnus
1214 #+begin_src emacs-lisp
1215 (global-set-key (kbd "C-M-g") 'mu4e)
1216 #+end_src
1217 *** C-S-g
1218 *** C-z
1219 #+begin_src emacs-lisp
1220 (global-set-key (kbd "C-z") 'undo-tree-undo)
1221 #+end_src
1222 *** M-z
1223 *** C-M-z]
1224 *** C-S-z
1225 *** C-x
1226 kill-region
1227 #+begin_src emacs-lisp
1228 (global-set-key (kbd "C-s") 'kill-region)
1229 #+end_src
1230 *** M-x]
1231 smex
1232 #+begin_src emacs-lisp
1233 (global-set-key (kbd "M-x") 'smex)
1234 #+end_src
1235 *** C-M-x]
1236 cut-to-register
1237 #+begin_src emacs-lisp
1238 ;; same args as copy-to-register
1239 (defun cut-to-register (register start end &optional delete-flag region)
1240 (interactive (list (register-read-with-preview "Cut to register: ")
1241 (region-beginning)
1242 (region-end)
1243 current-prefix-arg
1244 t))
1245 (copy-to-register register start end t region))
1246
1247 (global-set-key (kbd "C-M-x") 'cut-to-register)
1248 #+end_src
1249 *** C-S-x
1250 *** C-c
1251 copy
1252 #+begin_src emacs-lisp
1253 (global-set-key (kbd "C-d") 'kill-ring-save)
1254 (add-hook 'c-mode-hook
1255 (lambda () (define-key c-mode-map (kbd "C-d") nil)))
1256 (add-hook 'comint-mode-hook
1257 (lambda ()
1258 (define-key comint-mode-map (kbd "C-d") nil)))
1259 ;; the base map is shared by many c-modes, like java
1260 (add-hook 'c-mode-hook
1261 (lambda ()
1262 (define-key c-mode-base-map "\C-d" nil)
1263 (define-key c-mode-base-map (kbd "<deletechar>") 'c-electric-delete-forward)))
1264
1265 #+end_src
1266 *** M-c]
1267 org-capture
1268 #+begin_src emacs-lisp
1269 (define-key global-map "\M-c" 'org-capture)
1270 #+end_src
1271 *** C-M-c]
1272 copy-to-register
1273 #+begin_src emacs-lisp
1274 (global-set-key (kbd "C-M-c") 'copy-to-register)
1275 #+end_src
1276 *** C-S-c
1277 *** C-v
1278 yank
1279 #+begin_src emacs-lisp
1280 (global-set-key (kbd "C-v") 'yank-better)
1281
1282
1283
1284 (defun yank-better (arg)
1285 "Paste, linewise if our kill ends with a newline.
1286 I change the behavior of plain prefix. It makes it not do linewise paste,
1287 because sometimes you want to yank pop and a linewise paste screws that up.
1288 c-u with no number normally makes the point go before the yank.
1289 That is pointless for me, as it would be just as easier and less
1290 thought to pop the mark after yanking cuz it is set to before the mark."
1291 (interactive "*P")
1292 (if (and (not (equal arg '(4))) (string-suffix-p "\n" (current-kill 0 t)))
1293 (beginning-of-line))
1294 (if (and (stringp mode-name) (string= mode-name "Org"))
1295 (call-interactively 'org-yank)
1296 (setq this-command 'yank)
1297 (call-interactively 'yank (and (not (equal arg '(4)))))))
1298
1299 (put 'yank-better 'delete-selection 'yank)
1300 #+end_src
1301 *** M-v]
1302 insert-register
1303 #+begin_src emacs-lisp
1304 (global-set-key (kbd "M-v") 'insert-register)
1305 #+end_src
1306 *** C-M-v]
1307 yank-pop
1308 #+begin_src emacs-lisp
1309 (global-set-key (kbd "C-M-v") 'yank-pop)
1310 #+end_src
1311 *** C-S-v
1312 *** C-b]
1313 delete-other-windows
1314 #+begin_src emacs-lisp
1315 (global-set-key (kbd "C-b") 'delete-other-windows)
1316 #+end_src
1317 *** M-b]
1318 isearch-backward-current-symbol
1319 #+begin_src emacs-lisp
1320 (global-set-key (kbd "M-b") 'isearch-backward-current-symbol)
1321 #+end_src
1322 *** C-M-b]
1323 isearch-current-symbol
1324 #+begin_src emacs-lisp
1325 (global-set-key (kbd "C-M-b") 'isearch-current-symbol)
1326 #+end_src
1327 *** C-S-b
1328 *** C-tab]
1329 ---
1330 in terminal, it's just TAB, duplicate keybind.
1331 *** M-tab]
1332 ---
1333 in terminal it's duplicated of C-M-i
1334 *** C-M-tab
1335 *** C-S-tab
1336 *** C-delete]
1337 kill-symbol
1338 #+begin_src emacs-lisp
1339 (global-set-key (kbd "<C-delete>") 'kill-symbol)
1340 (defun kill-symbol (arg)
1341 (interactive "p")
1342 (kill-region (point) (save-excursion (forward-symbol arg) (point))))
1343
1344 #+end_src
1345 *** M-delete
1346 *** C-M-delete]
1347 kill-sexp
1348 #+begin_src emacs-lisp
1349 (global-set-key (kbd "<C-M-delete>") 'kill-sexp)
1350 #+end_src
1351 *** C-S-delete
1352
1353 *** C-left-arrow]
1354 compile / comint search
1355 #+begin_src emacs-lisp
1356 (defun set-p (var)
1357 (and (bound-and-true-p var)
1358 (not (eq var 'unset))))
1359 (global-set-key (kbd "C-(") 'run)
1360
1361 ;; make compile work from the gtags root dir
1362 (defadvice compile (before pre-compile-advice activate)
1363 (basic-save-buffer)
1364 (when (set-p ggtags-project-root)
1365 (setq-local compile-saved-dir default-directory)
1366 (setq default-directory ggtags-project-root)))
1367 (defadvice compile (after post-compile-advice activate)
1368 (when (bound-and-true-p compile-saved-dir)
1369 (setq default-directory compile-saved-dir)))
1370
1371
1372 (add-hook 'c-mode-hook (lambda () (define-key c-mode-map (kbd "C-(") 'compile)))
1373 (add-hook 'comint-mode-hook
1374 (lambda ()
1375 (define-key isearch-mode-map (kbd "C-(") 'isearch-repeat-backward)
1376 (define-key comint-mode-map (kbd "C-(") 'isearch-backward)))
1377
1378 #+end_src
1379 *** M-left-arrow
1380 *** C-M-left-arrow]
1381 org-shiftup
1382 #+begin_src emacs-lisp
1383 (add-hook 'org-mode-hook
1384 (lambda () (define-key org-mode-map (kbd "C-M-(") 'org-shiftup)))
1385 #+end_src
1386 *** C-S-left-arrow
1387 *** C-right-arrow]
1388 keyboard-yank-primary
1389 #+begin_src emacs-lisp
1390 (defun keyboard-yank-primary ()
1391 (interactive)
1392 (let ((mouse-yank-at-point t))
1393 (mouse-yank-primary nil)))
1394 ;; paste selection
1395 (global-set-key (kbd "C-)") 'keyboard-yank-primary) ;; kinesis binding
1396 (global-set-key (kbd "<S-right>") 'keyboard-yank-primary)
1397 #+end_src
1398 *** M-right-arrow
1399 *** C-M-right-arrow
1400 #+begin_src emacs-lisp
1401 (add-hook 'org-mode-hook
1402 (lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
1403 #+end_src
1404 *** C-S-right-arrow
1405 *** C-backspace]
1406 backward-kill-symbol
1407 #+begin_src emacs-lisp
1408 (global-set-key (kbd "<C-backspace>") 'backward-kill-symbol)
1409 (add-hook 'comint-mode-hook
1410 (lambda ()
1411 (define-key comint-mode-map (kbd "<C-backspace>") 'backward-kill-word)))
1412 (defun backward-kill-symbol (arg)
1413 (interactive "p")
1414 (kill-region (point) (save-excursion (backward-symbol arg) (point))))
1415 #+end_src
1416 *** M-backspace
1417 *** C-M-backspace]
1418 backward-kill-sexp
1419 #+begin_src emacs-lisp
1420 (global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
1421 #+end_src
1422 *** C-S-backspace
1423 *** C-f7
1424 *** M-f7
1425 *** C-M-f7
1426 *** C-S-f7
1427
1428 ** right primary
1429 *** C-*]
1430 split-window-horizontally
1431 #+begin_src emacs-lisp
1432 (global-set-key (kbd "C-*") 'split-window-horizontally)
1433 #+end_src
1434 *** M-*
1435 *** C-M-*]
1436 calc-dispatch
1437 #+begin_src emacs-lisp
1438 (global-set-key (kbd "C-M-*") 'calc-dispatch)
1439 #+end_src
1440 *** C-S-*
1441 *** C-9]
1442 delete-window-or-exit
1443 #+begin_src emacs-lisp
1444 (global-set-key (kbd "C-9") 'delete-window-or-exit)
1445
1446 (defun delete-window-or-exit ()
1447 "Delete window or exit emacs."
1448 (interactive)
1449 (if (condition-case nil (delete-window) (error t))
1450 (if (or (boundp 'server-process) (> (length (frame-list)) 1))
1451 (progn (basic-save-buffer) (delete-frame))
1452 (save-buffers-kill-terminal t))))
1453 #+end_src
1454 *** M-9]
1455 kill-buffer
1456 #+begin_src emacs-lisp
1457 (defun kill-buffer-no-ido ()
1458 "kill-buffer, avoid the ido remapping"
1459 (interactive)
1460 (kill-buffer))
1461 (global-set-key (kbd "M-9") 'kill-buffer-no-ido)
1462 #+end_src
1463 strangely, in simple mode, this is overridden.
1464 I found this map to override, but it didn't work, so it seems its being bound some other way.
1465 I did a grep of the emacs sources, but couldn't find anything.
1466 (define-key universal-argument-map [?9] nil)
1467
1468 *** C-M-9]
1469 end server edit
1470 ,save & kill buffer if it was opened externally via emacsclient
1471
1472 #+begin_src emacs-lisp
1473 (defun server-edit-save ()
1474 (interactive)
1475 (save-buffer)
1476 (server-edit))
1477 (global-set-key (kbd "C-M-9") 'server-edit-save)
1478 #+end_src
1479 *** C-S-9
1480 *** C-u]
1481 universal-argument
1482 *** M-u
1483 *** C-M-u]
1484 search-keybind
1485 #+begin_src emacs-lisp
1486 (global-set-key (kbd "C-M-u") 'search-keybind)
1487
1488 (defun search-keybind (regexp &optional nlines)
1489 (interactive (occur-read-primary-args))
1490 (save-excursion
1491 (describe-bindings)
1492 (set-buffer "*Help*")
1493 (occur regexp)
1494 (delete-windows-on "*Help*")
1495 ))
1496 #+end_src
1497 *** C-S-u
1498 *** C-i
1499 -----
1500 *** M-i
1501 *** C-M-i]
1502 query-replace-regexp
1503 #+begin_src emacs-lisp
1504 (global-set-key (kbd "C-M-i") 'query-replace-regexp)
1505 (add-hook 'flyspell-mode-hook
1506 (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
1507 (add-hook 'text-mode-hook
1508 (lambda () (define-key text-mode-map (kbd "C-M-i") nil)))
1509
1510 #+end_src
1511 *** C-S-i
1512 *** C-o]
1513 occur
1514 #+begin_src emacs-lisp
1515 (global-set-key (kbd "C-o") 'occur)
1516 #+end_src
1517 *** M-o
1518 *** C-M-o]
1519 counsel-imenu
1520 #+begin_src emacs-lisp
1521 (global-set-key (kbd "C-M-o") 'counsel-imenu)
1522 #+end_src
1523 *** C-S-o
1524 *** C-p]
1525 move-mouse-to-point
1526 #+begin_src emacs-lisp
1527 (global-set-key (kbd "C-p") 'move-mouse-to-point)
1528 #+end_src
1529 *** M-p
1530 *** C-M-p]
1531 delete-horizontal-space
1532 #+begin_src emacs-lisp
1533 (global-set-key (kbd "C-M-p") 'delete-horizontal-space)
1534 #+end_src
1535 *** C-S-p
1536 *** C-j]
1537 pop-to-mark
1538 #+begin_src emacs-lisp
1539 (defun my-pop-to-mark-command ()
1540 "Jump to mark, and pop a new position for mark off the ring.
1541 \(Does not affect global mark ring\)."
1542 (interactive)
1543 (pop-to-mark-command)
1544 (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
1545 (org-show-context 'mark-goto)))
1546
1547 (global-set-key (kbd "C-j") 'my-pop-to-mark-command)
1548 (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)
1549 (add-hook 'ido-setup-hook
1550 (lambda () (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)))
1551 (add-hook 'lisp-interaction-mode-hook
1552 (lambda ()
1553 (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
1554
1555 #+end_src
1556 *** M-j]
1557 previous-error
1558 #+begin_src emacs-lisp
1559 (global-set-key (kbd "M-j") 'previous-error)
1560 #+end_src
1561 *** C-M-j]
1562
1563 register prefix
1564 #+begin_src emacs-lisp
1565 (define-key global-map (kbd "C-M-j") ctl-x-r-map)
1566 (define-key ctl-x-r-map "m" 'kmacro-to-register)
1567 #+end_src
1568
1569 *** C-S-j
1570 *** C-k]
1571 jump-to-register
1572 #+begin_src emacs-lisp
1573
1574 (global-set-key (kbd "C-k") 'jump-to-register)
1575 #+end_src
1576 *** M-k]
1577 next-error
1578 #+begin_src emacs-lisp
1579 (global-set-key (kbd "M-k") 'next-error)
1580 #+end_src
1581 *** C-M-k]
1582 man
1583 #+begin_src emacs-lisp
1584 (global-set-key (kbd "C-M-k") 'man)
1585 #+end_src
1586 *** C-S-k
1587 *** C-l]
1588 ivy-switch-buffer
1589 #+begin_src emacs-lisp
1590 (global-set-key (kbd "C-l") 'ivy-switch-buffer)
1591 #+end_src
1592 *** M-l
1593
1594 *** C-M-l]
1595 move cursor top bottom mid, comint clear screen
1596 #+begin_src emacs-lisp
1597 (global-set-key (kbd "C-M-l") 'move-to-window-line-top-bottom)
1598 #+end_src
1599 *** C-S-l
1600 *** C-;]
1601 used in flyspell, not sure what for, otherwise unbound
1602 *** M-;
1603 comment-dwim
1604 *** C-M-;]
1605 comment-current-line-dwim
1606 #+begin_src emacs-lisp
1607 (defun comment-current-line-dwim ()
1608 "Comment or uncomment the current line."
1609 (interactive)
1610 (save-excursion
1611 (push-mark (beginning-of-line) t t)
1612 (end-of-line)
1613 (comment-dwim nil))
1614 (move-beginning-of-line 2))
1615 (global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
1616 #+end_src
1617 *** C-S-;
1618 *** C-m]
1619 *** M-m
1620 *** C-M-m]
1621 recursive grep
1622 #+begin_src emacs-lisp
1623 (define-key global-map (kbd "C-M-m") 'rgrep)
1624 #+end_src
1625 *** C-S-m
1626 *** C-,]
1627 counsel-find-file
1628 #+begin_src emacs-lisp
1629 (global-set-key (kbd "C-,") 'counsel-find-file)
1630 (add-hook 'flyspell-mode-hook
1631 (lambda () (define-key flyspell-mode-map (kbd "C-,") nil)))
1632 #+end_src
1633 *** M-,
1634 *** C-M-,]
1635 find-file-in-project
1636 #+begin_src emacs-lisp
1637 (global-set-key (kbd "C-M-,") 'find-file-in-project)
1638 #+end_src
1639 *** C-S-,
1640 *** C-.]
1641 find recent file
1642 Taken from starter kit.
1643 #+begin_src emacs-lisp
1644 (defun recentf-ido-find-file ()
1645 "Find a recent file using Ido."
1646 (interactive)
1647 (let* ((file-assoc-list
1648 (mapcar (lambda (x)
1649 (cons (file-name-nondirectory x)
1650 x))
1651 recentf-list))
1652 (filename-list
1653 (remove-duplicates (mapcar #'car file-assoc-list)
1654 :test #'string=))
1655 (filename (ido-completing-read "Choose recent file: "
1656 filename-list
1657 nil
1658 t)))
1659 (when filename
1660 (find-file (cdr (assoc filename
1661 file-assoc-list))))))
1662
1663 (add-hook 'flyspell-mode-hook
1664 (lambda () (define-key flyspell-mode-map (kbd "C-.") nil)))
1665 (define-key dot-mode-map (kbd "C-.") nil)
1666 (global-set-key (kbd "C-.") 'recentf-ido-find-file)
1667 (add-hook 'php-mode-hook
1668 (lambda () (define-key php-mode-map (kbd "C-.") nil)))
1669 #+end_src
1670 *** M-.
1671 *** C-M-.
1672 -
1673 #+begin_src emacs-lisp
1674 (define-key dot-mode-map (kbd "C-M-.") nil)
1675 ;; (global-set-key (kbd "C-M-.") 'execute-extended-command)
1676 #+end_src
1677 *** C-S-.
1678 *** C-/]
1679 join lines
1680 #+begin_src emacs-lisp
1681 (defun vim-style-join-line ()
1682 (interactive)
1683 (join-line '(4)))
1684 (global-set-key (kbd "C-/") 'vim-style-join-line)
1685 (define-key undo-tree-map (kbd "C-/") nil)
1686 #+end_src
1687 *** M-/
1688 *** C-M-/]
1689 copy-buffer-file-name
1690 #+begin_src emacs-lisp
1691 ;; haven't bound this atm, todo, maybe someday?
1692 (defun copy-variable (variable)
1693 (interactive
1694 (let ((v (variable-at-point))
1695 (enable-recursive-minibuffers t)
1696 val)
1697 (setq val (completing-read (if (symbolp v)
1698 (format
1699 "Describe variable (default %s): " v)
1700 "Describe variable: ")
1701 obarray
1702 (lambda (vv)
1703 (or (get vv 'variable-documentation)
1704 (and (boundp vv) (not (keywordp vv)))))
1705 t nil nil
1706 (if (symbolp v) (symbol-name v))))
1707 (list (if (equal val "")
1708 v (intern val)))))
1709 (kill-new (symbol-value variable)))
1710
1711 (defun copy-buffer-file-name ()
1712 (interactive)
1713 (let ((name (cond
1714 ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
1715 (t buffer-file-name))
1716 ))
1717 (kill-new name)
1718 (message name)))
1719
1720
1721 (global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
1722
1723
1724 #+end_src
1725 *** C-S-/
1726 *** C-8]
1727 calc-embedded-word
1728 #+begin_src emacs-lisp
1729 (global-set-key (kbd "C-8") 'calc-embedded-word)
1730 #+end_src
1731 *** M-8
1732 *** C-M-8
1733 *** C-S-8
1734 *** C-up-arrow]
1735 org prev headline
1736 #+begin_src emacs-lisp
1737 (define-key undo-tree-map "\C-_" nil)
1738 ;; disabled just because i don't want to accidentally hit it
1739 (define-key global-map "\C-_" nil)
1740 (global-set-key (kbd "<C-_>") 'beginning-of-defun)
1741
1742 (add-hook 'org-mode-hook
1743 (lambda ()
1744 (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
1745
1746 #+end_src
1747
1748
1749 *** M-up-arrow
1750 *** C-M-up-arrow
1751 *** C-S-up-arrow
1752 winner undo
1753 #+begin_src emacs-lisp
1754 (global-set-key (kbd "<C-S-_>") 'winner-undo)
1755 #+end_src
1756 *** C-down-arrow]
1757 org next headline
1758 #+begin_src emacs-lisp
1759 (global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
1760
1761 (add-hook 'org-mode-hook
1762 (lambda ()
1763 (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
1764
1765 #+end_src
1766
1767
1768 *** M-down-arrow
1769 *** C-M-down-arrow]
1770 toggle-mark-activation
1771 #+begin_src emacs-lisp
1772 (defun toggle-mark-activation ()
1773 (interactive)
1774 (if mark-active
1775 (deactivate-mark t)
1776 (activate-mark)))
1777
1778 (global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
1779 #+end_src
1780 winner redo
1781 #+begin_src emacs-lisp
1782 (global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
1783 #+end_src
1784
1785 *** C-S-down-arrow]
1786 m-x for major mode
1787 #+begin_src emacs-lisp
1788 (global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
1789 #+end_src
1790 *** C-lbracket
1791 ----
1792 *** M-lbracket
1793 *** C-M-lbracket]
1794 scroll-right
1795 #+begin_src emacs-lisp
1796 (global-set-key (kbd "C-M-[") 'scroll-right)
1797 #+end_src
1798 *** C-S-lbracket
1799 *** C-rbracket]
1800 fill-paragraph
1801 #+begin_src emacs-lisp
1802 (global-set-key (kbd "C-]") 'fill-paragraph)
1803 #+end_src
1804 *** M-rbracket
1805 *** C-M-rbracket]
1806 scroll-left
1807 #+begin_src emacs-lisp
1808 (global-set-key (kbd "C-M-]") 'scroll-left)
1809 #+end_src
1810 *** C-S-rbracket
1811 *** C-return]
1812 newline-anywhere
1813 #+begin_src emacs-lisp
1814 (defun newline-anywhere ()
1815 "Add a newline from anywhere in the line."
1816 (interactive)
1817 (end-of-line)
1818 (newline-and-indent))
1819 (global-set-key (kbd "<C-return>") 'newline-anywhere)
1820
1821 #+end_src
1822 *** M-return]
1823 plain newline
1824 #+begin_src emacs-lisp
1825 (defun plain-newline ()
1826 (interactive)
1827 (insert "\n"))
1828 (global-set-key (kbd "<M-return>") 'plain-newline)
1829 #+end_src
1830
1831 *** C-M-return
1832 #+begin_src emacs-lisp
1833 (defun newline-anywhere-previous ()
1834 "Add a newline from anywhere in the line."
1835 (interactive)
1836 (forward-line -1)
1837 (end-of-line)
1838 (newline-and-indent))
1839 (global-set-key (kbd "<C-M-return>") 'newline-anywhere-previous)
1840 #+end_src
1841 *** C-S-return
1842 *** C-space]
1843 org-edit-special
1844 #+begin_src emacs-lisp
1845 ;; commented due to new keyboard needing ctrl-space for mark
1846 ;; (kbd "<C-space>") does not work, (kbd "C-SPC") should work
1847 ;; (add-hook 'org-mode-hook
1848 ;; (lambda ()
1849 ;; (define-key org-mode-map (kbd "C-SPC") 'org-edit-special)
1850 ;; ;; org-src-mode-map is broken in git version of emacs.
1851 ;; ;; temporarily use this for exiting edit-special mode.
1852 ;; (global-set-key (kbd "C-M--") 'org-edit-src-exit)
1853 ;; (define-key org-src-mode-map (kbd "C-SPC") 'org-edit-src-exit)))
1854 #+end_src
1855 *** M-space
1856 *** C-M-space
1857 before or under cursor
1858 #+begin_src emacs-lisp
1859 (global-set-key (kbd "C-M-SPC") 'ispell-word)
1860 #+end_src
1861 *** C-S-space
1862 ** left secondary
1863 *** C-=
1864 *** M-=
1865 *** C-M-=
1866 *** C-S-=
1867 *** C-1
1868 *** M-1
1869 *** C-M-1
1870 *** C-S-1
1871 *** C-4
1872 *** M-4
1873 *** C-M-4
1874 widen
1875 #+begin_src emacs-lisp
1876 (global-set-key (kbd "C-M-4") 'widen)
1877 #+end_src
1878 *** C-S-4
1879 *** C-5
1880 *** M-5
1881 *** C-M-5
1882 *** C-S-5
1883 *** C-tab-key]
1884 query-replace
1885 #+begin_src emacs-lisp
1886
1887 (global-set-key (kbd "<C-kp-add>") 'query-replace)
1888 #+end_src
1889 *** M-tab-key
1890 *** C-M-tab-key
1891 *** C-S-tab-key
1892 *** C-t]
1893 org cycle todo / toggle comint motion
1894 #+begin_src emacs-lisp
1895 (add-hook 'org-mode-hook
1896 (lambda ()
1897 (define-key org-mode-map (kbd "C-t") 'org-todo)))
1898
1899 (defun my-comint-previous-input (arg)
1900 (interactive "*p")
1901 (if (comint-after-pmark-p)
1902 (comint-previous-input arg)
1903 (forward-line -1)))
1904
1905 (defun my-comint-next-input (arg)
1906 (interactive "*p")
1907 (if (comint-after-pmark-p)
1908 (comint-next-input arg)
1909 (forward-line)))
1910
1911 (add-hook 'comint-mode-hook
1912 (lambda ()
1913 (define-key comint-mode-map (kbd "C-t") 'comint-toggle-arrow-keys)
1914 (define-key comint-mode-map (kbd "<up>") 'my-comint-previous-input)
1915 (define-key comint-mode-map (kbd "<down>") 'my-comint-next-input)))
1916
1917
1918 (defun comint-toggle-arrow-keys ()
1919 (interactive)
1920 (toggle-arrow-keys comint-mode-map))
1921
1922 (setq-default comint-arrow-movement nil)
1923 (defun toggle-arrow-keys (map)
1924 (cond ((lookup-key map (kbd "<up>"))
1925 (setq-local comint-arrow-movement t)
1926 (define-key map (kbd "<up>") nil)
1927 (define-key map (kbd "<down>") nil))
1928 (t
1929 (setq-local comint-arrow-movement nil)
1930 (define-key map (kbd "<up>") 'my-comint-previous-input)
1931 (define-key map (kbd "<down>") 'my-comint-next-input)
1932 (goto-char (point-max)))))
1933
1934 (eval-after-load "message"
1935 '(define-key message-mode-map (kbd "C-t") 'mail-signature))
1936 #+end_src
1937 Thanks for the update. I will be enjoying it.
1938
1939 #+RESULTS:
1940 : comint-toggle-arrow-keys
1941 *** M-t
1942 *** C-M-t]
1943 org timestamp
1944 #+begin_src emacs-lisp
1945 (global-set-key (kbd "C-M-t") 'org-time-stamp-with-time)
1946 #+end_src
1947 *** C-S-t
1948 *** C-home
1949 start of buffer
1950 *** M-home
1951 *** C-M-home
1952 *** C-S-home
1953 *** C-end
1954 end of buffer
1955 *** M-end
1956 *** C-M-end
1957 *** C-S-end
1958 *** C-f9
1959 *** M-f9
1960 *** C-M-f9
1961 *** C-S-f9
1962 ** right secondary
1963 *** C-6
1964 save-buffers-kill-emacs
1965 #+begin_src emacs-lisp
1966 (global-set-key (kbd "C-6") 'save-buffers-kill-emacs)
1967 #+end_src
1968 *** M-6
1969 *** C-M-6]
1970 insert-small-copyright
1971 #+begin_src emacs-lisp
1972 (defun insert-small-copyright ()
1973 (interactive)
1974 (beginning-of-line)
1975 (let ((beg (point)))
1976 (insert "Copyright (C) 2017 Ian Kelling\nThis program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>")
1977 (comment-region beg (point))))
1978
1979 (global-set-key (kbd "C-M-6") 'insert-small-copyright)
1980 #+end_src
1981 *** C-S-6
1982 *** C-7
1983 *** M-7
1984 *** C-M-7]
1985 insert-full-copyright
1986 #+begin_src emacs-lisp
1987 (defun insert-full-copyright ()
1988 (interactive)
1989 (beginning-of-line)
1990 (let ((beg (point)))
1991 (insert "Copyright (C) 2017 Ian Kelling\n")
1992 (insert "\n")
1993 (insert "This program is free software: you can redistribute it and/or modify\n")
1994 (insert "it under the terms of the GNU General Public License as published by\n")
1995 (insert "the Free Software Foundation, either version 3 of the License, or\n")
1996 (insert "(at your option) any later version.\n")
1997 (insert "\n")
1998 (insert "This program is distributed in the hope that it will be useful,\n")
1999 (insert "but WITHOUT ANY WARRANTY; without even the implied warranty of\n")
2000 (insert "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")
2001 (insert "GNU General Public License for more details.\n")
2002 (insert "\n")
2003 (insert "You should have received a copy of the GNU General Public License\n")
2004 (insert "along with this program. If not, see <http://www.gnu.org/licenses/>.\n")
2005 (comment-region beg (point))))
2006
2007 (global-set-key (kbd "C-M-7") 'insert-full-copyright)
2008
2009 #+end_src
2010 *** C-S-7
2011 *** C-0
2012 text-scale-reset
2013 #+begin_src emacs-lisp
2014 (defun text-scale-reset ()
2015 (interactive)
2016 (text-scale-set 0))
2017 (global-set-key (kbd "C-0") 'text-scale-reset)
2018 #+end_src
2019 *** M-0
2020 *** C-M-0
2021 insert-apache
2022 #+begin_src emacs-lisp
2023 (defun insert-apache ()
2024 (interactive)
2025 (beginning-of-line)
2026 (let ((beg (point)))
2027 (insert "Copyright (C) 2017 Ian Kelling\n")
2028 (insert "\n")
2029 (insert "Licensed under the Apache License, Version 2.0 (the \"License\");\n")
2030 (insert "you may not use this file except in compliance with the License.\n")
2031 (insert "You may obtain a copy of the License at\n")
2032 (insert "\n")
2033 (insert " http://www.apache.org/licenses/LICENSE-2.0\n")
2034 (insert "\n")
2035 (insert "Unless required by applicable law or agreed to in writing, software\n")
2036 (insert "distributed under the License is distributed on an \"AS IS\" BASIS,\n")
2037 (insert "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n")
2038 (insert "See the License for the specific language governing permissions and\n")
2039 (insert "limitations under the License.\n")
2040 (comment-region beg (point))))
2041 (global-set-key (kbd "C-M-0") 'insert-apache)
2042 #+end_src
2043
2044 *** C-S-0
2045 *** C--
2046 *** M--
2047 *** C-M--
2048 org-edit-src-exit
2049 *** C-S--
2050 *** C-y]
2051 undo-tree-redo
2052 #+begin_src emacs-lisp
2053 (global-set-key (kbd "C-y") 'undo-tree-redo)
2054 (add-hook 'org-mode-hook
2055 (lambda () (define-key org-mode-map (kbd "C-y") nil)))
2056 #+end_src
2057
2058 *** M-y
2059 *** C-M-y
2060 *** C-S-y
2061 *** C-\
2062 #+begin_src emacs-lisp
2063 (global-set-key (kbd "C-\\") 'sr-speedbar-toggle)
2064 #+end_src
2065 *** M-\
2066 *** C-M-\]
2067 mark-defun
2068 #+begin_src emacs-lisp
2069 (global-set-key (kbd "C-M-\\") 'mark-defun)
2070 #+end_src
2071 *** C-S-\
2072 *** C-h
2073 help-prefix
2074
2075 *** M-h
2076 *** C-M-h
2077 *** C-S-h
2078 *** C-'
2079 eval-expression
2080 #+begin_src emacs-lisp
2081 (global-set-key (kbd "C-'") 'eval-expression)
2082 #+end_src
2083 *** M-'
2084 *** C-M-'
2085 *** C-S-'
2086 *** C-n]
2087 unpop to mark
2088 #+begin_src emacs-lisp
2089 (defun unpop-to-mark-command ()
2090 "Unpop off mark ring. Does nothing if mark ring is empty."
2091 (interactive)
2092 (when mark-ring
2093 (let ((pos (marker-position (car (last mark-ring)))))
2094 (if (not (= (point) pos))
2095 (goto-char pos)
2096 (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring))
2097 (set-marker (mark-marker) pos)
2098 (setq mark-ring (nbutlast mark-ring))
2099 (goto-char (marker-position (car (last mark-ring))))))))
2100
2101 (global-set-key (kbd "C-n") 'unpop-to-mark-command)
2102 #+end_src
2103 *** M-n
2104 *** C-M-n]
2105 narrow-to-region
2106 #+begin_src emacs-lisp
2107 (global-set-key (kbd "C-M-n") 'narrow-to-region)
2108 #+end_src
2109 *** C-S-n
2110 *** C-rshift
2111 *** M-rshift
2112 *** C-M-rshift
2113 *** C-S-rshift
2114 *** C-escape]
2115 find-tag
2116 :ID: a6dd7e4c-1831-4493-bbfd-557dc2f9c856
2117 :CUSTOM_ID: 6901fa1b-c827-4525-b24b-bdb8fe5f638b
2118
2119
2120
2121
2122
2123
2124
2125
2126 :END:
2127 find-tag
2128 #+begin_src emacs-lisp
2129 (global-set-key (kbd "<C-escape>") 'find-tag)
2130 #+end_src
2131 *** M-escape
2132 *** C-M-escape
2133 *** C-S-escape
2134 * keybind table src
2135 not necessary to have at the end, but its convenient to have it next
2136 to its output.
2137 #+NAME: keybind-table-generator
2138 #+BEGIN_SRC emacs-lisp :results silent
2139 (defun org-custom-id-get (&optional pom create prefix)
2140 "Get the CUSTOM_ID property of the entry at point-or-marker POM.
2141 If POM is nil, refer to the entry at point.
2142 If the entry does not have a CUSTOM_ID, the function returns nil.
2143 However, when CREATE is non nil, create an ID if none is present already.
2144 PREFIX will be passed through to `org-id-new'.
2145 In any case, the CUSTOM_ID of the entry is returned."
2146 (org-with-point-at pom
2147 (let ((id (org-entry-get nil "CUSTOM_ID")))
2148 (cond
2149 ((and id (stringp id) (string-match "\\S-" id))
2150 id)
2151 (create
2152 (setq id (org-id-new prefix))
2153 (org-entry-put pom "CUSTOM_ID" id)
2154 (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
2155 id)))))
2156
2157 (defun get-title()
2158 (interactive)
2159 (let ((title (plist-get (cadr (org-element-at-point)) ':title)))
2160 ;; remove brackets from [title]
2161 ;; I was at one point using org-drill for spaces repitition,
2162 ;; and enclosed question and answer by 2 sets of brackets.
2163 (string-match "[^[ ][^]]*" title)
2164 (setq title (match-string 0 title))
2165 (print title)
2166 title))
2167
2168
2169 (defun org-dblock-write:keybind-dblock (arg)
2170 (let (output)
2171 (save-excursion
2172 (goto-char (org-find-entry-with-id "beginning-of-keybind-table-data"))
2173 (let* ((table-level (org-current-level))
2174 (keybind-level (1+ table-level))
2175 (prefixes (list "C-M-S-" "C-M-" "C-S-" "M-S-" "M-" "C-" "S-"))
2176 table-title
2177 previous-prefixes
2178 )
2179 (while (>= (org-current-level) table-level)
2180 (setq table-title (get-title))
2181 (outline-next-heading)
2182 (let (found-prefixes
2183 found-all-prefixes)
2184 ;; go through the first few elements of the table to find out what column headings aka prefixes it should have
2185 (save-excursion
2186 (while (not found-all-prefixes)
2187 (let ((prefixes-copy prefixes)
2188 current-prefix
2189 found-prefix)
2190 (while (and prefixes-copy (not found-prefix))
2191 (setq current-prefix (car prefixes-copy))
2192 (when (and (> (length (get-title)) (length current-prefix))
2193 (string= (substring (get-title) 0 (length current-prefix)) current-prefix))
2194 (setq found-prefix t))
2195 (setq prefixes-copy (cdr prefixes-copy)))
2196 (unless found-prefix
2197 (setq current-prefix ""))
2198 (if (and found-prefixes (string= (car (last found-prefixes)) current-prefix))
2199 (setq found-all-prefixes t)
2200 (push current-prefix found-prefixes)))
2201 (outline-next-heading)))
2202 (setq found-prefixes (reverse found-prefixes))
2203
2204 ;; start a new table or repeat the prefixes in the current table
2205
2206 (if (or (not previous-prefixes) (equal previous-prefixes found-prefixes))
2207 (setq output (concat output "|-|\n| "))
2208 (setq output (concat output "|-|\n\n|-|\n| ")))
2209 (setq output (concat output table-title " | "))
2210 (setq previous-prefixes found-prefixes)
2211
2212 ;; add the prefixes
2213 (dolist (prefix found-prefixes)
2214 (setq output (concat output prefix "|")))
2215 (setq output (concat output "\n|-|\n"))
2216
2217
2218 (let (subtree-end)
2219 (while (>= (org-current-level) keybind-level)
2220 (dotimes (i (length found-prefixes))
2221 ;; add keybind name
2222 (when (= i 0)
2223 (setq output (concat output "| " (substring (get-title) (length (car found-prefixes))) " | ")))
2224 ;; add keybinds by searching for regex [keybind] to the start of the next heading
2225 (save-excursion
2226 (outline-next-heading)
2227 (setq subtree-end (point)))
2228 ;; skip over scheduled line
2229
2230 ;; see comment after source block to understand this regex
2231 (re-search-forward "^\\s-*\\([^*: ].*?$\\)" subtree-end t)
2232 (let ((m (match-string 1)))
2233 (when m
2234 (setq output (concat output "[[#" (org-custom-id-get (point) 'create) "][" m "]]")))
2235 (setq output (concat output " | ")))
2236 ;; advance to next keybind
2237 (outline-next-heading))
2238 (setq output (concat output "\n"))
2239 ))))))
2240 (setq output (concat output "|-|"))
2241 (insert output))
2242 (org-table-map-tables 'org-table-align 'quietly))
2243
2244
2245 #+END_SRC
2246 after source block due to bad parsing of comments in non emacs lisp mode
2247 some easily forgotten regex elements. whitespace: \\s-
2248 non-greedy star: *?
2249 subexpression for close bracket char or nothing: \\(\\]\\|\\)
2250
2251 * keybind tables
2252 :LOGBOOK:
2253 CLOCK: [2016-11-28 Mon 10:59]--[2016-11-28 Mon 10:59] => 0:00
2254 :END:
2255 dunno why but it takes doing ctrl-c twice to update this
2256 #+BEGIN: keybind-dblock
2257 |---------------------+------------------------|
2258 | single/special keys | |
2259 |---------------------+------------------------|
2260 | tab key | [[#6c10a716-1d8e-4ce4-8e26-64468f19c17a][isearch]] |
2261 | tab | [[#51ece189-1840-41a1-8ca0-19f9a0481895][isearch-forward]] |
2262 | end | [[#00d589b7-2b8e-494c-b761-3afefebe6ec6][move-end-of-line]] |
2263 | home | [[#7800e455-c3f6-4a8f-8907-b2292449ab67][back-to-indentation]] |
2264 | s-tab | [[#3072901e-5cf3-4d6e-9ac8-3ef64a5f6ad2][indent-buffer]] |
2265 | s-delete | [[#e53728b6-054d-4443-a03e-6cf02d13724d][send-shell]] |
2266 | s-left arrow | [[#d8c473ac-5507-4a6b-9e5a-46558c17b09f][shell]] |
2267 | s-right arrow | [[#cbae2b27-ff95-4b12-88e0-e1a0f7705db6][previous-buffer]] |
2268 | esc | |
2269 | return | [[#fab6adea-ed20-45ab-a0a3-776c68d5c3a5][new line]] |
2270 | s-return | [[#c433c837-24fa-45e1-8991-a4d380550ea0][auto-correct-prev-word]] |
2271 | down arrow | [[#7a868484-9c63-4a73-abda-7751cb2c02be][mark]] |
2272 | s-down arrow | [[#097b97e0-8ad8-40f7-8388-c4ace1706b38][extended command]] |
2273 | s-up arrow | |
2274 |---------------------+------------------------|
2275
2276 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2277 | mouse | | C- | M- | S- | C-M- | C-S- |
2278 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2279 | mouse-2 mode line | [[#69aaa631-6fb5-4beb-b2d8-c0f3d92c0a98][mouse-delete-other-windows]] | [[#501479ab-e1e2-497e-bd86-071f8afa3378][mouse-split-window-horizontally]] | | | | |
2280 | mouse-3 mode line | [[#917a1844-8c38-4f31-8616-50fc81334f2c][mouse-delete-window]] | | | | | |
2281 | mouse-1 | [[#4e60e2e4-8c2f-4450-8060-2d793ede530c][set cursor/mark]] | [[#b661f84f-57df-4095-9dc1-d1a876a53ee5][buffer list context menu]] | | | | |
2282 | mouse-2 | [[#086b0b50-054f-462d-92fa-b27852f887b0][paste]] | | | | | |
2283 | mouse-3 | [[#0481632e-9c50-4328-9365-c4b5bf967b66][set-mark]] | [[#9623c78f-7705-4cbe-a990-c24eb1067377][global menu]] | | | | |
2284 | mouse-9 | [[#efaec161-b279-4129-86fd-b410430926e4][move-mouse-to-point]] | | | | | |
2285 | mouse-8 | | | | | | |
2286 | 1/kp-end | | | | | | |
2287 | 2/kp-down | | | [[#50db5a06-452e-491f-875b-3de936a4d04a][smex]] | | | |
2288 | 3/kp-next | | | | | | |
2289 | 4/kp-left | [[#c44d0f65-9502-4cc6-9642-96d907f6b093][indent-region]] | | | | | |
2290 | 5/kp-begin | [[#2458c6bc-7113-4d4b-bbdf-206e1cb842a7][mark-defun]] | | | | | |
2291 | 6/kp-right | [[#3b79bc58-6067-43bd-9471-9d592744a25a][ibuffer]] | | | | | |
2292 | 7/kp-home | | | | | | |
2293 | 8/kp-up | | | | | | |
2294 | 9/kp-prior | [[#a3b51adb-4405-4d9f-9b88-a8faa479fbe7][delete-horizontal-space]] | | | | | |
2295 | 10/kp-insert | | | | | | |
2296 | 11/kp-subtract | | | | | | |
2297 | 12/kp-add | | | | | | |
2298 | scroll | [[#33433f0f-5b0e-46ba-8452-d2a51e54769b][up/dn / scroll]] | [[#38c594ca-1d13-441b-833c-ad47b27e7073][cycle recent buffers]] | [[#e1e2e253-450d-4620-af9e-78d378f49ad5][forward/back s-exp]] | [[#945cbcda-9a5a-4a9f-ad5c-4ede9a43656e][expand region]] | [[#10bc56d0-a6fe-4e2e-a287-1d280358ad1c][scroll]] | [[#fc79fff3-259e-416a-a62a-c237b30ade28][zoom]] |
2299 | left-scroll | [[#d2d5c5c7-f0de-4e08-953b-d41d3e282ba7][left/right]] | [[#7bb95aa5-381e-454a-a6c6-aaeec728db08][back / forward word]] | [[#3aeb5be7-6026-42f6-a65b-b00799e44642][winner undo redo]] | [[#ca5cdcd4-b3da-4d7b-86ab-4c7c0ac2caf7][---]] | [[#7f7103f5-2488-46a6-8530-6d8a558e6eff][unreachable]] | [[#7b4f1f49-6d93-4210-a30c-8278d6e63655][unreachable]] |
2300 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2301
2302 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2303 | left primary | C- | M- | C-M- | C-S- |
2304 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2305 | 2 | [[#b7db9f5c-f31d-45fb-ac70-eb3ef9369d3d][copy-symbol]] | [[#53ecfda2-d9f6-4882-b7a2-9b3c859e3bcb][shell-cd-to-file]] | [[#33c4996d-92bc-4df0-b005-11553677be13][---]] | |
2306 | 3 | [[#401f56ff-6aba-4156-b128-f449b18c27af][dot-mode-execute]] | | [[#eb0cc3a8-b62e-4a24-9f84-cc8e854f91dd][recenter-top-bottom]] | |
2307 | q | [[#679fd3cd-c43b-409c-be36-4175a5f27cd3][org-cycle, comint previous arg]] | [[#9a186632-7b04-4af7-b7de-eaec87daf315][org-archive-to-archive-sibling]] | [[#1f5e9b63-7ce0-445c-a426-b41839585d38][quoted-insert]] | |
2308 | w | [[#20005b6d-9a9d-4b58-882c-7ce860c7a395][goto-t.org]] | [[#9531a0da-269f-4359-9124-e83fbf61a92f][org-clock-in]] | | |
2309 | e | [[#11e8f541-f0a0-4058-883a-98bd1e7b8c4d][copy-line]] | [[#74d0ed51-ddb5-488e-bf55-0f033916e319][org-clock-in-last]] | | |
2310 | r | [[#5088a8b2-a772-4660-a3b6-b8cca7099da6][isearch-backward]] | [[#8fe64424-1f11-4086-84b3-07c2af210c1c][org-clock-out]] | | |
2311 | a | [[#d57dd0ac-2251-44af-b232-30f8a2b0b198][copy-all]] | [[#77987ef8-6a18-4123-8ede-77bc766aa2aa][kmacro-start-macro-or-in...]] | [[#dd2c225e-2d18-4b95-bc30-765163a5e368][kmacro-end-or-call-macro]] | |
2312 | s | [[#f26dd0f5-0655-485f-8c76-e6dfc6abd947][C-x prefix]] | | [[#290ea04a-be99-416a-a95f-458045a91c93][split-window-vertically]] | |
2313 | d | [[#b699614a-9994-4fe7-b2c6-f0fe81b7ad2b][C-c prefix]] | | [[#d9f48fbe-0a32-4133-93fb-f43ff6ab0037][swap buffer]] | |
2314 | f | [[#2695ed8a-e0d3-4e84-8688-98e3c50723b0][kill-whole-line]] | [[#869f0aec-c739-4fb7-8e3a-8b55ab637765][print-var-at-point]] | [[#e7e4dd0b-418f-48ee-b366-9e733e3bec61][kill rest of line]] | |
2315 | g | [[#a58a1eda-43ed-437e-b483-5c312e0754a7][other-window / cancel]] | [[#a287d720-4419-4546-8262-1f377bb158d2][abort-recursive-edit]] | [[#327e18af-30b7-47e5-aa53-5f678788b4c1][gnus]] | |
2316 | z | [[#5c30ce7e-8bc6-45bf-b9b1-5c75334a3e27][undo-tree-undo]] | | | |
2317 | x | [[#ec1403d3-528e-41b1-a195-5563bc93e124][kill-region]] | [[#bb7c95d5-dd97-439d-bf1f-cdac98d11543][append-next-kill]] | [[#47cc90e3-335f-4c44-9f39-b732e5440664][append-next-kill]] | |
2318 | c | [[#400f06e1-8e45-443c-8d7b-3d1bb1176aab][copy]] | [[#7a265014-1e9c-4639-ad1d-26b3416379a8][org-capture]] | [[#503e0beb-6fda-4e94-9678-d58bd3cbbc8e][copy-to-register]] | |
2319 | v | [[#16411f68-7fe0-49e8-9a73-212471594f9e][yank]] | [[#fe04fffa-6f85-483a-b329-938531109c35][insert-register]] | [[#c559e9ea-1218-4ccb-9c3a-74cbac4be220][yank pop]] | |
2320 | b | [[#3090fb11-9a11-47e5-bc98-080ebd250d37][delete-other-windows]] | [[#c18b9197-3d52-45a6-9d20-50d18fe1e7a7][isearch-backward-current-symbol]] | [[#e9dd549f-d031-418a-a0d5-30cf85e91c37][isearch-current-symbol]] | |
2321 | tab | [[#928505cb-707c-47ba-af54-5ae1df2ee07d][yas-insert-snippet]] | [[#64f91d86-afa9-4500-8d7d-ce8b2668726b][indent line]] | | |
2322 | delete | [[#e3d8653e-2282-4e3a-a4f5-29211ba2e647][kill-symbol]] | | [[#d9664937-d61c-4cc8-89c6-7f2182655c20][kill-sexp]] | |
2323 | left-arrow | [[#601c8172-f9b7-4e36-88ab-c66c2911b4d7][compile]] | | [[#91ddc121-db27-4f1c-a9ec-a4d29b96a7d2][org-shiftup]] | |
2324 | right-arrow | [[#5f66f60b-adcd-45dc-86b2-5d1225e2455c][paste selection]] | | [[#fc2147b4-a19a-4fde-bb53-e7ac28f0bfa1][org-shiftdown]] | |
2325 | backspace | [[#96f90a00-2260-4340-ae03-f4a86bd65502][backward-kill-symbol]] | | [[#606b0991-7431-4a8a-a909-b872e104cc88][backward-kill-sexp]] | |
2326 | f7 | | | | |
2327 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2328 | right primary | C- | M- | C-M- | C-S- |
2329 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2330 | * | [[#045c374c-b03e-42cb-b274-0f30c81fe3f3][split-window-horizontally]] | | [[#05cf6230-9263-4fd4-9812-4f32009eed46][calc-dispatch]] | |
2331 | 9 | [[#43d14154-2722-4ba5-b547-1b78c6274ebf][delete-window-or-exit]] | [[#ed93f5b8-2c7f-46f8-8d84-2e10d9bc8f87][kill-buffer-and-window]] | [[#37ef629b-fdbc-4d0b-bfa0-335eb1d408ee][kill client buffer]] | |
2332 | u | [[#327992c0-6eba-4935-aec1-49871c2a8619][universal-argument]] | | [[#7af825b1-92d8-4d5d-aaa1-8b4b466ea2e0][search-keybind]] | |
2333 | i | [[#3124e200-1d6e-4ad2-9a36-0d03e1e7dc38][-----]] | | [[#b2cc7cdd-c177-4ef2-af43-28ca7a338fda][query-replace-regexp]] | |
2334 | o | [[#b87a2c8a-7eb3-4661-9b28-589d14206c41][occur]] | | [[#d30ac3cd-1963-4bd0-8052-98e12b6524b0][counsel-imenu]] | |
2335 | p | [[#d84de055-e92e-478d-bb39-bc39acfa1586][move-mouse-to-point]] | | [[#08e65732-2fb1-4a78-9d18-cee87eb867a7][delete-horizontal-space]] | |
2336 | j | [[#ca1ce86b-dcea-45c1-9a8e-dd4f306776e8][pop-to-mark]] | [[#b92414e2-0d5b-4576-8fa5-5e7f1e32819a][previous-error]] | [[#8fe7cac2-ab1a-4b39-aced-10c5e0157e68][register prefix]] | |
2337 | k | [[#eb1c2360-bfd4-4d5c-b789-11b5ca5ba475][jump to register]] | [[#9061b192-735a-4273-ae36-993e6fad9205][next-error]] | [[#e1d768be-6b9b-4322-931f-3e570376ae15][man]] | |
2338 | l | [[#137995db-ee30-4738-90e2-54dcd5cadcf2][ivy-switch-buffer]] | | [[#56fcff3b-ffd9-4280-a226-4b58558906b8][move cursor top bottom mid]] | |
2339 | ; | [[#150bef9a-3faa-4c72-a176-88c3be56f612][comment-dwim]] | [[#211e76d9-d89a-4cc6-abce-69397d456fda][comment-dwim]] | [[#17035e1e-bbe6-44a6-ad54-6a39b04feac3][comment-current-line-dwim]] | |
2340 | m | | | [[#9a6a1998-4ed6-485e-9b2d-c36a42d7ec1a][recursive grep]] | |
2341 | , | [[#e4f617b2-d3f1-47e4-ae7f-2d64c4fd47b9][counsel-find-file]] | | [[#e0691924-11e1-48d2-abee-27945a409676][find-file-in-project]] | |
2342 | . | [[#6e97b7f1-c5cf-48bb-9c09-db1950dc1eae][recentf-ido-find-file]] | | [[#824d422c-67b6-4d68-af11-6a2135e528f5][-]] | |
2343 | / | [[#941a7fa8-84b9-434d-89a0-1487385ec479][join lines]] | | [[#37f67593-4f60-4d3b-9aad-6c9bc4882443][copy-variable]] | |
2344 | 8 | [[#45644cfa-d408-4a69-a97a-545ef46ba656][calc-embedded-word]] | | | |
2345 | up-arrow | [[#2dade04a-8ac7-483c-8675-5268af6eca2b][back defun/headline]] | | | [[#572d6618-471a-43c7-8a50-3f5e56f45cd7][winner undo]] |
2346 | down-arrow | [[#a1f25c12-3523-45bd-9bf5-62bf3cd5ca43][forward dfun/headline]] | | [[#57a09286-94c6-4b9f-953a-7368743f95ec][toggle-mark-activation]] | [[#9c87093b-7e30-44fb-83c9-c1b176074a5d][smex-major-mode-commands]] |
2347 | lbracket | [[#9d9916dd-3280-47dd-aab1-cd28d5ebfe15][----]] | | [[#c10b53e9-657c-48f4-8afb-cad0e709bcd6][scroll-right]] | |
2348 | rbracket | [[#21b38c6b-3a46-4a08-8eca-d44abb148287][fill-paragraph]] | | [[#095c3d97-bc49-419a-a8c0-c7a21d46d980][scroll-left]] | |
2349 | return | [[#db6e4c41-c048-4bef-b0c9-e129464c056d][newline next line]] | [[#10b2591a-5628-46ee-b395-682e91efcb83][non-indented newline]] | [[#1fc4f025-719f-4866-a9ab-23b30e4581b1][open newline on previous line]] | |
2350 | space | [[#b7d5a893-3045-4968-a150-cb813fddfe9e][org-edit-special]] | | [[#47b5912e-edc7-42ec-841b-f0e202b7f593][spell check word]] | |
2351 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2352 | left secondary | C- | M- | C-M- | C-S- |
2353 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2354 | = | | | | |
2355 | 1 | | | | |
2356 | 4 | | | [[#2d4de3c9-9e0c-4ab4-89e3-e41bfed3c9a7][widen]] | |
2357 | 5 | | | | |
2358 | tab-key | [[#2f527321-7f78-421b-b0c4-6fc810da0246][query-replace]] | | | |
2359 | t | [[#3bcdf4a3-f33c-4dad-ba94-e4fd3775eca6][org change todo state]] | | [[#47c64b9c-346d-45ad-8c38-865fe22d31a6][org insert timestamp]] | |
2360 | home | [[#1919659a-b466-4519-9276-8bf06a916066][start of buffer]] | | | |
2361 | end | [[#0a7bd629-cbcc-4761-8fe2-cc9370b985a4][end of buffer]] | | | |
2362 | f9 | | | | |
2363 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2364 | right secondary | C- | M- | C-M- | C-S- |
2365 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2366 | 6 | [[#e44e584b-d925-4036-9ad5-a90d02e74bef][save-buffers-kill-emacs]] | | [[#da73de75-0914-4f48-81d5-9b408433b14b][insert-small-copyright]] | |
2367 | 7 | | | [[#a68c6b8e-9911-475e-ab35-e239771fe881][insert-full-copyright]] | |
2368 | 0 | [[#96ae2fcc-3a0c-40c4-aef8-06aff3fd42be][text-scale-reset]] | | [[#0e7f83a5-600e-4016-af98-95904300c016][insert-apache]] | |
2369 | - | | | [[#6febc7ea-9cc7-488c-af34-538b8e69633b][org-edit-src-exit]] | |
2370 | y | [[#97aee7f1-3647-4602-a65a-45e8a3aa3a7c][undo-tree-redo]] | | | |
2371 | \ | [[#69005926-08ab-4adc-a163-44fed609cc95][sr-speedbar-toggle]] | | [[#27045e96-59a3-45b4-b0ff-6247aa5ed47e][mark-defun]] | |
2372 | h | [[#3c5f241f-fc62-459d-ab85-6b7c1fb04801][help-prefix]] | | | |
2373 | ' | [[#9f252721-a2d5-46c6-b268-8ed597256229][eval-expression]] | | | |
2374 | n | [[#65ac9206-1a67-48dc-8b72-26d763d7bf2b][unpop-to-mark-command]] | | [[#34fb8fbd-42dc-46b0-8c3c-c7e51edc9687][narrow-to-region]] | |
2375 | rshift | | | | |
2376 | escape | [[#da8bae21-a7be-45de-8027-1b26e6285e40][find-tag]] | | | |
2377 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2378 #+END:
2379
2380
2381 * keybind notes
2382 common keys, which would be better off doing swaps than rebinds:
2383 c-x prefix -> c-s
2384 c-c prefix -> c-d
2385 yank c-y -> c-c
2386 search c-s -> kp-add
2387 kill line c-k -> c-f
2388 undo c-_ -> c-z
2389 set-mark-command c-@ -> kp-enter
2390 quoted-insert c-q -> c-m-q
2391 recenter-top-bottom c-l -> c-m-3
2392 kill-region c-w -> c-x
2393
2394 commands to make less accessible
2395 narrow-to-defun/subtree -> M-2 maybe
2396 occur
2397
2398 command to make more accessible, ...
2399
2400
2401 * TESTING / DEVELOPMENT AREA
2402
2403 (defun comint-send-string (process string)
2404 "Like `process-send-string', but also does extra bookkeeping for Comint mode."
2405 (if process
2406 (with-current-buffer (if (processp process)
2407 (process-buffer process)
2408 (get-buffer process))
2409 (comint-snapshot-last-prompt))
2410 (comint-snapshot-last-prompt))
2411 (process-send-string process string))
2412
2413