Function: org-bbdb-anniversaries-future

org-bbdb-anniversaries-future is a byte-compiled function defined in ol-bbdb.el.gz.

Signature

(org-bbdb-anniversaries-future &optional N)

Documentation

Return list of anniversaries for today and the next n-1 days (default n=7).

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol-bbdb.el.gz
(defun org-bbdb-anniversaries-future (&optional n)
  "Return list of anniversaries for today and the next n-1 days (default n=7)."
  (let ((n (or n 7)))
    (when (<= n 0)
      (error "The (optional) argument of `org-bbdb-anniversaries-future' \
must be positive"))
    (let (
	  ;; List of relevant dates.
	  (dates (org-bbdb-date-list date n))
	  ;; Function to annotate text of each element of l with the
	  ;; anniversary date d.
	  (annotate-descriptions
	   (lambda (agenda-date d l)
	     (mapcar (lambda (x)
		       ;; The assumption here is that x is a bbdb link
		       ;; of the form [[bbdb:name][description]].
		       ;; This function rather arbitrarily modifies
		       ;; the description by adding the date to it in
		       ;; a fixed format.
		       (let ((desc (org-bbdb-anniversary-description
				    agenda-date d)))
			 (string-match "]]" x)
			 (replace-match desc nil nil x)))
		     l))))
      ;; Map a function that generates anniversaries for each date
      ;; over the dates and nconc the results into a single list. When
      ;; it is no longer necessary to support older versions of Emacs,
      ;; this can be done with a cl-mapcan; for now, we use the (apply
      ;; #'nconc ...) method for compatibility.
      (apply #'nconc
	     (mapcar
	      (lambda (d)
		(let ((agenda-date date)
		      (date d))
		  ;; Rebind 'date' so that org-bbdb-anniversaries will
		  ;; be fooled into giving us the list for the given
		  ;; date and then annotate the descriptions for that
		  ;; date.
		  (funcall annotate-descriptions agenda-date d (org-bbdb-anniversaries))))
	      dates)))))