Function: async-inject-environment

async-inject-environment is a function alias for async-inject-variables, defined in async.el.

Signature

(async-inject-environment INCLUDE-REGEXP &optional PREDICATE EXCLUDE-REGEXP NOPROPS)

Documentation

Return a setq form that replicates part of the calling environment.

It sets the value for every variable matching INCLUDE-REGEXP and also PREDICATE. It will not perform injection for any variable matching EXCLUDE-REGEXP (if present) and variables matching one of async-inject-variables-exclude-regexps. When NOPROPS is non nil it tries to strip out text properties of each variable's value with async-variables-noprops-function.

It is intended to be used as follows:

    (async-start
       `(lambda ()
          (require 'smtpmail)
          (with-temp-buffer
            (insert ,(buffer-substring-no-properties (point-min) (point-max)))
            ;; Pass in the variable environment for smtpmail
            ,(async-inject-variables "\\\\=`\\(smtpmail\\|\\(user-\\)?mail\\)-")
            (smtpmail-send-it)))
       'ignore)

Aliases

async-inject-variables