You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
1.6 KiB

  1. ;; Vague implementation of needed code to invoke Gnus from reportbug
  2. ;; by Tollef Fog Heen
  3. (require 'gnus)
  4. ;; Match each component of Gnus' version number.
  5. (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)\\(?:\\.\\([0-9]+\\)\\)?$"
  6. gnus-version-number)
  7. ;; Only load gnus-load if using a separately packaged Gnus (that is,
  8. ;; not the Gnus bundled with Emacs).
  9. (if (or
  10. ;; Check for a separately packaged release of Gnus
  11. ;; (second component of version number even):
  12. (= (% (string-to-number (match-string 2 gnus-version-number)) 2) 0)
  13. ;; Check for a separately packaged pre-release of Gnus
  14. ;; (first component of version number 0):
  15. (= (string-to-number (match-string 1 gnus-version-number)) 0))
  16. (require 'gnus-load))
  17. (defun tfheen-set-header (header value)
  18. "Insert a string at the beginning of a header."
  19. (message-narrow-to-head)
  20. (goto-char (point-min))
  21. (search-forward (format "%s: " header) (point-max) t)
  22. (insert value)
  23. (widen))
  24. (defun tfheen-reportbug-insert-template (reportbug-template)
  25. (interactive)
  26. (require 'gnus)
  27. (find-file reportbug-template)
  28. (let ((subject (message-fetch-field "Subject"))
  29. (toaddr (or (message-fetch-field "To") "submit@bugs.debian.org")))
  30. (gnus-narrow-to-body)
  31. (let ((body (or (buffer-string) "")))
  32. (gnus-summary-mail-other-window)
  33. (tfheen-set-header "Subject" subject)
  34. (tfheen-set-header "To" toaddr)
  35. (gnus-narrow-to-body)
  36. (insert body)
  37. (goto-char (point-min))
  38. (search-forward "\n\n" nil t)
  39. (widen)))
  40. (kill-buffer (find-buffer-visiting reportbug-template)))