1 #+title: My Personal Init Customization
2 #+OPTIONS: toc:nil num:nil ^:nil
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.
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
22 buffer select -> toggle find file / buffer
23 up/down -> next/previous history
24 forward/back -> ido-forward/back
27 right keyboard attributes: movement, involve typing words
28 left keyboard attributes: non-typing universal non-movement
34 fix global unpop mark ring
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
42 bind shell-command to something better
44 investigate keys in isearch mode and find file mode
46 investigate programming modes. M-g n/b next/previous error. gdb?
47 investigate org mode keys
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
55 install magit (git control)
56 magpie expansion provides a completion key for acronym expansion based on buffer text
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
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.
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])
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)
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)))
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
121 when in the same session, you can then do:
124 *** org insert table row
125 [org-shiftmetadown/up]
126 *** toggle line continuation / truncation / wrap
127 toggle-truncate-lines
132 *** show abbreviations
135 *** rename-file-and-buffer
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
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."
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)
157 (message "File '%s' successfully removed" filename))))
164 *** sgml-pretty-print
165 format xml in nxml-mode
176 [undo-tree-visualize]
178 [undo-tree save/restore state via register]
180 [org insert table horizontal line or create list]
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)))))
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))))))
210 #+begin_src emacs-lisp
211 (global-set-key (kbd "C-x C-b") 'ibuffer)
215 rectangular clear, replace area with whitespace
220 nnir searching with notmuch, specific group (not sure if it can do multiple)
221 search all groups with mairix
227 save newsrc file, alterations to groups.
229 gnus refresh / get new
233 gnus quoted reply all
235 gnus draft edit message
238 #+begin_src emacs-lisp
239 (add-hook 'gnus-startup-hook
241 (define-key gnus-summary-mode-map (kbd "<delete>") 'gnus-summary-delete-article)))
246 #+begin_src emacs-lisp
247 (add-hook 'gnus-startup-hook
249 (define-key gnus-group-mode-map "b" 'nnmairix-search)
250 (define-key gnus-summary-mode-map "b" 'nnmairix-search)))
253 move message, or messages in region
255 mark article, move with B m
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)
262 todo; send in patch to make author search to in sent folder
266 see C-h m for a full list
268 do a nnir notmuch search, for the group on the current line
270 jump to thread from nnir group
275 M-& apply process mark to a non-process mark command
279 maybe rebind this to a shorter keybind, like del
280 gnus-summary-kill-thread
286 notmuch advance to next message/thread
288 ** readline / bash / .inputrc
291 #+begin_src emacs-lisp
292 (add-hook 'comint-mode-hook
294 (define-key comint-mode-map "\C-m" nil)))
296 terminal crap, duplicate of enter
300 paste word/char under cursor into isearch
302 next/previous isearch history
305 Activate occur easily inside isearch
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
313 (regexp-quote isearch-string))))))
316 #+begin_src emacs-lisp
317 (defun my-isearch-toggle-regexp ()
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))
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)
333 icomplete-forward/backward-completions
337 forward / previous node, descend/ascend tree as needed
339 Info-follow-nearest-node
340 #+begin_src emacs-lisp
341 (define-key Info-mode-map "x" 'Info-follow-nearest-node)
343 m, f, n, p or ^ command, depending on where you click.
346 select next completion candidate
350 agenda cycle todo state
353 make just todo items visible
355 org-shifttab global visibility cycle / move table cell
361 org insert horizontal line
365 i'd like to drill these sometime when I have space in my head, or I
368 [enter input to the stack, or duplicate top stack item]
370 [cycle 3 elements on stack]
372 [cycle 2 elements on stack]
376 [begin negative number]
382 [delete 2nd from top of stack]
384 [0=whole stack, 1-9=that many, -1-9=that element]
386 [remove from the top of the stack]
388 [algebraic mode. infix expressions are calculated when input to the stack]
390 [auto algebraic mode]
392 [top x of stack reference]
394 [store to variable: store, top, retrieve, unstore. the quick variables 0-9 don't need s prefix]
398 [trail prev/next/end/yankh]
400 [calc edit mode, to edit the top of stack]
402 ** single/special keys
405 #+begin_src emacs-lisp
406 (define-key isearch-mode-map (kbd "<tab>") 'isearch-query-replace)
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)
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"
432 (let ((syn (syntax-ppss)))
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
442 (let ((start (point))
446 (eol (progn (move-end-of-line arg) (point))))
447 (while (point-in-comment)
449 (when (= (point) bol)
451 (throw 'bol (and (not (= eol start)) (>= start (point))))))
452 (move-end-of-line arg)))
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)))
459 #+begin_src emacs-lisp
460 (defun back-to-indentation-or-beginning ()
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)
472 #+begin_src emacs-lisp
473 (global-set-key (kbd "<S-iso-lefttab>") 'indent-buffer)
477 #+begin_src emacs-lisp
479 (global-set-key (kbd "<S-delete>") 'send-shell)
481 ;; optional variables used by send-shell
482 (setq shell-send-yank-key nil)
484 (defun repeat-shell ()
486 "Repeat the last command in shell-mode, displaying the window if needed."
487 (let ((shell-buffer (get-buffer "*shell*")))
489 (buffer-window-show shell-buffer)
490 (let ((original-buffer (current-buffer)))
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))))
500 (setq compilation-filenames '("Makefile" "makefile"))
502 (defun get-nearest-compilation-file ()
503 "Search for the compilation file traversing up the directory tree."
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)))
515 parent-dir (file-name-directory (directory-file-name parent-dir))))
516 nearest-compilation-file))
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
525 example of setting it in a file:
527 ;; run-fun: merge-test
530 (if (and (boundp 'run-fun) run-fun)
532 (let ((makefile (get-nearest-compilation-file)))
533 (if (and makefile (stringp mode-name) (string= mode-name "C/l"))
535 "make -f %s" (get-nearest-compilation-file)))
541 (send-shell-buffer "*shell*" 'shell (kbd "C-v")))
543 (defun send-python ()
545 (send-shell-buffer "*Python*" 'py-shell (kbd "C-v")))
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.
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
559 (let ((proc (get-buffer-process (current-buffer))))
560 (if (not proc) (user-error "Current buffer has no process")
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)))
572 (if (= (length intxt) 0)
573 (kill-new (comint-previous-matching-input-string "." 1))
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))
580 (select-window (next-window nil nil 'visible)))
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))))
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)))
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)))
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))
617 (comint-send-input nil t)))))
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."
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
633 temp-buffer-resize-mode))
635 window-combination-limit)))
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))
643 (setq minibuffer-scroll-window window)
644 (set-window-hscroll window 0)
645 ;; Return the window.
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)
663 #+begin_src emacs-lisp
664 (global-set-key (kbd "<S-kp-equal>") 'shell-wrap)
665 (global-set-key (kbd "<S-left>") 'shell-wrap)
669 #+begin_src emacs-lisp
670 (global-set-key (kbd "<S-kp-divide>") 'previous-buffer)
676 #+begin_src emacs-lisp
677 ;; todo, this doesn't set the keybind for the help minibuffer
680 (global-set-key (kbd "\r") 'indent-new-comment-line)
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)
686 (add-hook 'org-mode-hook
688 ;; copied from org-mode, replace org-enter with org-enter-indent
689 (org-defkey org-mode-map "\C-m" 'org-return-indent)))
692 (add-hook 'comint-mode-hook
694 (define-key comint-mode-map "\r" nil)
695 (define-key comint-mode-map (kbd "<return>") 'comint-send-input)))
697 (add-hook 'comint-mode-hook
699 (define-key comint-mode-map "\C-m" nil)
700 (define-key comint-mode-map "\C-d" nil)))
705 auto-correct-prev-word
706 #+begin_src emacs-lisp
707 (global-set-key (kbd "<S-return>") 'flyspell-auto-correct-previous-word)
712 #+begin_src emacs-lisp
713 (global-set-key (kbd "<kp-enter>") 'set-mark-command)
717 #+begin_src emacs-lisp
718 (global-set-key (kbd "<S-kp-enter>") 'smex)
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
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
741 buffer list context menu
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)
768 #+begin_src emacs-lisp
769 (global-set-key (kbd "<mouse-6>") 'move-mouse-to-point)
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)
809 #+begin_src emacs-lisp
810 (global-set-key (kbd "<kp-left>") 'indent-region)
819 #+begin_src emacs-lisp
820 (global-set-key (kbd "<kp-begin>") 'mark-defun)
829 #+begin_src emacs-lisp
830 (global-set-key (kbd "<kp-right>") 'ibuffer)
850 delete-horizontal-space
851 #+begin_src emacs-lisp
852 (global-set-key (kbd "<kp-prior>") 'delete-horizontal-space)
869 *** C-M-11/kp-subtract
870 *** C-S-11/kp-subtract
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.
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
895 (global-set-key (kbd "<C-up>") 'up-fast)
896 (global-set-key (kbd "<C-down>") 'down-fast)
898 (add-hook 'comint-mode-hook
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)))
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)
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)
920 (defun my-contract-region (arg)
922 (let ((current-prefix-arg '-))
923 (call-interactively 'er/expand-region)))
927 background: I originally tried to make c-scroll be scroll
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)
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)
952 #+begin_src emacs-lisp
953 (global-set-key (kbd "<C-left>") 'backward-symbol)
954 (global-set-key (kbd "<C-right>") 'forward-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"
977 (kill-new (thing-at-point 'symbol)))
979 (global-set-key (kbd "C-2") 'copy-symbol)
983 #+begin_src emacs-lisp
985 (defun shell-cd-to-file ()
987 (let ((file (buffer-file-name)))
989 (send-comint-string "*shell*"
990 (concat "c " (file-name-directory file))
992 (message "%s" "shell-cd-to-file: buffer has no file name"))))
993 (global-set-key (kbd "M-2") 'shell-cd-to-file)
997 #+begin_src emacs-lisp
998 (global-unset-key (kbd "C-M-2"))
1003 #+begin_src emacs-lisp
1004 (global-set-key (kbd "C-3") 'dot-mode-execute)
1009 #+begin_src emacs-lisp
1010 (global-set-key (kbd "C-M-3") 'recenter-top-bottom)
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)))
1024 org-archive-to-archive-sibling
1025 #+begin_src emacs-lisp
1026 (global-set-key (kbd "M-q") 'org-archive-to-archive-sibling)
1030 #+begin_src emacs-lisp
1031 (global-set-key (kbd "C-M-q") 'quoted-insert)
1036 #+begin_src emacs-lisp
1037 (global-set-key (kbd "C-w") (lambda () (interactive) (goto-buffer-or-find-file "/a/t.org")))
1041 #+begin_src emacs-lisp
1042 (global-set-key (kbd "M-w") 'org-clock-in)
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."
1058 (let ((beg (line-beginning-position))
1059 (end (line-end-position (or arg 1))))
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)))
1072 (global-set-key (kbd "C-e") 'copy-line)
1076 #+begin_src emacs-lisp
1077 (global-set-key (kbd "M-e") 'org-clock-in-last)
1083 #+begin_src emacs-lisp
1084 (global-set-key (kbd "C-r") 'isearch-backward)
1085 (add-hook 'comint-mode-hook
1087 (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
1091 #+begin_src emacs-lisp
1092 (global-set-key (kbd "M-r") 'org-clock-out)
1098 #+begin_src emacs-lisp
1100 "Copy entire buffer to clipboard"
1102 (clipboard-kill-ring-save (point-min) (point-max)))
1103 (global-set-key (kbd "C-a") 'copy-all)
1107 #+begin_src emacs-lisp
1108 (global-set-key (kbd "M-a") 'kmacro-start-macro-or-insert-counter)
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)))
1129 split-window-vertically
1130 #+begin_src emacs-lisp
1131 (global-set-key (kbd "C-M-s") 'split-window-vertically)
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"
1146 (if (and swapping-window
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))
1161 (setq swapping-buffer (current-buffer))
1162 (setq swapping-window (selected-window))
1163 (message "Buffer and window marked for swapping."))))
1165 (global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)
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."
1175 (if (= (point) (point-max))
1176 (kill-whole-line -1)
1177 (kill-whole-line arg)))
1181 #+begin_src emacs-lisp
1182 (defun print-var-at-point ()
1184 (let ((v (variable-at-point)))
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)
1193 #+begin_src emacs-lisp
1195 (add-hook 'org-mode-hook
1197 (define-key org-mode-map (kbd "C-M-f") 'org-kill-line)))
1199 (global-set-key (kbd "C-M-f") 'kill-line)
1203 cancel / other window
1204 #+begin_src emacs-lisp
1205 (global-set-key (kbd "C-g") 'other-window)
1208 abort-recursive-edit
1209 #+begin_src emacs-lisp
1210 (global-set-key (kbd "M-g") 'abort-recursive-edit)
1214 #+begin_src emacs-lisp
1215 (global-set-key (kbd "C-M-g") 'mu4e)
1219 #+begin_src emacs-lisp
1220 (global-set-key (kbd "C-z") 'undo-tree-undo)
1227 #+begin_src emacs-lisp
1228 (global-set-key (kbd "C-s") 'kill-region)
1232 #+begin_src emacs-lisp
1233 (global-set-key (kbd "M-x") 'smex)
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: ")
1245 (copy-to-register register start end t region))
1247 (global-set-key (kbd "C-M-x") 'cut-to-register)
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
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
1262 (define-key c-mode-base-map "\C-d" nil)
1263 (define-key c-mode-base-map (kbd "<deletechar>") 'c-electric-delete-forward)))
1268 #+begin_src emacs-lisp
1269 (define-key global-map "\M-c" 'org-capture)
1273 #+begin_src emacs-lisp
1274 (global-set-key (kbd "C-M-c") 'copy-to-register)
1279 #+begin_src emacs-lisp
1280 (global-set-key (kbd "C-v") 'yank-better)
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."
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)))))))
1299 (put 'yank-better 'delete-selection 'yank)
1303 #+begin_src emacs-lisp
1304 (global-set-key (kbd "M-v") 'insert-register)
1308 #+begin_src emacs-lisp
1309 (global-set-key (kbd "C-M-v") 'yank-pop)
1313 delete-other-windows
1314 #+begin_src emacs-lisp
1315 (global-set-key (kbd "C-b") 'delete-other-windows)
1318 isearch-backward-current-symbol
1319 #+begin_src emacs-lisp
1320 (global-set-key (kbd "M-b") 'isearch-backward-current-symbol)
1323 isearch-current-symbol
1324 #+begin_src emacs-lisp
1325 (global-set-key (kbd "C-M-b") 'isearch-current-symbol)
1330 in terminal, it's just TAB, duplicate keybind.
1333 in terminal it's duplicated of C-M-i
1338 #+begin_src emacs-lisp
1339 (global-set-key (kbd "<C-delete>") 'kill-symbol)
1340 (defun kill-symbol (arg)
1342 (kill-region (point) (save-excursion (forward-symbol arg) (point))))
1348 #+begin_src emacs-lisp
1349 (global-set-key (kbd "<C-M-delete>") 'kill-sexp)
1354 compile / comint search
1355 #+begin_src emacs-lisp
1357 (and (bound-and-true-p var)
1358 (not (eq var 'unset))))
1359 (global-set-key (kbd "C-(") 'run)
1361 ;; make compile work from the gtags root dir
1362 (defadvice compile (before pre-compile-advice activate)
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)))
1372 (add-hook 'c-mode-hook (lambda () (define-key c-mode-map (kbd "C-(") 'compile)))
1373 (add-hook 'comint-mode-hook
1375 (define-key isearch-mode-map (kbd "C-(") 'isearch-repeat-backward)
1376 (define-key comint-mode-map (kbd "C-(") 'isearch-backward)))
1382 #+begin_src emacs-lisp
1383 (add-hook 'org-mode-hook
1384 (lambda () (define-key org-mode-map (kbd "C-M-(") 'org-shiftup)))
1388 keyboard-yank-primary
1389 #+begin_src emacs-lisp
1390 (defun keyboard-yank-primary ()
1392 (let ((mouse-yank-at-point t))
1393 (mouse-yank-primary nil)))
1395 (global-set-key (kbd "C-)") 'keyboard-yank-primary) ;; kinesis binding
1396 (global-set-key (kbd "<S-right>") 'keyboard-yank-primary)
1400 #+begin_src emacs-lisp
1401 (add-hook 'org-mode-hook
1402 (lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
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
1411 (define-key comint-mode-map (kbd "<C-backspace>") 'backward-kill-word)))
1412 (defun backward-kill-symbol (arg)
1414 (kill-region (point) (save-excursion (backward-symbol arg) (point))))
1419 #+begin_src emacs-lisp
1420 (global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
1430 split-window-horizontally
1431 #+begin_src emacs-lisp
1432 (global-set-key (kbd "C-*") 'split-window-horizontally)
1437 #+begin_src emacs-lisp
1438 (global-set-key (kbd "C-M-*") 'calc-dispatch)
1442 delete-window-or-exit
1443 #+begin_src emacs-lisp
1444 (global-set-key (kbd "C-9") 'delete-window-or-exit)
1446 (defun delete-window-or-exit ()
1447 "Delete window or exit emacs."
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))))
1456 #+begin_src emacs-lisp
1457 (defun kill-buffer-no-ido ()
1458 "kill-buffer, avoid the ido remapping"
1461 (global-set-key (kbd "M-9") 'kill-buffer-no-ido)
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)
1470 ,save & kill buffer if it was opened externally via emacsclient
1472 #+begin_src emacs-lisp
1473 (defun server-edit-save ()
1477 (global-set-key (kbd "C-M-9") 'server-edit-save)
1485 #+begin_src emacs-lisp
1486 (global-set-key (kbd "C-M-u") 'search-keybind)
1488 (defun search-keybind (regexp &optional nlines)
1489 (interactive (occur-read-primary-args))
1492 (set-buffer "*Help*")
1494 (delete-windows-on "*Help*")
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)))
1514 #+begin_src emacs-lisp
1515 (global-set-key (kbd "C-o") 'occur)
1520 #+begin_src emacs-lisp
1521 (global-set-key (kbd "C-M-o") 'counsel-imenu)
1526 #+begin_src emacs-lisp
1527 (global-set-key (kbd "C-p") 'move-mouse-to-point)
1531 delete-horizontal-space
1532 #+begin_src emacs-lisp
1533 (global-set-key (kbd "C-M-p") 'delete-horizontal-space)
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\)."
1543 (pop-to-mark-command)
1544 (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
1545 (org-show-context 'mark-goto)))
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
1553 (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
1558 #+begin_src emacs-lisp
1559 (global-set-key (kbd "M-j") 'previous-error)
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)
1572 #+begin_src emacs-lisp
1574 (global-set-key (kbd "C-k") 'jump-to-register)
1578 #+begin_src emacs-lisp
1579 (global-set-key (kbd "M-k") 'next-error)
1583 #+begin_src emacs-lisp
1584 (global-set-key (kbd "C-M-k") 'man)
1589 #+begin_src emacs-lisp
1590 (global-set-key (kbd "C-l") 'ivy-switch-buffer)
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)
1601 used in flyspell, not sure what for, otherwise unbound
1605 comment-current-line-dwim
1606 #+begin_src emacs-lisp
1607 (defun comment-current-line-dwim ()
1608 "Comment or uncomment the current line."
1611 (push-mark (beginning-of-line) t t)
1614 (move-beginning-of-line 2))
1615 (global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
1622 #+begin_src emacs-lisp
1623 (define-key global-map (kbd "C-M-m") 'rgrep)
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)))
1635 find-file-in-project
1636 #+begin_src emacs-lisp
1637 (global-set-key (kbd "C-M-,") 'find-file-in-project)
1642 Taken from starter kit.
1643 #+begin_src emacs-lisp
1644 (defun recentf-ido-find-file ()
1645 "Find a recent file using Ido."
1647 (let* ((file-assoc-list
1649 (cons (file-name-nondirectory x)
1653 (remove-duplicates (mapcar #'car file-assoc-list)
1655 (filename (ido-completing-read "Choose recent file: "
1660 (find-file (cdr (assoc filename
1661 file-assoc-list))))))
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)))
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)
1680 #+begin_src emacs-lisp
1681 (defun vim-style-join-line ()
1684 (global-set-key (kbd "C-/") 'vim-style-join-line)
1685 (define-key undo-tree-map (kbd "C-/") nil)
1689 copy-buffer-file-name
1690 #+begin_src emacs-lisp
1691 ;; haven't bound this atm, todo, maybe someday?
1692 (defun copy-variable (variable)
1694 (let ((v (variable-at-point))
1695 (enable-recursive-minibuffers t)
1697 (setq val (completing-read (if (symbolp v)
1699 "Describe variable (default %s): " v)
1700 "Describe variable: ")
1703 (or (get vv 'variable-documentation)
1704 (and (boundp vv) (not (keywordp vv)))))
1706 (if (symbolp v) (symbol-name v))))
1707 (list (if (equal val "")
1709 (kill-new (symbol-value variable)))
1711 (defun copy-buffer-file-name ()
1714 ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
1715 (t buffer-file-name))
1721 (global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
1728 #+begin_src emacs-lisp
1729 (global-set-key (kbd "C-8") 'calc-embedded-word)
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)
1742 (add-hook 'org-mode-hook
1744 (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
1753 #+begin_src emacs-lisp
1754 (global-set-key (kbd "<C-S-_>") 'winner-undo)
1758 #+begin_src emacs-lisp
1759 (global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
1761 (add-hook 'org-mode-hook
1763 (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
1770 toggle-mark-activation
1771 #+begin_src emacs-lisp
1772 (defun toggle-mark-activation ()
1778 (global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
1781 #+begin_src emacs-lisp
1782 (global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
1787 #+begin_src emacs-lisp
1788 (global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
1795 #+begin_src emacs-lisp
1796 (global-set-key (kbd "C-M-[") 'scroll-right)
1801 #+begin_src emacs-lisp
1802 (global-set-key (kbd "C-]") 'fill-paragraph)
1807 #+begin_src emacs-lisp
1808 (global-set-key (kbd "C-M-]") 'scroll-left)
1813 #+begin_src emacs-lisp
1814 (defun newline-anywhere ()
1815 "Add a newline from anywhere in the line."
1818 (newline-and-indent))
1819 (global-set-key (kbd "<C-return>") 'newline-anywhere)
1824 #+begin_src emacs-lisp
1825 (defun plain-newline ()
1828 (global-set-key (kbd "<M-return>") 'plain-newline)
1832 #+begin_src emacs-lisp
1833 (defun newline-anywhere-previous ()
1834 "Add a newline from anywhere in the line."
1838 (newline-and-indent))
1839 (global-set-key (kbd "<C-M-return>") 'newline-anywhere-previous)
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
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)))
1857 before or under cursor
1858 #+begin_src emacs-lisp
1859 (global-set-key (kbd "C-M-SPC") 'ispell-word)
1875 #+begin_src emacs-lisp
1876 (global-set-key (kbd "C-M-4") 'widen)
1885 #+begin_src emacs-lisp
1887 (global-set-key (kbd "<C-kp-add>") 'query-replace)
1893 org cycle todo / toggle comint motion
1894 #+begin_src emacs-lisp
1895 (add-hook 'org-mode-hook
1897 (define-key org-mode-map (kbd "C-t") 'org-todo)))
1899 (defun my-comint-previous-input (arg)
1901 (if (comint-after-pmark-p)
1902 (comint-previous-input arg)
1905 (defun my-comint-next-input (arg)
1907 (if (comint-after-pmark-p)
1908 (comint-next-input arg)
1911 (add-hook 'comint-mode-hook
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)))
1918 (defun comint-toggle-arrow-keys ()
1920 (toggle-arrow-keys comint-mode-map))
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))
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)))))
1934 (eval-after-load "message"
1935 '(define-key message-mode-map (kbd "C-t") 'mail-signature))
1937 Thanks for the update. I will be enjoying it.
1940 : comint-toggle-arrow-keys
1944 #+begin_src emacs-lisp
1945 (global-set-key (kbd "C-M-t") 'org-time-stamp-with-time)
1964 save-buffers-kill-emacs
1965 #+begin_src emacs-lisp
1966 (global-set-key (kbd "C-6") 'save-buffers-kill-emacs)
1970 insert-small-copyright
1971 #+begin_src emacs-lisp
1972 (defun insert-small-copyright ()
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))))
1979 (global-set-key (kbd "C-M-6") 'insert-small-copyright)
1985 insert-full-copyright
1986 #+begin_src emacs-lisp
1987 (defun insert-full-copyright ()
1990 (let ((beg (point)))
1991 (insert "Copyright (C) 2017 Ian Kelling\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")
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")
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))))
2007 (global-set-key (kbd "C-M-7") 'insert-full-copyright)
2013 #+begin_src emacs-lisp
2014 (defun text-scale-reset ()
2017 (global-set-key (kbd "C-0") 'text-scale-reset)
2022 #+begin_src emacs-lisp
2023 (defun insert-apache ()
2026 (let ((beg (point)))
2027 (insert "Copyright (C) 2017 Ian Kelling\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")
2033 (insert " http://www.apache.org/licenses/LICENSE-2.0\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)
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)))
2062 #+begin_src emacs-lisp
2063 (global-set-key (kbd "C-\\") 'sr-speedbar-toggle)
2068 #+begin_src emacs-lisp
2069 (global-set-key (kbd "C-M-\\") 'mark-defun)
2080 #+begin_src emacs-lisp
2081 (global-set-key (kbd "C-'") 'eval-expression)
2088 #+begin_src emacs-lisp
2089 (defun unpop-to-mark-command ()
2090 "Unpop off mark ring. Does nothing if mark ring is empty."
2093 (let ((pos (marker-position (car (last mark-ring)))))
2094 (if (not (= (point) 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))))))))
2101 (global-set-key (kbd "C-n") 'unpop-to-mark-command)
2106 #+begin_src emacs-lisp
2107 (global-set-key (kbd "C-M-n") 'narrow-to-region)
2116 :ID: a6dd7e4c-1831-4493-bbfd-557dc2f9c856
2117 :CUSTOM_ID: 6901fa1b-c827-4525-b24b-bdb8fe5f638b
2128 #+begin_src emacs-lisp
2129 (global-set-key (kbd "<C-escape>") 'find-tag)
2135 not necessary to have at the end, but its convenient to have it next
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")))
2149 ((and id (stringp id) (string-match "\\S-" id))
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)))
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))
2169 (defun org-dblock-write:keybind-dblock (arg)
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-"))
2179 (while (>= (org-current-level) table-level)
2180 (setq table-title (get-title))
2181 (outline-next-heading)
2182 (let (found-prefixes
2184 ;; go through the first few elements of the table to find out what column headings aka prefixes it should have
2186 (while (not found-all-prefixes)
2187 (let ((prefixes-copy prefixes)
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))
2204 ;; start a new table or repeat the prefixes in the current table
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)
2213 (dolist (prefix found-prefixes)
2214 (setq output (concat output prefix "|")))
2215 (setq output (concat output "\n|-|\n"))
2219 (while (>= (org-current-level) keybind-level)
2220 (dotimes (i (length found-prefixes))
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
2226 (outline-next-heading)
2227 (setq subtree-end (point)))
2228 ;; skip over scheduled line
2230 ;; see comment after source block to understand this regex
2231 (re-search-forward "^\\s-*\\([^*: ].*?$\\)" subtree-end t)
2232 (let ((m (match-string 1)))
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"))
2240 (setq output (concat output "|-|"))
2242 (org-table-map-tables 'org-table-align 'quietly))
2246 after source block due to bad parsing of comments in non emacs lisp mode
2247 some easily forgotten regex elements. whitespace: \\s-
2249 subexpression for close bracket char or nothing: \\(\\]\\|\\)
2253 CLOCK: [2016-11-28 Mon 10:59]--[2016-11-28 Mon 10:59] => 0:00
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]] |
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]] |
2274 |---------------------+------------------------|
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 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
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]] | |
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 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2356 | 4 | | | [[#2d4de3c9-9e0c-4ab4-89e3-e41bfed3c9a7][widen]] | |
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]] | | | |
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]] | |
2376 | escape | [[#da8bae21-a7be-45de-8027-1b26e6285e40][find-tag]] | | | |
2377 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2382 common keys, which would be better off doing swaps than rebinds:
2386 search c-s -> kp-add
2387 kill line c-k -> c-f
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
2394 commands to make less accessible
2395 narrow-to-defun/subtree -> M-2 maybe
2398 command to make more accessible, ...
2401 * TESTING / DEVELOPMENT AREA
2403 (defun comint-send-string (process string)
2404 "Like `process-send-string', but also does extra bookkeeping for Comint mode."
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))