Variable: diary-date-forms

diary-date-forms is a customizable variable defined in calendar.el.gz.

Value

((month "/" day "[^/0-9]") (month "/" day "/" year "[^0-9]")
 (monthname " *" day "[^,0-9]")
 (monthname " *" day ", *" year "[^0-9]") (dayname "\\W"))

Documentation

List of pseudo-patterns describing the forms of date used in the diary.

The patterns on the list must be MUTUALLY EXCLUSIVE and should not match any portion of the diary entry itself, just the date component.

A pseudo-pattern is a list of regular expressions and the keywords month, day, year, monthname, and dayname. The keyword monthname will match the name of the month (see calendar-month-name-array), capitalized or not, or its user-specified abbreviation (see calendar-month-abbrev-array), followed by a period or not; it will also match *. Similarly, dayname will match the name of the day (see calendar-day-name-array), capitalized or not, or its user-specified abbreviation (see calendar-day-abbrev-array), followed by a period or not. The keywords month, day, and year will match those numerical values, preceded by arbitrarily many zeros; they will also match *.

The matching of the diary entries with the date forms is done with the standard syntax table from Fundamental mode, but with the * changed so that it is a word constituent.

If, to be mutually exclusive, a pseudo-pattern must match a portion of the diary entry itself, the first element of the pattern MUST be backup. This directive causes the date recognizer to back up to the beginning of the current word of the diary entry, so in no case can the pattern match more than a portion of the first word of the diary entry.

For examples of three common styles, see diary-american-date-forms, diary-european-date-forms, and diary-iso-date-forms.

If you customize this variable, you should also customize the variable diary-date-insertion-form to contain a pseudo-pattern which produces dates that match one of the forms in this variable. (If diary-date-insertion-form does not correspond to one of the patterns in this variable, then the diary will not recognize such dates, including those inserted into the diary from the calendar with diary-insert-entry.)

View in manual

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/calendar.el.gz
(defcustom diary-date-forms (cond ((eq calendar-date-style 'iso)
                                   diary-iso-date-forms)
                                  ((eq calendar-date-style 'european)
                                   diary-european-date-forms)
                                  (t diary-american-date-forms))
  "List of pseudo-patterns describing the forms of date used in the diary.
The patterns on the list must be MUTUALLY EXCLUSIVE and should not match
any portion of the diary entry itself, just the date component.

A pseudo-pattern is a list of regular expressions and the keywords `month',
`day', `year', `monthname', and `dayname'.  The keyword `monthname' will
match the name of the month (see `calendar-month-name-array'), capitalized
or not, or its user-specified abbreviation (see `calendar-month-abbrev-array'),
followed by a period or not; it will also match `*'.  Similarly, `dayname'
will match the name of the day (see `calendar-day-name-array'), capitalized or
not, or its user-specified abbreviation (see `calendar-day-abbrev-array'),
followed by a period or not.  The keywords `month', `day', and `year' will
match those numerical values, preceded by arbitrarily many zeros; they will
also match `*'.

The matching of the diary entries with the date forms is done with the
standard syntax table from Fundamental mode, but with the `*' changed so
that it is a word constituent.

If, to be mutually exclusive, a pseudo-pattern must match a portion of the
diary entry itself, the first element of the pattern MUST be `backup'.  This
directive causes the date recognizer to back up to the beginning of the
current word of the diary entry, so in no case can the pattern match more than
a portion of the first word of the diary entry.

For examples of three common styles, see `diary-american-date-forms',
`diary-european-date-forms', and `diary-iso-date-forms'.

If you customize this variable, you should also customize the variable
`diary-date-insertion-form' to contain a pseudo-pattern which produces
dates that match one of the forms in this variable. (If
`diary-date-insertion-form' does not correspond to one of the patterns
in this variable, then the diary will not recognize such dates,
including those inserted into the diary from the calendar with
`diary-insert-entry'.)"
  :type '(repeat (choice (cons :tag "Backup"
                               :value (backup . nil)
                               (const backup)
                               (repeat (list :inline t :format "%v"
                                             (symbol :tag "Keyword")
                                             (choice symbol regexp))))
                         (repeat (list :inline t :format "%v"
                                       (symbol :tag "Keyword")
                                       (choice symbol regexp)))))
  :set-after '(calendar-date-style diary-iso-date-forms
                                   diary-european-date-forms
                                   diary-american-date-forms)
  :initialize 'custom-initialize-default
  :set (lambda (symbol value)
         (unless (equal value (default-value symbol))
           (custom-set-default symbol value)
           (setq diary-font-lock-keywords (diary-font-lock-keywords))
           ;; Need to redraw not just to get new font-locking, but also
           ;; to pick up any newly recognized entries.
           (and (diary-live-p)
                (diary))))
  :group 'diary)