optimize startup
[dot-emacs] / init.el
diff --git a/init.el b/init.el
index e671ef40b06abb53517fab74af7249225bdd2b64..021fc6c9ccfdcfd3cc8a34779c92a442ee4d39c3 100644 (file)
--- a/init.el
+++ b/init.el
 (add-hook 'after-init-hook
           `(lambda ()
              (setq file-name-handler-alist file-name-handler-alist-old
-                   gc-cons-threshold 800000
-                   gc-cons-percentage 0.1)
-             (garbage-collect)) t)
+                   ;; 100 mb
+                   gc-cons-threshold 100000000))
+          ;; taken from wiegley, dunno why the t is there.
+          t)
 
 ;; 2019-6-26, 1.26s
-  ;;; to profile init:
-  ;;; uncomment the following block
-;; (require 'benchmark-init)
-;; (add-hook 'after-init-hook 'benchmark-init/deactivate)
-  ;;; Then run:
-  ;;; emacs -f benchmark-init/show-durations-tabulated
-  ;;; emacs -f benchmark-init/show-durations-tree
-  ;;; to catch things post-init
-  ;;; emacs -f benchmark-init/deactivate
+;; ; to profile init:
+;; ; uncomment the following block
+ (require 'benchmark-init)
+ (add-hook 'after-init-hook 'benchmark-init/deactivate)
+;; ; Then run:
+;; ; emacs -f benchmark-init/show-durations-tabulated
+;; ; emacs -f benchmark-init/show-durations-tree
+;; ; to catch things post-init
+;; ; emacs -f benchmark-init/deactivate
 
 
 ;; these need to be done before the hook in order to satisfy the byte compiler or batch mode
   :unless noninteractive
   :config
   (save-place-mode 1))
+;; find file at point
 (use-package ffap)
 
-;; from jwiegley
-(use-package recentf
-  :defer 10
-  :commands (recentf-mode
-             recentf-add-file
-             recentf-apply-filename-handlers)
-  :config
-  (recentf-mode 1))
 
 (setq package-archives
-   (quote
-    (("gnu" . "https://elpa.gnu.org/packages/")
-     ("MELPA" . "https://melpa.org/packages/"))))
+      (quote
+       (("gnu" . "https://elpa.gnu.org/packages/")
+        ("MELPA" . "https://melpa.org/packages/"))))
 
 ;;(add-to-list 'package-archives
 ;;             '("marmalade" .
 
 ;; keep our init.el clean, by moving customization elisp to it's own file
 (setq custom-file "~/.emacs.d/custom.el")
-(load custom-file 'noerror)
+;; empty atm
+;;(load custom-file 'noerror)
 
 
 ;;; auto-complete
 
 (add-to-list 'ac-modes 'org-mode 'sql-mode)
 
-(defun ac-common-setup ()
-  (add-to-list 'ac-sources 'ac-source-yasnippet))
 
 ;; for org mode completion source taken from wiki.
 ;; it did not work. no idea why. todo, investigate
        (set-process-coding-system proc decoding encoding))
     proc))
 
-;;; auto save & backup
+;;; auto save
+
+;; todo: patch this so i can turn it off like my-as-off-local.
+;; then try it out and see if it can replace my autosave.
+;; Or maybe with the new auto-save-visited-mode.
+;; (use-package super-save
+;;   :ensure t
+;;   :config
+;;   (setq super-save-exclude '("")
+;;         super-save-triggers
+;;         '(balance-windows
+;;           next-buffer
+;;           org-babel-execute-src-block
+;;           other-window
+;;           previous-buffer
+;;           split-window-below
+;;           split-window-horizontally
+;;           start-process-shell-command
+;;           switch-to-buffer
+;;           windmove-down
+;;           windmove-left
+;;           windmove-right
+;;           windmove-up)
+;;         )
+;;   (super-save-mode +1))
+
+
+
 (setq auto-save-timeout 1) ; idle time before auto-save.
 
 ;; main hook for my auto save
@@ -523,44 +543,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 ;;         but new emacs version fixed all that, yay!.
 
 
-                                        ; not using, but here for documentation,
-                                        ; alternate way to enable and specify how long between autosaves.
-                                        ; number of input events between autosave.
-                                        ; lowest bound of functionality is actually about 15 input events
-                                        ;(setq auto-save-interval
-
-;;; bbdb
-;; based on bbdb manual
-;; also has instructions to integrate with gnus,
-
-(bbdb-initialize 'message)
-
-;; recommended by gnus,
-;; but seems like it could be good to have set for other stuff
-(setq user-full-name "Ian Kelling")
-;; general email setting? recommended by mu4e
-(setq message-kill-buffer-on-exit t)
-
-
-
-;; use d instead
-(add-hook 'bbdb-mode-hook
-          (lambda () (define-key bbdb-mode-map (kbd "C-k") nil))
-          ;; based on emacs24-starter-kit
-          (setq bbdb-offer-save 'auto
-                bbdb-notice-auto-save-file t
-                bbdb-expand-mail-aliases t
-                bbdb-canonicalize-redundant-nets-p t
-                bbdb-complete-name-allow-cycling t)
-          )
-
-;;(require 'bbdb-csv-import)
-
-;;; bookmark settings
-                                        ; save bookmarks whenever they are changed instead of just when emacs quits
-(setq bookmark-save-flag 1)
-                                        ; increase bookmark context size for better functionality
-(setq bookmark-search-size 2000)
+;; not using, but here for documentation,
+;; alternate way to enable and specify how long between autosaves.
+;; number of input events between autosave.
+;; lowest bound of functionality is actually about 15 input events
+;; (setq auto-save-interval ...)
 
 ;;; c-like settings
 ;; change last thing from gnu.
@@ -581,9 +568,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 ;; themes are available through ELPA.
 
 
-;; interesting light themes
-
-
 (defun override-theme (arg)
   (interactive)
   (while custom-enabled-themes
@@ -629,8 +613,6 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 ;;(override-theme 'wombat) ; cursor not visible enough. from a wombat package, not sure which
 ;;(override-theme 'misterioso) ; cursor not visible enough
 
-
-
 ;;decent light themes
 ;;(override-theme 'alect-light) ; theres a -alt version, don't see a dif. could use this without dimming. from alect-something package
 ;;(override-theme 'occidental) ; from occidental-theme package
@@ -646,84 +628,39 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 
 
 
-;;; yasnippet
-
-;; cd ~/.emacs.d/src
-;; git clone --recursive https://github.com/capitaomorte/yasnippet
-;; touch snippets/.yas-make-groups
-
-;;   This all makes it so I can look through the default snippets
-;;   in the menu bar, but they don't show up elsewhere, because they are
-;;   mostly things I don't want.
-
-
-(require 'yasnippet)
-;; this needs to be before yas-global-mode
-(setq yas-snippet-dirs (list "~/.emacs.d/snippets"))
-(yas-global-mode 1)
-
-(setq
- yas-also-auto-indent-first-line t
- yas-choose-tables-first t
- yas-use-menu (quote full)
- ;; this sets ido-prompt as first function
- yas-prompt-functions
- '(yas-ido-prompt yas-dropdown-prompt yas-x-prompt yas-completing-prompt yas-no-prompt))
-
-;; todo, explore this option for wrapping region
-;; '(yas/wrap-around-region t))
-
 ;;; cross session settings
 
-;; Save a list of recent files visited.
-(recentf-mode 1)
-(setq recentf-max-saved-items 400
-      recentf-max-menu-items 15)
-
-
-(setq save-place t
-      save-place-version-control 'nospecial
-      save-place-limit 40000
-      save-place-file "~/.emacs.d/places")
-
-
-
-;; savehist keeps track of some history
-;; search entries
-(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring)
-      ;; save every minute
-      savehist-autosave-interval 60
-      ;; keep the home clean
-      savehist-file "~/.emacs.d/.savehist")
-(savehist-mode 1)
-
-
-;;; ediff
-;; ediff-buffers is the main command to use
-
-;; ediff - don't start another frame for the control panel
-;; unfortunately, this doesn't allow me to use 2 frames for the diff buffers
-;; so disable this temporarily with the next line if you want that
-;; sometime I should setup 2 functions to explicitly do each type
-(setq ediff-window-setup-function 'ediff-setup-windows-plain)
-;;(setq ediff-window-setup-function 'ediff-setup-windows-default)
-
-;; do side by side diffs
-(setq ediff-split-window-function 'split-window-horizontally)
+(use-package recentf
+  ;; defer & commands from jwiegley
+  :defer 10
+  :commands (recentf-mode
+             recentf-add-file
+             recentf-apply-filename-handlers)
+  :config
+  (recentf-mode 1)
+  (setq recentf-max-saved-items 400
+        recentf-max-menu-items 15)
+  )
 
+(use-package saveplace
+  :unless noninteractive
+  :config
+  save-place-version-control 'nospecial
+  save-place-limit 4000
+  save-place-file "~/.emacs.d/places"
+  (save-place-mode 1))
 
 
-;; Things I tried which didn't work, which intuitively I think should
-;; work better: I can open the second diff buffer in a new frame, and
-;; close it's window in the first frame after starting ediff, but when I
-;; hit n to go to the next diff, it restores the window in the first
-;; frame. Another thing I tried is to open 2 new frames and set them up
-;; as I want. However, if I try to open the *Ediff Control Panel* buffer
-;; in a different window from its original one, my mouse jumps to one of
-;; the diff frames, or if that isn't visible, the buffer just hangs
-;; until I select the original ediff control panel window. This seems
-;; like a bug to me. I am using a very recent development version of
-;; emacs.
+;; savehist keeps track of some history search entries
+(use-package savehist
+  :unless noninteractive
+  :config
+  (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring)
+        ;; save every minute
+        savehist-autosave-interval 60
+        ;; keep the home clean
+        savehist-file "~/.emacs.d/.savehist")
+  (savehist-mode 1))
 
 ;;; dired
 
@@ -742,6 +679,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 ;; (setq mu4e-headers-results-limit 2000)
 
 
+
 (defun my-mu4e-init ()
   (setq mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields))
   ;; it's implemented in mu4e, but not in the actions list for
@@ -780,6 +718,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer."
 (eval-after-load "mu4e" '(my-mu4e-init))
 
 (setq
+ ;; message mode prompted me on first message.
+ ;; a function which describes options then sets this
+ ;; the other options were to use smtp directly or pass to another mail client
+ ;; here we use the standard sendmail interface. This applies for gnus too.
+ send-mail-function (quote sendmail-send-it)
  ;; https://github.com/djcb/mu/issues/1025
  mail-user-agent 'mu4e-user-agent
  ;; common to gnus. default sendmail-query-once asks us, then sets this via customize.
@@ -912,200 +855,14 @@ and Ian Kelling as the name"
 
 
 ;;; elisp settings
-                                        ; when manually evaluating lisp, go into debugger on error
+;; when manually evaluating lisp, go into debugger on error
 (setq eval-expression-debug-on-error t)
-                                        ;reminder of useful var: debug-on-error
 
 
-;;; haskell
-
-;; useful comint-shell mode commands. If not prefaced with *, it means it is not in the haskell custom repl
-;; *todo: setup haskell c-t toggle arrow keys
-;; tab completion
-;; C-q insert prev arg
-;; C-( history search
-;; c-m-left/right move to next/prev prompts
-;; *c-enter, multi-line input
-;; *s-delete, send input across windows. (i can implement this)
-;; *c-m-l clear screen
-;; *haskell-process-interrupt, c-cc terminate job (i can implement this maybe)
-
-;; nice bash/readline functions missing in comint:
-;; yank-nth-arg
-;; operate-get-next
-;; menu-complete
-
-;; usefull comint commands:
-;; c-cl : list historic command in temp buffer
-;; C-c C-o comint-delete-output
-;; comint-restore-input, todo: put this on a randomish c-c key
-
-
-
-;; todo:
-;; checkout haskell repl functions:
-;; c-cv haskell-check, hlint
-;; C-M-q           prog-indent-sexp
-;; c-c.  haskell-mode-format-imports
-;; C-c M-/         haskell-doc-check-active
-;; haskell-process-generate-tags
-;; haskell-process-cabal-build
-;; haskell-cabal-command.. or something
-;; haskell-process-restart
-;; C-h v haskell-process-log
-;; C-h v haskell-process-show-debug-tips
-
-;; various not immediately useful functions:
-;; haskell-process-add-dependency
-;; haskell-process-touch-buffer
-;; haskell-process-cd
-;; haskell-process-unignore
-;; haskell-process-reload-devel-main
-
-
-;; rebind
-;; home: C-a             haskell-interactive-mode-beginning
-;; c-return: C-j             haskell-interactive-mode-newline-indent
-;; up/down: <C-down>        haskell-interactive-mode-history-next
-
-;; todo haskell mode better binds for:
-;; 'haskell-process-load-file
-;; 'haskell-process-do-type
-;; 'haskell-process-do-info
-;; 'inferior-haskell-send-decl
-
-
-;; commands which don't work in haskell-interactive-mode(hi) vs inferior-haskell-mode(ih, default)
-;; functions not in hi:
-;; inferior-haskell-find-definition, use tags instead
-;; inferior-haskell-find-haddock, todo, test if this works
-
-;; redefined ih to hi
-;; switch-to-haskell -> 'haskell-interactive-switch
-;; haskell-process-load-file -> inferior-haskell-load-file
-;; haskell-process-do-type -> inferior-haskell-type
-;; switch-to-haskell -> haskell-interactive-switch
-;; inferior-haskell-load-file -> 'haskell-process-load-file
-
-
-;; haskell-mode installation from source, based on its readme
-;; in the git directory,
-;; make all
-
-
-
-
-;; remove default option to not link the file
-(setq haskell-compile-command "ghc -Wall -ferror-spans -fforce-recomp %s")
-(add-hook 'haskell-indentation-mode-hook
-          (lambda ()
-            (define-key haskell-indentation-mode-map [?\C-d] nil)
-            (define-key haskell-indentation-mode-map
-              (kbd "<deletechar>")
-              'haskell-indentation-delete-char)))
-
-;;copied from haskell-mode docs in order to use the new, better, nondefault
-;;interactive mode.
-(eval-after-load "haskell-mode"
-  '(progn
-     (define-key haskell-mode-map (kbd "C-x C-d") nil)
-     (define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
-     (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
-     (define-key haskell-mode-map (kbd "C-c C-b") 'haskell-interactive-switch)
-     (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
-     (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
-     (define-key haskell-mode-map (kbd "C-c M-.") nil)
-     (define-key haskell-mode-map (kbd "C-c C-d") nil)))
-
-;; ghc-mod install http://www.mew.org/~kazu/proj/ghc-mod/en/emacs.html
-;; todo, try this out
-;; (autoload 'ghc-init "ghc" nil t)
-;;(add-hook 'haskell-mode-hook (lambda () (ghc-init) (flymake-mode)))
-
-
-
-;; from the package readme for ghci-completion
-(add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)
-
-
-;; disable some rebinds. they are set to appropriate keys in the keybinds section
-(eval-after-load "haskell-mode"
-  '(progn
-     (define-key haskell-mode-map (kbd "C-a") 'nil)
-     (define-key haskell-mode-map (kbd "C-j") 'nil)))
-
 (eval-after-load "python-mode"
   '(progn
      (define-key python-mode-map (kbd "C-j") nil)))
 
-(defun pretty-lambdas-haskell ()
-  (font-lock-add-keywords
-   nil `((,(concat "(?\\(" (regexp-quote "\\") "\\)")
-          (0 (progn (compose-region (match-beginning 1) (match-end 1)
-                                    ,(make-char 'greek-iso8859-7 107))
-                    nil))))))
-;; from haskell-mode manual
-(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
-(when (window-system)
-  (add-hook 'haskell-mode-hook 'pretty-lambdas-haskell))
-
-;; added from haskell-mode website install instructions
-                                        ;(load "/usr/share/emacs/site-lisp/haskell-mode/haskell-site-file")
-(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
-;;the three indentation modules are mutually exclusive - add at most one. Trying out the "most advanced"
-(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
-;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
-;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
-
-
-;; todo, set this to some other key
-;;    (local-set-key (kbd "C-e") 'my-haskell-load-and-run)
-
-(defun my-haskell-load-and-run ()
-  "Loads and runs the current Haskell file."
-  (interactive)
-  (let ((start-buffer (current-buffer)))
-    (inferior-haskell-load-and-run inferior-haskell-run-command)
-    (sleep-for 0 100)
-    (end-of-buffer)
-    (pop-to-buffer start-buffer)))
-
-;; show haskell function in mode line
-;; todo, this broke after updating emacs
-;;(eval-after-load "which-func"
-;;  '(add-to-list 'which-func-modes 'haskell-mode))
-
-
-
-(add-hook 'interactive-haskell-mode-hook 'ac-haskell-process-setup)
-(add-hook 'haskell-interactive-mode-hook 'ac-haskell-process-setup)
-(eval-after-load "auto-complete"
-  '(add-to-list 'ac-modes 'haskell-interactive-mode))
-
-(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)))))
-(add-hook 'haskell-cabal-mode-hook
-          (lambda () (define-key haskell-cabal-mode-map (kbd "C-(") 'haskell-compile)))
-
-
-
-(add-hook 'haskell-interactive-mode-hook
-          (lambda ()
-            (define-key haskell-interactive-mode-map "\r" nil)
-            (define-key haskell-interactive-mode-map (kbd "RET")
-              'haskell-interactive-mode-return)))
-(add-hook 'haskell-indentation-mode-hook (lambda () (define-key haskell-indentation-mode-map "\r" nil)))
-
-
-
-(add-hook 'haskell-interactive-mode-hook
-          (lambda ()
-            (define-key haskell-interactive-mode-map (kbd "<C-M-return>") 'haskell-interactive-mode-newline-indent)))
-
 ;;; isearch
 (setq
  isearch-allow-scroll t
@@ -1183,11 +940,7 @@ and Ian Kelling as the name"
     (isearch-yank-symbol partialp)))
 
 
-
-                                        ; lets look through emacs starter kit before we throw this out.
-
-
-                                        ;   automatically wrap to the top of the buffer when isearch fails
+;;   automatically wrap to the top of the buffer when isearch fails
 (defadvice isearch-search (after isearch-no-fail activate)
   (unless isearch-success
     (ad-disable-advice 'isearch-search 'after 'isearch-no-fail)
@@ -1243,37 +996,40 @@ and Ian Kelling as the name"
   (turn-on-eldoc-mode))
 (add-hook 'ielm-mode-hook 'ielm-mode-defaults)
 
-;;; mediawiki
-
-(eval-after-load "mediawiki"
-  '(progn
-     (remove-hook 'outline-minor-mode-hook 'mediawiki-outline-magic-keys)
-     (add-hook 'mediawiki-mode-hook
-               (lambda () (define-key mediawiki-mode-map (kbd "C-(") 'mediawiki-save-reload)))
-
-     ;; mediawiki mode has a bug that it will claim an edit conflict unless you reload after saving.
-     ;; I also like to save with no edit summary for previewing on my local mw instance
-     (defun mediawiki-save-reload ()
-       (interactive)
-       (and (mediawiki-save "") (mediawiki-reload)))))
 ;;; modes with little configuration needed
-;; busted:
-;;(require 'csv-mode)
-;;(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode))
 
-;; disabled temporarily
+(setq outline-minor-mode-prefix "\ 3\ 1"
+      css-indent-offset 2
+      ;; auto indent shell script comments
+      sh-indent-comment t
+      sh-here-document-word "'EOF'"
+      tramp-default-method "ssh"
+      ;; ediff-buffers is the main command to use
+      ;; don't start another frame for the control panel
+      ;; unfortunately, this doesn't allow me to use 2 frames for the diff buffers
+      ;; so disable this temporarily with the next line if you want that
+      ;; sometime I should setup 2 functions to explicitly do each type
+      ediff-window-setup-function 'ediff-setup-windows-plain
+      ;;(setq ediff-window-setup-function 'ediff-setup-windows-default)
+      ;; do side by side diffs
+      ediff-split-window-function 'split-window-horizontally
+      ;; ediff things I tried which didn't work, which intuitively I think should
+      ;; work better: I can open the second diff buffer in a new frame, and
+      ;; close it's window in the first frame after starting ediff, but when I
+      ;; hit n to go to the next diff, it restores the window in the first
+      ;; frame. Another thing I tried is to open 2 new frames and set them up
+      ;; as I want. However, if I try to open the *Ediff Control Panel* buffer
+      ;; in a different window from its original one, my mouse jumps to one of
+      ;; the diff frames, or if that isn't visible, the buffer just hangs
+      ;; until I select the original ediff control panel window. This seems
+      ;; like a bug to me. I am using a very recent development version of
+      ;; emacs.
+
+      )
+
+;; disabled temporarily. todo, look into it
 ;;(add-hook 'outline-minor-mode-hook 'outshine-mode)
 
-(setq org-caldav-url "https://cal.iankelling.org"
-      org-caldav-calendar-id "ian"
-      org-caldav-inbox "/p/cal.org")
-;;(org-caldav-sync)
-
-
-;;(require 'dtrt-indent)
-;;(setq dtrt-indent-mode t)
-
-(setq css-indent-offset 2)
 
 (when (file-exists-p "/a/h/iank-mod.el")
   (load-file "/a/h/iank-mod.el"))
@@ -1294,9 +1050,9 @@ and Ian Kelling as the name"
 
 (ws-butler-global-mode)
 
-
-
-(require 'nginx-mode)
+;; disabled because i dont edit nginx files enough
+;; to have this loaded at startup
+;;(use-package nginx-mode)
 ;;The mode should automatically activate for files called nginx.conf and files under /etc/nginx - if not, you can add something like this to your init file:
 ;;(add-to-list 'auto-mode-alist '("/etc/nginx/sites-available/.*" . nginx-mode))
 
@@ -1316,111 +1072,28 @@ and Ian Kelling as the name"
   (setq-local prev-auto-revert-max (point-max)))
 
 
-;; gnu global
-(add-hook 'c-mode-common-hook
-          (lambda () (ggtags-mode 1)
-            (setq c-label-minimum-indentation 0)))
-
-(defun my-ggtags-init()
-  ;; specific to my unusual keybind setup, you may want to
-  ;; pick different keys
-  (define-key ggtags-mode-map (kbd "C-M-o") 'ggtags-find-tag-dwim)
-  (define-key ggtags-mode-map (kbd "C-M-m") 'ggtags-grep))
-(eval-after-load "ggtags" '(my-ggtags-init))
-
-
-(defun gtags-update-single(filename)
-  "Update Gtags database for changes in a single file"
-  (interactive)
-  (start-process "update-gtags" "update-gtags" "bash" "-c" (concat "cd " ggtags-project-root " ; gtags --single-update " filename )))
-
-(defun gtags-update-current-file()
-  (interactive)
-  (let ((rel-filename (replace-regexp-in-string
-                       ggtags-project-root "."
-                       (buffer-file-name (current-buffer)))))
-    (gtags-update-single rel-filename)))
-
-(defun gtags-update-hook()
-  "Update GTAGS file incrementally upon saving a file"
-  (when (and (boundp 'ggtags-mode) ggtags-mode ggtags-project-root)
-    (gtags-update-current-file)))
-
-(add-hook 'after-save-hook 'gtags-update-hook)
-
-;; i'd like to make some elisp which modifies a keymap to remove
-;; all binds which don't match a predicate.
-;; I tried setting a keymap to a new keymap,
-;; but that didn't register as functional.
-;; so I'd need to modify the list in place.
-
-;; colorize hex colors: use rainbow mode
-
-
-;; message mode prompted me on first message.
-;; a function which describes options then sets this
-;; the other options were to use smtp directly or pass to another mail client
-;; here we use the standard sendmail interface, which I use postfix for
-(setq send-mail-function (quote sendmail-send-it))
-
-(global-set-key (kbd "C-M-w") 'spray-mode)
-;; remember, h/l = move. f/s = faster/slower, space = pause, all others quit
-
 ;; delete active selection with self-insert commands
 (delete-selection-mode t)
 
 ;; Transparently open compressed files
 (auto-compression-mode t)
 
-;; Highlight matching parenthesesq when the pointq is on them.
-;; not needed since smart paren mode?
-;;  (show-paren-mode 1)
-
-
-;; not documented, but looking at the source, I find this
-;; stops me from being asked what command on every C-c-c
-;; when doing a latex document.
-(setq TeX-command-force "LaTeX")
-
 ;; dot mode, repeats last action
 (require 'dot-mode)
 (add-hook 'find-file-hooks 'dot-mode-on)
 
-
 ;; clean up obsolete buffers automatically at midnight
 (require 'midnight)
 
-
-;; disabled because it takes 400ms on startup
-;; ;; emacs regexes are too limited.
-;; (require 'foreign-regexp)
-;; ;; perl is most powerful, but javascript is pretty close and
-;; ;; I'd rather know javascript stuff than perl
-;; (custom-set-variables
-;;  '(foreign-regexp/regexp-type 'javascript) ;; Choose by your preference.
-;;  '(reb-re-syntax 'foreign-regexp)) ;; Tell re-builder to use foreign regexp.
-;; ;; it would be nice to add documentation to do this for more commands to that package
-;; ;; disabled because it's too slow. but I'd still m-x it for advanced replacements
-;; ;;(define-key global-map [remap isearch-forward-regexp] 'foreign-regexp/isearch-forward)
-
-
 ;; saner regex syntax
 (require 're-builder)
 (setq reb-re-syntax 'string)
 
 
-;; use shift + arrow keys to switch between visible buffers
-;; todo, set these keys to something else
-;; (require 'windmove)
-;; (windmove-default-keybindings)
-
-
 ;; show the name of the current function definition in the modeline
-;;(require 'which-func)
 (setq which-func-modes t)
 (which-function-mode 1)
 
-
 ;; enable winner-mode to manage window configurations
 (winner-mode +1)
 
@@ -1450,10 +1123,6 @@ and Ian Kelling as the name"
 ;;(add-hook 'text-mode-hook 'turn-on-auto-fill)
 (add-hook 'text-mode-hook 'turn-on-flyspell)
 
-
-;; auto indent shell script comments
-(setq sh-indent-comment t)
-
 ;; random extra highlights
 (require 'volatile-highlights)
 (volatile-highlights-mode t)
@@ -1473,11 +1142,22 @@ and Ian Kelling as the name"
 (add-hook 'info-mode-hook 'my-info-init)
 
 
-(setq sh-here-document-word "'EOF'")
-
-(setq tramp-default-method "ssh")
 ;;; misc general settings
 
+
+;; I tried to look for a function that would set this that is
+;; not part of the emacs interactive customize stuff, but didn't see one
+;; in the faces documentation.
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(header-line ((t (:background "default" :foreground "default" :overline nil :underline nil))))
+ '(region ((t nil))))
+
+
 ;; from tramp manual, use the same ssh controlmaster. I was having problems with
 ;; tramp prompting me for a username and pass.
 (customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
@@ -1488,7 +1168,17 @@ and Ian Kelling as the name"
  mode-require-final-newline t
  require-final-newline t
  auto-revert-verbose nil
- auto-revert-remote-files t)
+ auto-revert-remote-files t
+ ;; save bookmarks whenever they are changed instead of just when emacs quits
+ bookmark-save-flag 1
+ ;; increase bookmark context size for better functionality
+ bookmark-search-size 2000
+ ;; https://www.emacswiki.org/emacs/FillParagraph
+ ;; make list items start paragraphs.
+ paragraph-start "\f\\|[ \t]*$\\|[ \t]*[-+*] "
+ sh-basic-offset 2
+ vc-follow-symlinks t
+ )
 
 (ivy-mode 1)
 (add-hook 'text-mode-hook (lambda () (auto-fill-mode t)))
@@ -1498,18 +1188,6 @@ and Ian Kelling as the name"
   ;; easier to read with just spaces as separator
   (quote (setf (nth 2 ido-decorations) "   ")))
 
-
-;; https://www.emacswiki.org/emacs/FillParagraph
-;; make list items start paragraphs.
-(setq paragraph-start "\f\\|[ \t]*$\\|[ \t]*[-+*] ")
-
-(setq sh-basic-offset 2)
-(setq vc-follow-symlinks t)
-
-;; give us a shell to start instead of scratch
-;;(setq initial-buffer-choice (lambda () (new-shell)))
-
-
 ;; Seed the random-number generator
 (random t)
 
@@ -1590,7 +1268,7 @@ and Ian Kelling as the name"
 ;; todo sometime, make it work for certain modes only
 (smooth-scroll-mode t)
 ;; its too slow with the default of 2
-(setq smooth-scroll/vscroll-step-size 7)
+(setq smooth-scroll/vscroll-step-size 6)
 ;; sublimity doesn't work as good going fast by default
 ;; smooth-scrolling.el, does not do smooth scrolling. its about cursor location
 
@@ -1756,10 +1434,10 @@ Go to the next directory based on where the cursor is."
 ;; make window title be the buffer name
 (setq frame-title-format "%b")
 
-                                        ; -----------------------------
-                                        ; fixing up the mode line
-                                        ; modified from mastering emacs blog
-                                        ; ----------------------------
+;; -----------------------------
+;; fixing up the mode line
+;; modified from mastering emacs blog
+;; ----------------------------
 
 (defvar mode-line-cleaner-alist
   `((auto-complete-mode . "")
@@ -1805,8 +1483,8 @@ Go to the next directory based on where the cursor is."
                                         ;  (add-hook 'after-change-major-mode-hook 'clean-mode-line)
 
 
-  ;;; alias the new `flymake-report-status-slim' to
-  ;;; `flymake-report-status'
+;; alias the new `flymake-report-status-slim' to
+;; `flymake-report-status'
 (defalias 'flymake-report-status 'flymake-report-status-slim)
 (defun flymake-report-status-slim (e-w &optional status)
   "Show \"slim\" flymake status in mode line."
@@ -1843,14 +1521,6 @@ Go to the next directory based on where the cursor is."
          (y (cdr pos)))
     (set-mouse-position (selected-frame) x y)))
 
-;;;; keybinds for wow mouse
-
-(global-set-key (kbd "<mouse-6>") 'move-mouse-to-point)
-(global-set-key (kbd "<kp-left>") 'indent-region)
-(global-set-key (kbd "<kp-begin>") 'mark-defun)
-(global-set-key (kbd "<kp-right>") 'ibuffer)
-(global-set-key (kbd "<kp-prior>") 'delete-horizontal-space)
-
 ;;; org mode
 
 ;; todo work on org-cycle-emulate-tab
@@ -1905,12 +1575,8 @@ Go to the next directory based on where the cursor is."
       org-completion-use-ido t
       org-catch-invisible-edits 'smart)
 
-;; non universally recommended settings
 (setq
  org-default-notes-file "/a/t.org"
- org-agenda-files (quote ("/a/t.org"))
- org-mobile-directory "/p/org-mobile"
- org-mobile-inbox-for-pull "/p/from-mobile.org"
  org-directory "/p")
 
 ;; modeilne populated from (org-clock-get-clocked-time)
@@ -1921,15 +1587,12 @@ Go to the next directory based on where the cursor is."
 (eval-after-load "org"
   '(org-clock-persistence-insinuate))
 
-
 (defun time-to-org-day (time)
   (round (time-to-number-of-days
           (time-subtract time (list 0 (* 3600 org-extend-today-until) 0)))))
 
-
 (defun my-org-confirm-babel-evaluate (lang body)
   (not (or (string= (buffer-file-name) "/a/t.org")
-           (string= (buffer-file-name) "/home/iank/.emacs.d/my-init.org")
            )))
 (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
 
@@ -1939,22 +1602,6 @@ Go to the next directory based on where the cursor is."
   ;; '(4) is the argument passed by universal prefix
   (org-time-stamp (if arg arg '(4)) t))
 
-(defun ian-org-work-time ()
-  (interactive)
-  (save-excursion
-    (set-buffer "t.org")
-    (goto-char (org-find-entry-with-id "ian-identifier-1"))
-    (org-clock-in)))
-
-(defun ian-org-idle-time ()
-  (interactive)
-  (save-excursion
-    (goto-char (org-find-entry-with-id "ian-identifier-2"))
-    (set-buffer "t.org")
-    (org-clock-in)))
-
-
-
 ;; based on http://stackoverflow.com/questions/3758139/variable-pitch-for-org-mode-fixed-pitch-for-tables
 ;; keywords: proportional font, monospace
 
@@ -2022,7 +1669,8 @@ Go to the next directory based on where the cursor is."
   ;; this says do autofilling using newcomment.el. The "only" is a misnomer.
   (set (make-local-variable 'comment-auto-fill-only-comments) t)
   (column-number-mode t)
-  (turn-on-smartparens-mode)
+  ;; trying without
+  ;; (turn-on-smartparens-mode)
 
   ;; prettify lambdas
   (font-lock-add-keywords
@@ -2036,7 +1684,6 @@ Go to the next directory based on where the cursor is."
 (add-hook 'prog-mode-hook 'flyspell-prog-mode)
 
 
-
 ;;; yank auto-indent
 ;; automatically indenting yanked text if in programming-modes
 (defvar yank-indent-modes
@@ -2122,62 +1769,13 @@ indent yanked text (with prefix arg don't indent)."
     (shell)))
 
 (add-hook 'shell-mode-hook 'track-shell-directory/procfs)
-;;; smartparens
-;; the melpa git version had a catastrophic bug I reported.
-;; downgraded to marmalade version and everything is working fine.
-(require 'smartparens-config)
-(show-smartparens-global-mode t)
-
-
-(defun gp/sp/pair-on-newline-and-indent (id action context)
-  "Open a new brace or bracket expression, with relevant newlines and indent. "
-  (save-excursion
-    (newline)
-    (indent-according-to-mode))
-  (indent-according-to-mode))
-
-;; when opening a pair, and then inserting a newline, push the closing pair to another newline
-(sp-pair "{" nil :post-handlers
-         '(:add ((lambda (id action context)
-                   (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
-(sp-pair "[" nil :post-handlers
-         '(:add ((lambda (id action context)
-                   (gp/sp/pair-on-newline-and-indent id action context)) (kbd "RET"))))
-
-
-;; in my version, this is not a pairing.
-;; not sure if it is in a future version since I reverted to marmalade
-;; Don't need c-comments in strings -- they frustrate filename globs
-;; (sp-pair "/*" nil :unless '(sp-in-string-p))
-
-;; Don't need quotes to pair next to words
-(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
-(sp-pair "'" nil :unless '(sp-point-before-word-p sp-point-after-word-p))
-
-
-;; todo, testout these mode specific settings from graphene.
-;; Ruby-specific pairs and handlers
-
-(eval-after-load "ruby"
-  '(require 'smartparens-ruby))
-
-;; Markdown
-(sp-local-pair '(markdown-mode gfm-mode) "*" "*"
-               :unless '(sp-in-string-p)
-               :actions '(insert wrap))
-
-;; Except in HTML
-(sp-local-pair 'html-mode "\"" nil :unless '(:rem sp-point-after-word-p))
-
-
-
-
 ;;; spell correction
 (setq
  ispell-program-name "hunspell"
  ispell-silently-savep t) ; don't prompt to save personal dictionary
 
-(require 'rw-hunspell)
+(use-package rw-hunspell
+  :defer t)
 ;; rw-hunspell sets up hunspell dictionary automagically.
 
 
@@ -2192,25 +1790,24 @@ indent yanked text (with prefix arg don't indent)."
 
 ;;; tex
 (setq-default TeX-PDF-mode t) ; use pdf
-
-                                        ; more sensible defaults based on info manual quickstart
-(setq TeX-auto-save t)
-(setq TeX-parse-self t)
-
-
+;; more sensible defaults based on info manual quickstart
+(setq TeX-auto-save t
+      TeX-parse-self t
+      ;; not documented, but looking at the source, I find this
+      ;; stops me from being asked what command on every C-c-c
+      ;; when doing a latex document.
+      TeX-command-force "LaTeX"
+      )
 
 ;;; visible mark mode
 
 ;; since it is not easy to change the mark overlay priority, I change this one.
 (setq show-paren-priority 999)
 
-
 (defface visible-mark-active
   '((((type tty) (class mono)))
     (t (:background "magenta"))) "")
 
-
-
 (defface mouse-cursor-face
   '((((type tty) (class mono)))
     (t (:background "DeepPink1"))) "")
@@ -2218,15 +1815,14 @@ indent yanked text (with prefix arg don't indent)."
 
 (require 'visible-mark)
 
-(setq visible-mark-faces '(visible-mark-face1 visible-mark-face2))
-(setq visible-mark-forward-faces '(visible-mark-forward-face1))
-
-
-                                        ; highlight the last 2 marks
-(setq visible-mark-max 2)
-                                        ; highlight 1 forward mark
-(setq visible-mark-forward-max 1)
-                                        ; globally activate visible-mark-mode
+(setq
+ visible-mark-faces '(visible-mark-face1 visible-mark-face2)
+ visible-mark-forward-faces '(visible-mark-forward-face1)
+ ;; highlight the last 2 marks
+ visible-mark-max 2
+ ;; highlight 1 forward mark
+ visible-mark-forward-max 1)
+;; globally activate visible-mark-mode
 (global-visible-mark-mode +1)
 
 
@@ -2234,10 +1830,7 @@ indent yanked text (with prefix arg don't indent)."
 ;; if I could define overlay faces to use inverse foreground color
 
 
-;;; znc
-
-
-(setq erc-fill-prefix "")
+;;; znc/erc
 (defun chirp()
   (interactive)
   (setq vol 50)
@@ -2260,27 +1853,27 @@ indent yanked text (with prefix arg don't indent)."
      ;; We must return nil. See help for `erc-server-PRIVMSG-functions'
      nil)))
 
-(add-hook 'erc-server-PRIVMSG-functions
-          'erc-my-privmsg-sound)
-
 (defun erc-sound-if-not-server (match-type nickuserhost msg)
   (unless (string-match "Server:[0-9]+" nickuserhost)
     (chirp)))
-(add-hook 'erc-text-matched-hook 'erc-sound-if-not-server)
-
-(eval-after-load "erc"
-  '(erc-track-mode 1))
-(setq
- ;; consider invisible frames to be unseen. seems like an obvious default
- erc-track-visibility 'visible
- ;; switch to buffer where i've been mentioned, etc instead of oldest
- erc-track-switch-direction 'importance
- ;; defaults minus fill. todo: modify the list instead of specifying it explicitly in case the defaults change
- erc-modules
- '(autojoin button completion irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track)
- )
-
 
+(use-package erc
+  :defer t
+  :init
+  (setq erc-fill-prefix ""
+        ;; consider invisible frames to be unseen. seems like an obvious default
+        erc-track-visibility 'visible
+        ;; switch to buffer where i've been mentioned, etc instead of oldest
+        erc-track-switch-direction 'importance
+        ;; defaults minus fill. todo: modify the list instead of specifying it explicitly in case the defaults change
+        erc-modules
+        '(autojoin button completion irccontrols list match menu move-to-prompt netsplit networks noncommands readonly ring stamp track)
+        ) ; end setq
+  :config
+  (add-hook 'erc-server-PRIVMSG-functions
+            'erc-my-privmsg-sound)
+  (add-hook 'erc-text-matched-hook 'erc-sound-if-not-server)
+  (erc-track-mode 1))
 ;;; named commands
 (defun rm-file-and-buffer ()
   "Removes file connected to current buffer and kills buffer."
@@ -2322,19 +1915,22 @@ indent yanked text (with prefix arg don't indent)."
 
 ;; note, this has weird errors when it was before recentf-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)
+(use-package undo-tree
+  :config
+  ;; more resilient undo-tree-history if we have its location set up front.
+  (setq undo-tree-history-directory-alist '(("." . "~/.undo-tree-history"))
+        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
+        undo-tree-enable-undo-in-region nil)
+  ;; disabled due to bug, something like unknown entry in undo tree canary
+  ;; (setq undo-tree-auto-save-history t)
+
+  ;; todo, send patch undo-tree-visualize should scroll with the scroll key, instead of just pgup pgdn (aka next/prior)
+  (global-undo-tree-mode)
+  ;; simple way to fix that enable undo-tree starts out disabled in org-mode
+  (defun undo-tree-overridden-undo-bindings-p() nil))
 
 ;;; keybinds
 
@@ -2343,8 +1939,6 @@ indent yanked text (with prefix arg don't indent)."
 (define-prefix-command 'terminal-key-map)
 (global-set-key (kbd "\e[") 'terminal-key-map)
 
-
-
 (global-set-key (kbd "C-x C-b") 'ibuffer)
 
 
@@ -2378,14 +1972,12 @@ indent yanked text (with prefix arg don't indent)."
 ;;;; single/special keys
 ;;;;; tab - isearch
 ;; todo: this doesnt work. needs <tab>, which doesnt work in terminal. fix that.
-;; (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace)
-(define-key isearch-mode-map (kbd "M-f") 'isearch-query-replace)
+(define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace)
 
 ;;;;; f12 - isearch-forward
 ;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs
 (global-set-key (kbd "<kp-add>") 'isearch-forward)
 (global-set-key (kbd "<f12>") 'isearch-forward)
-(define-key isearch-mode-map "\t" nil)
 (define-key isearch-mode-map (kbd "<kp-add>") 'isearch-repeat-forward)
 (define-key isearch-mode-map (kbd "<f12>") 'isearch-repeat-forward)
 ;; get rid of the standard completion binding, always use auto-complete
@@ -2637,8 +2229,8 @@ modes like org-mode which have their own yank function."
 (add-hook 'org-mode-hook
           (lambda ()
             (define-key org-mode-map (kbd "<S-right>") nil)))
-;;;;; esc
-                                        ; todo, test out if this can be used
+;;;;; esc --- terminal dup
+;; todo, test out if this can be used
 ;;;;; return - new line
 
 ;; todo, this doesn't set the keybind for the help minibuffer
@@ -2769,10 +2361,7 @@ modes like org-mode which have their own yank function."
 (add-hook 'comint-mode-hook
           (lambda () (define-key comint-mode-map (kbd "C-q") 'comint-insert-previous-argument)))
 
-;;;;; M-q org-archive-to-archive-sibling
-
-(global-set-key (kbd "M-q") 'org-archive-to-archive-sibling)
-
+;;;;; M-q ?? unused
 ;;;;; C-M-q quoted-insert
 
 (global-set-key (kbd "C-M-q") 'quoted-insert)
@@ -2812,9 +2401,7 @@ modes like org-mode which have their own yank function."
 
 (global-set-key (kbd "C-e") 'copy-line)
 
-;;;;; M-e org-clock-in-last
-
-(global-set-key (kbd "M-e") 'org-clock-in-last)
+;;;;; M-e ?? unused
 
 ;;;;; C-r isearch-backward
 
@@ -2823,10 +2410,7 @@ modes like org-mode which have their own yank function."
           (lambda ()
             (define-key comint-mode-map (kbd "C-r") 'comint-history-isearch-backward-regexp)))
 
-;;;;; M-r org-clock-out
-
-(global-set-key (kbd "M-r") 'org-clock-out)
-
+;;;;; M-r ?? unused
 ;;;;; C-a copy buffer
 
 (defun copy-all ()
@@ -2836,31 +2420,31 @@ modes like org-mode which have their own yank function."
 (global-set-key (kbd "C-a") 'copy-all)
 
 ;;;;; C-s - c-x prefix
-                                        ; prefix key binds.
-                                        ; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
-                                        ; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
-                                        ; so you have to dig into their key maps and redo things.
-                                        ; There are 2 simpler alternatives which have their own downsides.
-                                        ; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
-                                        ; The other is keyboard-translate, which translates the key presses before anything else.
-                                        ; The downside is that it translates them when you aren't using them as a prefix.
-                                        ; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
-
-                                        ; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
-                                        ; (define-key key-translation-map [f12] "\C-c")
-                                        ; (define-key key-translation-map "\C-c" [left])
-
-
-                                        ;idea to remove the hook later since it is only needed at startup.
-                                        ; did not work however, and there is not a real need to fix it, so I did not investigate
-                                        ;(defun removeSwapHook ()
-                                        ;  (remove-hook 'buffer-list-update-hook 'myKeySwap)
-                                        ;  (remove-hook 'change-major-mode-hook 'removeSwapHook))
-                                        ;(add-hook 'change-major-mode-hook 'removeSwapHook)
-
-
-                                        ; went through almost all the relevant standard hooks,
-                                        ; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
+;; prefix key binds.
+;; good info http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
+;; rebinding the prefix keys are tricky. apparently, some modes ignore any redefinition of a prefix key and use it explicitly,
+;; so you have to dig into their key maps and redo things.
+;; There are 2 simpler alternatives which have their own downsides.
+;; One is cua mode, which I do not like because it smashes 2 keybinds onto 1 and limits what you can do.
+;; The other is keyboard-translate, which translates the key presses before anything else.
+;; The downside is that it translates them when you aren't using them as a prefix.
+;; Since the swaps I'm using are all very accessible, the only downside is some mental jugling when reading docs etc about these keybinds.
+
+;; I've seen this as an another suggestion, it was a total fail. The prefix command took over both keys.
+;; (define-key key-translation-map [f12] "\C-c")
+;; (define-key key-translation-map "\C-c" [left])
+
+
+;;idea to remove the hook later since it is only needed at startup.
+;; did not work however, and there is not a real need to fix it, so I did not investigate
+;;(defun removeSwapHook ()
+;;  (remove-hook 'buffer-list-update-hook 'myKeySwap)
+;;  (remove-hook 'change-major-mode-hook 'removeSwapHook))
+;;(add-hook 'change-major-mode-hook 'removeSwapHook)
+
+
+;; went through almost all the relevant standard hooks,
+;; this overcomes a known bug that (keyboard-translate) does not get applied when running emacs daemon
 (add-hook 'buffer-list-update-hook (lambda () (interactive)
                                      (keyboard-translate ?\C-x ?\C-s)
                                      (keyboard-translate ?\C-s ?\C-x)
@@ -2869,16 +2453,16 @@ modes like org-mode which have their own yank function."
 
 
 
-                                        ; these all don't work
-                                        ; don't know why this doesn't error but reversing the keys does
-                                        ;(keyboard-translate ?\t ?\M-\t)
-                                        ;(keyboard-translate [M-tab] [tab])
-                                        ; from what i can tell, it wants to use a keyboard-translate-table,
-                                        ; which is a char table, which is a vector indexed by chars,
-                                        ; and mod+tab is not a char (it has too many bits), it is an integer
-                                        ; it actually says it can hold vectors or strings, but that it is obsolete to do so
-                                        ;(characterp ?\M-a)
-                                        ;(characterp ?\C-a)
+;; these all don't work
+;; don't know why this doesn't error but reversing the keys does
+;;(keyboard-translate ?\t ?\M-\t)
+;;(keyboard-translate [M-tab] [tab])
+;; from what i can tell, it wants to use a keyboard-translate-table,
+;; which is a char table, which is a vector indexed by chars,
+;; and mod+tab is not a char (it has too many bits), it is an integer
+;; it actually says it can hold vectors or strings, but that it is obsolete to do so
+;;(characterp ?\M-a)
+;;(characterp ?\C-a)
 
 ;;;;; C-M-s - split-window-vertically
 
@@ -3010,7 +2594,6 @@ modes like org-mode which have their own yank function."
 
 ;;;;; M-c - delete-other-windows
 
-;; todo, consider binding/using org-capture
 (define-key global-map "\M-c" 'delete-other-windows)
 
 ;;;;; C-M-c - copy-to-register
@@ -3641,4 +3224,5 @@ modes like org-mode which have their own yank function."
 
 ;; Local Variables:
 ;; eval: (outline-minor-mode)
+;; outline-regexp: "\\( *\\);;;\\{1,8\\} "
 ;; End: