File: w3m-bug.el

package info (click to toggle)
w3m-el 1.4.538%2B0.20141022-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,416 kB
  • ctags: 3,724
  • sloc: lisp: 44,834; sh: 486; makefile: 404
file content (192 lines) | stat: -rw-r--r-- 6,352 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
;;; w3m-bug.el --- command to report emacs-w3m bugs -*- coding: euc-japan -*-

;; Copyright (C) 2002, 2003, 2005, 2007, 2010
;; TSUCHIYA Masatoshi <tsuchiya@namazu.org>

;; Author: Katsumi Yamaoka <yamaoka@jpl.org>
;; Keywords: w3m, WWW, hypermedia

;; This file is a part of emacs-w3m.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:

;; `M-x report-emacs-w3m-bug' starts an email note to the emacs-w3m
;; developers describing a problem.

;;; Code:

(defvar report-emacs-w3m-bug-address "emacs-w3m@namazu.org"
  "*Address of mailing list for emacs-w3m bugs.")

(defvar report-emacs-w3m-bug-no-explanations nil
  "*If non-nil, suppress the explanations given for the sake of novice users.")

(defconst report-emacs-w3m-bug-system-informations
  (eval
   '`(emacs-w3m-version
      emacs-version
      ,@(if (or (boundp 'mule-version)
		(functionp 'mule-version))
	    '(mule-version))
      ,@(cond ((featurep 'xemacs)
	       '((featurep 'mule)
		 (featurep 'file-coding)))
	      ((or (boundp 'Meadow-version)
		   (functionp 'Meadow-version))
	       '(Meadow-version)))
      system-type
      (featurep 'gtk)
      w3m-version
      w3m-type
      w3m-compile-options
      w3m-language
      w3m-command-arguments
      w3m-command-arguments-alist
      w3m-command-environment
      w3m-input-coding-system
      w3m-output-coding-system
      w3m-use-mule-ucs))
  "List of the system informations.  Users should NEVER modify the value."
  ;; For the developers:
  ;; It is possible that it would be a security hole.  To prevent those
  ;; rogue attacks, this constant should be reloaded for each time to
  ;; send a bug report.  Each element can be the symbol of a variable,
  ;; a Lisp function with no argument or any Lisp form to be evaluated.
  )

(eval-when-compile
  (require 'cl))

(defun report-emacs-w3m-bug (topic &optional buffer)
  "Report a bug in emacs-w3m.
Prompts for bug subject.  Leaves you in a mail buffer."
  (interactive
   (let* ((buffer (current-buffer))
	  (buffers (cons buffer (delq buffer (buffer-list))))
	  (inhibit-point-motion-hooks t)
	  keymap)
     (save-current-buffer
       (while buffers
	 (setq buffer (car buffers)
	       buffers (cdr buffers))
	 (set-buffer buffer)
	 (save-restriction
	   (widen)
	   (if (or (eq major-mode 'w3m-mode)
		   (and (keymapp (setq keymap
				       (or (get-text-property
					    (max (1- (point-max)) (point-min))
					    'keymap)
					   (get-text-property
					    (max (1- (point-max)) (point-min))
					    'local-map)))))
		   (where-is-internal 'w3m-print-current-url keymap))
	       (setq buffers nil)
	     (setq buffer nil)))))
     (list (read-string "Bug Subject: ") buffer)))
  (let (after-load-alist)
    ;; See the comment for `report-emacs-w3m-bug-system-informations'.
    (load "w3m-bug"))
  (compose-mail report-emacs-w3m-bug-address topic nil 'new)
  (goto-char (point-min))
  (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
  (forward-line 1)
  (unless buffer
    (insert
     (if (and (boundp 'w3m-language)
	      (equal (symbol-value 'w3m-language) "Japanese"))
	 "⤷ǽʤ emacs-w3m ưƤľƤ\n"
       "It is if possible, please redo after starting emacs-w3m.\n")
     "\
================================================================\n"))
  (unless report-emacs-w3m-bug-no-explanations
    ;; Insert warnings for the novice users.
    (if (and (boundp 'w3m-language)
	     (equal (symbol-value 'w3m-language) "Japanese"))
	(progn
	  (insert "ΥХݡȤ emacs-w3m ȯޤ\n")
	  (put-text-property (point)
			     (progn
			       (insert "\
ʤΥ륵Ȥδ԰ƤǤϤޤ!!")
			       (point))
			     'face 'underline)
	  (insert "\n\nǤʷ˽Ҥ٤Ƥ:
\t- ޤ?
\t- Ϥɤʤ٤äȻפޤ?
\t- ΤȤ򤷤ޤ? (Τ)

⤷ Lisp ΥХåȥ졼źդƤ\n"))
      (insert "\
This bug report will be sent to the emacs-w3m development team,\n")
      (put-text-property (point)
			 (progn
			   (insert " not to your local site managers!!")
			   (point))
			 'face 'italic)
      (insert "\nPlease write in ")
      (put-text-property (point) (progn
				   (insert "simple")
				   (point))
			 'face 'italic)
      (insert " English, because the emacs-w3m developers
aren't good at English reading. ;-)

Please describe as succinctly as possible:
\t- What happened.
\t- What you thought should have happened.
\t- Precisely what you were doing at the time.

Please also include any Lisp back-traces that you may have.\n"))
    (insert "\
================================================================\n"))
  (insert "Dear Bug Team!\n\n")
  (let ((user-point (point))
	(print-escape-newlines t)
	(print-quoted t)
	infos print-length print-level)
    (insert "\n
================================================================

System Info to help track down your bug:
---------------------------------------\n")
    (with-current-buffer (or buffer (current-buffer))
      (dolist (info report-emacs-w3m-bug-system-informations)
	(push (prin1-to-string info) infos)
	(push "\n => " infos)
	(push (cond ((functionp info)
		     (prin1-to-string (condition-case code
					  (funcall info)
					(error
					 code))))
		    ((symbolp info)
		     (prin1-to-string (condition-case code
					  (symbol-value info)
					(error
					 code))))
		    ((consp info)
		     (prin1-to-string (condition-case code
					  (eval info)
					(error
					 code)))))
	      infos)
	(push "\n" infos)))
    (apply 'insert (nreverse infos))
    (goto-char user-point)))

;;; w3m-bug.el ends here