chiark / gitweb /
dot/emacs: Sort the global keybindings list.
[profile] / dot / ercrc.el
index a5390103cd4baccc2482e7487bce061f4d6dc526..3881cc12c46eac9abda3720758ada109d61ae149 100644 (file)
@@ -13,8 +13,6 @@ (setq erc-fill-column 76
       erc-fill-prefix "   "
       erc-max-buffer-size (* 60 3000))
 
-(load "~/.erc-local.el")
-
 (setq erc-track-exclude-types '("NICK" "JOIN" "PART"))
 
 (setq erc-auto-query 'buffer)
@@ -30,12 +28,10 @@ (add-hook 'erc-mode-hook 'mdw-erc-turn-off-truncate-lines)
 (setq erc-autojoin t
       erc-autojoin-domain-only nil
       erc-autojoin-channels-alist
-      '(("irc.ssdis.loc" "#devel" "#jukebox" "#nextgen")
-       ("cam.irc.devel.ncipher.com"
-        "#devel" "#jukebox" "#nextgen" "#sec-team")
-       ("chiark.greenend.org.uk" "#chiark")
+      '(("chiark.greenend.org.uk" "#chiark")
        ("irc.distorted.org.uk" "#distorted" "#jukebox")
        ("irc.hstg.corp.good.com" "#hstg")))
+(erc-autojoin-mode 1)
 
 (defvar mdw-erc-auto-greet-bots-alist nil
   "*Alist of (SERVER-REGEXP BOT-NICK MESSAGE-FORM).
@@ -61,27 +57,30 @@ (defun mdw-remprop-nondestructive (indic plist)
        (cdr head))
     plist))
 
-(defmacro* mdw-pushnew-replace
-    (item place &rest keys &key (key '#'identity) &allow-other-keys)
+(defun* mdw-cons-replace
+    (item list &rest keys &key (key '#'identity) &allow-other-keys)
+  "Return LIST, with ITEM at the start, replacing any existing matching item.
+Specifically, any item in the list satisfying the test are removed
+\(nondestructively), and then the new ITEM is added to the front."
+  (cons item (apply #'remove* (funcall key item) list :key key
+                   (mdw-remprop-nondestructive :key keys))))
+
+(defmacro* mdw-pushnew-replace (item place &rest keys)
   "Add ITEM to the list PLACE, replacing any existing matching item.
 Specifically, any item in the list satisfying the test are removed
 \(nondestructively), and then the new ITEM is added to the front.
 
 Evaluation order for the keywords is a bit screwy: don't rely on it."
-  ;; `cl-setf-do-modify' returns a list (LETS STORE FETCH).
-  (let ((setf-things (cl-setf-do-modify place (cons 'list keys)))
-       (keyfn (gensym "key"))
-       (itemvar (gensym "item")))
-    `(let ((,keyfn ,key)
-          (,itemvar ,item)
-          ,@(car setf-things))
-       ,(cl-setf-do-store (cadr setf-things)
-                         `(cons ,itemvar
-                                (remove* (funcall ,keyfn ,itemvar)
-                                         ,(caddr setf-things)
-                                         :key ,keyfn
-                                         ,@(mdw-remprop-nondestructive
-                                            :key keys)))))))
+  (cond ((fboundp 'cl-callf2)
+        `(cl-callf2 mdw-cons-replace ,item ,place ,@keys))
+       ((fboundp 'cl-setf-do-modify)
+        ;; `cl-setf-do-modify' returns a list (LETS STORE FETCH).
+        (let ((setf-things (cl-setf-do-modify place (cons 'list keys))))
+          `(let (,@(car setf-things))
+             ,(cl-setf-do-store (cadr setf-things)
+                                `(mdw-cons-replace ,item ,place
+                                                   ,@keys)))))
+       (t (error "Don't know how to hack places on this Emacs."))))
 
 (defun mdw-define-bot-greeting (server bot greeting)
   "Define a new bot greeting."
@@ -93,7 +92,6 @@ (defun mdw-add-ircop-credentials (server acct passwd)
   (mdw-pushnew-replace (list server acct passwd)
                       mdw-erc-ircop-alist
                       :test #'string= :key #'car))
-(load "~/.erc-auth.el")
 
 (defun mdw-assoc-regexp (regexp alist)
   "Return the association in ALIST whose car matches REGEXP."
@@ -123,3 +121,6 @@ (defun erc-cmd-IRCOP ()
       (let ((acct (cadr a))
            (passwd (caddr a)))
        (erc-server-send (concat "OPER " acct " " passwd))))))
+
+(load "~/.erc-auth.el")
+(load "~/.erc-local.el")