Nick Sieger writes:
 > Hi all,
 > 
 > I have a nagging little problem with the current wget usage in
 > jde-help.el.  One of the javadoc sites in my `jde-help-docsets' list
 > is on my corporate intranet, and is accessible only when at work or
 > connected to the VPN.  When I bring my laptop home and do a jde-help-*
 > lookup when not connected to the VPN, the DNS entry appears to be
 > cached for the server on the intranet, so wget starts trying to
 > connect to the server and hangs.  I have to kill the wget process in
 > order to continue.
 > 
 > So here's a little patch that would help me that I'd propose get
 > included, it simply allows customization of the parameters to pass to
 > wget.  In my case, I want to add timeout parameters such as '--tries=1
 > --timeout=2'.  If this seems ok, let me know and I'll commit the
 > change.  On the other hand, does it seem like overkill to customize
 > the way wget is called here?  Should the timeout parameters be
 > hard-coded, and maybe customize the timeout value instead?

Yes. I suggest the following new customization variables:

jde-help-wget-tries
jde-help-wget-timeout
jde-help-wget-command-line-options

The first two takes care of the timeout problem and the provides
for any other contingency the JDEE user might encounter.


Paul


 > 
 > Regards,
 > /Nick
 > 
 > Index: jde-help.el
 > ===================================================================
 > RCS file: /pack/anoncvs/jde/lisp/jde-help.el,v
 > retrieving revision 1.64
 > diff -b -c -c -r1.64 jde-help.el
 > *** jde-help.el      2003/08/28 05:18:15     1.64
 > --- jde-help.el      2004/02/28 20:59:41
 > ***************
 > *** 5,11 ****
 >   ;; Maintainer: Paul Kinnucan
 >   ;; Keywords: java, tools
 >   
 > ! ;; Copyright (C) 1999, 2001, 2002, 2003 Paul Kinnucan.
 >   
 >   ;; GNU Emacs is free software; you can redistribute it and/or modify
 >   ;; it under the terms of the GNU General Public License as published by
 > --- 5,11 ----
 >   ;; Maintainer: Paul Kinnucan
 >   ;; Keywords: java, tools
 >   
 > ! ;; Copyright (C) 1999, 2001, 2002, 2003, 2004 Paul Kinnucan.
 >   
 >   ;; GNU Emacs is free software; you can redistribute it and/or modify
 >   ;; it under the terms of the GNU General Public License as published by
 > ***************
 > *** 114,119 ****
 > --- 114,127 ----
 >             (autoload 'url-file-exists "url" nil nil nil))
 >        (set-default sym val)))
 >   
 > + (defcustom jde-help-wget-extra-options nil
 > +   "Specifies extra options to pass to wget, if wget is used for
 > + `jde-help-remote-file-exists-function'.  In some cases it is
 > + desirable to add, for example, timeout parameters (such as
 > + '--tries=1 --timeout=2') to wget so that remote urls that are not
 > + responding do not cause your editing session to hang."
 > +   :group 'jde-project
 > +   :type 'string)
 >   
 >   (defun jde-file-to-url (file)
 >     "Convert FILE path to a URL. If FILE is a DOS path, this
 > ***************
 > *** 171,177 ****
 >                    (string-match
 >                     "200"
 >                     (shell-command-to-string
 > !                    (concat "wget --spider " url))))
 >                   (setq url nil))
 >             (error
 >              (concat "Cannot find wget. This utility is needed "
 > --- 179,187 ----
 >                    (string-match
 >                     "200"
 >                     (shell-command-to-string
 > !                    (concat "wget --spider "
 > !                       jde-help-wget-extra-options
 > !                       " " url))))
 >                   (setq url nil))
 >             (error
 >              (concat "Cannot find wget. This utility is needed "
 > ***************
 > *** 442,448 ****
 >           (executable-find (if (eq system-type 'windows-nt) "wget.exe" "wget"))
 >           (not (string-match "200"
 >                              (shell-command-to-string
 > !                             (concat "wget --spider " jde-jdk-doc-url)))))) 
 >      (error "JDK doc does not exist at jde-jdk-doc-url value: %s" jde-jdk-doc-url))
 >       jde-jdk-doc-url)
 >      ((string-match "file://" jde-jdk-doc-url)
 > --- 452,460 ----
 >           (executable-find (if (eq system-type 'windows-nt) "wget.exe" "wget"))
 >           (not (string-match "200"
 >                              (shell-command-to-string
 > !                             (concat "wget --spider "
 > !                                     jde-help-wget-extra-options
 > !                                     " " jde-jdk-doc-url))))))      
 >      (error "JDK doc does not exist at jde-jdk-doc-url value: %s" jde-jdk-doc-url))
 >       jde-jdk-doc-url)
 >      ((string-match "file://" jde-jdk-doc-url)
 > 

Reply via email to