X-Git-Url: https://iankelling.org/git/?p=dot-emacs;a=blobdiff_plain;f=my-init.org;h=35c03baa5581b390d29b3b18110e1cf38ffb4b04;hp=6dcb7f1d5fa54aaf710563413a932c6670543edb;hb=da907fbf50cbb4eb2b32238fc077fa919726f974;hpb=659fc238ff78b67319fe44b7ec06b189d22ca251 diff --git a/my-init.org b/my-init.org index 6dcb7f1..35c03ba 100644 --- a/my-init.org +++ b/my-init.org @@ -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,6 +154,8 @@ 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 @@ -470,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 @@ -605,19 +600,21 @@ I need this function here, where INSIDE_EMACS is replaced with RLC_INSIDE_EMACS. (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)) @@ -755,7 +752,6 @@ 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 @@ -854,6 +850,7 @@ interesting light themes #+end_src * yasnippet + cd ~/.emacs.d/src git clone --recursive https://github.com/capitaomorte/yasnippet touch snippets/.yas-make-groups @@ -949,11 +946,14 @@ 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 send-mail-function (quote sendmail-send-it) ;; common to gnus also +(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" @@ -967,6 +967,9 @@ has a list of folders which i'd rather not publish, so it's config is archived. 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. @@ -996,7 +999,7 @@ has a list of folders which i'd rather not publish, so it's config is archived. (read-only-mode 0) (let ((start (match-beginning 0)) (end (search-forward "-----END PGP MESSAGE-----" nil t))) - (shell-command-on-region start end "gpg -dq" nil t shell-command-default-error-buffer 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) @@ -1040,11 +1043,14 @@ and Ian Kelling as the name" ;; on first run mkdir -p /nocow/user/.mufsf; mu index --maildir=/nocow/user/fsfmd (defun mu-exit-wait () (interactive) - (let ((wait (= 0 (call-process "/bin/pidof" nil nil nil "mu")))) + ;; 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. - (when wait (sleep-for 0 300)))) + (if proc (sleep-for 0 1000)))) + (defun fsf-mu4e () (interactive) (unless (equal mu4e-maildir "/nocow/user/fsfmd") (mu-exit-wait)) @@ -1053,11 +1059,12 @@ and Ian Kelling as the name" mu4e-headers-visible-lines 15 mu4e-maildir "/nocow/user/fsfmd" mu4e-refile-folder "/Spam" - mu4e-get-mail-command "/a/bin/distro-setup/fsf-get-mail" + 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 @@ -1090,7 +1097,9 @@ https://fsf.org | https://gnu.org (setq mu4e-bookmarks `( ,(make-mu4e-bookmark :name "Unread messages" - :query "flag:unread AND NOT flag:trashed AND NOT maildir:/Junk AND NOT maildir:/fwfw AND NOT maildir:/log" + ;; 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" @@ -1789,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) @@ -1801,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 "\\") "\\)") @@ -2068,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) @@ -2083,6 +2094,16 @@ 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" @@ -2183,7 +2204,6 @@ org-caldav-inbox "/p/cal.org") ;; 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 @@ -2312,7 +2332,11 @@ org-caldav-inbox "/p/cal.org") * 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 @@ -2454,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 () @@ -2532,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)))) @@ -3226,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)) @@ -3571,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) @@ -3611,24 +3643,32 @@ these colors were better for dark theme #+RESULTS: : 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 - (start-process-shell-command "ignoreme" nil "mpv --no-terminal --vo=null --volume=25 /a/bin/data/bird.mp3") + 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) - (start-process-shell-command "ignoreme" nil "mpv --no-terminal --vo=null /a/bin/data/bird.mp3"))) + (chirp))) (add-hook 'erc-text-matched-hook 'erc-sound-if-not-server) (erc-track-mode 1) @@ -4651,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) @@ -5479,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 "") 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