Function: tramp-skeleton-make-directory

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

Signature

(tramp-skeleton-make-directory DIR &optional PARENTS &rest BODY)

Documentation

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

BODY is the backend specific code.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defmacro tramp-skeleton-make-directory (dir &optional parents &rest body)
  "Skeleton for `tramp-*-handle-make-directory'.
BODY is the backend specific code."
  ;; Since Emacs 29.1, PARENTS isn't propagated to the handlers
  ;; anymore.  And the return values are specified since then as well.
  (declare (indent 2) (debug t))
  `(let* ((dir (directory-file-name (expand-file-name ,dir)))
	  (par (file-name-directory dir)))
     (with-parsed-tramp-file-name dir nil
       (when (and (null ,parents) (file-exists-p dir))
	 (tramp-error v 'file-already-exists dir))
       ;; Make missing directory parts.
       (when ,parents
	 (unless (file-directory-p par)
	   (make-directory par ,parents)))
       ;; Just do it.
       (if (file-exists-p dir) t
	 (tramp-flush-file-properties v localname)
	 ,@body
	 nil))))