Function: setq-connection-local

setq-connection-local is an autoloaded macro defined in files-x.el.gz.

Signature

(setq-connection-local [VARIABLE VALUE]...)

Documentation

Set each VARIABLE connection-locally to VALUE.

When connection-local-profile-name-for-setq is set, assign each variable's value on that connection profile, and set that profile for connection-local-criteria. You can use this in combination with with-connection-local-variables, as in

  (with-connection-local-variables
    (setq-connection-local VARIABLE VALUE))

If there's no connection-local profile to use, just set the variables normally, as with setq.

The variables are literal symbols and should not be quoted. The second VALUE is not computed until after the first VARIABLE is set, and so on; each VALUE can use the new value of variables set earlier in the setq-connection-local. The return value of the setq-connection-local form is the value of the last VALUE.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/files-x.el.gz
;;;###autoload
(defmacro setq-connection-local (&rest pairs)
  "Set each VARIABLE connection-locally to VALUE.

When `connection-local-profile-name-for-setq' is set, assign each
variable's value on that connection profile, and set that profile
for `connection-local-criteria'.  You can use this in combination
with `with-connection-local-variables', as in

  (with-connection-local-variables
    (setq-connection-local VARIABLE VALUE))

If there's no connection-local profile to use, just set the
variables normally, as with `setq'.

The variables are literal symbols and should not be quoted.  The
second VALUE is not computed until after the first VARIABLE is
set, and so on; each VALUE can use the new value of variables set
earlier in the `setq-connection-local'.  The return value of the
`setq-connection-local' form is the value of the last VALUE.

\(fn [VARIABLE VALUE]...)"
  (declare (debug setq))
  (unless (evenp (length pairs))
    (error "PAIRS must have an even number of variable/value members"))
  (let ((set-expr nil)
        (profile-vars nil))
    (while pairs
      (unless (symbolp (car pairs))
        (error "Attempting to set a non-symbol: %s" (car pairs)))
      (push `(set ',(car pairs) ,(cadr pairs)) set-expr)
      (push `(cons ',(car pairs) ,(car pairs)) profile-vars)
      (setq pairs (cddr pairs)))
    `(prog1
         ,(macroexp-progn (nreverse set-expr))
       (when connection-local-profile-name-for-setq
         (connection-local-update-profile-variables
          connection-local-profile-name-for-setq
          (list ,@(nreverse profile-vars)))
         (connection-local-set-profiles
          connection-local-criteria
          connection-local-profile-name-for-setq)))))