2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ;; Release: $efs release: 1.24 $
6 ;; Version: #Revision: 1.11 $
8 ;; Description: Function to report efs bugs in a usable way.
9 ;; Author: Andy Norman, Dawn
10 ;; Created: Tue May 18 08:34:45 1993
11 ;; Language: Emacs-Lisp
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 (autoload 'reporter-submit-bug-report "reporter")
18 (defvar reporter-version) ; For the byte-compiler
22 (defconst efs-report-version
23 (concat (substring "$efs release: 1.24 $" 14 -2)
25 (substring "#Revision: 1.10 $" 11 -2)))
27 (defconst efs-report-salutations
32 "To whom it may concern:"
34 "Greetings earthlings:"])
36 (defvar efs-bug-address "elisp-code-efs@nongnu.org")
38 (defconst efs-report-other-vars
39 ;; List of variables needed for efs-report, that aren't generated below.
40 '(efs-ftp-program-name
43 efs-ftp-local-host-regexp
49 (defconst efs-report-avoid-vars
50 ;; List of variables we don't want to see.
56 ;; Dynamically bound. Used to pass data to hooks.
57 (defvar efs-report-default-host nil)
58 (defvar efs-report-default-user nil)
59 (defvar efs-report-blurb nil)
63 (defun efs-report-get-host-type-regexps ()
64 "Return a list of host type regexp's which are non-nil."
65 (let ((list efs-host-type-alist)
67 (while (setq ent (car list))
68 (if (symbol-value (cdr ent))
69 (setq result (cons (cdr ent) result)))
70 (setq list (cdr list)))
73 (defun efs-report-get-versions ()
74 ;; Return a list of efs versions variables.
78 (let (completion-ignore-case)
84 (let ((name (symbol-name sym)))
85 (and (>= (length name) 8)
86 (string-equal (substring name -8) "-version"))))))))
89 (defun efs-report-get-user-vars ()
90 ;; Return a list of efs user variables.
94 (let (completion-ignore-case)
95 (all-completions "efs-" obarray 'user-variable-p))
98 (defun efs-report-pre-hook ()
99 ;; efs-report-default-host, efs-report-default-user, and
100 ;; efs-report-blurb are dynamically bound.
102 (let ((end (progn (mail-position-on-field "subject") (point))))
104 (search-forward ":" end)
105 (delete-region (point) end)
108 (or (and (boundp 'efs-version) (string-match "/" efs-version)
109 (concat (substring efs-version 0 (match-beginning 0))
113 (let ((host (read-string "Bug occurred for remote host: "
114 efs-report-default-host))
115 (user (read-string "Logged in as: "
116 efs-report-default-user))
118 (if (string-match "^ *$" host) (setq host nil))
119 (if (string-match "^ *$" user) (setq user nil))
121 (insert "\nefs believes that the host type of " host " is "
122 (symbol-name (efs-host-type host))
125 (insert "\n" efs-report-blurb "\n"))
128 (get-buffer (setq buff-name (efs-ftp-process-buffer host user)))
129 (save-window-excursion
132 (with-output-to-temp-buffer "*Help*"
136 will likely very useful for identifying any bugs.
138 You will be given a chance to edit out any sensitive information.
139 Passwords are never written into this buffer." buff-name)))
140 (format "Insert contents of %s? "
142 (let ((header-1 (concat "Contents of " buff-name ":"))
143 (header-2 "Please edit sensitive or irrelevant information."))
144 (insert "\n" header-1 "\n" header-2 "\n")
145 (insert-char ?= (max (length header-1) (length header-2)))
147 (insert-buffer-substring buff-name)
150 (defun efs-report-post-hook ()
151 ;; Post hook run by report-submit-bug-report.
153 (mail-position-on-field "subject")
154 (let ((subj (read-string "Subject header: ")))
155 (if (string-equal subj "")
156 (subst-char-in-region
160 (if (or (fboundp 'yow) (load "yow" t t)) (yow) ""))
166 (defun efs-report-bug (&optional default-host default-user blurb no-confirm)
167 "Submit a bug report for efs."
169 (let (;; reporter-confirm-p and reporter-package-abbrev appeared once
170 ;; as fluid vars in reporter.el. They aren't used any longer,
171 ;; but we let-bind them anyway in case the user has an old version
173 (reporter-confirm-p nil)
174 (reporter-prompt-for-summary-p nil)
175 (reporter-package-abbrev "efs"))
176 ;; Look out for old reporter versions.
177 (or (boundp 'reporter-version)
178 (setq reporter-version
179 "Your version of reporter is obsolete. Please upgrade."))
181 (y-or-n-p "Do you want to submit a bug report on efs? "))
182 (let ((efs-report-default-host default-host)
183 (efs-report-default-user default-user)
184 (efs-report-blurb blurb)
185 (vars (nconc (efs-report-get-versions)
186 (efs-report-get-user-vars)
187 efs-report-other-vars
188 (efs-report-get-host-type-regexps)))
189 (avoids efs-report-avoid-vars)
192 ((or efs-report-default-host efs-report-default-user))
194 (setq efs-report-default-host efs-process-host
195 efs-report-default-user efs-process-user))
196 ((setq path (or buffer-file-name
197 (and (eq major-mode 'dired-mode)
199 (let ((parsed (efs-ftp-path path)))
200 (setq efs-report-default-host (car parsed)
201 efs-report-default-user (nth 1 parsed)))))
203 (setq vars (delq (car avoids) vars))
204 (setq avoids (cdr avoids)))
205 (reporter-submit-bug-report
209 (function efs-report-pre-hook)
210 (function efs-report-post-hook)
211 (aref efs-report-salutations
212 (% (+ (% (random) 1000) 1000)
213 (length efs-report-salutations))))))))
215 ;;; end of efs-report.el