Previous: Localname deconstruction, Up: Files directories and localnames

8.2 Integrating with external Lisp packages

8.2.1 File name completion.

For name completions in the minibuffer, tramp depends on the last input character to decide whether to look for method name completion or host name completion. For example, C-x C-f /ssh: <TAB> is not entirely clear if ssh is a method or a host name. But if the last input character was either <TAB>, <SPACE> or ?, then tramp favors file name completion over host name completion.

What about external packages using other characters to trigger file name completions? They must somehow signal this to tramp. Use the variable non-essential temporarily and bind it to non-nil value.

     (let ((non-essential t))

8.2.2 File attributes cache.

Keeping a local cache of remote file attributes in sync with the remote host is a time-consuming operation. Flushing and re-querying these attributes can tax tramp to a grinding halt on busy remote servers.

To get around these types of slow-downs in tramp's responsiveness, set the process-file-side-effects to nil to stop tramp from flushing the cache. This is helpful in situations where callers to process-file know there are no file attribute changes. The let-bind form to accomplish this:

     (let (process-file-side-effects)

For asynchronous processes, tramp uses a process sentinel to flush file attributes cache. When callers to start-file-process know beforehand no file attribute changes are expected, then the process sentinel should be set to the default state. 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))

Since tramp traverses subdirectories starting with the root-directory, it is most likely sufficient to make the default-directory of the process buffer as the root directory.