mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 09:14:18 +00:00
8 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
858cebd6c5 |
Fix failing iCalendar tests when TZ=UTC
* lisp/calendar/diary-icalendar.el (diary-icalendar--tz-is-utc-p): New function. (diary-icalendar-convert-time-via-strategy): Don't expect a VTIMEZONE for UTC times. (diary-icalendar-export-region): Don't generate a VTIMEZONE for 'local export strategy in UTC. * test/lisp/calendar/diary-icalendar-tests.el (diary-icalendar-test-entry-parser): Don't generate a VTIMEZONE for 'local export strategy in UTC. |
||
|
|
c091ff00ec |
lisp/calendar/diary-icalendar.el (di:summary-regexp): Fix :type
|
||
|
|
1e7dae37b8 |
lisp/calendar: Style changes
Fix some misuses of `defconst` and `%s`, avoid uses of the old dynbound dialect of `eval`, delete redundant `:group` arguments, and prefer #' to quote function names. And stop creating alists for completion tables since lists of strings work just as well. * lisp/calendar/appt.el: Delete redundant `:group` arguments. Prefer #' to quote function names. * lisp/calendar/cal-hebrew.el (solar-time-string): Declare function. (calendar-hebrew-read-date, calendar-hebrew-list-yahrzeits): * lisp/calendar/cal-persia.el (calendar-persian-read-date): * lisp/calendar/cal-mayan.el (calendar-mayan-read-haab-date) (calendar-mayan-read-tzolkin-date): * lisp/calendar/cal-julian.el (calendar-julian-goto-date): * lisp/calendar/cal-islam.el (calendar-islamic-read-date): * lisp/calendar/cal-coptic.el (calendar-coptic-read-date): * lisp/calendar/cal-bahai.el (calendar-bahai-read-date): Completion tables can be lists of strings for decades. * lisp/calendar/cal-china.el: Delete redundant `:group` arguments. (calendar-chinese-zodiac-sign-on-or-after) (calendar-chinese-new-moon-on-or-after): Use lexical dialect also for `eval`. * lisp/calendar/cal-dst.el: Delete redundant `:group` arguments. Use lexical dialect also for `eval`. * lisp/calendar/cal-html.el: Delete redundant `:group` arguments. * lisp/calendar/cal-menu.el: Prefer #' to quote function names. * lisp/calendar/cal-tex.el: Delete redundant `:group` arguments. (cal-tex-weekly-common): Use lexical dialect also for `eval`. * lisp/calendar/calendar.el (calendar-mode-map): Prefer #' to quote function names. * lisp/calendar/diary-icalendar.el (di:rrule-sexp-to-recurrence) (di:other-sexp-to-recurrence): Use lexical dialect also for `eval`. * lisp/calendar/diary-lib.el: Delete redundant `:group` arguments. Prefer #' to quote function names. (diary-sexp-entry, diary-offset, diary-remind): Use lexical dialect also for `eval`. * lisp/calendar/icalendar-macs.el (ical:define-param): Fix misuse of `%s` in `format`. * lisp/calendar/icalendar-parser.el (ical:value-types) (ical:param-types, ical:property-types, ical:component-types): Don't use `defconst` on variables we mutate. * lisp/calendar/icalendar-recur.el (icr:current-tz-to-vtimezone) (icr:current-tz-to-vtimezone): Use lexical dialect also for `eval`. * lisp/calendar/icalendar.el: Delete redundant `:group` arguments. * lisp/calendar/lunar.el: Prefer #' to quote function names. * lisp/calendar/solar.el (solar-sunrise-sunset-string) (calendar-sunrise-sunset-month): Use lexical dialect also for `eval`. * lisp/calendar/timeclock.el: Prefer #' to quote function names. |
||
|
|
4db3be2001 |
Fix iCalendar macro (debug ...) forms and indentation
As discussed in Bug#74994. * lisp/calendar/icalendar-ast.el (icalendar-make-param) (icalendar-make-property, icalendar-make-component) (icalendar-make-node-from-templates) * lisp/calendar/icalendar-macs.el (icalendar-with-node-children) (icalendar-with-node-value, icalendar-with-param) (icalendar-with-child-of, icalendar-with-property-of): Remove extraneous arguments in (debug ...) forms. * lisp/calendar/icalendar-recur.el * lisp/calendar/diary-icalendar.el: Fix indentation of calls to them. Plus one other minor fix: * lisp/calendar/diary-icalendar.el (diary-icalendar-current-tz-to-vtimezone): Ignore unused error variable (fixes a byte compiler warning). |
||
|
|
74750e269b |
Some minor code improvements in iCalendar library
* lisp/calendar/icalendar-mode.el: Update file header. Fix error display in 'icalendar-errors-mode': * lisp/calendar/icalendar.el (icalendar-error-regexp): Fix to allow " *UNFOLDED:" prefix in buffer names. (Extra colon was breaking match.) (icalendar-format-error): Suppress this prefix preferentially in long buffer names. Add declarations to some iCalendar macros: * lisp/calendar/icalendar-macs.el (icalendar-with-node-value) (icalendar-with-child-of) (icalendar-with-param-of) (icalendar-with-node-children) (icalendar-with-node-value) (icalendar-with-param) * lisp/calendar/icalendar-ast.el (icalendar-make-property) (icalendar-make-component) (icalendar-make-node-from-templates): Add (declare ...) forms. Add `icalendar-trimp' to icalendar-utils.el: * lisp/calendar/icalendar-utils.el (icalendar-trimp): New function. * lisp/calendar/diary-icalendar.el (diary-icalendar-format-entry) (diary-icalendar-parse-attendees-and-organizer) (diary-icalendar-parse-location) (diary-icalendar-parse-url) (diary-icalendar-parse-uid): Use it to replace diary-icalendar--nonempty. (diary-icalendar--nonempty): Remove. Move VTIMEZONE creation to icalendar-recur.el: The following changes move `diary-icalendar-current-tz-to-vtimezone' and associated code to icalendar-recur.el. Library users are likely to need this function, so it makes sense to keep it with other time zone-related code in that file, instead of having them depend on diary-icalendar. * lisp/calendar/icalendar-recur.el (icalendar-tz-data-insufficient) (icalendar-tz-unsupported): New error types. (icalendar-recur-current-tz-to-vtimezone): Rename from `diary-icalendar-current-tz-to-vtimezone'; signal new error types. (icalendar-recur--tz-warning): Rename from `diary-icalendar--tz-warning'. (icalendar-recur--emacs-local-tzid): Rename from `diary-icalendar--emacs-local-tzid'. (icalendar-recur--tz-info-sexp-p): Rename from `diary-icalendar--tz-info-sexp-p'. * lisp/calendar/diary-icalendar.el (diary-icalendar-current-tz-to-vtimezone): Reimplement with `icalendar-recur-current-tz-to-vtimezone'. (diary-icalendar--tz-warning) (diary-icalendar--emacs-local-tzid) (diary-icalendar--tz-info-sexp-p): Renamed and moved; see above. (diary-time-zone-export-strategy): Update validation function name. |
||
|
|
cf20565e63 |
Change the format function calling conventions in diary-icalendar.el
This avoids `calendar-dlet' and unprefixed dynamic variable bindings when calling user format functions, as discussed in Bug#74994. * lisp/calendar/diary-icalendar.el (diary-icalendar-time-format): Fix whitespace. (diary-icalendar-format-attendee) (diary-icalendar-format-entry): Use fewer dynamic variables, prefix them, replace `calendar-dlet' with `dlet', and call user format functions with the node to be formatted. (diary-icalendar-attendee-format-function) (diary-icalendar-vevent-format-function) (diary-icalendar-vjournal-format-function) (diary-icalendar-vtodo-format-function): Document these changes. (diary-icalendar-attendee-skeleton) (diary-icalendar-vevent-skeleton) (diary-icalendar-vjournal-skeleton) (diary-icalendar-vtodo-skeleton): Use `defun' with `skeleton-insert' instead of `define-skeleton'. Update variable references. (diary-icalendar-import-buffer-to-buffer) (diary-icalendar-add-valarms): Replace `calendar-dlet' with `dlet'. * doc/emacs/calendar.texi (Diary iCalendar Import): Update example in manual. |
||
|
|
f37efe5e94 |
iCalendar code improvements
Thanks to Stefan Monnier for the comments in Bug#74994 leading to most of these changes. Improvements in diary-icalendar.el and related changes: * lisp/calendar/diary-icalendar.el (icalendar-save-binary-atttachment): Rename to `diary-icalendar-save-binary-attachment'. Document internal require. (diary-icalendar-attendee-skeleton-command): Rename to `diary-icalendar-attendee-format-function'. (diary-icalendar-vevent-skeleton-command): Rename to `diary-icalendar-vevent-format-function'. (diary-icalendar-vjournal-skeleton-command): Rename to `diary-icalendar-vjournal-format-function'. (diary-icalendar-vtodo-skeleton-command): Rename to `diary-icalendar-vtodo-format-function'. * doc/emacs/calendar.texi (Diary iCalendar Import) * 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): Update references to renamed functions. (diary-icalendar-attendee-format-function): Fix quoted function name. (diary-icalendar-attendee-format-function) (diary-icalendar-vevent-format-function) (diary-icalendar-vjournal-format-function) (diary-icalendar-vtodo-format-function) (diary-icalendar-after-mailcap-viewer-hook): Improve docstrings. (diary-icalendar-skip-addresses-regexp): Ensure default value is a regexp. (diary-icalendar-description-regexp): Fix :type declaration to agree with default. (diary-icalendar-format-date): Replace unnecessary `calendar-dlet' with `dlet'. (diary-icalendar-vevent-format-function) (diary-icalendar-vjournal-format-function) (diary-icalendar-vtodo-format-function) (diary-icalendar-format-entry) (diary-icalendar-import-buffer-to-buffer) (diary-icalendar--entry-import) (diary-icalendar-import-buffer) (diary-icalendar-import-file): Change "non-marking" to "nonmarking" in variable names for consistency (cf. `diary-nonmarking-symbol'). (diary-icalendar-attendee-skeleton): Remove unnecessary call to `skeleton-insert'. (diary-icalendar-vevent-skeleton) (diary-icalendar-vjournal-skeleton) (diary-icalendar-vtodo-skeleton): Don't insert return values of `let' forms. (diary-icalendar-parse-entry): Call `diary-icalendar-other-properties-parser' with type and properties as arguments, instead of dynamic binding. (diary-icalendar-other-properties-parser): Document the new calling convention. * test/lisp/calendar/diary-icalendar-tests.el (diary-icalendar-test-parse-@-location): Accept the new arguments. Clarify `declare-function' usage: * lisp/calendar/icalendar-parser.el (icalendar-read-time) (icalendar-period-end, icalendar-parse-calendar) (icalendar-index-insert, icalendar-index-get) * lisp/calendar/icalendar-ast.el (icalendar-printable-value-type-symbol-p) (icalendar-ast-node-valid-value-p) * lisp/calendar/icalendar-utils.el (icalendar-date-time-add) (icalendar-dates-until, icalendar-date-time-variant): Move `declare-function' forms to corresponding `require' forms. Improve debugging with icalendar-ast.el macros: * lisp/calendar/icalendar-ast.el (icalendar-make-value-node-of): Add explanatory comment to require. (icalendar--make-param--list, icalendar--make-param--nonlist) (icalendar--make-property--list, icalendar--make-property--nonlist): New functions. (icalendar-make-param, icalendar-make-property): Use them to reduce code generated by these macros. Add (declare (debug ...)) forms. (icalendar-make-component, icalendar-make-node-from-templates): Add (declare (debug ...)) forms. * test/lisp/calendar/icalendar-ast-tests.el: New file. Various other minor changes: * lisp/calendar/icalendar-macs.el (icalendar-define-type): Improve docstring. (icalendar-define-property): Fix deprecation warning: replace 'any' with 'not-newline' in rx definition. * test/lisp/calendar/icalendar-recur-tests.el (icalendar-test-rrule-test): Pass tags on to `ert-deftest' and mark several tests as expensive. * lisp/calendar/calendar.el (diary-date-insertion-form): Remove constants from :set-after list. * lisp/calendar/diary-lib.el (diary-time-regexp): Clarify FIXME comment. * lisp/calendar/icalendar-parser.el (icalendar-x-name): Fix indentation. (icalendar-cal-address): Improve docstring. |
||
|
|
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. |