From d0ba0c810462146471cbcb60a43ef44501d556a1 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 26 Mar 2022 12:36:23 +0800 Subject: gnus: determine the default identity correctly If the to field contains Chinese characters, then the default identity should be the one with Chinese characters. --- gnus-conf.el | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'gnus-conf.el') diff --git a/gnus-conf.el b/gnus-conf.el index c0eae08..5ffca03 100644 --- a/gnus-conf.el +++ b/gnus-conf.el @@ -454,15 +454,28 @@ If ARG is non-nil, ask which identity to use. Otherwise use the identity named durand." (interactive "P") (let* (choice + (to (message-fetch-field "To")) + (all-mnemonics + (flatten-tree + (mapcar (lambda (c) + (mapcar #'identity + (category-set-mnemonics + (char-category-set c)))) + to))) + (default (cond + ((memq ?C all-mnemonics) "alt") + ("durand"))) (identity-to-use (cond (arg (setq choice (completing-read - "Choose an identity: " durand-identities nil t)) + (format "Choose an identity [%s]: " default) + durand-identities nil t nil nil + default)) (alist-get choice durand-identities nil nil #'string=)) ((alist-get - (setq choice "durand") + (setq choice default) durand-identities nil nil #'string=)) ((user-error "No identity crisis!")))) (from (car identity-to-use)) -- cgit v1.2.3-18-g5258