Brad Giaccio writes:
> I noticed a bug when using jde-help-symbol with a docset that is not remote
> the problem is in jde-help-get-root-dir:
>
I don't understand the bug. What are the symptoms? The function
works for me. However, I did find a small bug. The function
assumes that a JDK API docset is always in the current JDK
directory. This may not be the case. Here is my updated version
of the function. I have checked it into the CVS repository.
- Paul
(defun jde-help-get-root-dir (docfile)
"Returns the javadoc root directory of docfile"
(if jde-help-docsets
(let ((docsets jde-help-docsets)
dir)
(while docsets
(let ((docset (car docsets)))
(setq dir (jde-help-docset-get-dir docset))
(if (and
(or (not dir)
(string= dir ""))
(string= (jde-help-docset-get-type docset) "JDK API"))
(setq dir (expand-file-name "docs/api" (jde-get-jdk-dir))))
(setq dir (jde-file-to-url (concat dir "/")))
(if (string-match dir docfile)
(setq docsets nil)
(setq docsets (cdr docsets)))))
dir)))
> (defun jde-help-get-root-dir (docfile)
> "Returns the javadoc root directory of docfile"
> (if jde-help-docsets
> (let ((docsets jde-help-docsets)
> temp dir)
> (while docsets
> (setq temp (car docsets))
> (if (string= (jde-help-docset-get-type temp) "JDK API")
> (setq dir (jde-file-to-url (expand-file-name "docs/api"
>(jde-get-jdk-dir))))
> (setq dir (jde-file-to-url (jde-help-docset-get-dir temp))))
> (if (string-match dir docfile)
> (setq docsets nil))
> (setq docsets (cdr docsets)))
> (setq dir (jde-file-to-url (concat dir "/")))
> dir)))
>
> The if and else for string= are backwards they should be:
>
> (defun jde-help-get-root-dir (docfile)
> "Returns the javadoc root directory of docfile"
> (if jde-help-docsets
> (let ((docsets jde-help-docsets)
> temp dir)
> (while docsets
> (setq temp (car docsets))
> (if (string= (jde-help-docset-get-type temp) "JDK API")
> (setq dir (jde-file-to-url (jde-help-docset-get-dir temp)))
> (setq dir (jde-file-to-url (expand-file-name "docs/api"
>(jde-get-jdk-dir)))))
> (if (string-match dir docfile)
> (setq docsets nil))
> (setq docsets (cdr docsets)))
> (setq dir (jde-file-to-url (concat dir "/")))
> dir)))
>
> This is 2.2.7beta 7 revision 1.44 of jde-help.el
>
> Brad
> --
> --- There are two kinds of knowledge, you either know the answer or
> you know where to find it
> -Kane, Johnson, and anonymous
>