Function: tramp-sh-handle-set-visited-file-modtime

tramp-sh-handle-set-visited-file-modtime is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-set-visited-file-modtime &optional TIME-LIST)

Documentation

Like set-visited-file-modtime for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-set-visited-file-modtime (&optional time-list)
  "Like `set-visited-file-modtime' for Tramp files."
  (unless (buffer-file-name)
    (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
	   (buffer-name)))
  (if time-list
      (tramp-run-real-handler #'set-visited-file-modtime (list time-list))
    (let ((f (expand-file-name (buffer-file-name)))
	  coding-system-used)
      (with-parsed-tramp-file-name f nil
	(let* ((remote-file-name-inhibit-cache t)
	       (attr (file-attributes f))
	       (modtime (or (file-attribute-modification-time attr)
			    tramp-time-doesnt-exist)))
	  (setq coding-system-used last-coding-system-used)
	  (if (not (tramp-compat-time-equal-p modtime tramp-time-dont-know))
	      (tramp-run-real-handler #'set-visited-file-modtime (list modtime))
	    (progn
	      (tramp-send-command
	       v
	       (format "%s -ild %s"
		       (tramp-get-ls-command v)
		       (tramp-shell-quote-argument localname)))
	      (setq attr (buffer-substring (point) (line-end-position))))
	    (tramp-set-file-property
	     v localname "visited-file-modtime-ild" attr))
	  (setq last-coding-system-used coding-system-used)
	  nil)))))