efs / efs-report.el

;; -*-Emacs-Lisp-*-
;; File:         efs-report.el
;; Release:      $efs release: 1.19 $
;; Version:      #Revision: 1.10 $
;; RCS:          
;; Description:  Function to report efs bugs in a usable way.
;; Author:       Andy Norman, Dawn
;; Created:      Tue May 18 08:34:45 1993
;; Language:     Emacs-Lisp

(provide 'efs-report)
(require 'efs)
(autoload 'reporter-submit-bug-report "reporter")
(defvar reporter-version) ; For the byte-compiler

;;; Variables

(defconst efs-report-version
  (concat (substring "$efs release: 1.19 $" 14 -2)
	  (substring "#Revision: 1.10 $" 11 -2)))

(defconst efs-report-salutations
  ["Dear bug team:"
   "Ciao bug team:"
   "Salut bug team:"
   "Gruss bug team:"
   "To whom it may concern:"
   "Fellow efs'ers:"
   "Greetings earthlings:"])

(defvar efs-bug-address "")

(defconst efs-report-other-vars
  ;; List of variables needed for efs-report, that aren't generated below.

(defconst efs-report-avoid-vars
  ;; List of variables we don't want to see.

;; Dynamically bound.  Used to pass data to hooks.
(defvar efs-report-default-host nil)
(defvar efs-report-default-user nil)
(defvar efs-report-blurb nil)  

;;; Functions

(defun efs-report-get-host-type-regexps ()
  "Return a list of host type regexp's which are non-nil."
  (let ((list efs-host-type-alist)
	ent result)
    (while (setq ent (car list))
      (if (symbol-value (cdr ent))
	  (setq result (cons (cdr ent) result)))
      (setq list (cdr list)))

(defun efs-report-get-versions ()
  ;; Return a list of efs versions variables.
    (let (completion-ignore-case)
       "efs-" obarray
	(lambda (sym)
	  (and (boundp sym)
	       (let ((name (symbol-name sym)))
		 (and (>= (length name) 8)
		      (string-equal (substring name -8) "-version"))))))))

(defun efs-report-get-user-vars ()
  ;; Return a list of efs user variables.
    (let (completion-ignore-case)
      (all-completions "efs-" obarray 'user-variable-p))

(defun efs-report-pre-hook ()
  ;; efs-report-default-host, efs-report-default-user, and
  ;; efs-report-blurb are dynamically bound.
    (let ((end (progn (mail-position-on-field "subject") (point))))
      (search-forward ":" end)
      (delete-region (point) end)
       " EFS "
       (or (and (boundp 'efs-version) (string-match "/" efs-version)
		(concat (substring efs-version 0 (match-beginning 0))
			" "))
       "bug: ")))
  (let ((host (read-string "Bug occurred for remote host: "
	(user (read-string "Logged in as: "
    (if (string-match "^ *$" host) (setq host nil))
    (if (string-match "^ *$" user) (setq user nil))
    (if host
	(insert "\nefs believes that the host type of " host " is "
		(symbol-name (efs-host-type host))
    (if efs-report-blurb
	(insert "\n" efs-report-blurb "\n"))
    (if (and host
	     (get-buffer (setq buff-name (efs-ftp-process-buffer host user)))
		  (with-output-to-temp-buffer "*Help*"
		      "The contents of %s
will likely very useful for identifying any bugs.

You will be given a chance to edit out any sensitive information.
Passwords are never written into this buffer." buff-name)))
		  (format "Insert contents of %s? "
	(let ((header-1 (concat "Contents of " buff-name ":"))
	      (header-2 "Please edit sensitive or irrelevant information."))
	  (insert "\n" header-1 "\n" header-2 "\n")
	  (insert-char ?= (max (length header-1) (length header-2)))
	  (insert "\n\n")
	  (insert-buffer-substring buff-name)
	  (insert "\n")))))

(defun efs-report-post-hook ()
  ;; Post hook run by report-submit-bug-report.
    (mail-position-on-field "subject")
    (let ((subj (read-string "Subject header: ")))
      (if (string-equal subj "")
	      (if (or (fboundp 'yow) (load "yow" t t)) (yow) ""))
	   ?\n ?\ )
	(insert subj)))))

(defun efs-report-bug (&optional default-host  default-user blurb no-confirm)
  "Submit a bug report for efs."
  (let (;; reporter-confirm-p and reporter-package-abbrev appeared once
	;; as fluid vars in reporter.el.  They aren't used any longer,
	;; but we let-bind them anyway in case the user has an old version
	;; of reporter.
	(reporter-confirm-p nil)
	(reporter-prompt-for-summary-p nil)
	(reporter-package-abbrev "efs"))
    ;; Look out for old reporter versions.
    (or (boundp 'reporter-version)
	(setq reporter-version
	      "Your version of reporter is obsolete.  Please upgrade."))
    (if (or no-confirm
	    (y-or-n-p "Do you want to submit a bug report on efs? "))
	(let ((efs-report-default-host default-host)
	      (efs-report-default-user default-user)
	      (efs-report-blurb blurb)
	      (vars (nconc (efs-report-get-versions)
	      (avoids efs-report-avoid-vars)
	   ((or efs-report-default-host efs-report-default-user))
	    (setq efs-report-default-host efs-process-host
		  efs-report-default-user efs-process-user))
	   ((setq path (or buffer-file-name
			   (and (eq major-mode 'dired-mode)
	    (let ((parsed (efs-ftp-path path)))
	      (setq efs-report-default-host (car parsed)
		    efs-report-default-user (nth 1 parsed)))))
	  (while avoids
	    (setq vars (delq (car avoids) vars))
	    (setq avoids (cdr avoids)))
	   (function efs-report-pre-hook)
	   (function efs-report-post-hook)
	   (aref efs-report-salutations
		 (% (+ (% (random) 1000) 1000)
		    (length efs-report-salutations))))))))

;;; end of efs-report.el
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.