]> git.eshelyaron.com Git - emacs.git/commit
Allow updating of /IGNORE timeouts in ERC
authorF. Jason Park <jp@neverwas.me>
Mon, 1 Apr 2024 22:27:47 +0000 (15:27 -0700)
committerEshel Yaron <me@eshelyaron.com>
Wed, 10 Apr 2024 20:27:55 +0000 (22:27 +0200)
commit5dfe572e8ce0ce6253b34898a3315c1a106edc33
tree59fbd7b932e94cbe59666d250cdd6c97a44ae368
parentbf1d7a022fc670549fe64b5e42b50e937c6e4375
Allow updating of /IGNORE timeouts in ERC

* lisp/erc/erc.el (erc--read-time-period, erc--decode-time-period):
Move body of former, now a superficial wrapper, to latter, a new
function.
(erc--format-time-period): New function.
(erc--get-ignore-timer-args): New function.
(erc--find-ignore-timer): New function to search through `timer-list'
to find matching ignore timer.
(erc-cmd-IGNORE): Refactor and redo doc string.  Add new optional
`timespec' parameter, primarily to aid in testing.  Update an existing
timer instead of always creating one, and display time remaining in
"ignore list" output.  Pass server buffer instead of current buffer to
timer callbacks because `erc--unignore-user' displays its messages in
the `active' buffer, not necessarily the issuing one.  Note that doing
this does discard potentially useful information, so if ever reverting,
we can change the `cl-find' :test in `erc--find-ignore-timer' to
something that compares the `erc-server-process' of both buffers.
;;
;; Something like:
;;
;; (defun erc--ignore-timers-equal-p (a b)
;;   (and (equal (car a) (car b))
;;        (eq (buffer-local-value 'erc-server-process (cadr a))
;;            (buffer-local-value 'erc-server-process (cadr b)))))
;;
(erc-cmd-UNIGNORE): Pass `erc-ignore-list' member matching `user'
parameter to `erc--unignore-user' instead of original, raw parameter,
along with the server buffer.
(erc--unignore-user): Cancel existing timer and don't bother switching
to server buffer since we're already there.
(erc-message-english-ignore-list): New variable.
* test/lisp/erc/erc-scenarios-ignore.el: New file.
* test/lisp/erc/erc-tests.el (erc--read-time-period): New test.
(erc-cmd-UNIGNORE): New test.  (Bug#70127)

(cherry picked from commit e0df2841fb78251d5461a17e2d9be581c152bdc2)
lisp/erc/erc.el
test/lisp/erc/erc-scenarios-ignore.el [new file with mode: 0644]
test/lisp/erc/erc-tests.el