No description
Find a file
Richard Lawrence c685cf336a Add full support for iCalendar (RFC5545) data
This is a fix for Bug#74994 that replaces the existing support
in icalendar.el.  It implements a full parser, recurrence rule
and time zone calculations, diary import and export, and a
major mode with syntax highlighting for iCalendar data.  It
obsoletes most of the code in icalendar.el.

In addition to Bug#74994, the proposal to update Emacs' iCalendar
support was discussed on emacs-devel in this thread:
https://lists.gnu.org/archive/html/emacs-devel/2024-10/msg00425.html

icalendar.el pre-dates the current standard (RFC5545), contains numerous
bugs, is not well documented, and could not easily be updated or
extended; starting fresh was the simplest path to creating an iCalendar
library that other Emacs applications and packages can rely on.  It was
decided to leave icalendar.el's code in place for posterity, but declare
it obsolete.  Most of the changes in icalendar.el simply consist of such
declarations.  The old To Do list has also been deleted.

A few changes in icalendar.el, however, consist of new code for
library-wide functions and options, especially error handling.  In
particular:

* lisp/calendar/icalendar.el: Log iCalendar library errors in a single
buffer.
(icalendar-errors-mode): New mode for it.
(icalendar-uid-format): Change the default value to "%h", a hash
value (for privacy).
(icalendar-make-uid): New function, to replace 'icalendar--create-uid'.
(icalendar-debug-level, icalendar-vcalendar-prodid): New option.
(icalendar-vcalendar-version): New constant.
* lisp/calendar/icalendar.el (icalendar-import-format)
(icalendar-import-format-summary, icalendar-import-format-description)
(icalendar-import-format-location, icalendar-import-format-organizer)
(icalendar-import-format-url, icalendar-import-format-uid)
(icalendar-import-format-status, icalendar-import-format-class)
(icalendar-recurring-start-year, icalendar-export-hidden-diary-entries)
(icalendar-export-sexp-enumerate-all, icalendar-export-alarms,
icalendar-debug, icalendar--weekday-array, icalendar--dmsg)
(icalendar--get-unfolded-buffer icalendar--clean-up-line-endings)
(icalendar--rris, icalendar--read-element)
(icalendar--get-event-property, icalendar--get-event-properties)
(icalendar--get-event-property-attributes)
(icalendar--get-children, icalendar--all-events, icalendar--split-value)
(icalendar--convert-tz-offset, icalendar--parse-vtimezone)
(icalendar--get-most-recent-observance)
(icalendar--convert-all-timezones, icalendar--find-time-zone)
(icalendar--decode-isodatetime)
(icalendar--decode-isoduration, icalendar--add-decoded-times)
(icalendar--datetime-to-american-date)
(icalendar--datetime-to-european-date, icalendar--datetime-to-iso-date)
(icalendar--datetime-to-diary-date, icalendar--datetime-to-colontime)
(icalendar--get-month-number, icalendar--get-weekday-number)
(icalendar--get-weekday-numbers, icalendar--get-weekday-abbrev)
(icalendar--date-to-isodate, icalendar--datestring-to-isodate)
(icalendar--diarytime-to-isotime, icalendar--convert-string-for-export)
(icalendar--convert-string-for-import, icalendar-export-file)
(icalendar-export-region, icalendar--create-uid)
(icalendar--parse-summary-and-rest, icalendar--create-ical-alarm)
(icalendar--do-create-ical-alarm, icalendar--convert-ordinary-to-ical)
(icalendar-first-weekday-of-year, icalendar--convert-weekly-to-ical)
(icalendar--convert-yearly-to-ical, icalendar--convert-sexp-to-ical)
(icalendar--convert-block-to-ical, icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical, icalendar--convert-cyclic-to-ical)
(icalendar--convert-anniversary-to-ical, icalendar-import-file)
(icalendar-import-buffer, icalendar--format-ical-event)
(icalendar--convert-to-ical, icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--convert-non-recurring-all-day-to-diary)
(icalendar--convert-non-recurring-not-all-day-to-diary)
(icalendar--add-diary-entry, icalendar-import-format-sample): Mark them
as obsolete.

In addition to the changes above, the new iCalendar library consists of
the following:

* lisp/calendar/diary-icalendar.el:
* lisp/calendar/icalendar-ast.el:
* lisp/calendar/icalendar-macs.el:
* lisp/calendar/icalendar-mode.el:
* lisp/calendar/icalendar-parser.el:
* lisp/calendar/icalendar-recur.el:
* lisp/calendar/icalendar-utils.el: New files

A few changes were made to existing files dealing with the calendar and
diary:

* lisp/calendar/calendar.el (calendar-date-from-day-of-year): New
function, extracted from calendar-goto-day-of-year.
* lisp/calendar/cal-move.el (calendar-goto-day-of-year): Use it.
* lisp/calendar/cal-dst.el (calendar-dst-find-data): Improve docstring.
* lisp/calendar/calendar.el (diary-date-insertion-form): New option.
(diary-american-date-insertion-form, diary-european-date-insertion-form)
(diary-iso-date-insertion-form): New constants.
* lisp/calendar/diary-lib.el (diary-insert-entry): Use the new
'diary-date-insertion-form' option.
(diary-time-regexp): Add FIXME to an existing comment.

The user-facing aspects of the above changes are documented in the Emacs
manual and the NEWS file:

* doc/emacs/calendar.texi (Diary Conversion): Update manual section to
describe the new importer and exporter.
* doc/emacs/emacs.texi (Detailed node listing): Update to include the
new nodes in docs/emacs/calendar.texi.
* etc/NEWS: Briefly describe the new library, major mode, and options.

The remainder of the changes apply to test files.

The following changes introduce new test files related to the new diary
importer and exporter:

* test/lisp/calendar/diary-icalendar-tests.el (Diary import and export):
Tests for diary-icalendar.  In addition to new tests for the exporter,
the existing import tests for icalendar.el have been ported here; these
use the existing iCalendar files in
test/lisp/calendar/icalendar-resources.  (A few new input .ics files
have also been added to this directory; see below.)
* test/lisp/calendar/diary-icalendar-resources: New directory containing
expected outputs for the import tests in diary-icalendar-tests.el.
(These have the same or similar names to the output files for the old
importer, in test/lisp/calendar/icalendar-resources, but different
contents.  Thus they live in a new directory.)
* test/lisp/calendar/icalendar-resources/import-legacy-function.ics: New
input file to test backward compatibility of the new importer with a
function as the value of 'icalendar-import-format', now obsolete.
* test/lisp/calendar/icalendar-resources/import-legacy-vars.ics: New
input file to test backward compatibility of the new importer with
values for options provided by icalendar.el which are now obsolete.
* test/lisp/calendar/icalendar-resources/import-with-attachment.ics: New
input file to test import of base64-encoded attachments.
* icalendar-resources/import-time-format-12hr-blank.ics: New input file
to test import with a custom value of 'diary-icalendar-time-format'.

Two other new test files provide unit tests for the main functions of
the library:

* test/lisp/calendar/icalendar-parser-tests.el (Parser): Tests for
icalendar-parser.  Most of these are derived from examples in RFC5545,
to ensure the parser implements the standard.
* test/lisp/calendar/icalendar-recur-tests.el (Recurrence rules): Tests
for icalendar-recur.  Most of these are derived from examples in RFC5545,
to ensure the recurrence rule interpreter implements the standard.

A few of the existing test files for icalendar.el have also been
modified.  Besides the specific changes mentioned below, the modified
.ics files also now use CR-LF line endings, as required by RFC5545:

* test/lisp/calendar/icalendar-tests.el (icalendar-deftest-obsolete):
New macro.
* test/lisp/calendar/icalendar-resources/import-non-recurring-all-day.ics:
Correct a malformed VALUE parameter.
* test/lisp/calendar/icalendar-resources/import-rrule-anniversary.ics:
Correct representation of a recurring event.
*
test/lisp/calendar/icalendar-resources/import-rrule-daily-with-exceptions.ics:
Add a required VALUE parameter.
* test/lisp/calendar/icalendar-resources/import-rrule-daily.ics:
* test/lisp/calendar/icalendar-resources/import-rrule-monthly-no-end.ics:
* test/lisp/calendar/icalendar-resources/import-rrule-monthly-with-end.ics:
* test/lisp/calendar/icalendar-resources/import-rrule-weekly.ics:
Correct a malformed RRULE property.
2025-12-20 13:38:02 -05:00
admin Merge from origin/emacs-30 2025-12-13 05:43:15 -05:00
build-aux Update from Gnulib by running admin/merge-gnulib 2025-07-29 15:06:14 -07:00
cross Remove ctags program 2025-03-22 11:57:29 -07:00
doc Add full support for iCalendar (RFC5545) data 2025-12-20 13:38:02 -05:00
etc Add full support for iCalendar (RFC5545) data 2025-12-20 13:38:02 -05:00
exec Bump Emacs version 2025-08-14 03:52:16 -04:00
java Support `toolkit-theme-set-functions' on Android and execute hooks safely 2025-11-24 10:16:49 +08:00
leim ; Delete troff markers from ChangeLog files 2025-02-20 02:46:43 +01:00
lib Update from Gnulib by running admin/merge-gnulib 2025-12-12 16:27:11 -08:00
lib-src make-docfile preferring streq 2025-12-14 14:47:22 -08:00
lisp Add full support for iCalendar (RFC5545) data 2025-12-20 13:38:02 -05:00
lwlib Update copyright year to 2025 2025-01-01 07:39:17 +00:00
m4 Update from Gnulib by running admin/merge-gnulib 2025-12-12 16:27:11 -08:00
modules Update copyright year to 2025 2025-01-01 07:39:17 +00:00
msdos Fix the DJGPP port 2025-12-08 10:06:29 +08:00
nextstep ; Delete troff markers from ChangeLog files 2025-02-20 02:46:43 +01:00
nt Remove all traces of MSVC support from MS-Windows code 2025-11-27 09:07:04 +02:00
oldXMenu Omit trailing white space in one line 2025-04-19 22:54:34 -07:00
src Improve handling of non-ASCII characters in 'transpose-regions' 2025-12-20 13:23:29 -05:00
test Add full support for iCalendar (RFC5545) data 2025-12-20 13:38:02 -05:00
.clang-format ; Configure ObjC for clang-format 2023-10-06 16:52:19 +02:00
.clangd Tweak .clangd to work with gcc-compiled Emacs (bug#78367) 2025-05-11 11:14:32 +01:00
.dir-locals.el Fix fontification of ATTRIBUTE_NO_SANITIZE_ADDRESS functions 2025-02-10 00:03:12 +01:00
.gitattributes Update copyright year to 2025 2025-01-01 07:39:17 +00:00
.gitignore Remove ctags program 2025-03-22 11:57:29 -07:00
.gitlab-ci.yml Update copyright year to 2025 2025-01-01 07:39:17 +00:00
.mailmap * .mailmap: update my entry 2025-07-27 14:32:23 +02:00
autogen.sh Fix build on Solaris 10 (bug#75451) 2025-01-17 17:22:45 +00:00
BUGS * BUGS: Minor copy edit. 2024-09-21 13:29:36 +02:00
ChangeLog.1 ; Delete troff markers from ChangeLog files 2025-02-20 02:46:43 +01:00
ChangeLog.2 ; Delete troff markers from ChangeLog files 2025-02-20 02:46:43 +01:00
ChangeLog.3 ; Fix spurious email address in ChangeLog 2025-07-12 17:11:28 +02:00
ChangeLog.4 ; * ChangeLog.4: Update. 2025-02-23 17:19:47 +01:00
ChangeLog.5 Update files for Emacs 30.2 2025-08-14 04:05:28 -04:00
ChangeLog.android Update copyright year to 2025 2025-01-01 07:39:17 +00:00
config.bat Port to modern GCC and pdumper on MS-DOS 2025-02-20 14:04:59 +08:00
configure.ac Use GCC warning -Wunused-const-variable=2 2025-12-13 21:33:01 -08:00
CONTRIBUTE Add etc/NEWS style rules 2025-11-25 09:33:17 +01:00
COPYING Merge from Gnulib 2017-10-01 18:31:10 -07:00
GNUmakefile Update copyright year to 2025 2025-01-01 07:39:17 +00:00
INSTALL Remove ctags program 2025-03-22 11:57:29 -07:00
INSTALL.REPO ; * INSTALL.REPO: Minor copyedits. 2025-02-22 09:16:05 +02:00
make-dist Merge from origin/emacs-30 2025-08-16 13:35:47 +02:00
Makefile.in Remove ctags program 2025-03-22 11:57:29 -07:00
README Bump Emacs version 2025-08-14 03:52:16 -04:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Copyright (C) 2001-2025 Free Software Foundation, Inc.
See the end of the file for license conditions.


This directory tree holds version 31.0.50 of GNU Emacs, the extensible,
customizable, self-documenting real-time display editor.

The file INSTALL in this directory says how to build and install GNU
Emacs on various systems, once you have unpacked or checked out the
entire Emacs file tree.

See the file etc/NEWS for information on new features and other
user-visible changes in recent versions of Emacs.

The file etc/PROBLEMS contains information on many common problems that
occur in building, installing and running Emacs.

The file CONTRIBUTE contains information on contributing to Emacs as a
developer.

You may encounter bugs in this release.  If you do, please report
them; your bug reports are valuable contributions to the FSF, since
they allow us to notice and fix problems on machines we don't have, or
in code we don't use often.  Please send bug reports to the mailing
list bug-gnu-emacs@gnu.org.  If possible, use M-x report-emacs-bug.

See the "Bugs" section of the Emacs manual for more information on how
to report bugs.  (The file 'BUGS' in this directory explains how you
can find and read that section using the Info files that come with
Emacs.)  For a list of mailing lists related to Emacs, see
<https://savannah.gnu.org/mail/?group=emacs>.  For the complete
list of GNU mailing lists, see <https://lists.gnu.org/>.

The 'etc' subdirectory contains several other files, named in capital
letters, which you might consider looking at when installing GNU
Emacs.

The file 'configure' is a shell script to acclimate Emacs to the
oddities of your processor and operating system.  It creates the file
'Makefile' (a script for the 'make' program), which automates the
process of building and installing Emacs.  See INSTALL for more
detailed information.

The file 'configure.ac' is the input used by the autoconf program to
construct the 'configure' script.

The shell script 'autogen.sh' generates 'configure' and other files by
running Autoconf (which in turn uses GNU m4), and configures files in
the .git subdirectory if you are using Git.  If you want to use it,
you will need to install recent versions of these build tools.  This
should be needed only if you edit files like 'configure.ac' that
specify Emacs's autobuild procedure.

The file 'Makefile.in' is a template used by 'configure' to create
'Makefile'.

The file 'make-dist' is a shell script to build a distribution tar
file from the current Emacs tree, containing only those files
appropriate for distribution.  If you make extensive changes to Emacs,
this script will help you distribute your version to others.

There are several subdirectories:

'src'       holds the C code for Emacs (the Emacs Lisp interpreter and
            its primitives, the redisplay code, and some basic editing
            functions).
'lisp'      holds the Emacs Lisp code for Emacs (most everything else).
'leim'      holds the original source files for the generated files
            in lisp/leim.  These form the library of Emacs input methods,
            required to type international characters that can't be
            directly produced by your keyboard.
'lib'       holds source code for libraries used by Emacs and its utilities
'lib-src'   holds the source code for some utility programs for use by or
            with Emacs, like movemail and etags.
'lwlib'     holds the sources of the Lucid Widget Library used on X.
'oldXMenu'  source files from X11R2 XMenu library, used in non-toolkit builds.
'etc'       holds miscellaneous architecture-independent data files Emacs
            uses, like the tutorial text and tool bar images.
            The contents of the 'lisp', 'leim', 'info', and 'doc'
            subdirectories are architecture-independent too.
'info'      holds the Info documentation tree for Emacs.
'doc/emacs' holds the source code for the Emacs Manual.  If you modify the
            manual sources, you will need the 'makeinfo' program to produce
            an updated manual.  'makeinfo' is part of the GNU Texinfo
            package; you need a suitably recent version of Texinfo.
'doc/lispref'   holds the source code for the Emacs Lisp reference manual.
'doc/lispintro' holds the source code for the Introduction to Programming
                in Emacs Lisp manual.
'msdos'     holds configuration files for compiling Emacs under MS-DOS.
'nextstep'  holds instructions and some other files for compiling the
            Nextstep port of Emacs, for GNUstep and macOS Cocoa.
'nt'        holds code and documentation for building Emacs on MS-Windows.
'test'      holds tests for various aspects of Emacs's functionality.
'modules'   holds the modhelp.py helper script.
'admin'     holds files used by Emacs developers, and Unicode data files.
'build-aux' holds auxiliary files used during the build.
'm4'        holds Autoconf macros used for generating the configure script.
'java'	    holds the Java code for the Emacs port to Android.
'cross'	    holds Makefiles and an additional copy of gnulib used to build
	    Emacs for Android devices.
'exec'	    holds the source code to several helper executables used to run
	    user-installed programs on Android.

   Building Emacs on non-Posix platforms requires tools that aren't part
of the standard distribution of the OS.  The platform-specific README
files and installation instructions should list the required tools.


NOTE ON COPYRIGHT YEARS

In copyright notices where the copyright holder is the Free Software
Foundation, then where a range of years appears, this is an inclusive
range that applies to every year in the range.  For example: 2005-2008
represents the years 2005, 2006, 2007, and 2008.


This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.