Function: idlwave-help-assistant-start

idlwave-help-assistant-start is a byte-compiled function defined in idlw-help.el.gz.

Signature

(idlwave-help-assistant-start &optional FULL-LINK)

Documentation

Start the IDL Assistant, loading link FULL-LINK, if passed.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/idlw-help.el.gz
(defun idlwave-help-assistant-start (&optional full-link)
  "Start the IDL Assistant, loading link FULL-LINK, if passed."
  (when (or (not idlwave-help-assistant-socket)
	    (not (eq (process-status idlwave-help-assistant-socket) 'open)))
    (let* ((help-loc (idlwave-html-help-location))
	   (command (idlwave-help-assistant-command))
	   (extra-args
	    (nconc
	     (if (memq system-type '(ms-dos windows-nt))
		 `("-profile" ,(expand-file-name "idl.adp" help-loc)))
	     (if full-link `("-file" ,full-link))))
	   port)
      (if idlwave-help-assistant-socket
	  (delete-process idlwave-help-assistant-socket))

      (setq idlwave-help-assistant-process
	    (apply #'start-process
		   "IDL_ASSISTANT_PROC" nil command "-server" extra-args))

      (set-process-filter idlwave-help-assistant-process
			  (lambda (_proc string)
			    (setq port (string-to-number string))))
      (unless (accept-process-output idlwave-help-assistant-process 15)
	(error "Failed binding IDL_ASSISTANT socket"))
      (if (not port)
	  (error "Unable to open IDL_ASSISTANT")
	(set-process-filter idlwave-help-assistant-process nil)
	(setq idlwave-help-assistant-socket
	      (open-network-stream "IDL_ASSISTANT_SOCK"
				   nil "localhost" port))
	(if (eq (process-status idlwave-help-assistant-socket) 'open)
	    (progn
	      (process-send-string  idlwave-help-assistant-socket
				    (concat "setHelpPath " help-loc "\n"))
	      t)
	  (idlwave-help-assistant-close)
	  (error "Cannot communicate with IDL_ASSISTANT"))))))