Function: tramp-crypt-handle-insert-directory

tramp-crypt-handle-insert-directory is a byte-compiled function defined in tramp-crypt.el.gz.

Signature

(tramp-crypt-handle-insert-directory FILENAME SWITCHES &optional WILDCARD FULL-DIRECTORY-P)

Documentation

Like insert-directory for Tramp files.

WILDCARD is not supported.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-crypt.el.gz
(defun tramp-crypt-handle-insert-directory
  (filename switches &optional wildcard full-directory-p)
  "Like `insert-directory' for Tramp files.
WILDCARD is not supported."
  ;; This package has been added to Emacs 27.1.
  (when (load "text-property-search" 'noerror 'nomessage)
    (let (tramp-crypt-enabled)
      (tramp-handle-insert-directory
       (tramp-crypt-encrypt-file-name filename)
       switches wildcard full-directory-p)
      (let* ((filename (file-name-as-directory filename))
	     (enc (tramp-crypt-encrypt-file-name filename))
	     match string)
	(goto-char (point-min))
	(while (setq match (text-property-search-forward 'dired-filename t t))
	  (setq string
		(buffer-substring
		 (prop-match-beginning match) (prop-match-end match))
		string (if (file-name-absolute-p string)
			   (tramp-crypt-decrypt-file-name string)
			 (substring
			  (tramp-crypt-decrypt-file-name (concat enc string))
			  (length filename))))
	  (delete-region (prop-match-beginning match) (prop-match-end match))
	  (insert (propertize string 'dired-filename t)))))))