Function: tramp-skeleton-delete-directory

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

Signature

(tramp-skeleton-delete-directory DIRECTORY RECURSIVE TRASH &rest BODY)

Documentation

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

BODY is the backend specific code.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defmacro tramp-skeleton-delete-directory (directory recursive trash &rest body)
  "Skeleton for `tramp-*-handle-delete-directory'.
BODY is the backend specific code."
  (declare (indent 3) (debug t))
  `(with-parsed-tramp-file-name (expand-file-name ,directory) nil
     (let ((delete-by-moving-to-trash
	    (and delete-by-moving-to-trash
		 ;; This variable exists since Emacs 30.1.
		 (not (bound-and-true-p
		       remote-file-name-inhibit-delete-by-moving-to-trash)))))
       (if (and delete-by-moving-to-trash ,trash)
	   ;; Move non-empty dir to trash only if recursive deletion was
	   ;; requested.
	   (if (not (or ,recursive (tramp-compat-directory-empty-p ,directory)))
	       (tramp-error
		v 'file-error "Directory is not empty, not moving to trash")
	     (move-file-to-trash ,directory))
	 ,@body)
       (tramp-flush-directory-properties v localname))))