From 4a29942b06798bae94fe71fc476088ef284e1b71 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 14 Sep 2020 13:12:33 +0100 Subject: 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 Tested-by: BuildkiteCI --- users/tazjin/emacs/config/desktop.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/users/tazjin/emacs/config/desktop.el b/users/tazjin/emacs/config/desktop.el index 8e7a94f962..b099b573ae 100644 --- a/users/tazjin/emacs/config/desktop.el +++ b/users/tazjin/emacs/config/desktop.el @@ -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. -- cgit 1.4.1