From 92f75d7113dc15ee17ee98badb59873c6de5914a Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 14 Jul 2019 20:51:38 -0400 Subject: [PATCH] use undo tree again, minor improvements --- ian-notes.org | 152 +++++++++++++++++++++++++------------------------- init.el | 46 ++++++++++----- 2 files changed, 108 insertions(+), 90 deletions(-) diff --git a/ian-notes.org b/ian-notes.org index 1dfb3c1..2b373f1 100644 --- a/ian-notes.org +++ b/ian-notes.org @@ -1803,82 +1803,82 @@ plan to use calc. * keybind tables - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | left primary | C- | M- | C-M- | C-S- | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | 2 | copy-symbol | shell-cd-to-file | --- | | - | 3 | dot-mode-execute | | recenter-top-bottom | | - | q | mode specific | org-archive-... | quoted-insert | | - | w | find-file | org-clock-in | | | - | e | copy-line | org-clock-in-last | | | - | r | isearch-backward | org-clock-out | | | - | a | copy-all | | | | - | s | C-x prefix | | split-window-vertically | | - | d | C-c prefix | | swap buffer | | - | f | kill-whole-line | print-var-at-point | kill rest of line | | - | g | other-window / cancel | abort-recursive-edit | gnus | | - | z | undo-tree-undo | | | | - | x | kill-region | append-next-kill | append-next-kill | | - | c | copy | org-capture | copy-to-register | | - | v | yank | insert-register | yank pop | | - | b | delete-other-windows | search back symbol | isearch-current-symbol | | - | tab | --- | indent line | | | - | delete | kill-symbol | | kill-sexp | | - | left-arrow | backward-symbol | | org-shiftup | | - | right-arrow | forward-symbol | | org-shiftdown | | - | backspace | backward-kill-symbol | | backward-kill-sexp | | - | f7 | | | | | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | right primary | C- | M- | C-M- | C-S- | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | * | split-window-horizontally | | calc-dispatch | | - | 9 | delete-window-or-exit | kill-buffer-and-window | kill client buffer | | - | u | universal-argument | | search-keybind | | - | i | | | query-replace-regexp | | - | o | occur | | counsel-imenu | | - | p | move-mouse-to-point | | delete-horizontal-space | | - | j | pop-to-mark | previous-error | register prefix | | - | k | jump to register | next-error | man | | - | l | ivy-switch-buffer | | cursor top bottom mid | | - | ; | comment-dwim | comment-dwim | comment line | | - | m | | | recursive grep | | - | , | counsel-find-file | | find-file-in-project | | - | . | recentf-ido-find-file | | - | | - | / | join lines | | copy-variable | | - | 8 | calc-embedded-word | | | | - | up-arrow | back defun/headline | | | winner undo | - | down-arrow | forward dfun/headline | | toggle-mark-activation | smex-major-mode | - | lbracket | ---- | | scroll-right | | - | rbracket | fill-paragraph | | scroll-left | | - | return | newline next line | newline plain | | | - | space | org-edit-special | | spell check word | | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | left secondary | C- | M- | C-M- | C-S- | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | = | | | | | - | 1 | | | | | - | 4 | | | widen | | - | 5 | | | | | - | tab-key | query-replace | | | | - | t | org change todo state | | org insert timestamp | | - | home | start of buffer | | | | - | end | end of buffer | | | | - | f9 | | | | | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | right secondary | C- | M- | C-M- | C-S- | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| - | 6 | save-buffers-kill-emacs | | insert-small-copyright | | - | 7 | | | insert-full-copyright | | - | 0 | text-scale-reset | | insert-apache | | - | - | | | org-edit-src-exit | | - | y | undo-tree-redo | | | | - | \ | sr-speedbar-toggle | | mark-defun | | - | h | help-prefix | | | | - | ' | eval-expression | | | | - | n | unpop-to-mark-command | | narrow-to-region | | - | rshift | | | | | - | escape | find-tag | | | | - |-----------------+---------------------------+------------------------+-------------------------+-----------------| + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | left primary | C- | M- | C-M- | C-S- | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | 2 | copy-symbol | shell-cd-to-file | --- | | + | 3 | dot-mode-execute | | recenter-top-bottom | | + | q | mode specific | org-archive-... | quoted-insert | | + | w | find-file | org-clock-in | | | + | e | copy-line | org-clock-in-last | | | + | r | isearch-backward | org-clock-out | | | + | a | copy-all | | | | + | s | C-x prefix | | split-window-vertically | | + | d | C-c prefix | | swap buffer | | + | f | kill-whole-line | print-var-at-point | kill rest of line | | + | g | other-window / cancel | abort-recursive-edit | gnus | | + | z | undo-tree-undo | | | | + | x | kill-region | append-next-kill | append-next-kill | | + | c | copy | org-capture | copy-to-register | | + | v | yank | insert-register | yank pop | | + | b | delete-other-windows | search back symbol | isearch-current-symbol | | + | tab | --- | indent line | | | + | delete | kill-symbol | | kill-sexp | | + | left-arrow | backward-symbol | | org-shiftup | | + | right-arrow | forward-symbol | | org-shiftdown | | + | backspace | backward-kill-symbol | | backward-kill-sexp | | + | f7 | | | | | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | right primary | C- | M- | C-M- | C-S- | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | * | split-window-horizontally | | calc-dispatch | | + | 9 | delete-window-or-exit | kill-buffer-and-window | kill client buffer | | + | u | universal-argument | | search-keybind | | + | i | | | query-replace-regexp | | + | o | occur | | counsel-imenu | | + | p | move-mouse-to-point | | delete-horizontal-space | | + | j | pop-to-mark | previous-error | register prefix | | + | k | jump to register | next-error | man | | + | l | ivy-switch-buffer | | cursor top bottom mid | | + | ; | comment-dwim | comment-dwim | comment line | | + | m | | | recursive grep | | + | , | counsel-find-file | | find-file-in-project | | + | . | recentf-ido-find-file | | - | | + | / | join lines | | copy-variable | | + | 8 | calc-embedded-word | | | | + | up-arrow | back defun/headline | | | winner undo | + | down-arrow | forward dfun/headline | | toggle-mark-activation | smex-major-mode | + | lbracket | ---- | | scroll-right | | + | rbracket | fill-paragraph | | scroll-left | | + | return | newline next line | newline plain | | | + | space | org-edit-special | | spell check word | | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | left secondary | C- | M- | C-M- | C-S- | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | = | | | | | + | 1 | | | | | + | 4 | | | widen | | + | 5 | | | | | + | tab-key | query-replace | | | | + | t | org change todo state | | org insert timestamp | | + | home | start of buffer | | | | + | end | end of buffer | | | | + | f9 | | | | | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | right secondary | C- | M- | C-M- | C-S- | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| + | 6 | | | insert-small-copyright | save-buffers-kill-emacs | + | 7 | | | insert-full-copyright | | + | 0 | text-scale-reset | | insert-apache | | + | - | | | org-edit-src-exit | | + | y | undo-tree-redo | | | | + | \ | sr-speedbar-toggle | | mark-defun | | + | h | help-prefix | | | | + | ' | eval-expression | | | | + | n | unpop-to-mark-command | | narrow-to-region | | + | rshift | | | | | + | escape | find-tag | | | | + |-----------------+---------------------------+------------------------+-------------------------+-------------------------| * keybind notes todo: diff --git a/init.el b/init.el index 6b9094f..247ecff 100644 --- a/init.el +++ b/init.el @@ -311,6 +311,22 @@ Fourth argument TYPE is the custom option type." +;;; undo tree mode + + ;; more resilient undo-tree-history if we have its location set up front. + (setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history"))) + + + ;; todo, send patch undo-tree-visualize should scroll with the scroll key, instead of just pgup pgdn (aka next/prior) + (global-undo-tree-mode) + ;; disabled due to bug, something like unknown entry in undo tree canary + ;; (setq undo-tree-auto-save-history t) + (setq undo-outer-limit 100000000 ; per undo command + undo-limit 500000000 ; undo history limit + undo-strong-limit 600000000) ; undo history limit plus some extra + ;; Undo in region just happens accidentally, and throws me off + (setq undo-tree-enable-undo-in-region nil) + ;;; abreviations ;; turn on abbrev mode globally (setq-default abbrev-mode t) @@ -1177,10 +1193,10 @@ https://fsf.org | https://gnu.org (add-hook 'haskell-mode-hook (lambda () (define-key haskell-mode-map (kbd "C-(") - (lambda () (interactive) - (basic-save-buffer) - (haskell-compile) - (run-with-timer .3 nil 'repeat-shell))))) + (lambda () (interactive) + (basic-save-buffer) + (haskell-compile) + (run-with-timer .3 nil 'repeat-shell))))) (add-hook 'haskell-cabal-mode-hook (lambda () (define-key haskell-cabal-mode-map (kbd "C-(") 'haskell-compile))) @@ -1850,6 +1866,7 @@ Go to the next directory based on where the cursor is." (dot-mode . "") (yas-global-mode . "") (yas-minor-mode . "") + (undo-tree-mode . "") (volatile-highlights-mode . "") (highlight-symbol-mode . "") ;; Major modes @@ -2990,7 +3007,7 @@ modes like org-mode which have their own yank function." ;;;;; C-z - undo-only - (global-set-key (kbd "C-z") 'undo-only) + (global-set-key (kbd "C-z") 'undo-tree-undo) ;;;;; C-x - kill-region @@ -3305,14 +3322,14 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-;") 'comment-current-line-dwim) ;;;;; C-m -(define-key input-decode-map [?\C-m] [C-m]) + (define-key input-decode-map [?\C-m] [C-m]) ;;;;; C-M-m - recursive grep (define-key global-map (kbd "C-M-m") 'rgrep) ;;;;; C-, - --- -;; not recognized by terminal, can't get konsole keydef file to recognize comma, -;; todo: dig into konsole sources, or try newer version than t8 + ;; not recognized by terminal, can't get konsole keydef file to recognize comma, + ;; todo: dig into konsole sources, or try newer version than t8 (add-hook 'flyspell-mode-hook (lambda () (define-key flyspell-mode-map (kbd "C-,") nil))) @@ -3362,6 +3379,7 @@ modes like org-mode which have their own yank function." (interactive) (join-line '(4))) (global-set-key (kbd "C-/") 'vim-style-join-line) + (define-key undo-tree-map (kbd "C-/") nil) ;;;;; C-M-/ - copy-buffer-file-name @@ -3448,7 +3466,7 @@ modes like org-mode which have their own yank function." ;;;;; C-S-down-arrow - m-x for major mode -;; todo, update this for ivy + ;; todo, update this for ivy (global-set-key (kbd "") 'smex-major-mode-commands) ;;;;; C-lbracket - ---- @@ -3559,9 +3577,9 @@ modes like org-mode which have their own yank function." ;;;;; C-home - start of buffer ;;;;; C-end - end of buffer ;;;; right secondary -;;;;; C-6 - save-buffers-kill-emacs +;;;;; C-^ - save-buffers-kill-emacs - (global-set-key (kbd "C-6") 'save-buffers-kill-emacs) + (global-set-key (kbd "C-^") 'save-buffers-kill-emacs) ;;;;; C-M-6 - insert-small-copyright @@ -3569,7 +3587,7 @@ modes like org-mode which have their own yank function." (interactive) (beginning-of-line) (let ((beg (point))) - (insert "Copyright (C) 2017 Ian Kelling\nThis program is under GPL v. 3 or later, see ") + (insert "Copyright (C) 2019 Ian Kelling\nThis program is under GPL v. 3 or later, see ") (comment-region beg (point)))) (global-set-key (kbd "C-M-6") 'insert-small-copyright) @@ -3580,7 +3598,7 @@ modes like org-mode which have their own yank function." (interactive) (beginning-of-line) (let ((beg (point))) - (insert "Copyright (C) 2017 Ian Kelling\n") + (insert "Copyright (C) 2019 Ian Kelling\n") (insert "\n") (insert "This program is free software: you can redistribute it and/or modify\n") (insert "it under the terms of the GNU General Public License as published by\n") @@ -3632,7 +3650,7 @@ modes like org-mode which have their own yank function." ;;;;; C-M-- - org-edit-src-exit ;;;;; C-y - undo - (global-set-key (kbd "C-y") 'undo) + (global-set-key (kbd "C-y") 'undo-tree-redo) (add-hook 'org-mode-hook (lambda () (define-key org-mode-map (kbd "C-y") nil))) -- 2.30.2