;; (: gnus-group-split-fancy "INBOX" t "INBOX")
;; gnu
(list ".*<\\(.*\\)\\.\\(non\\)?gnu\\.org>.*" "l.\\1")
- ;; *@lists.sr.ht
- (list ".*<~\\(.*\\)/\\(.*\\)@lists.sr.ht>" "l.~\\1.\\2")
+ ;; *@lists.sr.ht, omitting one dot if present
+ ;; add more \\.?\\([^.@]*\\) if needed
+ (list ".*<~\\(.*\\)/\\([^.@]*\\)\\.?\\([^.@]*\\)@lists.sr.ht>.*" "l.~\\1.\\2\\3")
;; webmasters
(from "webmasters\\(-comment\\)?@gnu\\.org" "webmasters")
;; other
(add-to-list 'erc-modules 'notifications)
(add-to-list 'erc-modules 'spelling)
(add-to-list 'erc-modules 'scrolltoplace)
- (erc-update-modules))
+ (erc-update-modules)
+
+ (when (and (version<= "24.4" emacs-version)
+ (version< emacs-version "27"))
+ ;; fix erc-lurker bug
+ ;; patch submitted: https://bugs.gnu.org/36843#10
+ ;; TODO: remove when patch is merged and emacs 27 is released
+ (defvar erc-message-parsed)
+ (defun erc-display-message (parsed type buffer msg &rest args)
+ "Display MSG in BUFFER.
+
+ARGS, PARSED, and TYPE are used to format MSG sensibly.
+
+See also `erc-format-message' and `erc-display-line'."
+ (let ((string (if (symbolp msg)
+ (apply #'erc-format-message msg args)
+ msg))
+ (erc-message-parsed parsed))
+ (setq string
+ (cond
+ ((null type)
+ string)
+ ((listp type)
+ (mapc (lambda (type)
+ (setq string
+ (erc-display-message-highlight type string)))
+ type)
+ string)
+ ((symbolp type)
+ (erc-display-message-highlight type string))))
+
+ (if (not (erc-response-p parsed))
+ (erc-display-line string buffer)
+ (unless (erc-hide-current-message-p parsed)
+ (erc-put-text-property 0 (length string) 'erc-parsed parsed string)
+ (erc-put-text-property 0 (length string) 'rear-sticky t string)
+ (when (erc-response.tags parsed)
+ (erc-put-text-property 0 (length string) 'tags (erc-response.tags parsed)
+ string))
+ (erc-display-line string buffer)))))
+
+ (defun erc-lurker-update-status (_message)
+ "Update `erc-lurker-state' if necessary.
+
+This function is called from `erc-insert-pre-hook'. If the
+current message is a PRIVMSG, update `erc-lurker-state' to
+reflect the fact that its sender has issued a PRIVMSG at the
+current time. Otherwise, take no action.
+
+This function depends on the fact that `erc-display-message'
+lexically binds `erc-message-parsed', which is used to check if
+the current message is a PRIVMSG and to determine its sender.
+See also `erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'.
+
+In order to limit memory consumption, this function also calls
+`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval'
+updates of `erc-lurker-state'."
+ (when (and (boundp 'erc-message-parsed)
+ (erc-response-p erc-message-parsed))
+ (let* ((command (erc-response.command erc-message-parsed))
+ (sender
+ (erc-lurker-maybe-trim
+ (car (erc-parse-user (erc-response.sender erc-message-parsed)))))
+ (server
+ (erc-canonicalize-server-name erc-server-announced-name)))
+ (when (equal command "PRIVMSG")
+ (when (>= (cl-incf erc-lurker-cleanup-count)
+ erc-lurker-cleanup-interval)
+ (setq erc-lurker-cleanup-count 0)
+ (erc-lurker-cleanup))
+ (unless (gethash server erc-lurker-state)
+ (puthash server (make-hash-table :test 'equal) erc-lurker-state))
+ (puthash sender (current-time)
+ (gethash server erc-lurker-state))))))))
(use-package erc-fill
:after erc