fix(tazjin/emacs): Gracefully handle irregular Quassel titles

Some Quassel dialogues (e.g. popups, or clients that aren't connected
yet) don't match the expression and cause errors. This falls back to
the raw title for the window if no match is found.

Change-Id: I67b9cd7f6e2cb8e3e118d7fb7eeb615380be09d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1976
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2020-09-14 13:12:33 +01:00 committed by tazjin
parent 20e88b0dd6
commit 4a29942b06

View file

@ -94,13 +94,14 @@
;; "Quassel IRC - ##tvl (Freenode) — Quassel IRC"
(`("quassel" ,title)
(progn
(string-match
(rx "Quassel IRC - "
(group (one-or-more (any alnum "&" "-" "#"))) ;; <-- channel name
" (" (group (one-or-more (any ascii space))) ")" ;; <-- network name
" — Quassel IRC")
title)
(format "Quassel<%s>" (match-string 2 title))))
(if (string-match
(rx "Quassel IRC - "
(group (one-or-more (any alnum "[" "]" "&" "-" "#"))) ;; <-- channel name
" (" (group (one-or-more (any ascii space))) ")" ;; <-- network name
" — Quassel IRC")
title)
(format "Quassel<%s>" (match-string 2 title))
title)))
;; For any other application, a name is constructed from the
;; window's class and name.