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.103 2004/01/21 17:17:46 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 (ecb-fix-filename
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
(when (or ecb-minor-mode
233
(y-or-n-p "ECB should be active when submitting a problem-report. Force report? "))
234
(if (and (equal ecb-frame (selected-frame))
235
(not (ecb-point-in-edit-window)))
236
(ecb-select-edit-window))
237
(if (not (locate-library "reporter"))
238
(ecb-error "You need the reporter.el package to submit a bugreport for ECB!")
241
(message "Preparing problem report...")
242
;;prepare the basic buffer
243
(reporter-submit-bug-report
244
ecb-problem-report-mail-address
245
(format "ECB: %s, semantic: %s, eieio: %s, speedbar: %s, JDEE: %s"
250
(if (boundp 'jde-version)
253
(ecb-problem-report-list-all-variables)
255
'ecb-problem-report-post-hook
256
ecb-problem-report-message)
257
(if (equal ecb-frame (selected-frame))
260
(insert (read-string "Problem report subject: "
261
(format "ECB-%s -- " ecb-version)))
263
(search-forward ecb-problem-report-message)
265
(message "Preparing bug report...done")))))
267
(defun ecb-problem-report-post-hook()
268
"Function run the reporter package done its work. It looks for a message- and
269
a backtrace-buffer and inserts the contents of that."
271
(beginning-of-buffer)
272
;; if the mail-packages has already inserted a signature we must not go to
273
;; the buffer-end but just before the signature
274
(if (re-search-forward "^--[ \t]*$" nil t)
279
(goto-char (point-max))
282
(let ((ecb-face-list (delq nil (mapcar (function
284
(if (string-match "^ecb-"
289
(insert "\n\n-----------------------------------------------------\n")
290
(insert "The attributes of the ECB-faces are:\n\n")
291
(dolist (f ecb-face-list)
293
(insert (format "%s: %s\n"
295
(funcall (if ecb-running-xemacs
296
'face-custom-attributes-get
297
'custom-face-attributes-get)
299
(insert "\n-----------------------------------------------------\n\n"))
300
(let* ((messages-buffer
302
(if ecb-running-xemacs " *Message-Log*" "*Messages*")))
303
(backtrace-buffer (get-buffer "*Backtrace*")))
305
;;insert the contents of the backtrace buffer if it is there.
306
(insert "\n\n-----------------------------------------------------\n")
309
(insert "The contents of the *Backtrace* buffer were\n\n")
310
(insert-buffer backtrace-buffer)
311
;; we must force the mark
313
(insert "\nEnd Insert *Backtrace* buffer" ))
314
(insert "There was no *Backtrace* buffer" ))
315
(insert "\n-----------------------------------------------------\n\n")
317
;;insert the contents of the messages buffer if it is there.
318
(insert "-----------------------------------------------------\n")
321
(insert "The contents of the *Messages* buffer were\n\n")
322
(insert-buffer messages-buffer)
324
(insert "\nEnd Insert *Messages* buffer" ))
325
(insert "There was no *Messages* buffer" ))
326
(insert "\n-----------------------------------------------------\n\n"))))
329
(defun ecb-problem-report-list-all-variables()
330
"List all variables starting with `ecb-' and some other variables which
331
could be interesting for support."
332
(let ((emacs-vars (sort (delete nil
337
compilation-mode-hook
338
truncate-partial-width-windows
340
,(if (boundp 'compilation-window-height)
341
'compilation-window-height)
342
,(if (boundp 'temp-buffer-max-height)
343
'temp-buffer-max-height)
345
,(if (boundp 'c-mode-hook)
347
,(if (boundp 'c++-mode-hook)
349
,(if (boundp 'c-mode-common-hook)
351
,(if (boundp 'java-mode-hook)
353
,(if (boundp 'jde-mode-hook)
359
,(if (boundp 'ediff-quit-hook)
361
(function (lambda (l r)
362
(string< (symbol-name l)
364
(semantic-vars (sort (delete nil
365
`(semantic-after-toplevel-cache-change-hook
366
semantic-after-partial-cache-change-hook
367
,(if (boundp 'semantic-format-face-alist)
368
'semantic-format-face-alist
369
'semantic-face-alist)
370
semantic-uml-colon-string
371
semantic-orphaned-member-metaparent-type))
372
(function (lambda (l r)
373
(string< (symbol-name l)
375
(speedbar-vars (sort '(speedbar-dynamic-tags-function-list
376
speedbar-tag-hierarchy-method
377
speedbar-tag-group-name-minimum-length
378
speedbar-tag-split-minimum-length
379
speedbar-tag-regroup-maximum-length
380
speedbar-fetch-etags-command
381
speedbar-fetch-etags-arguments
382
speedbar-fetch-etags-parse-list)
383
(function (lambda (l r)
384
(string< (symbol-name l)
389
(let (completion-ignore-case)
390
(all-completions "ecb-" obarray 'user-variable-p))
392
(ecb-internal-vars (sort '(ecb-path-selected-directory
393
ecb-path-selected-source
394
ecb-use-semantic-grouping
396
ecb-post-command-hooks
397
ecb-max-specpdl-size-old
398
ecb-max-lisp-eval-depth-old
400
ecb-last-window-config-before-deactivation
401
ecb-edit-area-creators
403
ecb-toggle-layout-state
404
ecb-current-maximized-ecb-buffer-name
405
ecb-tree-buffers-of-current-layout)
406
(function (lambda (l r)
407
(string< (symbol-name l)
408
(symbol-name r)))))))
409
(append emacs-vars semantic-vars speedbar-vars
410
ecb-internal-vars ecb-options)))
413
(silentcomp-provide 'ecb-help)
415
;; ecb-help.el ends here