diff options
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | varuga.el | 28 |
2 files changed, 27 insertions, 16 deletions
@@ -1,13 +1,9 @@ [](https://melpa.org/#/varuga) [](https://ci.systemreboot.net/jobs/varuga) -Send ical calendar invites using your Emacs mail client. These -invites are similar to those produced by Google Calendar, Outlook -Calendar, etc. and are compatible with them. +Send ical calendar invites using your Emacs mail client. These invites are similar to those produced by Google Calendar, Outlook Calendar, etc. and are compatible with them. -varuga populates a message mode buffer with an ical MIME part (using -MML, the MIME Meta Language). It also adds a plain text part listing -the time of the event in various configured timezones. +varuga populates a message mode buffer with an ical MIME part (using MML, the MIME Meta Language). It also adds a plain text part listing the time of the event in various configured timezones. All dates and times you enter into varuga are in your local timezone. varuga automatically converts these into a set of configured timezones (specified in `varuga-clock-list`) for your correspondents' benefit. @@ -25,12 +21,7 @@ In a message mode buffer, run `M-x varuga-invite`, and enter the event details. # Natural language date-time and event duration specification -varuga uses the very flexible `org-read-date` to read the date and -time of the event from a natural language -specification. `org-read-date` assumes that most of the time you want -to enter a date in the future: if you omit the month/year and the -given day/month is *before* today, it assumes that you mean a future -date. See [*The date/time prompt* in the Org mode manual](https://orgmode.org/manual/The-date_002ftime-prompt.html) for more details. Here are a few examples of date-time specifications. All the examples below assume that the current date-time is June 16, 2024 7 am. +varuga uses the very flexible `org-read-date` to read the date and time of the event from a natural language specification. `org-read-date` assumes that most of the time you want to enter a date in the future: if you omit the month/year and the given day/month is *before* today, it assumes that you mean a future date. See [*The date/time prompt* in the Org mode manual](https://orgmode.org/manual/The-date_002ftime-prompt.html) for more details. Here are a few examples of date-time specifications. All the examples below assume that the current date-time is June 16, 2024 7 am. ``` 25-2-5 1pm ⇒ 2025-02-05 1300 2/5/25 1am ⇒ 2025-02-05 0100 @@ -51,10 +51,6 @@ (require 'org-id) (require 'time) -;; We use the `method' parameter in our text/calendar MIME part; allow -;; it. -(add-to-list 'mml-content-type-parameters 'method) - (cl-defstruct (varuga-calendar (:constructor varuga-calendar) (:copier nil)) components) @@ -80,6 +76,10 @@ (defvar varuga-time-format world-clock-time-format) +(defvar varuga--mml-content-type-confirmed nil + "t if we've already asked the user whether to configure +`mml-content-type-parameters' for RSVP support, nil otherwise.") + (defun varuga-insert-calendar-line (key value &optional params) "Insert ical calendar line. KEY is the name of the ical property and VALUE is its value. @@ -163,6 +163,25 @@ PARAMS is an alist of ical property parameters and their values." (or (message-fetch-field "Subject") "")) +(defun varuga-mml-content-type-confirm () + "Ask the user for permission to modify +`mml-content-type-parameters' for RSVP support." + (when (and (not (memq 'method mml-content-type-parameters)) + (not varuga--mml-content-type-confirmed) + (let ((help-form "\ +This will add 'method to mml-content-type-parameters, which is +required for RSVPs to work.")) + (y-or-n-p "Set up RSVP support?"))) + (if (and (custom-file t) + (let ((help-form "\ +This will save the value of mml-content-type-parameters in your +`custom-file', so future sessions will support RSVP without +prompting you.")) + (y-or-n-p "Support RSVP in future sessions?"))) + (customize-save-variable 'mml-content-type-parameters '(method)) + (add-to-list 'mml-content-type-parameters 'method)) + (setq varuga--mml-content-type-confirmed t))) + ;;;###autoload (defun varuga-invite (summary location when duration) "Insert calendar invitation into current email message buffer. @@ -178,6 +197,7 @@ is the length of the event in minutes." (org-read-date t t nil "When?") (org-duration-to-minutes (read-string "Duration: " "1h")))) + (varuga-mml-content-type-confirm) (save-excursion ;; Fill Subject header if it is blank. (when (string-blank-p (varuga-message-subject)) |