Function: inferior-php-ts-mode-startup

inferior-php-ts-mode-startup is a byte-compiled function defined in php-ts-mode.el.gz.

Signature

(inferior-php-ts-mode-startup CMD &optional CONFIG)

Documentation

Start an inferior PHP process with command CMD and init file CONFIG.

CMD is the command to run. Optional CONFIG, if supplied, is the php.ini file to use.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
(defun inferior-php-ts-mode-startup (cmd &optional config)
  "Start an inferior PHP process with command CMD and init file CONFIG.
CMD is the command to run.  Optional CONFIG, if supplied, is the php.ini
file to use."
  (apply #'make-comint-in-buffer
		     (string-replace "*" "" php-ts-mode-inferior-php-buffer)
		     php-ts-mode-inferior-php-buffer
		     cmd
		     nil
		     (delq
		      nil
		      (list
		       (when config
			 (format "-c %s" config))
		       "-a")))
  (add-hook 'comint-preoutput-filter-functions
	    (lambda (string)
	      (let ((prompt (concat php-ts-mode--inferior-prompt " ")))
		(if (member
		     string
		     (list prompt "php { " "php ( " "/* > " "Interactive shell\n\n"))
		    string
		  (let (;; Filter out prompts characters that accumulate when sending
			;; regions to the inferior process.
			(clean-string
			 (replace-regexp-in-string
			  (rx-to-string `(or
					  (+ "php >" (opt space))
					  (+ "php {" (opt space))
					  (+ "php (" (opt space))
					  (+ "/*" (1+ space) (1+ ">") (opt space))))
			  "" string)))
		    ;; Re-add the prompt for the next line, if isn't empty.
		    (if (string= clean-string "")
			""
		      (concat (string-chop-newline clean-string) "\n" prompt))))))
	    nil t)
  (when php-ts-mode-inferior-history
    (set-process-sentinel
     (get-buffer-process php-ts-mode-inferior-php-buffer)
     'php-ts-mode-inferior--write-history)))