bug#54523: 28.0.91; mail-header-parse-addresses-lax is not lax
From:
Benjamin Orthen
Subject:
bug#54523: 28.0.91; mail-header-parse-addresses-lax is not lax
Date:
Tue, 22 Mar 2022 20:09:10 +0100
User-agent:
K-9 Mail for Android
mail-header-parse-addresses-lax runs into an "Unbalanced parentheses" error when trying to parse mail/name pairs which do not conform to the expected standard. This is because the function calls mail-header-parse-address on each mail/name pair which fails for non-conforming pairs.
See for example: (mail-header-parse-addresses-lax "Bob Weiner <rsw@gnu.org>, Mats Lidell <matsl@gnu.org")
A simple fix could be like this:
(defun mail-header-parse-addresses-lax (string) "Parse STRING as a comma-separated list of mail addresses. The return value is a list with mail/name pairs." (delq nil (mapcar (lambda (elem) (or (condition-case nil (mail-header-parse-address elem) (error nil)) (mail-header-parse-address-lax elem))) (mail-header-parse-addresses string t))))
In GNU Emacs 28.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.31, cairo version 1.16.0) Repository revision: emacs-28.0.91 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12013000 System Description: Ubuntu 20.04.4 LTS
Important settings: value of $EMACSLOADPATH: /nix/store/739k4qq06yh7fw1gld1ldx5yc5x0qlli-emacs-packages-deps/share/emacs/site-lisp: value of $EMACSNATIVELOADPATH: /nix/store/739k4qq06yh7fw1gld1ldx5yc5x0qlli-emacs-packages-deps/share/emacs/native-lisp:: value of $LC_MONETARY: de_DE.UTF-8 value of $LC_NUMERIC: de_DE.UTF-8 value of $LC_TIME: de_DE.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8
Major mode: Helpful
Minor modes in effect: global-git-commit-mode: t magit-auto-revert-mode: t recentf-mode: t diredfl-global-mode: t beacon-mode: t dap-tooltip-mode: t dap-ui-many-windows-mode: t dap-ui-controls-mode: t dap-ui-mode: t gdb-many-windows: t dap-auto-configure-mode: t dap-mode: t lsp-treemacs-sync-mode: t treemacs-icons-dired-mode: t treemacs-filewatch-mode: t treemacs-follow-mode: t treemacs-git-mode: t treemacs-fringe-indicator-mode: t lsp-dired-mode: t yas-global-mode: t yas-minor-mode: t corfu-doc-mode: t global-tree-sitter-mode: t TeX-PDF-mode: t org-super-agenda-mode: t projectile-mode: t global-evil-surround-mode: t evil-surround-mode: t evil-leader-mode: t evil-commentary-mode: t global-evil-collection-unimpaired-mode: t evil-collection-unimpaired-mode: t disable-mouse-global-mode: t shell-dirtrack-mode: t evil-mode: t evil-local-mode: t windmove-mode: t corfu-global-mode: t corfu-mode: t all-the-icons-completion-mode: t savehist-mode: t vertico-mode: t marginalia-mode: t su-mode: t global-origami-mode: t origami-mode: t doom-modeline-mode: t global-hl-todo-mode: t zoom-mode: t google-this-mode: t direnv-mode: t which-key-mode: t global-undo-tree-mode: t undo-tree-mode: t smartparens-global-mode: t global-hl-line-mode: t desktop-save-mode: t global-auto-revert-mode: t global-display-line-numbers-mode: t display-line-numbers-mode: t delete-selection-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t global-prettify-symbols-mode: t tab-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t