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 in terminal, it's ctrl-backspace, duplicate keybind.
1039 #+begin_src emacs-lisp
1040 (global-set-key (kbd "M-w") 'org-clock-in)
1046 #+begin_src emacs-lisp
1047 ;; todo, make repeated calls to this append the kills
1048 (defun copy-line (&optional arg)
1049 "Copy lines (as many as prefix argument) in the kill ring.
1050 Ease of use features:
1051 - Move to start of next line.
1052 - Appends the copy on sequential calls.
1053 - Use newline as last char even on the last line of the buffer.
1054 - If region is active, copy its lines."
1056 (let ((beg (line-beginning-position))
1057 (end (line-end-position (or arg 1))))
1059 (if (> (point) (mark))
1060 (setq beg (save-excursion (goto-char (mark)) (line-beginning-position)))
1061 (setq end (save-excursion (goto-char (mark)) (line-end-position)))))
1062 (if (eq last-command 'copy-line)
1063 (kill-append (buffer-substring beg end) (< end beg))
1064 (kill-ring-save beg end)))
1065 (kill-append "\n" nil)
1066 ;; dun need cuz I have yank-better
1067 ;;(beginning-of-line (or (and arg (1+ arg)) 2))
1068 (if (and arg (not (= 1 arg))) (message "%d lines copied" arg)))
1070 (global-set-key (kbd "C-e") 'copy-line)
1074 #+begin_src emacs-lisp
1075 (global-set-key (kbd "M-e") 'org-clock-in-last)
1081 #+begin_src emacs-lisp
1082 (global-set-key (kbd "C-r") 'isearch-backward)
1083 (add-hook 'comint-mode-hook
1085 (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
1089 #+begin_src emacs-lisp
1090 (global-set-key (kbd "M-r") 'org-clock-out)
1096 #+begin_src emacs-lisp
1098 "Copy entire buffer to clipboard"
1100 (clipboard-kill-ring-save (point-min) (point-max)))
1101 (global-set-key (kbd "C-a") 'copy-all)
1105 #+begin_src emacs-lisp
1106 (global-set-key (kbd "M-a") 'kmacro-start-macro-or-insert-counter)
1110 #+begin_src emacs-lisp
1111 (global-set-key (kbd "C-M-a") 'kmacro-end-or-call-macro)
1112 (add-hook 'perl-mode-hook (lambda () (define-key perl-mode-map (kbd "C-M-a") nil)))
1113 (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-M-a") nil)))
1114 (add-hook 'c++-mode-hook
1115 (lambda () (define-key c++-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)))
1127 split-window-vertically
1128 #+begin_src emacs-lisp
1129 (global-set-key (kbd "C-M-s") 'split-window-vertically)
1136 swap buffer across windows
1137 from http://www.emacswiki.org/emacs/TransposeWindows
1138 #+begin_src emacs-lisp
1139 (setq swapping-buffer nil)
1140 (setq swapping-window nil)
1141 (defun swap-buffers-in-windows ()
1142 "Swap buffers between two windows"
1144 (if (and swapping-window
1146 (let ((this-buffer (current-buffer))
1147 (this-window (selected-window)))
1148 (if (and (window-live-p swapping-window)
1149 (buffer-live-p swapping-buffer))
1150 (progn (switch-to-buffer swapping-buffer)
1151 (select-window swapping-window)
1152 (switch-to-buffer this-buffer)
1153 (select-window this-window)
1154 (message "Swapped buffers."))
1155 (message "Old buffer/window killed. Aborting."))
1156 (setq swapping-buffer nil)
1157 (setq swapping-window nil))
1159 (setq swapping-buffer (current-buffer))
1160 (setq swapping-window (selected-window))
1161 (message "Buffer and window marked for swapping."))))
1163 (global-set-key (kbd "C-M-d") 'swap-buffers-in-windows)
1168 #+begin_src emacs-lisp
1169 (global-set-key (kbd "C-f") 'kill-whole-line-wrapper)
1170 (defun kill-whole-line-wrapper (&optional arg)
1171 "If we are at the end of the file, kill backwards instead of doing nothing."
1173 (if (= (point) (point-max))
1174 (kill-whole-line -1)
1175 (kill-whole-line arg)))
1179 #+begin_src emacs-lisp
1180 (defun print-var-at-point ()
1182 (let ((v (variable-at-point)))
1184 (message "%s: %s" v (symbol-value v))
1185 (message "no symbol found at point"))))
1186 (global-set-key (kbd "M-f") 'print-var-at-point)
1191 #+begin_src emacs-lisp
1193 (add-hook 'org-mode-hook
1195 (define-key org-mode-map (kbd "C-M-f") 'org-kill-line)))
1197 (global-set-key (kbd "C-M-f") 'kill-line)
1201 cancel / other window
1202 #+begin_src emacs-lisp
1203 (global-set-key (kbd "C-g") 'other-window)
1206 abort-recursive-edit
1207 #+begin_src emacs-lisp
1208 (global-set-key (kbd "M-g") 'abort-recursive-edit)
1212 #+begin_src emacs-lisp
1213 (global-set-key (kbd "C-M-g") 'mu4e)
1217 #+begin_src emacs-lisp
1218 (global-set-key (kbd "C-z") 'undo-tree-undo)
1225 #+begin_src emacs-lisp
1226 (global-set-key (kbd "C-s") 'kill-region)
1230 #+begin_src emacs-lisp
1231 (global-set-key (kbd "M-x") 'smex)
1235 #+begin_src emacs-lisp
1236 ;; same args as copy-to-register
1237 (defun cut-to-register (register start end &optional delete-flag region)
1238 (interactive (list (register-read-with-preview "Cut to register: ")
1243 (copy-to-register register start end t region))
1245 (global-set-key (kbd "C-M-x") 'cut-to-register)
1250 #+begin_src emacs-lisp
1251 (global-set-key (kbd "C-d") 'kill-ring-save)
1252 (add-hook 'c-mode-hook
1253 (lambda () (define-key c-mode-map (kbd "C-d") nil)))
1254 (add-hook 'comint-mode-hook
1256 (define-key comint-mode-map (kbd "C-d") nil)))
1257 ;; the base map is shared by many c-modes, like java
1258 (add-hook 'c-mode-hook
1260 (define-key c-mode-base-map "\C-d" nil)
1261 (define-key c-mode-base-map (kbd "<deletechar>") 'c-electric-delete-forward)))
1266 #+begin_src emacs-lisp
1267 (define-key global-map "\M-c" 'org-capture)
1271 #+begin_src emacs-lisp
1272 (global-set-key (kbd "C-M-c") 'copy-to-register)
1277 #+begin_src emacs-lisp
1278 (global-set-key (kbd "C-v") 'yank-better)
1282 (defun yank-better (arg)
1283 "Paste, linewise if our kill ends with a newline.
1284 I change the behavior of plain prefix. It makes it not do linewise paste,
1285 because sometimes you want to yank pop and a linewise paste screws that up.
1286 c-u with no number normally makes the point go before the yank.
1287 That is pointless for me, as it would be just as easier and less
1288 thought to pop the mark after yanking cuz it is set to before the mark."
1290 (if (and (not (equal arg '(4))) (string-suffix-p "\n" (current-kill 0 t)))
1291 (beginning-of-line))
1292 (if (and (stringp mode-name) (string= mode-name "Org"))
1293 (call-interactively 'org-yank)
1294 (setq this-command 'yank)
1295 (call-interactively 'yank (and (not (equal arg '(4)))))))
1297 (put 'yank-better 'delete-selection 'yank)
1301 #+begin_src emacs-lisp
1302 (global-set-key (kbd "M-v") 'insert-register)
1306 #+begin_src emacs-lisp
1307 (global-set-key (kbd "C-M-v") 'yank-pop)
1311 delete-other-windows
1312 #+begin_src emacs-lisp
1313 (global-set-key (kbd "C-b") 'delete-other-windows)
1316 isearch-backward-current-symbol
1317 #+begin_src emacs-lisp
1318 (global-set-key (kbd "M-b") 'isearch-backward-current-symbol)
1321 isearch-current-symbol
1322 #+begin_src emacs-lisp
1323 (global-set-key (kbd "C-M-b") 'isearch-current-symbol)
1328 in terminal, it's just TAB, duplicate keybind.
1331 in terminal it's duplicated of C-M-i
1336 #+begin_src emacs-lisp
1337 (global-set-key (kbd "<C-delete>") 'kill-symbol)
1338 (defun kill-symbol (arg)
1340 (kill-region (point) (save-excursion (forward-symbol arg) (point))))
1346 #+begin_src emacs-lisp
1347 (global-set-key (kbd "<C-M-delete>") 'kill-sexp)
1352 compile / comint search
1353 #+begin_src emacs-lisp
1355 (and (bound-and-true-p var)
1356 (not (eq var 'unset))))
1357 (global-set-key (kbd "C-(") 'run)
1359 ;; make compile work from the gtags root dir
1360 (defadvice compile (before pre-compile-advice activate)
1362 (when (set-p ggtags-project-root)
1363 (setq-local compile-saved-dir default-directory)
1364 (setq default-directory ggtags-project-root)))
1365 (defadvice compile (after post-compile-advice activate)
1366 (when (bound-and-true-p compile-saved-dir)
1367 (setq default-directory compile-saved-dir)))
1370 (add-hook 'c-mode-hook (lambda () (define-key c-mode-map (kbd "C-(") 'compile)))
1371 (add-hook 'comint-mode-hook
1373 (define-key isearch-mode-map (kbd "C-(") 'isearch-repeat-backward)
1374 (define-key comint-mode-map (kbd "C-(") 'isearch-backward)))
1380 #+begin_src emacs-lisp
1381 (add-hook 'org-mode-hook
1382 (lambda () (define-key org-mode-map (kbd "C-M-(") 'org-shiftup)))
1386 keyboard-yank-primary
1387 #+begin_src emacs-lisp
1388 (defun keyboard-yank-primary ()
1390 (let ((mouse-yank-at-point t))
1391 (mouse-yank-primary nil)))
1393 (global-set-key (kbd "C-)") 'keyboard-yank-primary) ;; kinesis binding
1394 (global-set-key (kbd "<S-right>") 'keyboard-yank-primary)
1398 #+begin_src emacs-lisp
1399 (add-hook 'org-mode-hook
1400 (lambda () (define-key org-mode-map (kbd "C-M-)") 'org-shiftdown)))
1404 backward-kill-symbol
1405 #+begin_src emacs-lisp
1406 (global-set-key (kbd "<C-backspace>") 'backward-kill-symbol)
1407 (add-hook 'comint-mode-hook
1409 (define-key comint-mode-map (kbd "<C-backspace>") 'backward-kill-word)))
1410 (defun backward-kill-symbol (arg)
1412 (kill-region (point) (save-excursion (backward-symbol arg) (point))))
1417 #+begin_src emacs-lisp
1418 (global-set-key (kbd "<C-M-backspace>") 'backward-kill-sexp)
1428 split-window-horizontally
1429 #+begin_src emacs-lisp
1430 (global-set-key (kbd "C-*") 'split-window-horizontally)
1435 #+begin_src emacs-lisp
1436 (global-set-key (kbd "C-M-*") 'calc-dispatch)
1440 delete-window-or-exit
1441 #+begin_src emacs-lisp
1442 (global-set-key (kbd "C-9") 'delete-window-or-exit)
1444 (defun delete-window-or-exit ()
1445 "Delete window or exit emacs."
1447 (if (condition-case nil (delete-window) (error t))
1448 (if (or (boundp 'server-process) (> (length (frame-list)) 1))
1449 (progn (basic-save-buffer) (delete-frame))
1450 (save-buffers-kill-terminal t))))
1454 #+begin_src emacs-lisp
1455 (defun kill-buffer-no-ido ()
1456 "kill-buffer, avoid the ido remapping"
1459 (global-set-key (kbd "M-9") 'kill-buffer-no-ido)
1461 strangely, in simple mode, this is overridden.
1462 I found this map to override, but it didn't work, so it seems its being bound some other way.
1463 I did a grep of the emacs sources, but couldn't find anything.
1464 (define-key universal-argument-map [?9] nil)
1468 ,save & kill buffer if it was opened externally via emacsclient
1470 #+begin_src emacs-lisp
1471 (defun server-edit-save ()
1475 (global-set-key (kbd "C-M-9") 'server-edit-save)
1483 #+begin_src emacs-lisp
1484 (global-set-key (kbd "C-M-u") 'search-keybind)
1486 (defun search-keybind (regexp &optional nlines)
1487 (interactive (occur-read-primary-args))
1490 (set-buffer "*Help*")
1492 (delete-windows-on "*Help*")
1500 query-replace-regexp
1501 #+begin_src emacs-lisp
1502 (global-set-key (kbd "C-M-i") 'query-replace-regexp)
1503 (add-hook 'flyspell-mode-hook
1504 (lambda () (define-key flyspell-mode-map (kbd "C-M-i") nil)))
1505 (add-hook 'text-mode-hook
1506 (lambda () (define-key text-mode-map (kbd "C-M-i") nil)))
1512 #+begin_src emacs-lisp
1513 (global-set-key (kbd "C-o") 'occur)
1518 #+begin_src emacs-lisp
1519 (global-set-key (kbd "C-M-o") 'counsel-imenu)
1524 #+begin_src emacs-lisp
1525 (global-set-key (kbd "C-p") 'move-mouse-to-point)
1529 delete-horizontal-space
1530 #+begin_src emacs-lisp
1531 (global-set-key (kbd "C-M-p") 'delete-horizontal-space)
1536 #+begin_src emacs-lisp
1537 (defun my-pop-to-mark-command ()
1538 "Jump to mark, and pop a new position for mark off the ring.
1539 \(Does not affect global mark ring\)."
1541 (pop-to-mark-command)
1542 (if (and (derived-mode-p 'org-mode) (outline-invisible-p))
1543 (org-show-context 'mark-goto)))
1545 (global-set-key (kbd "C-j") 'my-pop-to-mark-command)
1546 (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)
1547 (add-hook 'ido-setup-hook
1548 (lambda () (define-key ido-common-completion-map (kbd "C-j") 'ido-select-text)))
1549 (add-hook 'lisp-interaction-mode-hook
1551 (define-key lisp-interaction-mode-map (kbd "C-j") nil)))
1556 #+begin_src emacs-lisp
1557 (global-set-key (kbd "M-j") 'previous-error)
1562 #+begin_src emacs-lisp
1563 (define-key global-map (kbd "C-M-j") ctl-x-r-map)
1564 (define-key ctl-x-r-map "m" 'kmacro-to-register)
1570 #+begin_src emacs-lisp
1572 (global-set-key (kbd "C-k") 'jump-to-register)
1576 #+begin_src emacs-lisp
1577 (global-set-key (kbd "M-k") 'next-error)
1581 #+begin_src emacs-lisp
1582 (global-set-key (kbd "C-M-k") 'man)
1587 #+begin_src emacs-lisp
1588 (global-set-key (kbd "C-l") 'ivy-switch-buffer)
1593 move cursor top bottom mid, comint clear screen
1594 #+begin_src emacs-lisp
1595 (global-set-key (kbd "C-M-l") 'move-to-window-line-top-bottom)
1599 used in flyspell, not sure what for, otherwise unbound
1603 comment-current-line-dwim
1604 #+begin_src emacs-lisp
1605 (defun comment-current-line-dwim ()
1606 "Comment or uncomment the current line."
1609 (push-mark (beginning-of-line) t t)
1612 (move-beginning-of-line 2))
1613 (global-set-key (kbd "C-M-;") 'comment-current-line-dwim)
1620 #+begin_src emacs-lisp
1621 (define-key global-map (kbd "C-M-m") 'rgrep)
1626 #+begin_src emacs-lisp
1627 (global-set-key (kbd "C-,") 'counsel-find-file)
1628 (add-hook 'flyspell-mode-hook
1629 (lambda () (define-key flyspell-mode-map (kbd "C-,") nil)))
1633 find-file-in-project
1634 #+begin_src emacs-lisp
1635 (global-set-key (kbd "C-M-,") 'find-file-in-project)
1640 Taken from starter kit.
1641 #+begin_src emacs-lisp
1642 (defun recentf-ido-find-file ()
1643 "Find a recent file using Ido."
1645 (let* ((file-assoc-list
1647 (cons (file-name-nondirectory x)
1651 (remove-duplicates (mapcar #'car file-assoc-list)
1653 (filename (ido-completing-read "Choose recent file: "
1658 (find-file (cdr (assoc filename
1659 file-assoc-list))))))
1661 (add-hook 'flyspell-mode-hook
1662 (lambda () (define-key flyspell-mode-map (kbd "C-.") nil)))
1663 (define-key dot-mode-map (kbd "C-.") nil)
1664 (global-set-key (kbd "C-.") 'recentf-ido-find-file)
1665 (add-hook 'php-mode-hook
1666 (lambda () (define-key php-mode-map (kbd "C-.") nil)))
1671 #+begin_src emacs-lisp
1672 (define-key dot-mode-map (kbd "C-M-.") nil)
1673 ;; (global-set-key (kbd "C-M-.") 'execute-extended-command)
1678 #+begin_src emacs-lisp
1679 (defun vim-style-join-line ()
1682 (global-set-key (kbd "C-/") 'vim-style-join-line)
1683 (define-key undo-tree-map (kbd "C-/") nil)
1687 copy-buffer-file-name
1688 #+begin_src emacs-lisp
1689 ;; haven't bound this atm, todo, maybe someday?
1690 (defun copy-variable (variable)
1692 (let ((v (variable-at-point))
1693 (enable-recursive-minibuffers t)
1695 (setq val (completing-read (if (symbolp v)
1697 "Describe variable (default %s): " v)
1698 "Describe variable: ")
1701 (or (get vv 'variable-documentation)
1702 (and (boundp vv) (not (keywordp vv)))))
1704 (if (symbolp v) (symbol-name v))))
1705 (list (if (equal val "")
1707 (kill-new (symbol-value variable)))
1709 (defun copy-buffer-file-name ()
1712 ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
1713 (t buffer-file-name))
1719 (global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
1726 #+begin_src emacs-lisp
1727 (global-set-key (kbd "C-8") 'calc-embedded-word)
1734 #+begin_src emacs-lisp
1735 (define-key undo-tree-map "\C-_" nil)
1736 ;; disabled just because i don't want to accidentally hit it
1737 (define-key global-map "\C-_" nil)
1738 (global-set-key (kbd "<C-_>") 'beginning-of-defun)
1740 (add-hook 'org-mode-hook
1742 (define-key org-mode-map (kbd "\C-_") 'outline-previous-visible-heading)))
1751 #+begin_src emacs-lisp
1752 (global-set-key (kbd "<C-S-_>") 'winner-undo)
1756 #+begin_src emacs-lisp
1757 (global-set-key (kbd "<C-kp-enter>") 'end-of-defun)
1759 (add-hook 'org-mode-hook
1761 (define-key org-mode-map (kbd "<C-kp-enter>") 'outline-next-visible-heading)))
1768 toggle-mark-activation
1769 #+begin_src emacs-lisp
1770 (defun toggle-mark-activation ()
1776 (global-set-key (kbd "<C-M-kp-enter>") 'toggle-mark-activation)
1779 #+begin_src emacs-lisp
1780 (global-set-key (kbd "<C-S-kp-enter>") 'winner-redo)
1785 #+begin_src emacs-lisp
1786 (global-set-key (kbd "<C-S-kp-enter>") 'smex-major-mode-commands)
1793 #+begin_src emacs-lisp
1794 (global-set-key (kbd "C-M-[") 'scroll-right)
1799 #+begin_src emacs-lisp
1800 (global-set-key (kbd "C-]") 'fill-paragraph)
1805 #+begin_src emacs-lisp
1806 (global-set-key (kbd "C-M-]") 'scroll-left)
1811 #+begin_src emacs-lisp
1812 (defun newline-anywhere ()
1813 "Add a newline from anywhere in the line."
1816 (newline-and-indent))
1817 (global-set-key (kbd "<C-return>") 'newline-anywhere)
1822 #+begin_src emacs-lisp
1823 (defun plain-newline ()
1826 (global-set-key (kbd "<M-return>") 'plain-newline)
1830 #+begin_src emacs-lisp
1831 (defun newline-anywhere-previous ()
1832 "Add a newline from anywhere in the line."
1836 (newline-and-indent))
1837 (global-set-key (kbd "<C-M-return>") 'newline-anywhere-previous)
1842 #+begin_src emacs-lisp
1843 ;; commented due to new keyboard needing ctrl-space for mark
1844 ;; (kbd "<C-space>") does not work, (kbd "C-SPC") should work
1845 ;; (add-hook 'org-mode-hook
1847 ;; (define-key org-mode-map (kbd "C-SPC") 'org-edit-special)
1848 ;; ;; org-src-mode-map is broken in git version of emacs.
1849 ;; ;; temporarily use this for exiting edit-special mode.
1850 ;; (global-set-key (kbd "C-M--") 'org-edit-src-exit)
1851 ;; (define-key org-src-mode-map (kbd "C-SPC") 'org-edit-src-exit)))
1855 before or under cursor
1856 #+begin_src emacs-lisp
1857 (global-set-key (kbd "C-M-SPC") 'ispell-word)
1873 #+begin_src emacs-lisp
1874 (global-set-key (kbd "C-M-4") 'widen)
1883 #+begin_src emacs-lisp
1885 (global-set-key (kbd "<C-kp-add>") 'query-replace)
1891 org cycle todo / toggle comint motion
1892 #+begin_src emacs-lisp
1893 (add-hook 'org-mode-hook
1895 (define-key org-mode-map (kbd "C-t") 'org-todo)))
1897 (defun my-comint-previous-input (arg)
1899 (if (comint-after-pmark-p)
1900 (comint-previous-input arg)
1903 (defun my-comint-next-input (arg)
1905 (if (comint-after-pmark-p)
1906 (comint-next-input arg)
1909 (add-hook 'comint-mode-hook
1911 (define-key comint-mode-map (kbd "C-t") 'comint-toggle-arrow-keys)
1912 (define-key comint-mode-map (kbd "<up>") 'my-comint-previous-input)
1913 (define-key comint-mode-map (kbd "<down>") 'my-comint-next-input)))
1916 (defun comint-toggle-arrow-keys ()
1918 (toggle-arrow-keys comint-mode-map))
1920 (setq-default comint-arrow-movement nil)
1921 (defun toggle-arrow-keys (map)
1922 (cond ((lookup-key map (kbd "<up>"))
1923 (setq-local comint-arrow-movement t)
1924 (define-key map (kbd "<up>") nil)
1925 (define-key map (kbd "<down>") nil))
1927 (setq-local comint-arrow-movement nil)
1928 (define-key map (kbd "<up>") 'my-comint-previous-input)
1929 (define-key map (kbd "<down>") 'my-comint-next-input)
1930 (goto-char (point-max)))))
1932 (eval-after-load "message"
1933 '(define-key message-mode-map (kbd "C-t") 'mail-signature))
1935 Thanks for the update. I will be enjoying it.
1938 : comint-toggle-arrow-keys
1942 #+begin_src emacs-lisp
1943 (global-set-key (kbd "C-M-t") 'org-time-stamp-with-time)
1962 save-buffers-kill-emacs
1963 #+begin_src emacs-lisp
1964 (global-set-key (kbd "C-6") 'save-buffers-kill-emacs)
1968 insert-small-copyright
1969 #+begin_src emacs-lisp
1970 (defun insert-small-copyright ()
1973 (let ((beg (point)))
1974 (insert "Copyright (C) 2017 Ian Kelling\nThis program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>")
1975 (comment-region beg (point))))
1977 (global-set-key (kbd "C-M-6") 'insert-small-copyright)
1983 insert-full-copyright
1984 #+begin_src emacs-lisp
1985 (defun insert-full-copyright ()
1988 (let ((beg (point)))
1989 (insert "Copyright (C) 2017 Ian Kelling\n")
1991 (insert "This program is free software: you can redistribute it and/or modify\n")
1992 (insert "it under the terms of the GNU General Public License as published by\n")
1993 (insert "the Free Software Foundation, either version 3 of the License, or\n")
1994 (insert "(at your option) any later version.\n")
1996 (insert "This program is distributed in the hope that it will be useful,\n")
1997 (insert "but WITHOUT ANY WARRANTY; without even the implied warranty of\n")
1998 (insert "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n")
1999 (insert "GNU General Public License for more details.\n")
2001 (insert "You should have received a copy of the GNU General Public License\n")
2002 (insert "along with this program. If not, see <http://www.gnu.org/licenses/>.\n")
2003 (comment-region beg (point))))
2005 (global-set-key (kbd "C-M-7") 'insert-full-copyright)
2011 #+begin_src emacs-lisp
2012 (defun text-scale-reset ()
2015 (global-set-key (kbd "C-0") 'text-scale-reset)
2020 #+begin_src emacs-lisp
2021 (defun insert-apache ()
2024 (let ((beg (point)))
2025 (insert "Copyright (C) 2017 Ian Kelling\n")
2027 (insert "Licensed under the Apache License, Version 2.0 (the \"License\");\n")
2028 (insert "you may not use this file except in compliance with the License.\n")
2029 (insert "You may obtain a copy of the License at\n")
2031 (insert " http://www.apache.org/licenses/LICENSE-2.0\n")
2033 (insert "Unless required by applicable law or agreed to in writing, software\n")
2034 (insert "distributed under the License is distributed on an \"AS IS\" BASIS,\n")
2035 (insert "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n")
2036 (insert "See the License for the specific language governing permissions and\n")
2037 (insert "limitations under the License.\n")
2038 (comment-region beg (point))))
2039 (global-set-key (kbd "C-M-0") 'insert-apache)
2050 #+begin_src emacs-lisp
2051 (global-set-key (kbd "C-y") 'undo-tree-redo)
2052 (add-hook 'org-mode-hook
2053 (lambda () (define-key org-mode-map (kbd "C-y") nil)))
2060 #+begin_src emacs-lisp
2061 (global-set-key (kbd "C-\\") 'sr-speedbar-toggle)
2066 #+begin_src emacs-lisp
2067 (global-set-key (kbd "C-M-\\") 'mark-defun)
2078 #+begin_src emacs-lisp
2079 (global-set-key (kbd "C-'") 'eval-expression)
2086 #+begin_src emacs-lisp
2087 (defun unpop-to-mark-command ()
2088 "Unpop off mark ring. Does nothing if mark ring is empty."
2091 (let ((pos (marker-position (car (last mark-ring)))))
2092 (if (not (= (point) pos))
2094 (setq mark-ring (cons (copy-marker (mark-marker)) mark-ring))
2095 (set-marker (mark-marker) pos)
2096 (setq mark-ring (nbutlast mark-ring))
2097 (goto-char (marker-position (car (last mark-ring))))))))
2099 (global-set-key (kbd "C-n") 'unpop-to-mark-command)
2104 #+begin_src emacs-lisp
2105 (global-set-key (kbd "C-M-n") 'narrow-to-region)
2114 :ID: a6dd7e4c-1831-4493-bbfd-557dc2f9c856
2115 :CUSTOM_ID: 6901fa1b-c827-4525-b24b-bdb8fe5f638b
2126 #+begin_src emacs-lisp
2127 (global-set-key (kbd "<C-escape>") 'find-tag)
2133 not necessary to have at the end, but its convenient to have it next
2135 #+NAME: keybind-table-generator
2136 #+BEGIN_SRC emacs-lisp :results silent
2137 (defun org-custom-id-get (&optional pom create prefix)
2138 "Get the CUSTOM_ID property of the entry at point-or-marker POM.
2139 If POM is nil, refer to the entry at point.
2140 If the entry does not have a CUSTOM_ID, the function returns nil.
2141 However, when CREATE is non nil, create an ID if none is present already.
2142 PREFIX will be passed through to `org-id-new'.
2143 In any case, the CUSTOM_ID of the entry is returned."
2144 (org-with-point-at pom
2145 (let ((id (org-entry-get nil "CUSTOM_ID")))
2147 ((and id (stringp id) (string-match "\\S-" id))
2150 (setq id (org-id-new prefix))
2151 (org-entry-put pom "CUSTOM_ID" id)
2152 (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
2157 (let ((title (plist-get (cadr (org-element-at-point)) ':title)))
2158 ;; remove brackets from [title]
2159 ;; I was at one point using org-drill for spaces repitition,
2160 ;; and enclosed question and answer by 2 sets of brackets.
2161 (string-match "[^[ ][^]]*" title)
2162 (setq title (match-string 0 title))
2167 (defun org-dblock-write:keybind-dblock (arg)
2170 (goto-char (org-find-entry-with-id "beginning-of-keybind-table-data"))
2171 (let* ((table-level (org-current-level))
2172 (keybind-level (1+ table-level))
2173 (prefixes (list "C-M-S-" "C-M-" "C-S-" "M-S-" "M-" "C-" "S-"))
2177 (while (>= (org-current-level) table-level)
2178 (setq table-title (get-title))
2179 (outline-next-heading)
2180 (let (found-prefixes
2182 ;; go through the first few elements of the table to find out what column headings aka prefixes it should have
2184 (while (not found-all-prefixes)
2185 (let ((prefixes-copy prefixes)
2188 (while (and prefixes-copy (not found-prefix))
2189 (setq current-prefix (car prefixes-copy))
2190 (when (and (> (length (get-title)) (length current-prefix))
2191 (string= (substring (get-title) 0 (length current-prefix)) current-prefix))
2192 (setq found-prefix t))
2193 (setq prefixes-copy (cdr prefixes-copy)))
2194 (unless found-prefix
2195 (setq current-prefix ""))
2196 (if (and found-prefixes (string= (car (last found-prefixes)) current-prefix))
2197 (setq found-all-prefixes t)
2198 (push current-prefix found-prefixes)))
2199 (outline-next-heading)))
2200 (setq found-prefixes (reverse found-prefixes))
2202 ;; start a new table or repeat the prefixes in the current table
2204 (if (or (not previous-prefixes) (equal previous-prefixes found-prefixes))
2205 (setq output (concat output "|-|\n| "))
2206 (setq output (concat output "|-|\n\n|-|\n| ")))
2207 (setq output (concat output table-title " | "))
2208 (setq previous-prefixes found-prefixes)
2211 (dolist (prefix found-prefixes)
2212 (setq output (concat output prefix "|")))
2213 (setq output (concat output "\n|-|\n"))
2217 (while (>= (org-current-level) keybind-level)
2218 (dotimes (i (length found-prefixes))
2221 (setq output (concat output "| " (substring (get-title) (length (car found-prefixes))) " | ")))
2222 ;; add keybinds by searching for regex [keybind] to the start of the next heading
2224 (outline-next-heading)
2225 (setq subtree-end (point)))
2226 ;; skip over scheduled line
2228 ;; see comment after source block to understand this regex
2229 (re-search-forward "^\\s-*\\([^*: ].*?$\\)" subtree-end t)
2230 (let ((m (match-string 1)))
2232 (setq output (concat output "[[#" (org-custom-id-get (point) 'create) "][" m "]]")))
2233 (setq output (concat output " | ")))
2234 ;; advance to next keybind
2235 (outline-next-heading))
2236 (setq output (concat output "\n"))
2238 (setq output (concat output "|-|"))
2240 (org-table-map-tables 'org-table-align 'quietly))
2244 after source block due to bad parsing of comments in non emacs lisp mode
2245 some easily forgotten regex elements. whitespace: \\s-
2247 subexpression for close bracket char or nothing: \\(\\]\\|\\)
2251 CLOCK: [2016-11-28 Mon 10:59]--[2016-11-28 Mon 10:59] => 0:00
2253 dunno why but it takes doing ctrl-c twice to update this
2254 #+BEGIN: keybind-dblock
2255 |---------------------+------------------------|
2256 | single/special keys | |
2257 |---------------------+------------------------|
2258 | tab key | [[#6c10a716-1d8e-4ce4-8e26-64468f19c17a][isearch]] |
2259 | tab | [[#51ece189-1840-41a1-8ca0-19f9a0481895][isearch-forward]] |
2260 | end | [[#00d589b7-2b8e-494c-b761-3afefebe6ec6][move-end-of-line]] |
2261 | home | [[#7800e455-c3f6-4a8f-8907-b2292449ab67][back-to-indentation]] |
2262 | s-tab | [[#3072901e-5cf3-4d6e-9ac8-3ef64a5f6ad2][indent-buffer]] |
2263 | s-delete | [[#e53728b6-054d-4443-a03e-6cf02d13724d][send-shell]] |
2264 | s-left arrow | [[#d8c473ac-5507-4a6b-9e5a-46558c17b09f][shell]] |
2265 | s-right arrow | [[#cbae2b27-ff95-4b12-88e0-e1a0f7705db6][previous-buffer]] |
2267 | return | [[#fab6adea-ed20-45ab-a0a3-776c68d5c3a5][new line]] |
2268 | s-return | [[#c433c837-24fa-45e1-8991-a4d380550ea0][auto-correct-prev-word]] |
2269 | down arrow | [[#7a868484-9c63-4a73-abda-7751cb2c02be][mark]] |
2270 | s-down arrow | [[#097b97e0-8ad8-40f7-8388-c4ace1706b38][extended command]] |
2272 |---------------------+------------------------|
2274 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2275 | mouse | | C- | M- | S- | C-M- | C-S- |
2276 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2277 | mouse-2 mode line | [[#69aaa631-6fb5-4beb-b2d8-c0f3d92c0a98][mouse-delete-other-windows]] | [[#501479ab-e1e2-497e-bd86-071f8afa3378][mouse-split-window-horizontally]] | | | | |
2278 | mouse-3 mode line | [[#917a1844-8c38-4f31-8616-50fc81334f2c][mouse-delete-window]] | | | | | |
2279 | mouse-1 | [[#4e60e2e4-8c2f-4450-8060-2d793ede530c][set cursor/mark]] | [[#b661f84f-57df-4095-9dc1-d1a876a53ee5][buffer list context menu]] | | | | |
2280 | mouse-2 | [[#086b0b50-054f-462d-92fa-b27852f887b0][paste]] | | | | | |
2281 | mouse-3 | [[#0481632e-9c50-4328-9365-c4b5bf967b66][set-mark]] | [[#9623c78f-7705-4cbe-a990-c24eb1067377][global menu]] | | | | |
2282 | mouse-9 | [[#efaec161-b279-4129-86fd-b410430926e4][move-mouse-to-point]] | | | | | |
2283 | mouse-8 | | | | | | |
2284 | 1/kp-end | | | | | | |
2285 | 2/kp-down | | | [[#50db5a06-452e-491f-875b-3de936a4d04a][smex]] | | | |
2286 | 3/kp-next | | | | | | |
2287 | 4/kp-left | [[#c44d0f65-9502-4cc6-9642-96d907f6b093][indent-region]] | | | | | |
2288 | 5/kp-begin | [[#2458c6bc-7113-4d4b-bbdf-206e1cb842a7][mark-defun]] | | | | | |
2289 | 6/kp-right | [[#3b79bc58-6067-43bd-9471-9d592744a25a][ibuffer]] | | | | | |
2290 | 7/kp-home | | | | | | |
2291 | 8/kp-up | | | | | | |
2292 | 9/kp-prior | [[#a3b51adb-4405-4d9f-9b88-a8faa479fbe7][delete-horizontal-space]] | | | | | |
2293 | 10/kp-insert | | | | | | |
2294 | 11/kp-subtract | | | | | | |
2295 | 12/kp-add | | | | | | |
2296 | 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]] |
2297 | 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]] |
2298 |-------------------+----------------------------+---------------------------------+--------------------+---------------+-------------+-------------|
2300 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2301 | left primary | C- | M- | C-M- | C-S- |
2302 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2303 | 2 | [[#b7db9f5c-f31d-45fb-ac70-eb3ef9369d3d][copy-symbol]] | [[#53ecfda2-d9f6-4882-b7a2-9b3c859e3bcb][shell-cd-to-file]] | [[#33c4996d-92bc-4df0-b005-11553677be13][---]] | |
2304 | 3 | [[#401f56ff-6aba-4156-b128-f449b18c27af][dot-mode-execute]] | | [[#eb0cc3a8-b62e-4a24-9f84-cc8e854f91dd][recenter-top-bottom]] | |
2305 | 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]] | |
2306 | w | [[#20005b6d-9a9d-4b58-882c-7ce860c7a395][goto-t.org]] | [[#9531a0da-269f-4359-9124-e83fbf61a92f][org-clock-in]] | | |
2307 | e | [[#11e8f541-f0a0-4058-883a-98bd1e7b8c4d][copy-line]] | [[#74d0ed51-ddb5-488e-bf55-0f033916e319][org-clock-in-last]] | | |
2308 | r | [[#5088a8b2-a772-4660-a3b6-b8cca7099da6][isearch-backward]] | [[#8fe64424-1f11-4086-84b3-07c2af210c1c][org-clock-out]] | | |
2309 | 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]] | |
2310 | s | [[#f26dd0f5-0655-485f-8c76-e6dfc6abd947][C-x prefix]] | | [[#290ea04a-be99-416a-a95f-458045a91c93][split-window-vertically]] | |
2311 | d | [[#b699614a-9994-4fe7-b2c6-f0fe81b7ad2b][C-c prefix]] | | [[#d9f48fbe-0a32-4133-93fb-f43ff6ab0037][swap buffer]] | |
2312 | 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]] | |
2313 | g | [[#a58a1eda-43ed-437e-b483-5c312e0754a7][other-window / cancel]] | [[#a287d720-4419-4546-8262-1f377bb158d2][abort-recursive-edit]] | [[#327e18af-30b7-47e5-aa53-5f678788b4c1][gnus]] | |
2314 | z | [[#5c30ce7e-8bc6-45bf-b9b1-5c75334a3e27][undo-tree-undo]] | | | |
2315 | x | [[#ec1403d3-528e-41b1-a195-5563bc93e124][kill-region]] | [[#bb7c95d5-dd97-439d-bf1f-cdac98d11543][append-next-kill]] | [[#47cc90e3-335f-4c44-9f39-b732e5440664][append-next-kill]] | |
2316 | c | [[#400f06e1-8e45-443c-8d7b-3d1bb1176aab][copy]] | [[#7a265014-1e9c-4639-ad1d-26b3416379a8][org-capture]] | [[#503e0beb-6fda-4e94-9678-d58bd3cbbc8e][copy-to-register]] | |
2317 | v | [[#16411f68-7fe0-49e8-9a73-212471594f9e][yank]] | [[#fe04fffa-6f85-483a-b329-938531109c35][insert-register]] | [[#c559e9ea-1218-4ccb-9c3a-74cbac4be220][yank pop]] | |
2318 | 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]] | |
2319 | tab | [[#928505cb-707c-47ba-af54-5ae1df2ee07d][yas-insert-snippet]] | [[#64f91d86-afa9-4500-8d7d-ce8b2668726b][indent line]] | | |
2320 | delete | [[#e3d8653e-2282-4e3a-a4f5-29211ba2e647][kill-symbol]] | | [[#d9664937-d61c-4cc8-89c6-7f2182655c20][kill-sexp]] | |
2321 | left-arrow | [[#601c8172-f9b7-4e36-88ab-c66c2911b4d7][compile]] | | [[#91ddc121-db27-4f1c-a9ec-a4d29b96a7d2][org-shiftup]] | |
2322 | right-arrow | [[#5f66f60b-adcd-45dc-86b2-5d1225e2455c][paste selection]] | | [[#fc2147b4-a19a-4fde-bb53-e7ac28f0bfa1][org-shiftdown]] | |
2323 | backspace | [[#96f90a00-2260-4340-ae03-f4a86bd65502][backward-kill-symbol]] | | [[#606b0991-7431-4a8a-a909-b872e104cc88][backward-kill-sexp]] | |
2325 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2326 | right primary | C- | M- | C-M- | C-S- |
2327 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2328 | * | [[#045c374c-b03e-42cb-b274-0f30c81fe3f3][split-window-horizontally]] | | [[#05cf6230-9263-4fd4-9812-4f32009eed46][calc-dispatch]] | |
2329 | 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]] | |
2330 | u | [[#327992c0-6eba-4935-aec1-49871c2a8619][universal-argument]] | | [[#7af825b1-92d8-4d5d-aaa1-8b4b466ea2e0][search-keybind]] | |
2331 | i | [[#3124e200-1d6e-4ad2-9a36-0d03e1e7dc38][-----]] | | [[#b2cc7cdd-c177-4ef2-af43-28ca7a338fda][query-replace-regexp]] | |
2332 | o | [[#b87a2c8a-7eb3-4661-9b28-589d14206c41][occur]] | | [[#d30ac3cd-1963-4bd0-8052-98e12b6524b0][counsel-imenu]] | |
2333 | p | [[#d84de055-e92e-478d-bb39-bc39acfa1586][move-mouse-to-point]] | | [[#08e65732-2fb1-4a78-9d18-cee87eb867a7][delete-horizontal-space]] | |
2334 | j | [[#ca1ce86b-dcea-45c1-9a8e-dd4f306776e8][pop-to-mark]] | [[#b92414e2-0d5b-4576-8fa5-5e7f1e32819a][previous-error]] | [[#8fe7cac2-ab1a-4b39-aced-10c5e0157e68][register prefix]] | |
2335 | k | [[#eb1c2360-bfd4-4d5c-b789-11b5ca5ba475][jump to register]] | [[#9061b192-735a-4273-ae36-993e6fad9205][next-error]] | [[#e1d768be-6b9b-4322-931f-3e570376ae15][man]] | |
2336 | l | [[#137995db-ee30-4738-90e2-54dcd5cadcf2][ivy-switch-buffer]] | | [[#56fcff3b-ffd9-4280-a226-4b58558906b8][move cursor top bottom mid]] | |
2337 | ; | [[#150bef9a-3faa-4c72-a176-88c3be56f612][comment-dwim]] | [[#211e76d9-d89a-4cc6-abce-69397d456fda][comment-dwim]] | [[#17035e1e-bbe6-44a6-ad54-6a39b04feac3][comment-current-line-dwim]] | |
2338 | m | | | [[#9a6a1998-4ed6-485e-9b2d-c36a42d7ec1a][recursive grep]] | |
2339 | , | [[#e4f617b2-d3f1-47e4-ae7f-2d64c4fd47b9][counsel-find-file]] | | [[#e0691924-11e1-48d2-abee-27945a409676][find-file-in-project]] | |
2340 | . | [[#6e97b7f1-c5cf-48bb-9c09-db1950dc1eae][recentf-ido-find-file]] | | [[#824d422c-67b6-4d68-af11-6a2135e528f5][-]] | |
2341 | / | [[#941a7fa8-84b9-434d-89a0-1487385ec479][join lines]] | | [[#37f67593-4f60-4d3b-9aad-6c9bc4882443][copy-variable]] | |
2342 | 8 | [[#45644cfa-d408-4a69-a97a-545ef46ba656][calc-embedded-word]] | | | |
2343 | up-arrow | [[#2dade04a-8ac7-483c-8675-5268af6eca2b][back defun/headline]] | | | [[#572d6618-471a-43c7-8a50-3f5e56f45cd7][winner undo]] |
2344 | 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]] |
2345 | lbracket | [[#9d9916dd-3280-47dd-aab1-cd28d5ebfe15][----]] | | [[#c10b53e9-657c-48f4-8afb-cad0e709bcd6][scroll-right]] | |
2346 | rbracket | [[#21b38c6b-3a46-4a08-8eca-d44abb148287][fill-paragraph]] | | [[#095c3d97-bc49-419a-a8c0-c7a21d46d980][scroll-left]] | |
2347 | 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]] | |
2348 | space | [[#b7d5a893-3045-4968-a150-cb813fddfe9e][org-edit-special]] | | [[#47b5912e-edc7-42ec-841b-f0e202b7f593][spell check word]] | |
2349 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2350 | left secondary | C- | M- | C-M- | C-S- |
2351 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2354 | 4 | | | [[#2d4de3c9-9e0c-4ab4-89e3-e41bfed3c9a7][widen]] | |
2356 | tab-key | [[#2f527321-7f78-421b-b0c4-6fc810da0246][query-replace]] | | | |
2357 | t | [[#3bcdf4a3-f33c-4dad-ba94-e4fd3775eca6][org change todo state]] | | [[#47c64b9c-346d-45ad-8c38-865fe22d31a6][org insert timestamp]] | |
2358 | home | [[#1919659a-b466-4519-9276-8bf06a916066][start of buffer]] | | | |
2359 | end | [[#0a7bd629-cbcc-4761-8fe2-cc9370b985a4][end of buffer]] | | | |
2361 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2362 | right secondary | C- | M- | C-M- | C-S- |
2363 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2364 | 6 | [[#e44e584b-d925-4036-9ad5-a90d02e74bef][save-buffers-kill-emacs]] | | [[#da73de75-0914-4f48-81d5-9b408433b14b][insert-small-copyright]] | |
2365 | 7 | | | [[#a68c6b8e-9911-475e-ab35-e239771fe881][insert-full-copyright]] | |
2366 | 0 | [[#96ae2fcc-3a0c-40c4-aef8-06aff3fd42be][text-scale-reset]] | | [[#0e7f83a5-600e-4016-af98-95904300c016][insert-apache]] | |
2367 | - | | | [[#6febc7ea-9cc7-488c-af34-538b8e69633b][org-edit-src-exit]] | |
2368 | y | [[#97aee7f1-3647-4602-a65a-45e8a3aa3a7c][undo-tree-redo]] | | | |
2369 | \ | [[#69005926-08ab-4adc-a163-44fed609cc95][sr-speedbar-toggle]] | | [[#27045e96-59a3-45b4-b0ff-6247aa5ed47e][mark-defun]] | |
2370 | h | [[#3c5f241f-fc62-459d-ab85-6b7c1fb04801][help-prefix]] | | | |
2371 | ' | [[#9f252721-a2d5-46c6-b268-8ed597256229][eval-expression]] | | | |
2372 | n | [[#65ac9206-1a67-48dc-8b72-26d763d7bf2b][unpop-to-mark-command]] | | [[#34fb8fbd-42dc-46b0-8c3c-c7e51edc9687][narrow-to-region]] | |
2374 | escape | [[#da8bae21-a7be-45de-8027-1b26e6285e40][find-tag]] | | | |
2375 |-----------------+--------------------------------+---------------------------------+-------------------------------+--------------------------|
2380 common keys, which would be better off doing swaps than rebinds:
2384 search c-s -> kp-add
2385 kill line c-k -> c-f
2387 set-mark-command c-@ -> kp-enter
2388 quoted-insert c-q -> c-m-q
2389 recenter-top-bottom c-l -> c-m-3
2390 kill-region c-w -> c-x
2392 commands to make less accessible
2393 narrow-to-defun/subtree -> M-2 maybe
2396 command to make more accessible, ...
2399 * TESTING / DEVELOPMENT AREA
2401 (defun comint-send-string (process string)
2402 "Like `process-send-string', but also does extra bookkeeping for Comint mode."
2404 (with-current-buffer (if (processp process)
2405 (process-buffer process)
2406 (get-buffer process))
2407 (comint-snapshot-last-prompt))
2408 (comint-snapshot-last-prompt))
2409 (process-send-string process string))