From: Mark Wooding Date: Fri, 15 Apr 2016 13:56:16 +0000 (+0100) Subject: Merge slippers:etc/profile X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/fff80d993fbf831f2cdffcbf2c0bc8f95d65b0a9?hp=a55efa66671e704cd3e69cb3ef5f65665d0e6caa Merge slippers:etc/profile * slippers:etc/profile: dot/bash_profile: Sensible default behaviour for `~/.mdw.conf' lookups. dot/emacs: Ignore email addresses for work bug system. dot/gnus.el: Set a null primary source if no NNTP server is available. dot/emacs: Arrange for Org mode to autoload for diary's benefit. dot/bash_profile: Use the `gnome-keyring-daemon' if there's a session bus. dot/emacs: Some more addresses for BBDB to ignore. dot/emacs: Don't try to save mail to `~/Mail/sent'. el/dot-emacs.el: Fix `bbdb-canonicalize-address'. dot/emacs: Note a new email address for me. dot/emacs: Use working `bbdb-extract-address-components-func'. dot/fonts.conf: Fix mis-spelled attribute name. --- diff --git a/dot/bash_profile b/dot/bash_profile index 4ce6280..2a47c68 100644 --- a/dot/bash_profile +++ b/dot/bash_profile @@ -93,6 +93,12 @@ __mdw_addto PYTHONPATH r $HOME/lib/python ###-------------------------------------------------------------------------- ### Various other kinds of configuration. +__mdw_setconf () { + if val=$(mdw-conf 2>/dev/null "$2"); then + eval "export $1=\$val" + fi +} + ## Establish a temporary directory. [ "$TMPDIR" ] || eval `tmpdir -b` export TMP=$TMPDIR @@ -101,9 +107,9 @@ export TMP=$TMPDIR umask 002 ## Mail and general identification. -export MAIL=`mdw-conf mailbox` +__mdw_setconf MAIL mailbox export NAME="Mark Wooding" -export EMAIL=`mdw-conf email` +__mdw_setconf EMAIL email export QMAILINJECT=c ## Some programs want to know the hostname. @@ -131,9 +137,9 @@ export EDITOR=mdw-editor VISUAL=mdw-editor ## Determine the locale settings. Really don't set LC_COLLATE because it ## messes with the order of files in `ls' listings and similar. if [ "$DISPLAY" != "" ]; then - LANG=`mdw-conf x-ctype` + LANG=`mdw-conf x-ctype POSIX` else - : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype`}}} + : ${LANG=${LC_CTYPE-${LC_ALL-`mdw-conf console-ctype POSIX`}}} case "$TERM,`tty`" in linux,/dev/tty*) if { vt-is-UTF8 || @@ -199,7 +205,7 @@ unset browsers ## Acquiring root privileges. This is mainly the job of `bashrc', but we ## cache the mechanism here. -export __MDW_ROOTLY=`mdw-conf rootly` +__mdw_setconf __MDW_ROOTLY rootly export BECOME="--preserve-environment" ## It's useful to see the little sigils in `ls'. @@ -210,12 +216,12 @@ export BASCAT="-l +n" ## Version control hacking. export CVS_RSH=ssh -export CVSROOT=`mdw-conf cvs-root` -export SVNROOT=`mdw-conf svn-root` +__mdw_setconf CVSROOT cvs-root +__mdw_setconf SVNROOT svn-root export P4CONFIG=.p4 ## News server. -[ -z "$NNTPSERVER" ] && export NNTPSERVER=`mdw-conf nntp-server` +__mdw_setconf NNTPSERVER nntp-server ## Help X programs find their resources. export XUSERFILESEARCHPATH="$HOME/.Xapps/%N:/usr/lib/X11/%T/%N%S" @@ -239,13 +245,11 @@ ulimit -S -c 0 if { { [ "$GNOME_KEYRING_CONTROL" ] && [ -s "$GNOME_KEYRING_CONTROL" ]; } || { [ "$DBUS_SESSION_BUS_ADDRESS" ] && - dbus-send --session --print-reply --dest=org.freedesktop.DBus \ - / org.freedesktop.DBus.GetNameOwner string:org.gnome.keyring \ - >/dev/null 2>/dev/null; }; } && - stuff=$(gnome-keyring-daemon -s -c ssh 2>/dev/null) + __mdw_programp gnome-keyring-daemon; }; } && + stuff=$(gnome-keyring-daemon -s -c ssh,gpg 2>/dev/null) then eval "$stuff" - export SSH_AUTH_SOCK + export SSH_AUTH_SOCK GPG_AGENT_INFO fi ## If we still don't have an agent then start one with a stable name. diff --git a/dot/emacs b/dot/emacs index 562d733..5bb61e2 100644 --- a/dot/emacs +++ b/dot/emacs @@ -52,6 +52,7 @@ (maybe-autoload 'stgit "stgit" nil t) (maybe-autoload 'nc-timesheet-prepare "nc-timesheet" nil t nil) (maybe-autoload 'nc-timesheet-submit "nc-timesheet" nil t nil) +(maybe-autoload 'org-bbdb-anniversaries "org" nil t) (and (library-exists-p "debian-changelog-mode") (add-to-list 'auto-mode-alist @@ -158,7 +159,9 @@ (setq mail-from-style 'angles mail-signature t mail-yank-prefix "> " - mail-archive-file-name "~/Mail/sent" + mail-archive-file-name nil + message-default-mail-headers "" + message-default-news-headers "" compose-mail-user-agent-warnings nil) (setq rmail-display-summary t) @@ -196,6 +199,7 @@ (trap (bbdb-initialize 'gnus 'sendmail 'message))) (setq bbdb-file "~/etc/brain/bbdb" bbdb-north-american-phone-numbers-p nil + bbdb-extract-address-components-func 'bbdb-extract-address-components bbdb/news-auto-create-p (lambda () (let ((group gnus-newsgroup-name)) @@ -210,6 +214,7 @@ "\\(chiark\\|slimy\\|coriolis\\)\\.greenend\\.org\\.uk" "\\|" "distorted\\.mdw@g\\(\\|oogle\\)mail.com" "\\|" "mwooding@\\(good\\|blackberry\\)\\.com" + "\\|" "mark\\.wooding@trustonic\\.com" "\\)$") bbdb-canonicalize-net-hook (lambda (addr) @@ -225,6 +230,13 @@ "\\|" "distorted\\.org\\.uk" "\\)$") addr) + (string-match (concat "^MicrosoftExchange[0-9a-f]*" + "@newincco\\.onmicrosoft\\.com") + addr) + (member (md5 addr) + '("8815c5583970856799c85a3ee0eb6a9f" ;work wiki spam + "0b94ab4d25dacaa5ac07243a09c9e22e" ;work bug spam + )) (and (string-match "^news\\([0-9]+\\)@\\(.*\\)$" addr) (string= (md5 (match-string 2 addr)) "879b795aed959b1a000e9f95c132b16c"))) diff --git a/dot/fonts.conf b/dot/fonts.conf index a71e415..261b760 100644 --- a/dot/fonts.conf +++ b/dot/fonts.conf @@ -57,7 +57,7 @@ - + Geneva FreeSans diff --git a/dot/gnus.el b/dot/gnus.el index 46b0a04..ebf83f2 100644 --- a/dot/gnus.el +++ b/dot/gnus.el @@ -96,7 +96,11 @@ (add-hook 'gnus-article-mode-hook #'mdw-gnus-article-setup) ;;; Local configuration. ;; Fetching news from the local news server seems sensible. -(setq gnus-select-method `(nntp ,(mdw-config 'nntp-server))) +(setq gnus-select-method + (let ((server (mdw-config 'nntp-server))) + (if server + `(nntp ,server) + '(nnnil "")))) ;; Now load a local configuration file. (load "~/.gnus-local.el") diff --git a/el/dot-emacs.el b/el/dot-emacs.el index a1cba54..dd8dc2f 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -238,6 +238,32 @@ (defadvice markdown-check-change-for-wiki-link "Save match data around the `markdown-mode' `after-change-functions' hook." (save-match-data ad-do-it)) +;; Bug fix for `bbdb-canonicalize-address': on Emacs 24, `run-hook-with-args' +;; always returns nil, with the result that all email addresses are lost. +;; Replace the function entirely. +(defadvice bbdb-canonicalize-address + (around mdw-bug-fix activate compile) + "Don't use `run-hook-with-args', because that doesn't work." + (let ((net (ad-get-arg 0))) + + ;; Make sure this is a proper hook list. + (if (functionp bbdb-canonicalize-net-hook) + (setq bbdb-canonicalize-net-hook (list bbdb-canonicalize-net-hook))) + + ;; Iterate over the hooks until things converge. + (let ((donep nil)) + (while (not donep) + (let (next (changep nil) + hook (hooks bbdb-canonicalize-net-hook)) + (while hooks + (setq hook (pop hooks)) + (setq next (funcall hook net)) + (if (not (equal next net)) + (setq changep t + net next))) + (setq donep (not changep))))) + (setq ad-return-value net))) + ;; Transient mark mode hacks. (defadvice exchange-point-and-mark