diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el index 116f702ab3e..1a0b9c323d1 100644 --- a/lisp/erc/erc-common.el +++ b/lisp/erc/erc-common.el @@ -641,25 +641,6 @@ Otherwise, return LIST-OR-ATOM." (car ,list-or-atom) ,list-or-atom)))) -(defmacro erc--doarray (spec &rest body) - "Map over ARRAY, running BODY with VAR bound to iteration element. -Behave more or less like `seq-doseq', but tailor operations for -arrays. - -\(fn (VAR ARRAY [RESULT]) BODY...)" - (declare (indent 1) (debug ((symbolp form &optional form) body))) - (let ((array (make-symbol "array")) - (len (make-symbol "len")) - (i (make-symbol "i"))) - `(let* ((,array ,(nth 1 spec)) - (,len (length ,array)) - (,i 0)) - (while-let (((< ,i ,len)) - (,(car spec) (aref ,array ,i))) - ,@body - (cl-incf ,i)) - ,(nth 2 spec)))) - (provide 'erc-common) ;;; erc-common.el ends here diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index cec261feb43..572b73188e3 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -7607,7 +7607,7 @@ Use the getter of the same name to retrieve the current value.") (ct (make-char-table 'erc--channel-mode-types)) (type ?a)) (dolist (cs types) - (erc--doarray (c cs) + (seq-doseq (c cs) (aset ct c type)) (cl-incf type)) (make-erc--channel-mode-types :key key @@ -7626,7 +7626,7 @@ complement relevant letters in STRING." (table (erc--channel-mode-types-table obj)) (fallbackp (erc--channel-mode-types-fallbackp obj)) (+p t)) - (erc--doarray (c string) + (seq-doseq (c string) (cond ((= ?+ c) (setq +p t)) ((= ?- c) (setq +p nil)) ((and status-letters (string-search (string c) status-letters)) @@ -7719,7 +7719,7 @@ dropped were they not already absent." (let ((addp t) ;; redundant-add redundant-drop adding dropping) - (erc--doarray (c string) + (seq-doseq (c string) (pcase c (?+ (setq addp t)) (?- (setq addp nil)) diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 1bbee0dad52..5c1a34bc3fa 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -165,19 +165,6 @@ (advice-remove 'buffer-local-value 'erc-with-server-buffer))) -(ert-deftest erc--doarray () - (let ((array "abcdefg") - out) - ;; No return form. - (should-not (erc--doarray (c array) (push c out))) - (should (equal out '(?g ?f ?e ?d ?c ?b ?a))) - - ;; Return form evaluated upon completion. - (setq out nil) - (should (= 42 (erc--doarray (c array (+ 39 (length out))) - (when (cl-evenp c) (push c out))))) - (should (equal out '(?f ?d ?b))))) - (ert-deftest erc-hide-prompt () (let ((erc-hide-prompt erc-hide-prompt) (inhibit-message noninteractive)