Function: sesman-remove-object

sesman-remove-object is a byte-compiled function defined in sesman.el.

Signature

(sesman-remove-object SYSTEM SESSION-NAME OBJECT &optional AUTO-UNREGISTER NO-ERROR)

Documentation

Remove (destructively) OBJECT from session SESSION-NAME of SYSTEM.

If SESSION-NAME is nil, retrieve the session with sesman-session-for-object. If OBJECT is the last object in sesman session, sesman-unregister the session. If AUTO-UNREGISTER is non-nil unregister sessions of length 0 and remove all the links with the session. If NO-ERROR is non-nil, don't throw an error if OBJECT is not found in any session. This is useful if there are several "concurrent" parties which can remove the object.

Source Code

;; Defined in ~/.emacs.d/elpa/sesman-20240417.1723/sesman.el
(defun sesman-remove-object (system session-name object &optional auto-unregister no-error)
  "Remove (destructively) OBJECT from session SESSION-NAME of SYSTEM.
If SESSION-NAME is nil, retrieve the session with
`sesman-session-for-object'.  If OBJECT is the last object in sesman
session, `sesman-unregister' the session.  If AUTO-UNREGISTER is non-nil
unregister sessions of length 0 and remove all the links with the session.
If NO-ERROR is non-nil, don't throw an error if OBJECT is not found in any
session.  This is useful if there are several \"concurrent\" parties which
can remove the object."
  (let* ((system (or system (sesman--system)))
         (session (if session-name
                      (sesman-session system session-name)
                    (sesman-session-for-object system object no-error)))
         (new-session (delete object session)))
    (cond ((null new-session))
          ((= (length new-session) 1)
           (when auto-unregister
             (sesman-unregister system session)))
          (t
           (puthash (cons system (car session)) new-session sesman-sessions-hashmap)))))