Function: activities-save

activities-save is a byte-compiled function defined in activities.el.

Signature

(activities-save ACTIVITY &key DEFAULTP LASTP PERSISTP)

Documentation

Save states of ACTIVITY.

If DEFAULTP, save its default state; if LASTP, its last. If PERSISTP, force persisting of data (otherwise, data is persisted according to option activities-always-persist, which see).

Source Code

;; Defined in ~/.emacs.d/elpa/activities-0.7.2/activities.el
;;;; Functions

(cl-defun activities-save (activity &key defaultp lastp persistp)
  "Save states of ACTIVITY.
If DEFAULTP, save its default state; if LASTP, its last.  If
PERSISTP, force persisting of data (otherwise, data is persisted
according to option `activities-always-persist', which see)."
  (activities-with activity
    (when (or defaultp lastp)
      (unless (run-hook-with-args-until-success 'activities-anti-save-predicates)
        (pcase-let* (((cl-struct activities-activity default last) activity)
                     (new-state (activities-state)))
          (setf (activities-activity-default activity) (if (or defaultp (not default)) new-state default)
                (activities-activity-last activity) (if (or lastp (not last)) new-state last)))))
    ;; Always set the value so, e.g. the activity can be modified
    ;; externally and saved here.
    (setf (map-elt activities-activities (activities-activity-name activity)) activity))
  (activities--persist persistp))