Function: sesman-link-session

sesman-link-session is a byte-compiled function defined in sesman.el.

Signature

(sesman-link-session SYSTEM SESSION &optional CXT-TYPE CXT-VAL)

Documentation

Link SYSTEM's SESSION to context give by CXT-TYPE and CXT-VAL.

If CXT-TYPE is nil, use the least specific type available in the current context. If CXT-TYPE is non-nil, and CXT-VAL is not given, retrieve it with sesman-context. See also sesman-link-with-project, sesman-link-with-directory and sesman-link-with-buffer.

Source Code

;; Defined in ~/.emacs.d/elpa/sesman-20240417.1723/sesman.el
(defun sesman-link-session (system session &optional cxt-type cxt-val)
  "Link SYSTEM's SESSION to context give by CXT-TYPE and CXT-VAL.
If CXT-TYPE is nil, use the least specific type available in the current
context. If CXT-TYPE is non-nil, and CXT-VAL is not given, retrieve it with
`sesman-context'. See also `sesman-link-with-project',
`sesman-link-with-directory' and `sesman-link-with-buffer'."
  (let* ((ses-name (or (car-safe session)
                       (error "SESSION must be a headed list")))
         (cxt-val (or cxt-val
                      (or (if cxt-type
                              (sesman-context cxt-type system)
                            (let ((cxt (sesman--least-specific-context system)))
                              (setq cxt-type (car cxt))
                              (cdr cxt)))
                          (error "No local context of type %s" cxt-type))))
         (cxt-val (if (stringp cxt-val)
                      (expand-file-name cxt-val)
                    cxt-val))
         (key (cons system ses-name))
         (link (list key cxt-type cxt-val)))
    (if (member cxt-type sesman-single-link-context-types)
        (thread-last sesman-links-alist
          (seq-remove (sesman--link-lookup-fn system nil cxt-type cxt-val))
          (cons link)
          (setq sesman-links-alist))
      (unless (seq-filter (sesman--link-lookup-fn system ses-name cxt-type cxt-val)
                          sesman-links-alist)
        (setq sesman-links-alist (cons link sesman-links-alist))))
    (run-hooks 'sesman-post-command-hook)
    link))