- ;; This only works for mailers that support mail-send-hook,
- ;; e.g. sendmail.el
- (if (fboundp 'add-hook)
- (progn
- (save-excursion
- (goto-char (point-max))
- (skip-chars-backward " \t\n")
- (setq reporter-initial-text
- (buffer-substring after-sep-pos (point))))
- (make-variable-buffer-local 'mail-send-hook)
- (add-hook 'mail-send-hook 'reporter-bug-hook)))
-
- ;; minibuf message
- ;; C-c C-c can't be generalized because they don't always run
- ;; mail-send-and-exit. E.g. vm-mail-send-and-exit. I don't want
- ;; to hard code these.
- (let* ((sendkey "C-c C-c")
- (killkey-whereis (where-is-internal 'kill-buffer nil t))
- (killkey (if killkey-whereis
- (key-description killkey-whereis)
- "M-x kill-buffer")))
- (message "Please type in your report. Hit %s to send, %s to abort."
- sendkey killkey))
+ ;; This only works for mailers that support a pre-send hook, and
+ ;; for which the paradigm has a non-nil value for the `hookvar'
+ ;; key in its agent (i.e. sendmail.el's mail-send-hook).
+ (save-excursion
+ (goto-char (point-max))
+ (skip-chars-backward " \t\n")
+ (setq reporter-initial-text (buffer-substring after-sep-pos (point))))
+ (if (setq hookvar (get agent 'hookvar))
+ (add-hook hookvar 'reporter-bug-hook nil t))
+
+ ;; compose the minibuf message and display this.
+ (let* ((sendkey-whereis (where-is-internal
+ (get agent 'sendfunc) nil t))
+ (abortkey-whereis (where-is-internal
+ (get agent 'abortfunc) nil t))
+ (sendkey (if sendkey-whereis
+ (key-description sendkey-whereis)
+ "C-c C-c")) ; TBD: BOGUS hardcode
+ (abortkey (if abortkey-whereis
+ (key-description abortkey-whereis)
+ "M-x kill-buffer")) ; TBD: BOGUS hardcode
+ )
+ (message "Please enter your report. Type %s to send, %s to abort."
+ sendkey abortkey))