misc minor fixes
[dot-emacs] / my-init.org
index 65808dab5112fb9db39fa54bfc6d69d1ae1f0638..35c03baa5581b390d29b3b18110e1cf38ffb4b04 100644 (file)
@@ -1,4 +1,4 @@
-#+TITLE: My Personal Init Customization
+#+title: My Personal Init Customization
 #+OPTIONS: toc:nil num:nil ^:nil
 * copyright
 # Copyright (C) 2017 Ian Kelling
@@ -19,8 +19,7 @@
 * things that should be at the beginning
 #+begin_src emacs-lisp
 ;; todo, evaluating this manually disables debug on error instead of toggling it
-;(toggle-debug-on-error) ;uncomment to help debug and catch errors
-
+;;(toggle-debug-on-error) ;uncomment to help debug and catch errors
 
 #+end_src
 
@@ -76,19 +75,14 @@ alternate keyboards
 ;; little kit to help remove a down server
 ;; (setq package-archives nil)
 
-(add-to-list 'package-archives
-             '("marmalade" .
-               "http://marmalade-repo.org/packages/"))
+;;(add-to-list 'package-archives
+;;             '("marmalade" .
+;;               "http://marmalade-repo.org/packages/"))
 
 (add-to-list 'package-archives
              '("melpa" . "http://melpa.milkbox.net/packages/") t)
 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
 
-;; if this is a new machine/config, get package list
-;; not sure why we need it, but it is recommended in starter kit,
-;; and doesn't seem like a bad thing
-(unless package-archive-contents (package-refresh-contents))
-
   #+end_src
 
 
@@ -160,7 +154,11 @@ find a recently dated file in ~/.emacs.d/auto-save-list/, and see the files list
 If it is different, emacs will give a message about recovering it when you open it.
 
 
-
+* TODO try out which key mode
+* TODO make installed emacs package declarative
+* TODO see if there are more cool functions in sh-script
+like sh-cd-here, and bind that to a key
+* TODO assign a key to append-next-kill
 * TODO keybinds to remember
 
 keys worth memorizing
@@ -200,7 +198,11 @@ forward/backward word
 C-M-d
 swap buffers across windows
 
+shell-cd-to-file
+M-2
 
+* TODO add simpler keybind for make-frame-command
+current one is C-x 5 2.
 
 * TODO learn some more ivy mode stuff
 * TODO declarative package installations,
@@ -210,6 +212,9 @@ with documentation.
 causes emacs to freeze until I kill -9 it.
 * TODO make a keybind to print var under cursor
 and actually, putting the start of it in th emodeline might be cool
+* TODO make recent files save periodically,
+normally it just saves on exit, but half the time I don't exit cleanly
+so they don't get saved, because I leave emacs running until it crashes
 * TODO fix undo tree outside visible buffer bug
 * TODO c-<delete> in shell mode should send over
 previous line if current line is empty
@@ -461,7 +466,6 @@ if all else fails, edit the abbrev file
 * auto-complete readline-complete
 #+begin_src emacs-lisp
 
-(add-to-list 'load-path "~/.emacs.d/src/readline-complete")
 (require 'readline-complete)
 ;; not sure how I made these, but I deleted, and
 ;; it would be nice to make them again sometime
@@ -478,7 +482,7 @@ if all else fails, edit the abbrev file
 (setq explicit-shell-file-name "bash")
 
 ;; readline-complete says to add this line.
-;; however, it messes up my procfs directory tracking hook
+;; however, it  up my procfs directory tracking hook
 ;; because get-process doesn't notice the child shell.
 ;; instead, I've removed export EMACS=t from
 ;;  comint-exec-1 (the function which initially sets it)
@@ -567,32 +571,50 @@ I need this function here, where INSIDE_EMACS is replaced with RLC_INSIDE_EMACS.
 ;; main hook for my auto save
 (add-hook 'auto-save-hook 'my-auto-save)
 ;; additional hook to try to deal with emacs not auto-saving when a buffer isn't active
-(add-hook 'window-configuration-change-hook 'my-auto-save)
+(add-hook 'window-configuration-change-hook 'my-auto-save-win)
+
+;; this function from mu4e really does not like buffer saving
+(advice-add 'message-send-and-exit :before 'my-as-off)
+(advice-add 'message-send-and-exit :after 'my-as-on)
 
-(defun my-auto-save ()
+;; avoid window config hook saving too much, it can
+;; get into loops in some random situations
+(setq my-auto-save-last nil)
+(defun my-auto-save-win ()
+  (unless (eq (current-buffer) my-auto-save-last)
+  (my-auto-save (current-buffer))))
+
+(defun my-auto-save (&optional last)
   (when (and
          my-as
          (buffer-file-name)
+         ;; mu4e has a bug right now, undo breaks when saving drafts
+         (not (string= (buffer-file-name) "*draft*"))
          (buffer-modified-p)
          (not (org-src-edit-buffer-p)))
+         ;; serial is incremented on each save, so let's do a bit less of them
+         (not (derived-mode-p 'dns-mode))
+    (setq my-auto-save-last last)
     (let (message-log-max)
       ;; a bit of a hack to partially suppress the constant saving in the echo area
       (with-temp-message ""
         (basic-save-buffer)))))
 
-(defun my-as-off ()
+;; in the message-send-and-exit advice, got an error because it passed an arg.
+;; didn't look into why, just add ignored args.
+(defun my-as-off (&rest ignore)
   (interactive)
   (setq my-as nil))
 
-(defun my-as-off-local ()
+(defun my-as-off-local (&rest ignore)
   (interactive)
   (setq-local my-as nil))
 
-(defun my-as-on ()
+(defun my-as-on (&rest ignore)
   (interactive)
   (setq my-as t))
 
-(defun my-as-on-local ()
+(defun my-as-on-local (&rest ignore)
   (interactive)
   (setq-local my-as on))
 
@@ -714,8 +736,7 @@ seems they are created
 
 ;; recommended by gnus,
 ;; but seems like it could be good to have set for other stuff
-(setq user-full-name "Ian Kelling"
-      user-mail-address "ian@iankelling.org")
+(setq user-full-name "Ian Kelling")
 ;; general email setting? recommended by mu4e
 (setq message-kill-buffer-on-exit t)
 
@@ -731,8 +752,8 @@ seems they are created
 (add-hook 'bbdb-mode-hook
           (lambda () (define-key bbdb-mode-map (kbd "C-k") nil)))
 
-(add-to-list 'load-path "~/.emacs.d/src/bbdb-csv-import")
 (require 'bbdb-csv-import)
+
         #+end_src
 
 * bookmark settings
@@ -822,13 +843,14 @@ interesting light themes
 ;; theme packages i tried then removed:
 ;; ignored ones that didn't use the new theme engine
 
-;;66 packages (zenburn-theme-2.1, zen-and-art-theme-1.0.1, waher-theme-20130917.7, ujelly-theme-1.0.35, twilight-theme-1.0.0, twilight-bright-theme-20130605.143, twilight-anti-bright-theme-20120713.316, tronesque-theme-1.3, tron-theme-12, toxi-theme-0.1.0, tommyh-theme-1.2, tango-2-theme-1.0.0, sunny-day-theme-20131203.1250, sublime-themes-20140117.323, subatomic-theme-20131011.1048, soothe-theme-0.3.16, soft-morning-theme-20131211.1342, soft-charcoal-theme-20130924.1206, sea-before-storm-theme-0.3, purple-haze-theme-20130929.1751, phoenix-dark-pink-theme-20130905.941, phoenix-dark-mono-theme-20130306.1215, pastels-on-dark-theme-0.3, obsidian-theme-20130920.937, nzenburn-theme-20130513, noctilux-theme-20131019.31, mustang-theme-20130920.939, monokai-theme-0.0.10, molokai-theme-20130828.0, late-night-theme-0.0, jujube-theme-0.1, ir-black-theme-20130302.2355, gruvbox-theme-20131229.1458, gruber-darker-theme-0.6, grandshell-theme-20140118.1003, github-theme-0.0.3, gandalf-theme-0.1, flatland-theme-20131204.858, django-theme-20131022.202, deep-thought-theme-0.1.1, dakrone-theme-20131212.1159, colorsarenice-theme-20131128.1106, color-theme-wombat+-0.0.2, color-theme-wombat-0.0.1, color-theme-twilight-0.1, color-theme-tango-0.0.2, color-theme-solarized-20120301, color-theme-sanityinc-solarized-2.25, color-theme-railscasts-0.0.2, color-theme-monokai-0.0.5, color-theme-molokai-0.1, color-theme-ir-black-1.0.1, color-theme-heroku-1.0.0, color-theme-github-0.0.3, color-theme-eclipse-0.0.2, color-theme-dpaste-0.0.1, color-theme-dawn-night-1.0, color-theme-colorful-obsolescence-0.0.1, color-theme-cobalt-0.0.2, color-theme-20080305.34, clues-theme-20130908.801, busybee-theme-20130920.942, bubbleberry-theme-0.1.2, assemblage-theme-20130715.621, anti-zenburn-theme-20140104.1542, ample-zen-theme-0.2)
+;;66 packages (zenburn-theme-2.1, zen-and-art-theme-1.0.1, waher-theme-20130917.7, ujelly-theme-1.0.35, twilight-theme-1.0.0, twilight-bright-theme-20130605.143, twilight-anti-bright-theme-20120713.316, tronesque-theme-1.3, tron-theme-12, toxi-theme-0.1.0, tommyh-theme-1.2, tango-2-theme-1.0.0, sunny-day-theme-20131203.1250, sublime-themes-20140117.323, subatomic-theme-20131011.1048, soothe-theme-0.3.16, soft-morning-theme-20131211.1342, soft-charcoal-theme-20130924.1206, sea-before-storm-theme-0.3, purple-haze-theme-20130929.1751, phoenix-dark-pink-theme-20130905.941, phoenix-dark-mono-theme-20130306.1215, pastels-on-dark-theme-0.3, obsidian-theme-20130920.937, nzenburn-theme-20130513, noctilux-theme-20131019.31, mustang-theme-20130920.939, monokai-theme-0.0.10, molokai-theme-20130828.0, late-night-theme-0.0, jujube-theme-0.1, ir-black-theme-20130302.2355, gruvbox-theme-20131229.1458, gruber-darker-theme-0.6, grandshell-theme-20140118.1003, github-theme-0.0.3, gandalf-theme-0.1, flatland-theme-20131204.858, django-theme-20131022.202, deep-thought-theme-0.1.1, dakrone-theme-20131212.1159, colorsarenice-theme-20131128.1106, color-theme-wombat+-0.0.2, color-theme-wombat-0.0.1, color-theme-twilight-0.1, color-theme-tango-0.0.2, color-theme-solarized-20120301, color-theme-sanityinc-solarized-2.25, color-theme-railscasts-0.0.2, color-theme-monokai-0.0.5, color-theme-molokai-0.1, color-theme-ir-black-1.0.1, color-theme-heroku-1.0.0, color-theme-github-0.0.3, color-theme-eclipse-0.0.2, color-theme-dpaste-0.0.1, color-theme-dawn-night-1.0, color-theme-colorful-obsolescence-0.0.1, color-theme-cobalt-0.0.2, color-theme-20080305.34, clues-theme-20130908.801, busybee-theme-20130920.942, bubbleberry-theme-0.1.2, mblage-theme-20130715.621, anti-zenburn-theme-20140104.1542, ample-zen-theme-0.2)
 
 
 
 #+end_src
 
 * yasnippet
+
 cd ~/.emacs.d/src
 git clone --recursive https://github.com/capitaomorte/yasnippet
 touch snippets/.yas-make-groups
@@ -915,6 +937,201 @@ Things I tried which didn't work, which intuitively I think should work better:
 (put 'dired-find-alternate-file 'disabled nil)
 #+end_src
 
+* mu4e
+[[info:org#External links]]
+[[info:mu4e#Keybindings]]
+
+alsot tried notmuch, it had some glitches, and it's config
+has a list of folders which i'd rather not publish, so it's config is archived.
+
+#+begin_src emacs-lisp
+;;(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
+;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
+(require 'mu4e)
+
+;; (setq mu4e-headers-results-limit 2000)
+
+(setq
+;; common to gnus. default sendmail-query-once asks us, then sets this via customize.
+send-mail-function (quote sendmail-send-it)
+      ;; use the standard imap folders
+      mu4e-sent-folder   "/Sent"
+      mu4e-drafts-folder "/Drafts"
+      mu4e-trash-folder  "/Trash"
+      ;; reindex new mail this often in seconds
+      ;; show addresses instead of just names
+      mu4e-view-show-addresses t
+      mu4e-use-fancy-chars t
+      mu4e-confirm-quit nil
+      mu4e-headers-leave-behavior 'apply ;; dont ask, do whatever was marked
+      mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields)
+      ;; default 500.
+      mu4e-headers-results-limit 1000
+      ;; tell exim to use from: as envelope from.
+      ;; exim's default is use outgoing_msg_localpart@hostname.
+      mail-specify-envelope-from t
+
+      ;; looking up the list of maildirs when doing jo from summary
+      ;; can take a few seconds if we have a ton of messages.
+      ;; Only take that time for the first lookup.
+      ;; if we add a new maildir, just restart mu4e for it to be in that list.
+      mu4e-cache-maildir-list t
+      ;; default is 8, way too small for my big monitors
+      mu4e-headers-visible-lines 50
+      )
+
+;; fucks up reading unread bookmark. when that is fixed, enable it
+;; (setq mu4e-update-interval 60)
+
+
+;; this file includes setting up my email addresses, which are not public,
+;; including
+;; mu4e-user-mail-address-list
+;; and a function
+;; inspired by mu4e info manual, search for mu4e-compose-pre-hook.
+(load "/p/c/mu4e.el")
+
+(defun my-decrypt ()
+  ;; use for decrypting in mu4e
+  (interactive)
+  (beginning-of-buffer)
+  (when (search-forward "-----BEGIN PGP MESSAGE-----" nil t)
+    (read-only-mode 0)
+    (let ((start (match-beginning 0))
+          (end (search-forward "-----END PGP MESSAGE-----" nil t)))
+      (shell-command-on-region start end "gpg2 -dq" nil t shell-command-default-error-buffer t)
+      )))
+(add-hook 'mu4e-view-mode-hook 'my-decrypt)
+
+(defun mu-set-from-name (regexes)
+  "If we find an address matching regex, then set that address as the to,
+and whatever was used"
+  (when mu4e-compose-parent-message
+    (let ((found nil))
+      (while (and regexes (not found))
+        (setq re (car regexes)
+              regexes (cdr regexes)
+              found (mu4e-message-contact-field-matches
+                     mu4e-compose-parent-message :to re)))
+      (when found (setq user-mail-address (cdr found)
+                        user-full-name (car found)))
+      found)))
+(defun mu-set-from (regexes)
+  "If we find an address matching regex, then set that address as the to,
+and Ian Kelling as the name"
+  (when mu4e-compose-parent-message
+    (let ((found nil))
+      (while (and regexes (not found))
+        (setq re (car regexes)
+              regexes (cdr regexes)
+              found (cdr (mu4e-message-contact-field-matches
+                          mu4e-compose-parent-message :to re))))
+      (when found (setq user-mail-address found
+                        user-full-name "Ian Kelling"))
+      found)))
+
+
+(defun my-mu4e-to-fsf ()
+  "inspired by mu4e info manual, search for mu4e-compose-pre-hook."
+  (cond
+   ((mu-set-from '("iank@fsf.org"
+                   "iank@gnu.org")))
+   ((setq user-mail-address "iank@fsf.org"
+          user-full-name "Ian Kelling"))))
+
+
+;; on first run   mkdir -p /nocow/user/.mufsf; mu index --maildir=/nocow/user/fsfmd
+(defun mu-exit-wait ()
+  (interactive)
+  ;; taken from the mu source
+    (let* ((buf (get-buffer mu4e~proc-name))
+         (proc (and (buffer-live-p buf) (get-buffer-process buf))))
+    (mu4e-quit)
+    ;; without sleep, we get database locked by another process error when hitting u
+    ;; if another mu was running.
+    (if proc (sleep-for 0 1000))))
+
+(defun fsf-mu4e ()
+  (interactive)
+  (unless (equal mu4e-maildir "/nocow/user/fsfmd") (mu-exit-wait))
+  (setq
+   ;; fsf monitor is smaller
+   mu4e-headers-visible-lines 15
+   mu4e-maildir "/nocow/user/fsfmd"
+   mu4e-refile-folder "/Spam"
+   mu4e-index-lazy-check nil
+   mu4e-get-mail-command "true"
+   user-mail-address "iank@fsf.org"
+   mail-signature "
+
+-- 
+Ian Kelling | Senior Systems Administrator, Free Software Foundation
+GPG Key: B125 F60B 7B28 7FF6 A2B7  DF8F 170A F0E2 9542 95DF
+https://fsf.org | https://gnu.org
+"
+
+   mu4e-user-mail-address-list '("iank@fsf.org"
+                                 "iank@gnu.org")
+   mu4e-maildir-shortcuts
+   '( ("/INBOX"     . ?i)
+      ("/sysadmin" . ?a)
+      ("/sec"  . ?x)
+      ("/rtcc"  . ?c)
+      ("/Drafts"     . ?d)
+      ("/Sent"     . ?s)
+      )
+   ) ;; end setq
+  (call-process "/a/exe/lnf" nil nil nil "-T" "/nocow/user/.mufsf" (concat (getenv "HOME") "/.mu"))
+  (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to-fsf)
+  (remove-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
+  (mu4e)) ;; end defun fsf-mu4e
+
+
+;; it's implemented in mu4e, but not in the actions list for
+;; some reason.
+(add-to-list 'mu4e-view-actions
+             '("browser view" . mu4e-action-view-in-browser) t)
+
+;; normally, you would add to this, but we want to
+;; modify unread messages. the first 4 are defined by default.
+(setq mu4e-bookmarks
+      `( ,(make-mu4e-bookmark
+           :name  "Unread messages"
+           ;; old less restrictive unread, for adapting in the future:
+           ;; flag:unread AND NOT flag:trashed AND NOT maildir:/Junk AND NOT maildir:/fwfw AND NOT maildir:/log
+           :query "flag:unread maildir:/INBOX"
+           :key ?u)
+         ,(make-mu4e-bookmark
+           :name "Today's messages"
+           :query "date:today..now"
+           :key ?t)
+         ,(make-mu4e-bookmark
+           :name "Last 7 days"
+           :query "date:7d..now"
+           :key ?w)
+         ,(make-mu4e-bookmark
+           :name "Messages with images"
+           :query "mime:image/*"
+           :key ?p))
+      )
+
+
+(defun mu4e-action-msgs-by-this-sender (msg)
+  "In header view, view messages by the sender of the message under point."
+  (let ((from (mu4e-message-field msg :from)))
+    (unless from
+      (mu4e-error "No from header for this message"))
+    ;; from is structured like: (("Anacron" . "root@x2.lan"))
+    (mu4e-headers-search (concat "f:" (cdar from)))))
+
+(add-to-list 'mu4e-headers-actions
+             '("from this sender" . mu4e-action-msgs-by-this-sender) t)
+(add-to-list 'mu4e-view-actions
+             '("from this sender" . mu4e-action-msgs-by-this-sender) t)
+#+end_src
+
+
+
 * disabled but saved for documentation purposes
 :PROPERTIES:
 :header-args: :tangle no
@@ -1148,55 +1365,6 @@ seems like 1 in 100 times, an invisible command to restore prompt didn't work
 
 
 
-** mu4e
-
-alsot tried notmuch, it had some glitches, and it's config
-has a list of folders which i'd rather not publish, so it's config is archived.
-
-#+begin_src emacs-lisp
-(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu4e")
-(require 'mu4e)
-(setq send-mail-function (quote sendmail-send-it) ;; common to gnus also
-      mu4e-sent-folder   "/Sent Items"
-      mu4e-drafts-folder "/Drafts"
-      mu4e-trash-folder  "/Trash"
-      mu4e-refile-folder "/Archive"
-      mu4e-get-mail-command "offlineimap"
-      mu4e-update-interval 60
-      mu4e-sent-messages-behavior 'delete
-      mu4e-use-fancy-chars t
-      mu4e-confirm-quit nil
-      mu4e-headers-leave-behavior 'apply ;; dont ask
-      mu4e-headers-fields (delq (assoc :mailing-list mu4e-headers-fields) mu4e-headers-fields)
-      ;; a bit faster than the default 500
-      mu4e-headers-results-limit 80)
-
-(define-key mu4e-headers-mode-map (kbd "<return>") 'mu4e-headers-view-message)
-
-(defun my-mu4e-to ()
-  "inspired by mu4e info manual"
-  (--reduce-from (if (mu4e-message-contact-field-matches
-                      mu4e-compose-parent-message :to (cadr it))
-                     (concat (car it) (cadr it))
-                   acc)
-                 '("Ian Kelling <ian@iankelling.org")
-                 ;;'(("Ian Kelling " "<alternate1@example.com>")
-                 ;;  ("Ian Kelling " "<alternate2@example.com>"))
-                   ))
-
-(add-hook 'mu4e-compose-pre-hook 'my-mu4e-to)
-
-(add-to-list 'mu4e-view-actions
-             '("ViewInBrowser" . mu4e-action-view-in-browser) t)
-(setq mu4e-maildir-shortcuts
-      '( ("/INBOX"     . ?i)
-         ("/bog"  . ?b)
-         ("/Drafts"     . ?d)))
-
-#+end_src
-
-
-
 
 ** org-mode auto-complete source
 
@@ -1235,6 +1403,13 @@ this looks nice, but it lags gnus just a bit
 ** misc
 #+begin_src emacs-lisp
 
+;; this makes more ergonomic sense, since our eyes are mostly on the left,
+;; but after using it a while, it's too much cognitive dissonance that
+;; every other program has it on the right
+;;(set-scroll-bar-mode 'left)
+
+
+
 ; todo, is this require things necessary?
 ;    (require 'flyspell)
 
@@ -1420,50 +1595,10 @@ disabled, as I haven't used it in a long time. I think it was good for learning
 good info http://www.emacswiki.org/emacs/GnusTutorial
 good info http://www.emacs.uniyar.ac.ru/doc/em24h/emacs183.htm
 
-searching / accessing old mailing list messages:
-http://wiki.list.org/display/DOC/How+do+I+make+the+archives+searchable
-3 options suggested. nabble is very good, and you can even reply directly from their web interface with your own email
-address.
-google with site:example.com/archive works
-However, it has the downside of relying on a 3rd party running unreleased software.
-mail-archive.com and gmane.org search do not work.
-
-Some lists mirror to a newsgroup via gmane, and then mirror the newsgroup via a google group, which has good search
-ability, and you can post via the newsgroup.
-
-Downsides of nabble/google. Doesn't integrate with normal email programs, and lock in. They store and show you what you
-have and haven't read, what messages you've sent, etc. migrating that data to a normal mail program is undocumented and
- unsupported.
-
-mailmans normal public archives are a bit obfuscated, but there is also a "private" archive, available to subscribers,
-which is not obfuscated, and can be easily imported to your local email program.
-you have to sub and log in to the web interfact to access it, and then the url is unpublished, but follows a format,
-which is documented in a few places around the web like
-https://mail.python.org/pipermail/mailman-users/2005-September/046757.html
-its form is:
-https://lists.fedorahosted.org/mailman/private/hyperkitty-devel.mbox/hyperkitty-devel.mbox
-http://www.example.com/mailman/private/<listname>.mbox/<listname>.mbox
-if you copy the url after logging in, and pass it to this function, it will print the transformed url
-lurl() { local x="${1#*/options/}"; x="${x%%/*}.mbox"; echo "${1%/mailman/*}/mailman/private/$x/$x"; }
-
-Then you can download that url. Actually downloading the url is something firefox doesn't make the easiest out of the box.
- Here are some options:
-- paste in the url bar, the save the page
-as a file after it loads.
-- use downthemall extension or similar and paste the url in it.
-- put it in an html page as
-a link (or a small javascript program which will display input as a link), then right click and save as.
-wget won't work because you need to have (i assume) the authorization cookie mailman gives your browser
-
-people have written various tools to de-obfuscate the normal public archives and sometimes import them to a mail
-program. It seems they were not aware of the private archive. However, these tools are probably still useful to automate
-things. None of them has a lot of usage, so I decided it was not worth the risk of hitting bugs vs doing a few extra clicks.
-
-this was the most interesting one I found within a few minutes of googling.
-https://github.com/wcdolphin/mailman-downloader
-
-Once you have an mbox file, there are rather straightforward ways to get it into any mail program, but I will cover
-gnus, which I use and is a bit tricky.
+
+After downloading mailing list archives, once you have an mbox file,
+there are rather straightforward ways to get it into any mail program,
+but I will cover gnus, which I use and is a bit tricky.
 
 gnus has a native search (limited, too slow for body text searches), and external search engine integration.
 gnus manual recommends converting to maildir for searching local mail, but importing lots of maildir messages to gnus
@@ -1663,7 +1798,6 @@ make all
 
 
 
-(add-to-list 'load-path "~/.emacs.d/src/ghci-completion")
 ;; from the package readme for ghci-completion
 (require 'ghci-completion)
 (add-hook 'inferior-haskell-mode-hook 'turn-on-ghci-completion)
@@ -1675,6 +1809,10 @@ make all
      (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 "\\") "\\)")
@@ -1942,7 +2080,6 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 * mediawiki
 #+begin_src emacs-lisp
 
-(add-to-list 'load-path "~/.emacs.d/src/mediawiki-el")
 (eval-after-load "mediawiki"
   '(progn
     (remove-hook 'outline-minor-mode-hook 'mediawiki-outline-magic-keys)
@@ -1957,6 +2094,22 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 #+end_src
 * modes with little configuration needed
   #+begin_src emacs-lisp
+;; busted:
+  ;;(require 'csv-mode)
+;;(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode))
+
+(require 'outshine)
+(add-hook 'outline-minor-mode-hook 'outshine-hook-function)
+(add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
+(add-hook 'sh-mode-hook 'outline-minor-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)
@@ -1965,9 +2118,20 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 
 (load-file "/a/h/iank-mod.el")
 
-(add-to-list 'load-path "/a/opt/ws-butler")
+;; from when i was running my own patches
+;;(add-to-list 'load-path "/a/opt/ws-butler")
 
 (require 'ws-butler)
+;; todo: I think this is broken, it keeps collapsing the last line
+;; for empty messages.
+
+;; the main problem is when it deletes the blank line at the end
+;; of a message with an empty body. but I might also
+;; be pasting whitespace significant things in here, so
+;; just don't do anything.
+;; todo: propose this upstream
+(add-to-list 'ws-butler-global-exempt-modes 'message-mode)
+
 (ws-butler-global-mode)
 
 
@@ -2040,7 +2204,6 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 ;; here we use the standard sendmail interface, which I use postfix for
 (setq send-mail-function (quote sendmail-send-it))
 
-(add-to-list 'load-path "~/.emacs.d/src/spray")
 (require 'spray)
 (global-set-key (kbd "C-M-w") 'spray-mode)
 ;; remember, h/l = move. f/s = faster/slower, space = pause, all others quit
@@ -2169,7 +2332,11 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 * misc general settings
 
 #+begin_src emacs-lisp
+;; 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
@@ -2198,9 +2365,8 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 ;; this starter kit setting is probably good
 (if window-system (setq frame-title-format '(buffer-file-name "%f" ("%b"))))
 
-(set-terminal-coding-system 'utf-8)
-(set-keyboard-coding-system 'utf-8)
-(prefer-coding-system 'utf-8)
+
+;;(prefer-coding-system 'utf-8-unix)
 
 ;; remove ugly 3d box feature
 (set-face-attribute 'mode-line nil :box nil)
@@ -2247,7 +2413,6 @@ currently makes emacs hang a bunch. dunno why. just using eclipse instead
 (blink-cursor-mode '(-4))
 (menu-bar-mode -1)
 (tool-bar-mode -1)
-(set-scroll-bar-mode 'left)
 
 
 ;; enable various commands
@@ -2313,7 +2478,12 @@ unchecked some stuff so that it inherits from default.
 #+begin_src emacs-lisp
 
 
-
+(defun fill-buffer ()
+  (interactive)
+  (save-mark-and-excursion
+    (beginning-of-buffer)
+    (while (= (forward-line) 0)
+      (fill-paragraph))))
 
 
 (defun next-backup-dir ()
@@ -2391,8 +2561,8 @@ Go to the next directory based on where the cursor is."
 (defun sudo-edit (&optional arg)
   (interactive "P")
   (if (or arg (not buffer-file-name))
-      (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
-    (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
+      (find-file (concat "/sudo::" (ido-read-file-name "File: ")))
+    (find-alternate-file (concat "/sudo::" buffer-file-name))))
 
 
 
@@ -2404,6 +2574,8 @@ Go to the next directory based on where the cursor is."
 
 * mode line
 #+begin_src emacs-lisp
+;; make window title be the buffer name
+(setq frame-title-format "%b")
 
   ; -----------------------------
   ; fixing up the mode line
@@ -2471,12 +2643,12 @@ Go to the next directory based on where the cursor is."
       (force-mode-line-update)))
 
 
-(add-hook 'after-change-major-mode-hook (lambda ()
-
-(setq mode-line-mule-info nil
-mode-line-position nil
-mode-line-modes nil))) ; todo, make only flymake status show up
+(defun my-after-change-major-mode-hook ()
+  (setq mode-line-mule-info nil
+        minor-mode-alist nil
+        mode-line-position nil)) ; todo, make only flymake status show up
 
+(add-hook 'after-change-major-mode-hook 'my-after-change-major-mode-hook)
 #+end_src
 
 * mouse related
@@ -2986,10 +3158,10 @@ clicking on info links
 ;; todo, generally fix org mode keys
 ;; todo, org-mark-element, unbdind from M-h, bind to mark defun key
 
-(org-babel-do-load-languages
- 'org-babel-load-languages
- '((emacs-lisp . t)
-   (sh . t)))
+;(org-babel-do-load-languages
+; 'org-babel-load-languages
+; '((emacs-lisp . t)
+;   (sh . t)))
 
 ;; make shell work like interactive bash shell
 (setq org-babel-default-header-args:sh
@@ -3049,7 +3221,7 @@ clicking on info links
 
 (defun my-org-confirm-babel-evaluate (lang body)
   (not (or (string= (buffer-file-name) "/a/t.org")
-           (string= (buffer-file-name) "/home/ian/.emacs.d/my-init.org")
+           (string= (buffer-file-name) "/home/iank/.emacs.d/my-init.org")
            )))
 (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
 
@@ -3083,6 +3255,10 @@ clicking on info links
 (add-hook 'fundamental-mode-hook 'variable-pitch-on)
 (add-hook 'org-mode-hook 'variable-pitch-on)
 (add-hook 'text-mode-hook 'variable-pitch-on)
+(defun variable-pitch-off ()
+  (variable-pitch-mode 0))
+(add-hook 'yaml-mode-hook 'variable-pitch-off)
+
 
 (set-face-attribute 'org-table nil :family (face-attribute 'fixed-pitch :family))
 (set-face-attribute 'org-code nil :family (face-attribute 'fixed-pitch :family))
@@ -3428,7 +3604,6 @@ these colors were better for dark theme
 
 #+begin_src emacs-lisp
 
-(add-to-list 'load-path "~/.emacs.d/src/visible-mark")
 
     ;; since it is not easy to change the mark overlay priority, I change this one.
     (setq show-paren-priority 999)
@@ -3469,6 +3644,43 @@ these colors were better for dark theme
 : t
 
 
+* zrc
+#+begin_src emacs-lisp
+(require 'znc)
+(setq erc-fill-prefix "")
+(defun chirp()
+  (interactive)
+  (setq vol 50)
+  (when (string= (system-name) "tp") (setq vol 40))
+  (start-process-shell-command "ignoreme" nil (format "mpv --no-terminal --vo=null --volume=%d /a/bin/data/bird.mp3" vol)))
+;; from https://www.emacswiki.org/emacs/ErcSound
+
+(defun erc-my-privmsg-sound (proc parsed)
+  (let* ((tgt (car (erc-response.command-args parsed)))
+         (privp (erc-current-nick-p tgt)))
+    (and
+     privp (chirp)
+                                        ;; 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)
+
+(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)
+
+#+end_src
+
+
 * key binds. keep at end of file
 this should come at the end because it depends on key maps being
 created in earlier sections.
@@ -3580,6 +3792,8 @@ commands to change: select other window: C-x o.
 #+end_src
 
 ** named commands
+*** gdb
+gdb-many-windows
 *** tramp sudo
 /ssh:host|sudo:host:
 when in the same session, you can then do:
@@ -3674,6 +3888,9 @@ to use with up and down.
 #+begin_src emacs-lisp
   (global-set-key (kbd "C-x C-b") 'ibuffer)
 #+end_src
+
+*** C-x r c
+rectangular clear, replace area with whitespace
 ** gnus
 searching overview.
 3 types:
@@ -3736,6 +3953,9 @@ E = expired
 M-& apply process mark to a non-process mark command
 *** S D e]
 edit as new
+*** T k / C-M-k
+maybe rebind this to a shorter keybind, like del
+gnus-summary-kill-thread
 ** message mode
 *** C-ck]
 discard message
@@ -3744,86 +3964,15 @@ discard message
 notmuch advance to next message/thread
 
 ** readline / bash / .inputrc
-*** M-0-9]
-bash digit-argument
-
-removed drill from all these because I'm using emacs for shell now
-*** C-2]
-terminal X paste
-*** C-3]
-terminal open file manager
-*** C-q]
-bash exchange-point-and-mark
-
-*** C-M-q]
-quoted insert
-*** C-w]
-    bash kill-region
-*** C-e]
-    bash yank-last-arg
-*** C-r
-    bash history-search-backward
-*** C-t]
-    shell-expand-line, expand like bash does u hit enter
-*** C-a]
-    bash comment-line
-*** C-s]
-    bash yank-nth-arg
-    yank $1 of last argument, or nth if prefixed with a digit argument
-*** C-d]
-   bash undo
-*** C-f]
-bash menu-complete
-*** C-g]
-   bash edit-and-execute-command
-*** C-z
-*** C-x
-    emacs hard to rebind
-    looks like it actually wouldn't be that hard.
-    possibly take the output from bind -p, make all those keys undefined.
-*** C-c
-    quit/cancel
-*** C-v
-    yank, aka paste
-*** C-M-v
-    yank-pop
-*** C-b]
-   bash menu-complete-backward
-*** tab
-completion
-*** C-tab]
-terminal find
-*** C-left/right]
-   forward/backward-word
-
-*** C-u]
-   bash backward-kill-word
-*** C-i]
-terminal find up
-[ terminal crap, duplicate of tab ]
-*** C-o]
-   bash operate-and-get-next, submit and bring up next item in history
-*** C-p]
-bash dabbrev-expand,
-    complete historical command names
-*** C-h
-    terminal incompatible junk
-*** C-k]
-   bash kill-line, to end of line
-*** C-l]
-   bash clear screen
-*** C-m]
+*** C-m
 [--------]
 #+begin_src emacs-lisp
 (add-hook 'comint-mode-hook
           (lambda ()
             (define-key comint-mode-map "\C-m" nil)))
-
 #+end_src
-*** C-space]
-bash set mark
-*** C-delete]
-   bash delete word
+terminal crap, duplicate of enter
+
 ** isearch
 *** C-w
 paste word/char under cursor into isearch
@@ -3848,9 +3997,11 @@ isearch-occur
   (isearch-toggle-regexp)
   (cond (isearch-regexp
          (global-set-key (kbd "C-r") 'isearch-backward-regexp)
+         (define-key global-map (kbd "<f12>") 'isearch-forward-regexp)
          (define-key global-map (kbd "<kp-add>") 'isearch-forward-regexp))
         (t
          (global-set-key (kbd "C-r") 'isearch-backward)
+         (define-key global-map (kbd "<f12>") 'isearch-forward)
          (define-key global-map (kbd "<kp-add>") 'isearch-forward))))
 (define-key isearch-mode-map (kbd "M-r") 'my-isearch-toggle-regexp)
   #+end_src
@@ -3937,8 +4088,10 @@ isearch-forward
 #+begin_src emacs-lisp
 ;; 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
 ;; this didn't work very well
 ;;(global-set-key (kbd "TAB") 'auto-complete)
@@ -4187,6 +4340,7 @@ modes like org-mode which have their own yank function."
 shell
 #+begin_src emacs-lisp
 (global-set-key (kbd "<S-kp-equal>") 'shell-wrap)
+(global-set-key (kbd "<S-left>") 'shell-wrap)
 #+end_src
 *** s-right arrow
 previous-buffer
@@ -4537,6 +4691,7 @@ dot-mode-execute
 *** C-q
 org-cycle, comint previous arg
 #+begin_src emacs-lisp
+(global-set-key (kbd "C-q") 'outline-cycle)
 (add-hook 'org-mode-hook
           (lambda () (define-key org-mode-map (kbd "C-q") 'org-cycle)))
 (define-key widget-keymap (kbd "C-q") 'widget-forward)
@@ -4636,9 +4791,12 @@ macro end / call
 (global-set-key (kbd "C-M-a") 'kmacro-end-or-call-macro)
 (add-hook 'perl-mode-hook (lambda () (define-key perl-mode-map (kbd "C-M-a") nil)))
 (add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-M-a") nil)))
+(add-hook 'c++-mode-hook
+          (lambda () (define-key c++-mode-map (kbd "C-M-a") nil)))
 (add-hook 'c-mode-hook
           (lambda () (define-key c-mode-map (kbd "C-M-a") nil)))
 
+
 #+end_src
 *** C-S-a
 *** C-s
@@ -4732,7 +4890,7 @@ abort-recursive-edit
 *** C-M-g]
 gnus
 #+begin_src emacs-lisp
-    (global-set-key (kbd "C-M-g") 'gnus)
+    (global-set-key (kbd "C-M-g") 'mu4e)
 #+end_src
 *** C-S-g
 *** C-z
@@ -4748,9 +4906,9 @@ kill-region
     (global-set-key (kbd "C-s") 'kill-region)
 #+end_src
 *** M-x]
-append-next-kill
+smex
 #+begin_src emacs-lisp
-(global-set-key (kbd "M-x") 'append-next-kill)
+(global-set-key (kbd "M-x") 'smex)
 #+end_src
 *** C-M-x]
 cut-to-register
@@ -4912,7 +5070,8 @@ keyboard-yank-primary
   (let ((mouse-yank-at-point t))
     (mouse-yank-primary nil)))
 ;; paste selection
-(global-set-key (kbd "C-)") 'keyboard-yank-primary)
+(global-set-key (kbd "C-)") 'keyboard-yank-primary) ;; kinesis binding
+(global-set-key (kbd "<S-right>") 'keyboard-yank-primary)
 #+end_src
 *** M-right-arrow
 *** C-M-right-arrow
@@ -5205,8 +5364,9 @@ join lines
 #+end_src
 *** M-/
 *** C-M-/]
-copy-variable
+copy-buffer-file-name
 #+begin_src emacs-lisp
+;; haven't bound this atm, todo, maybe someday?
 (defun copy-variable (variable)
   (interactive
    (let ((v (variable-at-point))
@@ -5225,7 +5385,19 @@ copy-variable
      (list (if (equal val "")
               v (intern val)))))
   (kill-new (symbol-value variable)))
-(global-set-key (kbd "C-M-/") 'copy-variable)
+
+(defun copy-buffer-file-name ()
+  (interactive)
+  (let ((name (cond
+               ((derived-mode-p 'mu4e-view-mode) (mu4e-message-field-at-point :path))
+               (t buffer-file-name))
+              ))
+    (kill-new name)
+    (message name)))
+
+
+(global-set-key (kbd "C-M-/") 'copy-buffer-file-name)
+
 
 #+end_src
 *** C-S-/
@@ -5348,14 +5520,15 @@ plain newline
 *** C-space]
 org-edit-special
 #+begin_src emacs-lisp
+;; commented due to new keyboard needing ctrl-space for mark
 ;; (kbd "<C-space>") does not work, (kbd "C-SPC") should work
-(add-hook 'org-mode-hook
-          (lambda ()
-            (define-key org-mode-map (kbd "C-SPC") 'org-edit-special)
-            ;; org-src-mode-map is broken in git version of emacs.
-            ;; temporarily use this for exiting edit-special mode.
-            (global-set-key (kbd "C-M--") 'org-edit-src-exit)
-            (define-key org-src-mode-map (kbd "C-SPC") 'org-edit-src-exit)))
+;; (add-hook 'org-mode-hook
+;;           (lambda ()
+;;             (define-key org-mode-map (kbd "C-SPC") 'org-edit-special)
+;;             ;; org-src-mode-map is broken in git version of emacs.
+;;             ;; temporarily use this for exiting edit-special mode.
+;;             (global-set-key (kbd "C-M--") 'org-edit-src-exit)
+;;             (define-key org-src-mode-map (kbd "C-SPC") 'org-edit-src-exit)))
 #+end_src
 *** M-space
 *** C-M-space
@@ -5436,13 +5609,8 @@ org cycle todo / toggle comint motion
          (define-key map (kbd "<down>") 'my-comint-next-input)
          (goto-char (point-max)))))
 
-(defun ian-sign-email ()
-  (interactive)
-  (insert "Ian Kelling
-https://iankelling.org"))
-
 (eval-after-load "message"
-  '(define-key message-mode-map (kbd "C-t") 'ian-sign-email))
+  '(define-key message-mode-map (kbd "C-t") 'mail-signature))
 #+end_src
 Thanks for the update. I will be enjoying it.