12.14.1 Connection Local Profiles

Emacs uses connection-local profiles to store the variable settings to apply to particular connections. You can then associate these with remote connections by defining the criteria when they should apply, using connection-local-set-profiles.

Function: connection-local-set-profile-variables profile variables

This function defines a set of variable settings for the connection profile, which is a symbol. You can later assign the connection profile to one or more remote connections, and Emacs will apply those variable settings to all process buffers for those connections. The list in variables is an alist of the form (name . value). Example:

(connection-local-set-profile-variables
  'remote-bash
  '((shell-file-name . "/bin/bash")
    (shell-command-switch . "-c")
    (shell-interactive-switch . "-i")
    (shell-login-switch . "-l")))

(connection-local-set-profile-variables
  'remote-ksh
  '((shell-file-name . "/bin/ksh")
    (shell-command-switch . "-c")
    (shell-interactive-switch . "-i")
    (shell-login-switch . "-l")))

(connection-local-set-profile-variables
  'remote-null-device
  '((null-device . "/dev/null")))

If you want to append variable settings to an existing profile, you could use the function connection-local-get-profile-variables in order to retrieve the existing settings, like

(connection-local-set-profile-variables
  'remote-bash
  (append
   (connection-local-get-profile-variables 'remote-bash)
   '((shell-command-dont-erase-buffer . t))))
User Option: connection-local-profile-alist

This alist holds the connection profile symbols and the associated variable settings. It is updated by connection-local-set-profile-variables.

Function: connection-local-set-profiles criteria &rest profiles

This function assigns profiles, which are symbols, to all remote connections identified by criteria. criteria is a plist identifying a connection and the application using this connection. Property names might be :application, :protocol, :user and :machine. The property value of :application is a symbol, all other property values are strings. All properties are optional; if criteria is nil, it always applies. Example:

(connection-local-set-profiles
  '(:application tramp :protocol "ssh" :machine "localhost")
  'remote-bash 'remote-null-device)

(connection-local-set-profiles
  '(:application tramp :protocol "sudo"
    :user "root" :machine "localhost")
  'remote-ksh 'remote-null-device)

If criteria is nil, it applies for all remote connections. Therefore, the example above would be equivalent to

(connection-local-set-profiles
  '(:application tramp :protocol "ssh" :machine "localhost")
  'remote-bash)

(connection-local-set-profiles
  '(:application tramp :protocol "sudo"
    :user "root" :machine "localhost")
  'remote-ksh)

(connection-local-set-profiles
  nil 'remote-null-device)

Any connection profile of profiles must have been already defined by connection-local-set-profile-variables.

User Option: connection-local-criteria-alist

This alist contains connection criteria and their assigned profile names. The function connection-local-set-profiles updates this list.