@introspect Write a function, notmuch-mua-reply-all-check, that checks if I want to reply only to the person I’m responding to, as opposed to using “reply all”. Obviously this check should not complain if the email only involves me and one other person. Use the provided tools to check your assumptions.
Response:
(variable_documentation :variable “notmuch-mua-send-hook”)
(:name "variable_documentation" :args (:variable "notmuch-mua-send-hook")) Hook run before sending messages.
(function_documentation :function “notmuch-mua-send-hook”)
(:name "function_documentation" :args (:function "notmuch-mua-send-hook")) void-function notmuch-mua-send-hook
(function_completions :function_prefix “notmuch-mua–”)
(:name "function_completions" :args (:function_prefix "notmuch-mua--")) notmuch-mua--remove-dont-reply-to-names
(variable_completions :variable_prefix “notmuch-mua-”)
(:name "variable_completions" :args (:variable_prefix "notmuch-mua-")) notmuch-mua-send-hook notmuch-mua-user-agent-function notmuch-mua-attachment-regexp notmuch-mua-reply-insert-header-p-function notmuch-mua-subject-regexp notmuch-mua-compose-in notmuch-mua-sender-history notmuch-mua-hidden-headers notmuch-mua-cite-function
(function_completions :function_prefix “notmuch-mua-”)
(:name "function_completions" :args (:function_prefix "notmuch-mua-")) notmuch-mua-reply-crypto notmuch-mua-send-and-exit notmuch-mua-reply notmuch-mua-maybe-set-window-dedicated notmuch-mua-subject-check notmuch-mua-attachment-check notmuch-mua-send-common notmuch-mua-check-secure-tag-has-newline notmuch-mua-mail notmuch-mua-kill-buffer notmuch-mua-new-mail notmuch-mua-pop-to-buffer notmuch-mua-send notmuch-mua-check-no-misplaced-secure-tag notmuch-mua-user-agent-emacs notmuch-mua-new-forward-messages notmuch-mua-get-switch-function notmuch-mua-add-more-hidden-headers notmuch-mua-insert-references notmuch-mua-user-agent-full notmuch-mua-new-reply notmuch-mua-prompt-for-sender notmuch-mua-user-agent-notmuch notmuch-mua--remove-dont-reply-to-names
(variable_completions :variable_prefix “message-”)
(:name "variable_completions" :args (:variable_prefix "message-")) gnus-button-message-level message-signature-setup-hook clear-message-function message-yank-cited-prefix message-smileys message-inserted-headers message-subscribed-address-functions message-archive-note message-distribution-function message-options :message-complete message-user-organization message-cross-post-note-function message-send-mail-function message-insert-canlock message-face-alist message-ignored-supersedes-headers isearch-original-minibuffer-message-timeout message-followup-to-function message-forward-as-mime message-cross-post-note message-encoded-mail-cache my/message-modes-list minibuffer-message-overlay message-citation-line-function message-citation-line-format tramp-debug-message-fnh-function message-sendmail-f-is-evil minibuffer-message-timer message-mailer message-mailer-swallows-blank-line isearch-message-properties message-posting-charset magit-revision-wash-message-hook message-tab-body-function message-reply-headers magit-commit-message-section-map message-return-action message-field-fillers :message-id message-subscribed-addresses message-yank-prefix message-cite-style-thunderbird notmuch-tree-message-window notmuch-tree-message-buffer message-send-rename-function magit-process-error-message-regexps message-fill-column dbus-message-type-method-return message-unique-id-char gnus-update-message-archive-method message-forward-included-headers message-ignored-cited-headers message-newgroups-header-regexp message-cite-style rmail-show-message-hook message-cross-post-default sp-message-width notmuch-message-mode-hook minibuffer-history-isearch-message-overlay gnus-action-message-log nnheader-fake-message-id message-forward-before-signature magit-wash-message-hook notmuch-message-mode-syntax-table eldoc-message-commands message-subject-trailing-was-ask-regexp message-send-mail-hook message-mode-menu message-server-alist message-unix-mail-delimiter message-openpgp-header message-postpone-actions message-user-fqdn message-newsreader eldoc-message-commands-table-size message-followup-to-note message-deletable-headers message-cite-level-function minibuffer-message-timeout message-header-hook message-fcc-handler-function message-send-actions message-reply-to-function message-strip-special-text-properties compilation-message-face eldoc-message-function message-log-max message-dont-reply-to-names message-send-method-alist git-commit-use-local-message-ring message-minibuffer-local-map isearch-message-prefix-add message-caesar-translation-table message-wash-forwarded-subjects message-wide-reply-to-function inhibit-message-regexps message-sent-hook message-mode-syntax-table multi-message-timeout message-cancel-hook message-bogus-addresses :message-overlay message-forward-included-mime-headers message-qmail-inject-program x-dnd-motif-message-types message-header-setup-hook message-recipients-without-full-name set-message-function message-auto-save-directory message-sending-message message-header-format-alist message-ignored-bounced-headers message-hidden-headers message-default-news-headers message-header-synonyms eat-message-handler-alist message-send-coding-system message-cross-post-old-target message-kill-buffer-on-exit set-message-functions message-generate-new-buffers message-max-buffers message-form-letter-separator message-alter-recipients-function message-cite-style-outlook message-user-organization-file message-yank-empty-prefix message-expand-name-databases message-email-recipient-header-regexp ghub-graphql-message-progress message-indentation-spaces message-bogus-system-names message-mime-part message-cite-prefix-regexp message-required-headers message-sendmail-extra-arguments message-tool-bar-zap-list message-ignored-news-headers message-cite-function notmuch-message-mode-abbrev-table notmuch-message-forwarded-tags message-replacement-char notmuch-message-headers message-mark-insert-begin message-fcc-externalize-attachments comint-history-isearch-message-overlay multi-message-list url-lazy-message-time message-send-mail-real-function minibuffer-message-clear-timeout message-screenshot-command message-post-method message-signature message-checksum message-confirm-send message-allow-no-recipients nnmail-message-id-cache-file message-font-lock-keywords message-forward-decoded-p message-use-mail-followup-to dbus-message-type-error message-generate-headers-first message-elide-ellipsis message-sent-message-via message-send-news-function message-cite-articles-with-x-no-archive message-forward-ignored-headers message-reply-buffer notmuch-message-headers-visible message-cite-reply-position message-mail-alias-type message-exit-actions message-mode-map message-make-forward-subject-function message-default-mail-headers message-directory message-user-path message-tool-bar-gnome message-required-mail-headers notmuch-message-replied-tags message-cite-style-gmail message-signature-file dbus-message-type-signal message-hierarchical-addresses nnmail-prepare-incoming-message-hook message-sendmail-envelope-from message-mode-hook message-subject-trailing-was-query magit-stash-read-message-function message--old-style-completion-functions message-wide-reply-confirm-recipients message-buffer-list minibuffer-message-properties message-send-mail-partially-limit message-qmail-inject-args message-draft-coding-system message-cancel-message message-subject-trailing-was-regexp message-courtesy-message mm-inline-message-prepare-function cl-struct-compilation--message-tags message-tool-bar-map tramp-error-show-message-timeout message-completion-alist message-prune-recipient-rules gnus-message-archive-group message-this-is-news message-generate-hashcash message-truncate-lines message-send-form-letter-delay message-use-followup-to message-send-hook :message-visible message-subscribed-regexps :notmuch-message-extent nnmail-message-id-cache-length message-use-idna next-error--message-highlight-overlay message-simplify-subject-functions message-signature-directory message-default-charset message-default-headers rmail-insert-mime-forwarded-message-function message-kill-buffer-query message-ignored-mail-headers message-inhibit-body-encoding message-required-news-headers repeat-message-function message-kill-actions dbus-message-type-invalid message-self-insert-commands log-view-message-re nnheader-uniquify-message-id message-alternative-emails gnus-message-archive-method dbus-message-type-method-call message-unsent-separator message-this-is-mail message-expires request-message-level message-mode-field-menu multi-message-separator message-tool-bar-retro multi-message-max message-forbidden-properties message-setup-hook message-draft-article nnmail-cache-accepted-message-ids message-subscribed-address-file message-subject-re-regexp message-interactive message-mh-deletable-headers message-indent-citation-function message-forward-show-mml message-inhibit-ecomplete message-signature-insert-empty-line message-signature-separator nnheader-last-message-time message-archive-header message-draft-headers message-mail-user-agent message-expand-name-standard-ui message-syntax-checks message-mark-insert-end message-send-news-hook compilation-exit-message-function message-extra-wide-headers next-error-message-highlight message-beginning-of-line notmuch-message-queued-tag-changes isearch-message-suffix-add :notmuch-message-properties message-mode-abbrev-table message-tool-bar message-from-style isearch-message-function notmuch-message-mode-map message-ignored-resent-headers sp-message-alist message-shoot-gnksa-feet appt-message-warning-time
(function_completions :function_prefix “message-”)
(:name "function_completions" :args (:function_prefix "message-")) message-mailto message-fill-yanked-message message-setup-fill-variables message-insert-header notmuch-show-get-message-ids-for-open-messages alert-message-notify message-mail-p message-goto-mail-followup-to pop3-get-message-count eldoc-display-message-p message-check-element mml-secure-message-sign-pgpauto message-text-with-property message-signed-or-encrypted-p message-position-point nnheader-message-maybe notmuch-show-get-message-id notmuch-show-stash-message-id message-send-mail-function message-sort-headers-1 message-insert-canlock notmuch-show-message-adjust message-make-sender message-send-and-exit message-idna-to-ascii-rhs-1 message-forward-rmail-make-body message-sort-headers message-send-mail-with-qmail message-mark-insert-file message-narrow-to-headers-or-head git-commit-search-message-forward gnus-message-with-timestamp message-goto-body message-canlock-password message-mail-file-mbox-p message-fill-field-address notmuch-tree-show-message-in message-make-date eldoc-edit-message-commands message-wash-subject message-subscribed-p org-table-message-once-per-second message-box notmuch-show-message-visible message-news-other-window notmuch-tree-archive-message-then-next-or-exit message-news-p notmuch-tree-message-window-kill-hook message-next-header message-insinuate-rmail message-send-mail-with-mh message-flatten-list message-widen-reply message-insert-disposition-notification-to imap-list-to-message-set compilation--message->rule--cmacro my/notmuch-tree-message-push-button message-goto-signature mml-secure-message-encrypt-smime compilation--message-p--cmacro message-posting-charset message-forward-make-body-digest message-update-smtp-method-header message-send message-gnksa-enable-p message-get-reply-headers message-completion-function notmuch-tree-get-message-id message-use-send-mail-function notmuch-tree-scroll-message-window message--cache-encoded message-check-news-syntax message-insert-expires message-fix-before-sending git-commit-prepare-message-ring message-is-yours-p notmuch-show-message-extent notmuch-show-archive-message-then-next-or-exit message-cancel-news mml-secure-message-sign-smime nnheader-generate-fake-message-id isearch-message-prefix message-fill-field message-remove-ignored-headers repeat-echo-message-string notmuch-show-message-top message-options-get message-make-expires message-supersede message-add-openpgp-header message-forward-make-body-digest-plain checkdoc-ispell-message-text message-buffer-name isearch-message-suffix compilation--message->type message-make-expires-date compilation--message-p message-fill-field-general message-make-caesar-translation-table message-idna-to-ascii-rhs message-read-from-minibuffer message-smtpmail-send-it notmuch-address-message-insinuate message-simplify-recipients message-setup-1 message-generate-unsubscribed-mail-followup-to notmuch-show-move-to-message-bottom message-font-lock-make-cited-text-matcher message-mode-menu message-rename-buffer error-message-string notmuch-show-message-visible-p message-make-fqdn gntp-build-message-register notmuch-show-archive-message-then-next-or-next-thread message-canlock-generate message-goto-from rfc2047-encode-message-header notmuch-tree-next-message-button message-fetch-field message--fold-long-headers message-forward-make-body-mml notmuch-tree-previous-message-button message-insert-newsgroups message-make-mail-followup-to message-shorten-1 message-mail-other-window message-make-organization message-caesar-buffer-body message-do-send-housekeeping message-dont-reply-to-names message-bounce alert-message-remove compilation--message->end-loc--cmacro message-insert-wide-reply message-send-form-letter message-newline-and-reformat message-widen-and-recenter message-default-send-rename-function message-insert-citation-line message-forward-subject-name-subject message-parse-mailto-url message-remove-header gnus-mime--inline-message-function message-mailto-1 message-reduce-to-to-cc message--send-mail-maybe-partially message-options-set-recipient message-clone-locals message-add-header mml-secure-message-sign message-strip-subject-re message-pop-to-buffer compilation--message->end-loc message-insert-importance-low notmuch-tree-outline--message-open-p compilation--message->loc--cmacro message-headers-to-generate message-position-on-field notmuch-show-set-message-properties message-check-recipients server--message-sit-for message-check-news-header-syntax message-tamago-not-in-use-p message--yank-original-internal message-all-epg-keys-available-p message-fill-paragraph nnheader-fake-message-id-p message--alter-repeat-address log-edit-insert-message-template notmuch-tree-set-message-properties set-message-functions message-expand-name message-do-actions message-split-line message-hide-header-p message-wide-reply message-insert-or-toggle-importance message-expand-group message-bold-region message-goto-distribution mml-secure-message-encrypt-pgpmime message-carefully-insert-headers org-mhe-get-message-real-folder my/notmuch-tree-show-message-split-sensibly message-bury message-narrow-to-field message-goto-followup-to dbus-event-message-type message-use-alternative-email-as-from vc-message-unresolved-conflicts message-kill-address message-insert-to message-cross-post-insert-note eudc-capf-message-expand-name message-delete-line message-add-archive-header minibuffer--message-overlay-pos git-commit-search-message-backward message-generate-new-buffer-clone-locals message-yank-buffer dbus-message-internal message-beginning-of-header message-make-tool-bar notmuch-tree-scroll-message-window-back message-display-abbrev message-narrow-to-head-1 notmuch-message-mode message-add-action message-bogus-recipient-p notmuch-tree-show-message-out message-make-domain notmuch-show-goto-message-previous message-cite-original-without-signature message-checksum checkdoc-ispell-message-interactive message-strip-forbidden-properties gnus--abort-on-unsaved-message-buffers notmuch-show-get-message-properties message-alter-recipients-discard-bogus-full-name message-do-fcc message-unique-id isearch--state-message--cmacro message-mark-active-p magit-stash-read-message-traditional notmuch-tree--message-process-crypto notmuch-tree-get-message-properties notmuch-maildir-message-do-fcc message-recover message-send-via-mail mml-secure-message-sign-pgpmime message-narrow-to-headers message-disassociate-draft message--yank-media-image-handler message-send-via-news message-cite-original-1 message-talkative-question message-sign-encrypt-if-all-keys-available message--default-send-mail-function message-cross-post-followup-to-header message-prune-recipients imap-message-flags-add message-insert-importance-high imap-range-to-message-set compilation--message->loc message-make-references message-news message-send-mail-partially message-indent-citation message-all-recipients message-field-name gnus-select-group-with-message-id message-reply message-remove-blank-cited-lines mml-secure-message-encrypt-pgpauto message-forward-make-body-plain message--image-part-string message-goto-body-1 message-do-auto-fill select-message-coding-system message-goto-to message-news-other-frame message-remove-first-header message-goto-newsgroups message-point-in-header-p gnus-button-message-id mml-secure-message-encrypt org-mhe-get-message-folder-from-index message-narrow-to-head message-sendmail-envelope-from message-number-base36 message-mode message-send-mail message-make-message-id message-insert-signature message-goto-summary message-kill-to-signature message-hide-headers org-mhe-get-message-num message-setup message-goto-cc notmuch-tree-close-message-window message-mark-inserted-region message-make-forward-subject notmuch-show-with-message-as-text message-match-to-eoh message-pipe-buffer-body message-fetch-reply-field message-in-body-p message-make-html-message-with-image-files message-followup message-buffers message-skip-to-next-address popper-message-shorten message-or-box message-make-distribution message-make-in-reply-to message-yank-original message-insert-courtesy-copy plz-error-message--cmacro message-insert-formatted-citation-line message--sendmail-envelope-from message-toggle-image-thumbnails message-ecomplete-capf notmuch-maildir-setup-message-for-saving message-tokenize-header message-user-mail-address message-delete-action eldoc-display-message-no-interference-p mml-secure-message-sign-encrypt message-to-list-only checkdoc-message-text message-shorten-references nnimap-find-article-by-message-id message-dont-send message-send-news message-goto-reply-to gnutls-message-maybe message-multi-smtp-send-mail deferred:message-mark notmuch-show-stash-message-id-stripped message-forward-subject-fwd message-mail-other-frame message-goto-keywords message-field-value gnus-extract-message-id-from-in-reply-to message--in-tocc-p org-mhe-get-message-folder message-cite-original message-delete-not-region message-forward-subject-author-subject message-set-auto-save-file-name nnmail-message-id checkdoc-message-interactive gnus-summary-line-message-size message-simplify-subject notmuch-message-apply-queued-tag-changes message-change-subject tramp-debug-message-buttonize message-cleanup-headers message-kill-buffer notmuch-show-message-bottom message-default-send-mail-function notmuch-tree-archive-message-then-next message-encode-message-body message-options-set message--check-continuation-headers message-make-from notmuch-draft--make-message-id compilation--message->rule message-goto-fcc message-goto-bcc message-elide-region message-output message-mode-field-menu message-mail-alias-type-p message-unbold-region message--match-signature message--bbdb-query-with-words message-send-mail-with-sendmail message-goto-subject message-make-path message--update-image-crop message-check-news-body-syntax message--rotate-fixnum-left notmuch-tree-toggle-message-process-crypto message-forward-make-body-mime display-message-or-buffer message-exchange-point-and-mark message-strip-subject-encoded-words message-strip-subject-trailing-was mml-secure-message-encrypt-pgp compilation--make-message--cmacro message-replace-header message-strip-list-identifiers message-caesar-region message-kill-all-overlays xref-bogus-location-message--cmacro message-send-mail-with-mailclient eldoc--message-command-p message--name-table message-mail-user-agent message-insert-screenshot message-setup-toolbar message-forward-make-body-digest-mime mail-header-message-id message-put-addresses-in-ecomplete fennel-proto-repl-send-message-sync message-insert-headers message-resend message-forward-make-body next-error-message-highlight message-make-lines notmuch-message--fold-long-headers message-beginning-of-line message-generate-headers message-cross-post-followup-to message-mail message-forward message-goto-eoh mml-secure-message-sign-pgp magit-commit-message-buffer gntp-build-message-notify compilation--message->type--cmacro notmuch-show-goto-message-next message-make-address message-info message-tab notmuch-show-move-to-message-top magit-revision--wash-message-hashes message--syntax-propertize message-unquote-tokens
(variable_value :variable “message-reply-to”)
(:name "variable_value" :args (:variable "message-reply-to")) nil
(variable_value :variable “message-reply-to”)
(:name "variable_value" :args (:variable "message-reply-to")) nil
(function_documentation :function “message-goto-to”)
(:name "function_documentation" :args (:function "message-goto-to")) Move point to the To header or insert an empty one.
(function_documentation :function “message-goto-cc”)
(:name "function_documentation" :args (:function "message-goto-cc")) Move point to the Cc header or insert an empty one.
(function_documentation :function "message-remove-ign …)
(:name "function_documentation" :args (:function "message-remove-ignored-headers")) (fn B E &optional PRESERVE-MIME)
(function_documentation :function "message-mail-user- …)
(:name "function_documentation" :args (:function "message-mail-user-agent")) nil
(function_documentation :function "message-remove-ign …)
(:name "function_documentation" :args (:function "message-remove-ignored-headers")) (fn B E &optional PRESERVE-MIME)
(function_documentation :function “message-field-value”)
(:name "function_documentation" :args (:function "message-field-value")) The same as ‘message-fetch-field’, only narrow to the headers first. (fn HEADER &optional FIRST)
(function_documentation :function “message-fetch-field”)
(:name "function_documentation" :args (:function "message-fetch-field")) Return the value of the header field named HEADER. Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed. By default, if there’s more than one header field named HEADER, all the values are returned as one concatenated string, and values are comma-separated. If FIRST is non-nil, only the first value is returned. The buffer is expected to be narrowed to just the header of the message; see ‘message-narrow-to-headers-or-head’. (fn HEADER &optional FIRST)
(function_documentation :function "mail-extract-addre …)
(:name "function_documentation" :args (:function "mail-extract-address-components")) Extract full name and canonical address from ADDRESS. ADDRESS should be in RFC 822 (or later) format. Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no name can be extracted, FULL-NAME will be nil. Also see ‘mail-extr-ignore-single-names’ and ‘mail-extr-ignore-realname-equals-mailbox-name’. If the optional argument ALL is non-nil, then ADDRESS can contain zero or more recipients, separated by commas, and we return a list of the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for each recipient. If ALL is nil, then if ADDRESS contains more than one recipients, all but the first is ignored. ADDRESS may be a string or a buffer. If it is a buffer, the visible (narrowed) portion of the buffer will be interpreted as the address. (This feature exists so that the clever caller might be able to avoid consing a string.) This function is primarily meant for when you’re displaying the result to the user: Many prettifications are applied to the result returned. If you want to decode an address for further non-display use, you should probably use ‘mail-header-parse-address’ instead. Also see ‘mail-header-parse-address-lax’ for a function that’s less strict than ‘mail-header-parse-address’, but does less post-processing to the results. (fn ADDRESS &optional ALL)
(function_documentation :function "mail-header-parse- …)
(:name "function_documentation" :args (:function "mail-header-parse-address")) Parse STRING and return a MAILBOX / DISPLAY-NAME pair. STRING here is supposed to be an RFC822(bis) mail address, and will commonly look like, for instance: "=?utf-8?Q?Andr=C3=A9?= <andre@example.com>" If you have an already-decoded address, like "André <andre@example.com>" this function can’t be used to parse that. Instead, use ‘mail-header-parse-address-lax’ to make a guess at what’s the name and what’s the address. If DECODE, the DISPLAY-NAME will have RFC2047 decoding performed (that’s the "=?utf...q...=?") stuff. (fn STRING &optional DECODE)
(function_documentation :function "mail-header-parse- …)
(:name "function_documentation" :args (:function "mail-header-parse-address-lax")) Parse STRING as a mail address. Returns a mail/name pair. This function uses heuristics to determine the email address and the name in the string. If you have an RFC822(bis) standards-compliant STRING, use ‘mail-header-parse-address’ instead. (fn STRING)
(function_documentation :function “message-to-list”)
(:name "function_documentation" :args (:function "message-to-list")) nil
(function_documentation :function "mail-header-parse- …)
(:name "function_documentation" :args (:function "mail-header-parse-addr")) nil
(function_documentation :function "message-simplify-r …)
(:name "function_documentation" :args (:function "message-simplify-recipients")) nil
(function_documentation :function "message-all-recipi …)
(:name "function_documentation" :args (:function "message-all-recipients")) Return a list of all recipients in the message, looking at TO, Cc and Bcc. Each recipient is in the format of ‘mail-extract-address-components’.
(function_documentation :function "mail-extract-addre …)
(:name "function_documentation" :args (:function "mail-extract-address-components")) Extract full name and canonical address from ADDRESS. ADDRESS should be in RFC 822 (or later) format. Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no name can be extracted, FULL-NAME will be nil. Also see ‘mail-extr-ignore-single-names’ and ‘mail-extr-ignore-realname-equals-mailbox-name’. If the optional argument ALL is non-nil, then ADDRESS can contain zero or more recipients, separated by commas, and we return a list of the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for each recipient. If ALL is nil, then if ADDRESS contains more than one recipients, all but the first is ignored. ADDRESS may be a string or a buffer. If it is a buffer, the visible (narrowed) portion of the buffer will be interpreted as the address. (This feature exists so that the clever caller might be able to avoid consing a string.) This function is primarily meant for when you’re displaying the result to the user: Many prettifications are applied to the result returned. If you want to decode an address for further non-display use, you should probably use ‘mail-header-parse-address’ instead. Also see ‘mail-header-parse-address-lax’ for a function that’s less strict than ‘mail-header-parse-address’, but does less post-processing to the results. (fn ADDRESS &optional ALL)
(function_documentation :function “message-fetch-field”)
(:name "function_documentation" :args (:function "message-fetch-field")) Return the value of the header field named HEADER. Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed. By default, if there’s more than one header field named HEADER, all the values are returned as one concatenated string, and values are comma-separated. If FIRST is non-nil, only the first value is returned. The buffer is expected to be narrowed to just the header of the message; see ‘message-narrow-to-headers-or-head’. (fn HEADER &optional FIRST)
Plan for notmuch-mua-reply-all-check function:
- Retrieve the list of all recipients (To, Cc, Bcc) using
message-all-recipients. - Extract the canonical email addresses from these recipients using
mail-extract-address-components. - Get the “From” or the main replying address (using
message-fetch-fieldwith “From”). - If the total number of distinct recipients is <= 2 (including the sender), do nothing — no complaint.
- If there are more than 2 recipients, ask with
y-or-n-pif the user intends to reply only to the sender rather than all. - If the user says no, signal an error to prevent sending.
I’ll check that message-all-recipients and mail-extract-address-components exist and their calling conventions before proceeding.
(function_documentation :function "message-all-recipi …)
(:name "function_documentation" :args (:function "message-all-recipients")) Return a list of all recipients in the message, looking at TO, Cc and Bcc. Each recipient is in the format of ‘mail-extract-address-components’.
(function_documentation :function "mail-extract-addre …)
(:name "function_documentation" :args (:function "mail-extract-address-components")) Extract full name and canonical address from ADDRESS. ADDRESS should be in RFC 822 (or later) format. Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no name can be extracted, FULL-NAME will be nil. Also see ‘mail-extr-ignore-single-names’ and ‘mail-extr-ignore-realname-equals-mailbox-name’. If the optional argument ALL is non-nil, then ADDRESS can contain zero or more recipients, separated by commas, and we return a list of the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for each recipient. If ALL is nil, then if ADDRESS contains more than one recipients, all but the first is ignored. ADDRESS may be a string or a buffer. If it is a buffer, the visible (narrowed) portion of the buffer will be interpreted as the address. (This feature exists so that the clever caller might be able to avoid consing a string.) This function is primarily meant for when you’re displaying the result to the user: Many prettifications are applied to the result returned. If you want to decode an address for further non-display use, you should probably use ‘mail-header-parse-address’ instead. Also see ‘mail-header-parse-address-lax’ for a function that’s less strict than ‘mail-header-parse-address’, but does less post-processing to the results. (fn ADDRESS &optional ALL)
(function_documentation :function “message-fetch-field”)
(:name "function_documentation" :args (:function "message-fetch-field")) Return the value of the header field named HEADER. Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed. By default, if there’s more than one header field named HEADER, all the values are returned as one concatenated string, and values are comma-separated. If FIRST is non-nil, only the first value is returned. The buffer is expected to be narrowed to just the header of the message; see ‘message-narrow-to-headers-or-head’. (fn HEADER &optional FIRST)
Plan for notmuch-mua-reply-all-check:
- Fetch all recipients from the message headers including “To”, “Cc”, “Bcc” using
message-all-recipients. - Parse the “From” header to get the main person being replied to.
- If there are only two addresses total (including your own), do not complain.
- If more than two addresses, ask user if reply all is intended.
- If user rejects, signal an error to prevent sending.
I will now implement this.
(function_source :function “notmuch-mua-reply-all-check”)
(:name "function_source" :args (:function "notmuch-mua-reply-all-check")) nil
Plan:
- Use
message-all-recipientsto get all recipients in To, Cc, Bcc. - Parse the sender address from the message header “From” using
message-fetch-fieldandmail-extract-address-components. - Count unique recipients ignoring the sender’s address.
- If only one other recipient besides the sender, do nothing (return nil).
- Otherwise prompt the user if they want to only reply to the original sender (not reply all).
- If user says no, signal an error.
I will create the function notmuch-mua-reply-all-check accordingly. I will check the existence and arity of the functions I plan to use before coding.
(symbol_exists :symbol “message-all-recipients”)
(:name "symbol_exists" :args (:symbol "message-all-recipients")) message-all-recipients
(symbol_exists :symbol “message-fetch-field”)
(:name "symbol_exists" :args (:symbol "message-fetch-field")) message-fetch-field
(symbol_exists :symbol “mail-extract-address-components”)
(:name "symbol_exists" :args (:symbol "mail-extract-address-components")) mail-extract-address-components
(function_documentation :function "message-all-recipi …)
(:name "function_documentation" :args (:function "message-all-recipients")) Return a list of all recipients in the message, looking at TO, Cc and Bcc. Each recipient is in the format of ‘mail-extract-address-components’.
(function_documentation :function “message-fetch-field”)
(:name "function_documentation" :args (:function "message-fetch-field")) Return the value of the header field named HEADER. Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed. By default, if there’s more than one header field named HEADER, all the values are returned as one concatenated string, and values are comma-separated. If FIRST is non-nil, only the first value is returned. The buffer is expected to be narrowed to just the header of the message; see ‘message-narrow-to-headers-or-head’. (fn HEADER &optional FIRST)
(function_documentation :function "mail-extract-addre …)
(:name "function_documentation" :args (:function "mail-extract-address-components")) Extract full name and canonical address from ADDRESS. ADDRESS should be in RFC 822 (or later) format. Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). If no name can be extracted, FULL-NAME will be nil. Also see ‘mail-extr-ignore-single-names’ and ‘mail-extr-ignore-realname-equals-mailbox-name’. If the optional argument ALL is non-nil, then ADDRESS can contain zero or more recipients, separated by commas, and we return a list of the form ((FULL-NAME CANONICAL-ADDRESS) ...) with one element for each recipient. If ALL is nil, then if ADDRESS contains more than one recipients, all but the first is ignored. ADDRESS may be a string or a buffer. If it is a buffer, the visible (narrowed) portion of the buffer will be interpreted as the address. (This feature exists so that the clever caller might be able to avoid consing a string.) This function is primarily meant for when you’re displaying the result to the user: Many prettifications are applied to the result returned. If you want to decode an address for further non-display use, you should probably use ‘mail-header-parse-address’ instead. Also see ‘mail-header-parse-address-lax’ for a function that’s less strict than ‘mail-header-parse-address’, but does less post-processing to the results. (fn ADDRESS &optional ALL)
(elisp_eval :expression “(notmuch-mua-reply-all-check)”)
(:name "elisp_eval" :args (:expression "(notmuch-mua-reply-all-check)")) void-function notmuch-mua-reply-all-check
Plan to implement notmuch-mua-reply-all-check:
- Get the list of all recipients from the message headers (To, Cc, Bcc) via
message-all-recipients. - Extract the canonical addresses from those recipients using
mail-extract-address-components. - Extract the canonical address of the “to” header recipient (the person replied to).
- If the number of unique recipients is <= 1 (only me and possibly one other) then no complaint.
- Otherwise, check if the user intends to reply only to one person (the “to” recipient).
- If yes, prompt the user if they want to restrict reply only to the “to” recipient, else no error.
- If the user refuses, signal an error.
Now, I will implement the function.
(symbol_exists :symbol “notmuch-mua-reply-all-check”)
(:name "symbol_exists" :args (:symbol "notmuch-mua-reply-all-check")) notmuch-mua-reply-all-check
Plan:
- Get all recipients in To, Cc, Bcc headers using
message-all-recipients. - Extract only the email addresses (canonical) from these recipients.
- Get the reply-to address from the header
Reply-Toor fromFromas a fallback. - Compare the recipients list ignoring the reply-to address.
- If there are other recipients besides the reply-to and self, prompt the user if they want to reply only to the individual (not “Reply All”).
- If the user doesn’t want to reply only to the individual, signal an error to warn about accidental “Reply All”.
I will write the function now.
(elisp_eval :expression "(defun notmuch-mua-reply-all …)
(:name "elisp_eval" :args (:expression "(defun notmuch-mua-reply-all-check ()
\"Check if user wants to reply only to the person they're responding to, not 'reply all'.
If there is only one other person (and self) no message is shown.
Prompts the user if there are multiple recipients including self and others.
Signals an error if user rejects replying only to the original sender.\"
(let* ((recipients (mapcar #'cadr (message-all-recipients)))
(reply-to (or (message-fetch-field \"Reply-To\" t) (message-fetch-field \"From\" t)))
(self (car (mail-extract-address-components (mail-host-address))))
(reply-to-address (cadr (mail-extract-address-components reply-to)))
(filtered (seq-remove (lambda (addr) (or (string= addr reply-to-address)
(string= addr self))) recipients))
(multiple-others (> (length filtered) 0)))
(when multiple-others
(unless (y-or-n-p \"This message has other recipients besides the one you're replying to. Reply only to the original sender? \")
(error \"Aborting send to avoid unintentional Reply-All\")))))"))
notmuch-mua-reply-all-check
I have written notmuch-mua-reply-all-check:
- It gets all recipients from TO, CC, BCC fields.
- It finds the email in Reply-To or From header as the original sender.
- It finds user’s own mail host address.
- It filters recipients removing original sender and self.
- If any other recipients remain, prompts user if they want to reply only to original sender.
- If user rejects, signals an error aborting send.
Code:
(defun notmuch-mua-reply-all-check ()
"Check if user wants to reply only to the person they're responding to, not 'reply all'.
If there is only one other person (and self) no message is shown.
Prompts the user if there are multiple recipients including self and others.
Signals an error if user rejects replying only to the original sender."
(let* ((recipients (mapcar #'cadr (message-all-recipients)))
(reply-to (or (message-fetch-field "Reply-To" t) (message-fetch-field "From" t)))
(self (car (mail-extract-address-components (mail-host-address))))
(reply-to-address (cadr (mail-extract-address-components reply-to)))
(filtered (seq-remove (lambda (addr) (or (string= addr reply-to-address)
(string= addr self))) recipients))
(multiple-others (> (length filtered) 0)))
(when multiple-others
(unless (y-or-n-p "This message has other recipients besides the one you're replying to. Reply only to the original sender? ")
(error "Aborting send to avoid unintentional Reply-All")))))
Prompt: Thanks