Function: sesman-current-links

sesman-current-links is a byte-compiled function defined in sesman.el.

Signature

(sesman-current-links SYSTEM &optional SESSION-OR-NAME SORT CXT-TYPES)

Documentation

Retrieve all active links in current context for SYSTEM and SESSION-OR-NAME.

SESSION-OR-NAME can be either a session or a name of the session. CXT-TYPES is a list of context types to consider. Returned links are a subset of sesman-links-alist sorted in order of relevance if SORT is non-nil.

Source Code

;; Defined in ~/.emacs.d/elpa/sesman-20240417.1723/sesman.el
(defun sesman-current-links (system &optional session-or-name sort cxt-types)
  "Retrieve all active links in current context for SYSTEM and SESSION-OR-NAME.
SESSION-OR-NAME can be either a session or a name of the session. CXT-TYPES is a
list of context types to consider. Returned links are a subset of
`sesman-links-alist' sorted in order of relevance if SORT is non-nil."
  ;; mapcan is a built-in in 26.1; don't want to require cl-lib for one function
  (let ((ses-name (if (listp session-or-name)
                      (car session-or-name)
                    session-or-name)))
    (seq-mapcat
     (lambda (cxt-type)
       (let* ((lfn (sesman--link-lookup-fn system ses-name cxt-type))
              (links (seq-filter (lambda (l)
                                   (and (funcall lfn l)
                                        (sesman-relevant-context-p cxt-type (sesman--lnk-value l))))
                                 sesman-links-alist)))
         (if sort
             (sesman--sort-links system links)
           links)))
     (or cxt-types (sesman-context-types system)))))