Function: tramp-handle-load

tramp-handle-load is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-handle-load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)

Documentation

Like load for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
  "Like `load' for Tramp files."
  (with-parsed-tramp-file-name (expand-file-name file) nil
    (unless nosuffix
      (cond ((file-exists-p (concat file ".elc"))
	     (setq file (concat file ".elc")))
	    ((file-exists-p (concat file ".el"))
	     (setq file (concat file ".el")))))
    (when (and must-suffix (not (string-match-p (rx ".el" (? "c") eos) file)))
      (tramp-error
       v 'file-error "File `%s' does not include a `.el' or `.elc' suffix" file))
    (unless (or noerror (file-exists-p file))
      (tramp-error v 'file-missing file))
    (if (not (file-exists-p file))
	nil
      (let ((signal-hook-function (unless noerror signal-hook-function))
	    (inhibit-message (or inhibit-message nomessage)))
	(with-tramp-progress-reporter v 0 (format "Loading %s" file)
	  (let ((local-copy (file-local-copy file)))
	    (unwind-protect
		(load local-copy noerror t nosuffix must-suffix)
	      (delete-file local-copy)))))
      t)))