Previous: , Up: Files directories and localnames   [Contents][Index]

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.

Previous: , Up: Files directories and localnames   [Contents][Index]