(defun report-org-mode-bug (topic &optional recent-keys) "Report a bug in GNU Emacs. Prompts for bug subject. Leaves you in a mail buffer." ;; This strange form ensures that (recent-keys) is the value before ;; the bug subject string is read. (interactive (reverse (list (recent-keys) (concat "org-mode; " (read-string "Bug Subject: ") )))) ;; The syntax `version;' is preferred to `[version]' because the ;; latter could be mistakenly stripped by mailing software. (if (eq system-type 'ms-dos) (setq topic (concat emacs-version "; " topic)) (when (string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version) (setq topic (concat (match-string 1 emacs-version) "; " topic)))) (let ((from-buffer (current-buffer)) ;; Put these properties on semantically-void text. ;; report-emacs-bug-hook deletes these regions before sending. (prompt-properties '(field emacsbug-prompt intangible but-helpful rear-nonsticky t)) (can-insert-mail (or (report-emacs-bug-can-use-xdg-email) (report-emacs-bug-can-use-osx-open))) user-point message-end-point) (setq message-end-point (with-current-buffer (get-buffer-create "*Messages*") (point-max-marker))) (compose-mail report-emacs-bug-address topic) ;; The rest of this does not execute if the user was asked to ;; confirm and said no. (when (eq major-mode 'message-mode) ;; Message-mode sorts the headers before sending. We sort now so ;; that report-emacs-bug-orig-text remains valid. (Bug#5178) (message-sort-headers) ;; Stop message-mode stealing the properties we will add. (set (make-local-variable 'message-strip-special-text-properties) nil)) (rfc822-goto-eoh) (forward-line 1) ;; Move the mail signature to the proper place. (let ((signature (buffer-substring (point) (point-max))) (inhibit-read-only t)) (delete-region (point) (point-max)) (insert signature) (backward-char (length signature))) ;; (with-help-window "*help-org-mode-bug*" (insert (concat "Please describe exactly what actions triggered the bug, and\n" ;; "the precise symptoms of the bug. If you can, give a recipe\n" ;; "starting from `emacs -Q':\n\n" ;; ;; "If Emacs crashed, and you have the Emacs process in the gdb debugger,\n" ;; "please include the output from the following gdb commands:\n" ;; " `bt full' and `xbacktrace'.\n" ;; ))) ;; (let ((debug-file (expand-file-name "DEBUG" data-directory))) ;; (if (file-readable-p debug-file) ;; (insert "For information about debugging Emacs, please read the file\n" ;; debug-file ".\n") ;; )) (add-text-properties (save-excursion (rfc822-goto-eoh) (line-beginning-position 2)) (point) prompt-properties) (setq user-point (point)) (insert "\n\n") (add-text-properties (1+ user-point) (point) prompt-properties) (insert "\n\nIn " (emacs-version) "\n") (when (and (boundp 'emacs-bzr-version)(stringp emacs-bzr-version)) (insert "Bzr revision: " emacs-bzr-version "\n")) (insert "\n") (insert (format "Major mode: %s\n" (format-mode-line (buffer-local-value 'mode-name from-buffer) nil nil from-buffer))) (insert "\n") ;; This is so the user has to type something in order to send easily. (use-local-map (nconc (make-sparse-keymap) (current-local-map))) (define-key (current-local-map) "\C-c\C-i" 'info-emacs-bug) (if can-insert-mail (define-key (current-local-map) "\C-cm" 'report-emacs-bug-insert-to-mailer)) (setq report-emacs-bug-send-command (get mail-user-agent 'sendfunc) report-emacs-bug-send-hook (get mail-user-agent 'hookvar)) (if report-emacs-bug-send-command (setq report-emacs-bug-send-command (symbol-name report-emacs-bug-send-command))) (unless report-emacs-bug-no-explanations (with-output-to-temp-buffer "*Bug Help*" (princ "While in the mail buffer:\n\n") (if report-emacs-bug-send-command (princ (substitute-command-keys (format " Type \\[%s] to send the bug report.\n" report-emacs-bug-send-command)))) (princ (substitute-command-keys " Type \\[kill-buffer] RET to cancel (don't send it).\n")) (if can-insert-mail (princ (substitute-command-keys " Type \\[report-emacs-bug-insert-to-mailer] to copy text to your preferred mail program.\n"))) (terpri) (princ (substitute-command-keys " Type \\[info-emacs-bug] to visit in Info the Emacs Manual section about when and how to write a bug report, and what information you should include to help fix the bug."))) (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*"))) ;; Make it less likely people will send empty messages. (if report-emacs-bug-send-hook (add-hook report-emacs-bug-send-hook 'report-emacs-bug-hook nil t)) (goto-char (point-max)) (skip-chars-backward " \t\n") (make-local-variable 'report-emacs-bug-orig-text) (setq report-emacs-bug-orig-text (buffer-substring-no-properties (point-min) (point))) (goto-char user-point)))