Title: RE: Patch to allow use of remote JavaDoc docsets

Thanks for the useful patch!

FYI, A port of wget for Windows can be downloaded from
        http://www.interlog.com/~tcharron/wgetwin.html

Cheers,
        Nascif

> -----Original Message-----
> From: Adrian Robert [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 09, 2001 10:17 PM
> To: [EMAIL PROTECTED]
> Subject: Patch to allow use of remote JavaDoc docsets
>
>
>
> Hi all,
>
> Two issues with JavaDoc display for symbols (C-c C-v C-w). 
> First, if you
> select "Other" when customizing 'jde-help-docsets' instead of
> "javadoc",
> lookup will fail (at least on emacs 20.7.1 on Linux) because
> the 'apply'
> built-in expects a list as its last argument.  (See patch below.)
>
> Second, at my company we store JavaDoc for the software we
> develop on an
> internal server and I didn't want to copy it to my machine. 
> So here is an
> initial stab at providing support for remote JavaDoc
> accessible through http.
> It only works on systems where the 'wget' utility is
> available.  Most linux
> systems come with it by default.  Cygwin for Windows doesn't,
> but it may
> exist.  I'm not sure about others...
>
> 1) Insert the following into .emacs:
>
> ; find the html file for a class in a local or remote javadoc tree
> (defun javadoc-find (class docset-dir)
>   (let ((doc-path (concat docset-dir "/" (substitute ?/ ?.
> class) ".html")))
>     (if (or (file-exists-p doc-path)
>           (and (string-match "http:" doc-path)
>                (string-match "200" (shell-command-to-string
>                                     (concat "wget " "--spider
> " doc-path)))))
>       doc-path)
>     ))
>
> 2) Apply the patch below sitting in the JDE top level
> directory with "patch
> -p0 < jde-help-patch.patch" (or whatever filename).  It affects
> "lisp/jde-help.el", and fixes both the "Other" bug mentioned
> above (first
> chunk) and adds the capability to use a remote JavaDoc docset by NOT
> prepending "file://" to the name if it starts with "http:" or
> "file:" already
> (second chunk).  You'll need to remove the "jde-help.elc"
> file and recompile
> it if you've already compiled jde.  The patch was generated against
> jde-2.2.6.  (I've attached it as well in case word-wrapping
> over email mangles
> it.)
>
> I suppose the "javadoc-find" function could be inserted
> directly in the
> jde-help.el file, but I wanted to keep the changes to the
> distribution file to
> a minimum.  It works by calling 'wget' to see if the file
> exists remotely
> instead of using 'file-exists-p'.
>
> hope it's useful,
> Adrian
>
>
> ------------patch follows
> --- lisp/jde-help.el    Fri Mar  9 17:45:15 2001
> +++ lisp/jde-help-new.el        Fri Mar  9 17:44:48 2001
> @@ -120,7 +120,7 @@
>                     (apply
>                      (jde-help-docset-get-lookup-function docset)
>                      class
> -                    (jde-help-docset-get-dir docset)))))
> +                    (list (jde-help-docset-get-dir docset))))))
>                 jde-help-docsets)))
>           (setq paths (delq nil paths))
>           ;; Return first file found.
> @@ -171,9 +171,12 @@
>   

>  (defun jde-help-show-document (doc-file)
> -  "Actually displays the document."
> +  "Actually displays the document, prepending 'file://' if
> it appears to be
> local."
>    (if (not (eq doc-file nil))
> -      (browse-url (format "file://%s" doc-file))))
> +      (cond
> +       ((or (string-match "http:" doc-file) (string-match
> "file:" doc-file))
> +       (browse-url doc-file))
> +       (t (browse-url (format "file://%s" doc-file)))) ))

>  (defun jde-help-choose-document(doc-files)
>    "Allows the user to select which of the possible
> documentation files they
> wish to view."
>

Reply via email to