1 ;;; ecb-help.el --- online help for ECB and bug reporting
3 ;; Copyright (C) 2000 - 2003 Jesper Nordenberg,
6 ;; Free Software Foundation, Inc.
8 ;; Author: Jesper Nordenberg <mayhem@home.se>
9 ;; Klaus Berndl <klaus.berndl@sdm.de>
10 ;; Kevin A. Burton <burton@openprivacy.org>
11 ;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
12 ;; Kevin A. Burton <burton@openprivacy.org>
13 ;; Keywords: browser, code, programming, tools
16 ;; This program is free software; you can redistribute it and/or modify it under
17 ;; the terms of the GNU General Public License as published by the Free Software
18 ;; Foundation; either version 2, or (at your option) any later version.
20 ;; This program is distributed in the hope that it will be useful, but WITHOUT
21 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
25 ;; You should have received a copy of the GNU General Public License along with
26 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software
27 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 ;; $Id: ecb-help.el,v 1.109 2004/11/17 17:28:38 berndl Exp $
33 ;; Contains all online-help for ECB (stolen something from recentf.el)
37 ;; For the ChangeLog of this file see the CVS-repository. For a complete
38 ;; history of the ECB-package see the file NEWS.
43 (require 'silentcomp))
48 ;; XEmacs and Emacs 20.X
49 (silentcomp-defvar browse-url-new-window-p)
50 (silentcomp-defun browse-url)
52 (silentcomp-defvar browse-url-new-window-flag)
54 (silentcomp-defvar jde-version)
56 (silentcomp-defun mail-subject)
57 (silentcomp-defun mail-text)
58 (silentcomp-defun reporter-submit-bug-report)
60 (defconst ecb-help-info-start-file "ecb.info")
61 (defconst ecb-help-html-start-file "ecb.html")
62 (defconst ecb-help-info-subdir "./info-help/")
63 (defconst ecb-help-html-subdir "./html-help/")
65 (defgroup ecb-help nil
66 "Settings for the ECB online help"
69 (defcustom ecb-show-help-format 'info
70 "*The format `ecb-show-help' shows its online help.
71 Allowed values are 'info \(for the Info format) and 'html \(for HTML format).
72 If the value is 'html then `browse-url-browser-function' says which browser is
75 Note: If you got ECB as a standard XEmacs-package maybe the
76 HTML-online-documentation is not included."
78 :group 'ecb-most-important
79 :type '(choice :tag "Online-help format" :menu-tag "Online-help format"
80 (const :tag "Info" :value info)
81 (const :tag "Html" :value html)))
84 (defcustom ecb-help-info-path (concat
85 (if ecb-running-xemacs
89 ecb-help-info-start-file))
93 ecb-help-info-start-file)
94 "*Path where the ECB online help in info format resides.
95 This must be the location of the file \"ecb.info\" which comes with the ECB
96 distribution. If is installed by unpacking the archive available on the ECB
97 web-site then this is the subdir `ecb-help-info-subdir' of the installation
98 directory of ECB. If it is installed as XEmacs-package \(e.g. via the package
99 manager of XEmacs) then this is probably the directory \"../../info/\"
100 \(relativ to the Elisp directory of ECB).
102 The path can either be an absolute path or a path relative to the directory
103 where the Elisp files of ECB are.
105 Normally there should be no need to change this option!"
109 (defcustom ecb-help-html-path
110 (if (not ecb-running-xemacs)
111 (concat ecb-help-html-subdir ecb-help-html-start-file)
112 (cond ((file-exists-p
115 ecb-help-html-start-file))
116 (concat ecb-help-html-subdir ecb-help-html-start-file))
120 ecb-help-html-start-file))
121 (concat "../../html/" ecb-help-html-start-file))
124 "../../html/ecb/index.html"))
125 "../../html/ecb/index.html")
127 (concat "../../etc/ecb/html/" ecb-help-html-start-file))))
128 "*Path where the ECB online help in HTML format resides.
129 This must be the location of the file \"index.html\" which comes with the ECB
130 distribution. If is installed by unpacking the archive available on the ECB
131 web-site then this is the subdir `ecb-help-html-subdir' of the installation
132 directory of ECB. If it is installed as XEmacs-package \(e.g. via the package
133 manager of XEmacs) then this is probably either the directory \"../../html/\" or
134 \"../../etc/ecb/html/\" \(both relative to the Elisp directory of ECB).
136 The path can either be an absolute path or a path relative to the directory
137 where the Elisp files of ECB are.
139 Normally there should be no need to change this option!"
144 (defun ecb-info (info-file &optional no-file-not-exist-err)
145 "Starts `info' with INFO-FILE. If INFO-FILE does not exists then nil is
146 returned otherwise true. If NO-FILE-NOT-EXIST-ERR is not nil then just nil is
147 returned if INFO-FILE does not exist otherwise an error is reported."
148 (if (file-exists-p info-file)
151 (unless no-file-not-exist-err
152 (ecb-error "Info file %s does not exists!" info-file))
155 (defun ecb-browse-html-file (html-file &optional no-file-not-exist-err)
156 "Opens HTML-FILE in the standard-webbrowser with `browse-url'. If INFO-FILE
157 does not exists then nil is returned otherwise true. If NO-FILE-NOT-EXIST-ERR
158 is not nil then just nil is returned if HTML-FILE does not exist otherwise an
160 (if (file-exists-p html-file)
162 (if (and (locate-library "browse-url")
163 (require 'browse-url)
164 (fboundp 'browse-url))
165 (browse-url (concat "file://" html-file)
166 (if (boundp 'browse-url-new-window-flag)
167 browse-url-new-window-flag
168 browse-url-new-window-p))
169 (ecb-error "Function 'browse-url needed for displaying HTML!")))
170 (unless no-file-not-exist-err
171 (ecb-error "HTML file %s does not exists!" html-file))
175 (defun ecb-show-help (&optional format)
176 "Shows the online help of ECB in Info or HTML-format.
177 The format depends on the setting in `ecb-show-help-format'. If called with
178 prefix argument, i.e. if FORMAT is not nil then the user is prompted to choose
179 the format of the help \(Info or Html).
181 If an error about not finding the needed help-file occurs please take a look
182 at the options `ecb-help-info-start-file' and `ecb-help-html-start-file'!
184 Note: If you got ECB as a standard XEmacs-package maybe the
185 HTML-online-documentation is not included."
188 (intern (ecb-query-string "Choose format of online-help:"
189 (if (equal 'ecb-show-help-format
193 ecb-show-help-format))
194 (info-path-abs (expand-file-name
195 (if (or (string-match "^\\." ecb-help-info-path)
196 (string-match (concat "^"
198 ecb-help-info-start-file))
200 (concat ecb-ecb-dir ecb-help-info-path)
201 ecb-help-info-path)))
202 (html-path-abs (expand-file-name
203 (if (or (string-match "^\\." ecb-help-html-path)
204 (string-match (concat "^"
206 ecb-help-html-start-file))
208 (concat ecb-ecb-dir ecb-help-html-path)
209 ecb-help-html-path))))
211 (ecb-info info-path-abs)
212 (message "Opening ECB online-help in a web-browser...")
213 (ecb-browse-html-file html-path-abs))))
217 ;; Problem reporting functions stolen from JDEE
219 (defvar ecb-problem-report-mail-address "ecb-list@lists.sourceforge.net" )
221 (defconst ecb-problem-report-message
222 "Please enter the details of your bug report here")
224 (defun ecb-submit-problem-report()
225 "Submit a problem report for the ECB to the ECB mailing-list.
226 This command generates in the edit-window a problem-report which contains
227 already the current values of all ECB options, the current backtrace-buffer if
228 there is any and the current message-buffer. You will be asked for a
229 problem-report subject and then you must insert a description of the problem.
230 Please describe the problem as detailed as possible!
232 *IMPORTANT*: Cause of extra appearance of SPAM in the mailing-lists,
233 SourceForge has changed its policy: Now it is only possible to post to the
234 mailing-list for users who have subscribed this mailing-list. So please be
235 aware you will not be able to send comments, bug reports and improvement
236 suggestions before you have subscribed the ECB-mailing-list. See the section
237 \"Mailing-list\" at the ECB-website at http://ecb.sourceforge.net how to do
241 (when (or ecb-minor-mode
242 (y-or-n-p "ECB should be active when submitting a problem-report. Force report? "))
243 (if (and (equal ecb-frame (selected-frame))
244 (not (ecb-point-in-edit-window)))
245 (ecb-select-edit-window))
246 (if (not (locate-library "reporter"))
247 (ecb-error "You need the reporter.el package to submit a bugreport for ECB!")
250 (message "Preparing problem report...")
251 ;;prepare the basic buffer
252 (reporter-submit-bug-report
253 ecb-problem-report-mail-address
254 (format "ECB: %s, semantic: %s, eieio: %s, speedbar: %s, JDEE: %s"
259 (if (boundp 'jde-version)
262 (ecb-problem-report-list-all-variables)
264 'ecb-problem-report-post-hook
265 ecb-problem-report-message)
266 (if (equal ecb-frame (selected-frame))
269 (insert (read-string "Problem report subject: "
270 (format "ECB-%s -- " ecb-version)))
272 (search-forward ecb-problem-report-message)
274 (message "Preparing bug report...done")))))
276 (defun ecb-problem-report-post-hook()
277 "Function run the reporter package done its work. It looks for a message- and
278 a backtrace-buffer and inserts the contents of that."
280 (beginning-of-buffer)
281 ;; if the mail-packages has already inserted a signature we must not go to
282 ;; the buffer-end but just before the signature
283 (if (re-search-forward "^--[ \t]*$" nil t)
288 (goto-char (point-max))
291 (let ((ecb-face-list (delq nil (mapcar (function
293 (if (string-match "^ecb-"
298 (insert "\n\n-----------------------------------------------------\n")
299 (insert "The attributes of the ECB-faces are:\n\n")
300 (dolist (f ecb-face-list)
302 (insert (format "%s: %s\n"
304 (funcall (if ecb-running-xemacs
305 'face-custom-attributes-get
306 'custom-face-attributes-get)
308 (insert "\n-----------------------------------------------------\n\n"))
309 (let* ((messages-buffer
311 (if ecb-running-xemacs " *Message-Log*" "*Messages*")))
312 (backtrace-buffer (get-buffer "*Backtrace*"))
313 (tag-dump-buffer (get-buffer "*ecb-tag-dump*")))
315 ;;insert the contents of the tag-dump buffer if it is there.
316 (insert "\n\n-----------------------------------------------------\n")
319 (insert "The contents of the *ecb-tag-dump* buffer were\n\n")
320 (insert-buffer tag-dump-buffer)
321 ;; we must force the mark
323 (insert "\nEnd Insert *ecb-tag-dump* buffer" ))
324 (insert "There was no *ecb-tag-dump* buffer" ))
325 (insert "\n-----------------------------------------------------\n\n")
327 ;;insert the contents of the trace-output buffer if it is there.
328 ;; (insert "\n\n-----------------------------------------------------\n")
329 ;; (if tag-dump-buffer
331 ;; (insert "The contents of the *ecb-tag-dump* buffer were\n\n")
332 ;; (insert-buffer tag-dump-buffer)
333 ;; ;; we must force the mark
334 ;; (goto-char (mark t))
335 ;; (insert "\nEnd Insert *ecb-tag-dump* buffer" ))
336 ;; (insert "There was no *ecb-tag-dump* buffer" ))
337 ;; (insert "\n-----------------------------------------------------\n\n")
339 ;;insert the contents of the backtrace buffer if it is there.
340 (insert "\n\n-----------------------------------------------------\n")
343 (insert "The contents of the *Backtrace* buffer were\n\n")
344 (insert-buffer backtrace-buffer)
345 ;; we must force the mark
347 (insert "\nEnd Insert *Backtrace* buffer" ))
348 (insert "There was no *Backtrace* buffer" ))
349 (insert "\n-----------------------------------------------------\n\n")
351 ;;insert the contents of the messages buffer if it is there.
352 (insert "-----------------------------------------------------\n")
355 (insert "The contents of the *Messages* buffer were\n\n")
356 (insert-buffer messages-buffer)
358 (insert "\nEnd Insert *Messages* buffer" ))
359 (insert "There was no *Messages* buffer" ))
360 (insert "\n-----------------------------------------------------\n\n"))))
363 (defun ecb-problem-report-list-all-variables()
364 "List all variables starting with `ecb-' and some other variables which
365 could be interesting for support."
366 (let ((emacs-vars (sort (delete nil
371 compilation-mode-hook
372 truncate-partial-width-windows
374 ,(if (boundp 'compilation-window-height)
375 'compilation-window-height)
376 ,(if (boundp 'temp-buffer-max-height)
377 'temp-buffer-max-height)
379 ,(if (boundp 'c-mode-hook)
381 ,(if (boundp 'c++-mode-hook)
383 ,(if (boundp 'c-mode-common-hook)
385 ,(if (boundp 'java-mode-hook)
387 ,(if (boundp 'jde-mode-hook)
393 ,(if (boundp 'ediff-quit-hook)
395 (function (lambda (l r)
396 (ecb-string< (symbol-name l)
398 (semantic-vars (sort (delete nil
399 `(semantic-after-toplevel-cache-change-hook
400 semantic-after-partial-cache-change-hook
401 ,(if (boundp 'semantic-format-face-alist)
402 'semantic-format-face-alist
403 'semantic-face-alist)
404 semantic-uml-colon-string
405 semantic-orphaned-member-metaparent-type))
406 (function (lambda (l r)
407 (ecb-string< (symbol-name l)
409 (speedbar-vars (sort '(speedbar-dynamic-tags-function-list
410 speedbar-tag-hierarchy-method
411 speedbar-tag-group-name-minimum-length
412 speedbar-tag-split-minimum-length
413 speedbar-tag-regroup-maximum-length
414 speedbar-fetch-etags-command
415 speedbar-fetch-etags-arguments
416 speedbar-fetch-etags-parse-list)
417 (function (lambda (l r)
418 (ecb-string< (symbol-name l)
423 (let (completion-ignore-case)
424 (all-completions "ecb-" obarray 'user-variable-p))
426 (ecb-internal-vars (sort '(ecb-path-selected-directory
427 ecb-path-selected-source
428 ecb-use-semantic-grouping
430 ecb-post-command-hooks
431 ecb-max-specpdl-size-old
432 ecb-max-lisp-eval-depth-old
434 ecb-last-window-config-before-deactivation
435 ecb-edit-area-creators
437 ecb-toggle-layout-state
438 ecb-current-maximized-ecb-buffer-name
439 ecb-special-ecb-buffers-of-current-layout)
440 (function (lambda (l r)
441 (ecb-string< (symbol-name l)
442 (symbol-name r)))))))
443 (append emacs-vars semantic-vars speedbar-vars
444 ecb-internal-vars ecb-options)))
447 (silentcomp-provide 'ecb-help)
449 ;; ecb-help.el ends here