Function: tramp-sudoedit-handle-file-writable-p

tramp-sudoedit-handle-file-writable-p is a byte-compiled function defined in tramp-sudoedit.el.gz.

Signature

(tramp-sudoedit-handle-file-writable-p FILENAME)

Documentation

Like file-writable-p for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-handle-file-writable-p (filename)
  "Like `file-writable-p' for Tramp files."
  (with-parsed-tramp-file-name (expand-file-name filename) nil
    (with-tramp-file-property v localname "file-writable-p"
      (if (file-exists-p filename)
	  ;; Examine `file-attributes' cache to see if request can be
	  ;; satisfied without remote operation.
	  (or (tramp-check-cached-permissions v ?w)
	      (tramp-sudoedit-send-command
	       v "test" "-w" (file-name-unquote localname)))
	;; If file doesn't exist, check if directory is writable.
	(and
	 (file-directory-p (file-name-directory filename))
	 (file-writable-p (file-name-directory filename)))))))