Function: tramp-skeleton-make-process

tramp-skeleton-make-process is a macro defined in tramp.el.gz.

Signature

(tramp-skeleton-make-process ARGS NULL-COMMAND STDERR-FILE &rest BODY)

Documentation

Skeleton for tramp-*-handle-make-process.

NULL-COMMAND indicates a possible empty command. STDERR-FILE means that a stderr file is supported. BODY is the backend specific code.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defmacro tramp-skeleton-make-process (args null-command stderr-file &rest body)
  "Skeleton for `tramp-*-handle-make-process'.
NULL-COMMAND indicates a possible empty command.  STDERR-FILE means
that a stderr file is supported.  BODY is the backend specific code."
  (declare (indent 3) (debug t))
  `(when ,args
     (with-parsed-tramp-file-name (expand-file-name default-directory) nil
       (let ((name (plist-get ,args :name))
	     (buffer (plist-get ,args :buffer))
	     (command (plist-get ,args :command))
	     (coding (plist-get ,args :coding))
	     (noquery (plist-get ,args :noquery))
	     (connection-type
	      (or (plist-get ,args :connection-type) process-connection-type))
	     (filter (plist-get ,args :filter))
	     (sentinel (plist-get ,args :sentinel))
	     (stderr (plist-get ,args :stderr)))
	 (unless (stringp name)
	   (signal 'wrong-type-argument (list #'stringp name)))
	 (unless (or (bufferp buffer) (string-or-null-p buffer))
	   (signal 'wrong-type-argument (list #'bufferp buffer)))
	 (unless (or (consp command) (and ,null-command (null command)))
	   (signal 'wrong-type-argument (list #'consp command)))
	 (unless (or (null coding)
		     (and (symbolp coding) (memq coding coding-system-list))
		     (and (consp coding)
			  (memq (car coding) coding-system-list)
			  (memq (cdr coding) coding-system-list)))
	   (signal 'wrong-type-argument (list #'symbolp coding)))
	 (when (eq connection-type t)
	   (setq connection-type 'pty))
	 (unless (or (and (consp connection-type)
			  (memq (car connection-type) '(nil pipe pty))
			  (memq (cdr connection-type) '(nil pipe pty)))
		     (memq connection-type '(nil pipe pty)))
	   (signal 'wrong-type-argument (list #'symbolp connection-type)))
	 (unless (or (null filter) (eq filter t) (functionp filter))
	   (signal 'wrong-type-argument (list #'functionp filter)))
	 (unless (or (null sentinel) (functionp sentinel))
	   (signal 'wrong-type-argument (list #'functionp sentinel)))
	 (unless (or (null stderr) (bufferp stderr)
		     (and ,stderr-file (stringp stderr)))
	   (signal 'wrong-type-argument (list #'bufferp stderr)))
	 (when (and (stringp stderr)
		    (not (tramp-equal-remote default-directory stderr)))
	   (signal 'file-error (list "Wrong stderr" stderr)))

	 (let ((name (tramp-get-unique-process-name name))
	       (buffer
		(if buffer
		    (get-buffer-create buffer)
		  ;; BUFFER can be nil.  We use a temporary buffer.
		  (generate-new-buffer tramp-temp-buffer-name)))
	       (orig-command command))

	   ,@body)))))