diff options
author | JSDurand <mmemmew@gmail.com> | 2022-03-26 12:36:23 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-03-26 12:36:23 +0800 |
commit | d0ba0c810462146471cbcb60a43ef44501d556a1 (patch) | |
tree | e66e3a3fb4e8a3bb92cef48c25364149e38bf67d | |
parent | 8f64522e8985d0e133751cdda920af032b01c2a5 (diff) |
gnus: determine the default identity correctly
If the to field contains Chinese characters, then the default identity
should be the one with Chinese characters.
-rw-r--r-- | gnus-conf.el | 17 |
1 files changed, 15 insertions, 2 deletions
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)) |