Function: connection-local-set-profiles

connection-local-set-profiles is an autoloaded and byte-compiled function defined in files-x.el.gz.

Signature

(connection-local-set-profiles CRITERIA &rest PROFILES)

Documentation

Add PROFILES for CRITERIA.

CRITERIA is a plist identifying a connection and the application using this connection, see connection-local-criteria-alist. PROFILES are the names of connection profiles (a symbol).

When a connection to a remote server is opened and CRITERIA matches to that server, the connection-local variables from PROFILES are applied to the corresponding process buffer. The variables for a connection profile are defined using connection-local-set-profile-variables.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;;###autoload
(defun connection-local-set-profiles (criteria &rest profiles)
  "Add PROFILES for CRITERIA.
CRITERIA is a plist identifying a connection and the application
using this connection, see `connection-local-criteria-alist'.
PROFILES are the names of connection profiles (a symbol).

When a connection to a remote server is opened and CRITERIA
matches to that server, the connection-local variables from
PROFILES are applied to the corresponding process buffer.  The
variables for a connection profile are defined using
`connection-local-set-profile-variables'."
  (unless (listp criteria)
    (error "Wrong criteria `%s'" criteria))
  (dolist (profile profiles)
    (unless (assq profile connection-local-profile-alist)
      (error "No such connection profile `%s'" (symbol-name profile))))
  ;; Avoid saving the changed user option to file unless triggered
  ;; explicitly by user.  This workaround can be removed once there is
  ;; a solution for bug#63891.
  (let* ((saved-value (get 'connection-local-criteria-alist 'saved-value))
         (criteria (connection-local-normalize-criteria criteria))
         (slot (assoc criteria connection-local-criteria-alist)))
    (if slot
        (setcdr slot (delete-dups (append (cdr slot) profiles)))
      (setq connection-local-criteria-alist
            (cons (cons criteria (delete-dups profiles))
		  connection-local-criteria-alist)))
    (custom-set-variables
     `(connection-local-criteria-alist ',connection-local-criteria-alist now))
    (unless saved-value
      (put 'connection-local-criteria-alist 'saved-value nil))))