]> git.eshelyaron.com Git - emacs.git/commitdiff
Use compatibility macro for ISUPPORT caching in ERC
authordickmao <dick.r.chiang@gmail.com>
Fri, 1 Jul 2022 15:06:51 +0000 (11:06 -0400)
committerF. Jason Park <jp@neverwas.me>
Wed, 6 Jul 2022 08:54:55 +0000 (01:54 -0700)
* lisp/erc/erc-backend.el (erc--with-memoization): Defalias was a
kung-fu I've never seen before. (Bug#56340)

lisp/erc/erc-backend.el

index bee2551d76e93eadc6e00a5d339458ca541fc75b..bc7a7d14dc251e4e73f6c60ea1902ff7ca2c2e4c 100644 (file)
@@ -1673,12 +1673,15 @@ Then display the welcome message."
          (split-string value ",")
        (list value)))))
 
-;; FIXME move to erc-compat (once we decide how to load it)
-(defalias 'erc--with-memoization
-  (cond
-   ((fboundp 'with-memoization) #'with-memoization) ; 29.1
-   ((fboundp 'cl--generic-with-memoization) #'cl--generic-with-memoization)
-   (t (lambda (_ v) v))))
+(defmacro erc--with-memoization (table &rest forms)
+  "Adapter to be migrated to erc-compat."
+  (declare (indent defun))
+  `(cond
+    ((fboundp 'with-memoization)
+     (with-memoization ,table ,@forms)) ; 29.1
+    ((fboundp 'cl--generic-with-memoization)
+     (cl--generic-with-memoization ,table ,@forms))
+    (t ,@forms)))
 
 (defun erc--get-isupport-entry (key &optional single)
   "Return an item for \"ISUPPORT\" token KEY, a symbol.