diff options
-rw-r--r-- | init.el | 7 | ||||
-rw-r--r-- | lib/eos/jao-tracking.el | 18 |
2 files changed, 14 insertions, 11 deletions
@@ -2653,7 +2653,9 @@ (jao-shorten-modes 'slack-message-buffer-mode 'slack-thread-message-buffer-mode) (jao-tracking-faces 'warning) - + (jao-tracking-cleaner "logstash-\\([^-]+\\)-\\(.+\\)" "\\2-\\1") + (jao-tracking-cleaner + "^\\*Slack - .*? : \\(mpdm-\\)?\\([^ ]+\\)\\( \\(T\\)\\)?.*" "\\2\\4") (jao-define-attached-buffer "\\*Slack .+ Edit Message [0-9].+" 20)) ;;;; telegram @@ -2716,7 +2718,8 @@ (tracking-add-buffer b)))) (add-hook 'ement-event-hook #'jao-ement-track) - (jao-shorten-modes 'ement-room-mode)) + (jao-shorten-modes 'ement-room-mode) + (jao-tracking-cleaner "^\\*Ement Room: \\(.+\\)\\*" "@\\1")) ;;;; startup (defun jao-chats (&optional p) diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el index 29a60a8..f695b3e 100644 --- a/lib/eos/jao-tracking.el +++ b/lib/eos/jao-tracking.el @@ -30,16 +30,16 @@ (defun jao-shorten-modes (&rest modes) (dolist (m modes) (add-to-list 'tracking-shorten-modes m))) +(defvar jao-tracking-cleaners '(("^[^a-zA-Z#@]+" . "#"))) + +(defun jao-tracking-cleaner (rx subst) + (add-to-list 'jao-tracking-cleaners (cons rx subst))) + (defun jao-tracking--clean-slack (s) - (let* ((s (replace-regexp-in-string - "^\\*Slack - .*? : \\(mpdm-\\)?\\([^ ]+\\)\\( \\(T\\)\\)?.*" - "\\2\\4" - s)) - (s (replace-regexp-in-string "^\\*Ement Room: \\(.+\\)\\*" "\\1" s)) - (s (replace-regexp-in-string "logstash-\\([^-]+\\)-\\(.+\\)" - "\\2-\\1" - s))) - (replace-regexp-in-string "^[^a-zA-Z#]+" "#" s))) + (dolist (cln jao-tracking-cleaners) + (when (string-match (car cln) s) + (setq s (replace-match (cdr cln) nil nil s)))) + s) (defun jao-tracking-shorten-aggressively (lst tail-count) (let* ((s (shorten-join-sans-tail lst tail-count))) |