Previous: Localname deconstruction, Up: Files directories and localnames

8.2 Integration with external Lisp packages

8.2.1 File name completion.

While reading file names in the minibuffer, tramp must decide whether it completes possible incomplete file names, or not. Imagine there is the following situation: You have typed C-x C-f /ssh: <TAB>. tramp cannot know, whether ssh is a method or a host name. It checks therefore the last input character you have typed. If this is <TAB>, <SPACE> or ?, tramp assumes that you are still in file name completion, and it does not connect to the possible remote host ssh.

External packages, which use other characters for completing file names in the minibuffer, must signal this to tramp. For this case, the variable non-essential can be bound temporarily to a non-nil value.

     (let ((non-essential t))
       ...)

8.2.2 File attributes cache.

When tramp runs remote processes, files on the remote host could change their attributes. Consequently, tramp must flush its complete cache keeping attributes for all files of the remote host it has seen so far.

This is a performance degradation, because the lost file attributes must be recomputed when needed again. In cases where the caller of process-file knows that there are no file attribute changes, it should let-bind the variable process-file-side-effects to nil. Then tramp won't flush the file attributes cache.

     (let (process-file-side-effects)
       ...)

For asynchronous processes, tramp flushes the file attributes cache via a process sentinel. If the caller of start-file-process knows that there are no file attribute changes, it should set the process sentinel to the default. In cases where the caller defines its own process sentinel, tramp's process sentinel is overwritten. The caller can still flush the file attributes cache in its process sentinel with this code:

     (unless (memq (process-status proc) '(run open))
       (dired-uncache remote-directory))

remote-directory shall be the root directory, where file attribute changes can happen during the process lifetime. tramp traverses all subdirectories, starting at this directory. Often, it is sufficient to use default-directory of the process buffer as root directory.