mirror of https://github.com/djcb/mu.git
bug-reference: Add clarifying comment / checked-headers as variable
This commit is contained in:
parent
fdbf912e06
commit
cbeed9ef28
|
@ -1311,24 +1311,33 @@ the third MIME-part."
|
||||||
|
|
||||||
;;; Bug Reference mode support
|
;;; Bug Reference mode support
|
||||||
|
|
||||||
|
;; Due to mu4e's view buffer handling (mu4e-view-mode is called long before the
|
||||||
|
;; actual mail text is inserted into the buffer), one should activate
|
||||||
|
;; bug-reference-mode in mu4e-after-view-message-hook, not mu4e-view-mode-hook.
|
||||||
|
|
||||||
;; This is Emacs 28 stuff but there is no need to guard it with some (f)boundp
|
;; This is Emacs 28 stuff but there is no need to guard it with some (f)boundp
|
||||||
;; checks (which would return nil if bug-reference.el is not loaded before
|
;; checks (which would return nil if bug-reference.el is not loaded before
|
||||||
;; mu4e) since the function definition doesn't hurt and `add-hook' works fine
|
;; mu4e) since the function definition doesn't hurt and `add-hook' works fine
|
||||||
;; for not yet defined variables (by creating them).
|
;; for not yet defined variables (by creating them).
|
||||||
(declare-function bug-reference-maybe-setup-from-mail "ext:bug-reference")
|
(declare-function bug-reference-maybe-setup-from-mail "ext:bug-reference")
|
||||||
|
|
||||||
|
(defvar mu4e--view-bug-reference-checked-headers
|
||||||
|
'("list" "list-id" "to" "from" "cc" "subject" "reply-to")
|
||||||
|
"List of mail headers whose values are passed to bug-reference's auto-setup.")
|
||||||
|
|
||||||
(defun mu4e--view-try-setup-bug-reference-mode ()
|
(defun mu4e--view-try-setup-bug-reference-mode ()
|
||||||
"Try to guess bug-reference setup from the current mu4e mail.
|
"Try to guess bug-reference setup from the current mu4e mail.
|
||||||
Looks at the maildir and the mail headers List, List-Id, Maildir,
|
Looks at the maildir and the mail headers in
|
||||||
To, From, Cc, and Subject and tries to guess suitable values for
|
`mu4e--view-bug-reference-checked-headers' and tries to guess suitable
|
||||||
`bug-reference-bug-regexp' and `bug-reference-url-format' by
|
values for `bug-reference-bug-regexp' and
|
||||||
matching the maildir name against GROUP-REGEXP and each header
|
`bug-reference-url-format' by matching the maildir name against
|
||||||
value against HEADER-REGEXP in
|
GROUP-REGEXP and each header value against HEADER-REGEXP in
|
||||||
`bug-reference-setup-from-mail-alist'."
|
`bug-reference-setup-from-mail-alist'."
|
||||||
(when (derived-mode-p 'mu4e-view-mode)
|
(when (derived-mode-p 'mu4e-view-mode)
|
||||||
(let (header-values)
|
(let (header-values)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(dolist (field '("list" "list-id" "to" "from" "cc" "subject"))
|
(dolist (field mu4e--view-bug-reference-checked-headers)
|
||||||
(let ((val (mail-fetch-field field)))
|
(let ((val (mail-fetch-field field)))
|
||||||
(when val
|
(when val
|
||||||
(push val header-values)))))
|
(push val header-values)))))
|
||||||
|
|
Loading…
Reference in New Issue