> I have a small comment regarding jde-help.  I've seen that the
> function jde-help-symbol makes use of the function
> jde-help-find-javadoc which checks whether a certain url exists.  It
> does that by invoking the shell command wget.  I think wget is a nice
> utility but I think it would be even nicer to use the w3 package.  For
> one thing I quite often use w3 anyways, but more important: using web
> proxies with authentication (which is used where I work) is far easier
> than with wget.  You only have to set the variable url-proxy-service
> and w3 will prompt you for login (defaulting to user-login-name) and
> password the first time w3 is used to fetch a url in a emacs session.
> I know that you can have a .wgetrc file with that information in it,
> but I find that almost more inconvenient because I don't like entering
> my password in 20 places.

I agree in all points. Good idea!!

> 
> So this is what I've done to use w3 (note that if w3 is not loaded
> wget will still be used):
> 
> - put (load "w3" t t) somewhere near the top of jde-help.el

I would not load the whole w3 only for this function. Try this near
the top of jde-help.el:

(if (locate-library "url")
   (autoload 'url-file-exists "url" nil nil nil))

> - changed jde-help-find-javadoc to the following:
> 
> (defun jde-help-find-javadoc (class docset-dir)
>   "Searches DOCSET-DIR for the javadoc HTML page
> for CLASS and, if found, returns the URL of the
> javadoc page for CLASS. This function uses 
> wget to verify the existense of pages located
> on remote systems."
>   (let ((class-path
>        (concat (substitute ?/ ?. class) ".html"))
>       url)
>     (cond
>      ((string-match "http:" docset-dir)
>       (setq url (concat docset-dir "/" class-path))
>       (if (featurep 'w3)

change the last line to:
        (if (fboundp 'url-file-exits)


>         (if (not
>                (url-file-exists url))
>               (setq url nil))
>         (if (executable-find "wget")
>             (if (not
>                  (string-match
>                   "200"
>                   (shell-command-to-string
>                    (concat "wget --spider " url))))
>                 (setq url nil))
>           (error
>            (concat "Cannot find wget. This utility is needed "
>                    "to access javadoc on remote systems.")))))
>      (t
>       (let ((doc-path
>            (expand-file-name class-path docset-dir)))
>       (if (file-exists-p doc-path)
>           (setq url (format "file://%s" doc-path))))))
>     url))
> 
> I am no elisper so I don't know what I did is absolutely correct, but
> the old behaviour should still be the same.

See my little modifications but now it should work. Really good idea!

Klaus

Reply via email to