Package: emacs;
Reported by: Ferdinand Pieper <list_gnu <at> pie.tf>
Date: Tue, 27 Aug 2024 13:52:02 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 31.1
Done: Robert Pluim <rpluim <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72831 in the body.
You can then email your comments to 72831 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Tue, 27 Aug 2024 13:52:02 GMT) Full text and rfc822 format available.Ferdinand Pieper <list_gnu <at> pie.tf>
:bug-gnu-emacs <at> gnu.org
.
(Tue, 27 Aug 2024 13:52:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Ferdinand Pieper <list_gnu <at> pie.tf> To: bug-gnu-emacs <at> gnu.org Subject: [PATCH] gnus-icalendar: Allow comments in event replies Date: Tue, 27 Aug 2024 11:58:32 +0200
[Message part 1 (text/plain, inline)]
Tags: patch The iCalendar RFC allows comments in an event reply to e.g. indicate a reason for declining. This patch implements sending an additional comment if the usual functions `gnus-icalendar-reply-[accept,decline,tentative]` (bound to `i a`, `i d`, `i t`) are called with a prefix argument. Please let me know any feedback regarding the patch and commit message formatting. Notably this only implements the comment functionality for the functions mentioned above and does not include the buttons defined in `gnus-icalendar-event:inline-reply-buttons`, as I am not sure how the `read-string` for the user's comment should be implemented for them. Best,
[0001-Allow-comments-to-organizer-in-ical-event-replies.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Wed, 28 Aug 2024 11:07:01 GMT) Full text and rfc822 format available.Message #8 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Ferdinand Pieper <list_gnu <at> pie.tf>, Robert Pluim <rpluim <at> gmail.com>, Andrew G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr> Cc: 72831 <at> debbugs.gnu.org Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Wed, 28 Aug 2024 14:02:42 +0300
> From: Ferdinand Pieper <list_gnu <at> pie.tf> > Date: Tue, 27 Aug 2024 11:58:32 +0200 > > Tags: patch > > The iCalendar RFC allows comments in an event reply to e.g. indicate a reason for declining. This patch implements sending an additional comment if the usual functions `gnus-icalendar-reply-[accept,decline,tentative]` (bound to `i a`, `i d`, `i t`) are called with a prefix argument. > > Please let me know any feedback regarding the patch and commit message formatting. > > Notably this only implements the comment functionality for the functions mentioned above and does not include the buttons defined in `gnus-icalendar-event:inline-reply-buttons`, as I am not sure how the `read-string` for the user's comment should be implemented for them. Thanks. Robert, Andrew, and Alexandre: would you please review the proposed changes below and comment? > >From 8ff07723b407d56de72ddfea98b8931951bb7ad8 Mon Sep 17 00:00:00 2001 > From: fpi <git <at> pie.tf> > Date: Mon, 19 Aug 2024 17:18:11 +0200 > Subject: [PATCH] Allow comments to organizer in ical event replies > > * lisp/gnus/gnus-icalendar.el > (gnus-icalendar-event--build-reply-event-body): Add optional COMMENT > argument to be inserted into the reply. > (gnus-icalendar-event-reply-from-buffer): Add COMMENT argument to be > passed through to gnus-icalendar-event--build-reply-event-body > (gnus-icalendar-reply-accept): > (gnus-icalendar-reply-tentative): > (gnus-icalendar-reply-decline): If interactively called with a prefix > argument ask user for a COMMENT to add to the reply. > --- > lisp/gnus/gnus-icalendar.el | 52 ++++++++++++++++++++++++++----------- > 1 file changed, 37 insertions(+), 15 deletions(-) > > diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el > index af7284b88e8..7a295fb9ed2 100644 > --- a/lisp/gnus/gnus-icalendar.el > +++ b/lisp/gnus/gnus-icalendar.el > @@ -309,7 +309,7 @@ gnus-icalendar-event-from-buffer > ;;; gnus-icalendar-event-reply > ;;; > > -(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities) > +(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities &optional comment) > (let ((summary-status (capitalize (symbol-name status))) > (attendee-status (upcase (symbol-name status))) > reply-event-lines) > @@ -319,6 +319,10 @@ gnus-icalendar-event--build-reply-event-body > (if (string-match "^[^:]+:" line) > (replace-match (format "\\&%s: " summary-status) t nil line) > line)) > + (update-comment > + (line) > + (if comment (format "COMMENT:%s" comment) > + line)) > (update-dtstamp () > (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) > (attendee-matches-identity > @@ -341,6 +345,7 @@ gnus-icalendar-event--build-reply-event-body > (cond > ((string= key "ATTENDEE") (update-attendee-status line)) > ((string= key "SUMMARY") (update-summary line)) > + ((string= key "COMMENT") (update-comment line)) > ((string= key "DTSTAMP") (update-dtstamp)) > ((member key '("ORGANIZER" "DTSTART" "DTEND" > "LOCATION" "DURATION" "SEQUENCE" > @@ -363,12 +368,17 @@ gnus-icalendar-event--build-reply-event-body > attendee-status user-full-name user-mail-address) > reply-event-lines)) > > + ;; add comment line if not existing > + (when (and comment (not (gnus-icalendar-find-if (lambda (x) (string-match "^COMMENT" x)) > + reply-event-lines))) > + (push (format "COMMENT:%s" comment) reply-event-lines)) > + > (mapconcat #'identity `("BEGIN:VEVENT" > ,@(nreverse reply-event-lines) > "END:VEVENT") > "\n")))) > > -(defun gnus-icalendar-event-reply-from-buffer (buf status identities) > +(defun gnus-icalendar-event-reply-from-buffer (buf status identities &optional comment) > "Build a calendar event reply for request contained in BUF. > The reply will have STATUS (`accepted', `tentative' or `declined'). > The reply will be composed for attendees matching any entry > @@ -396,7 +406,7 @@ gnus-icalendar-event-reply-from-buffer > "PRODID:Gnus" > "VERSION:2.0" > zone > - (gnus-icalendar-event--build-reply-event-body event status identities) > + (gnus-icalendar-event--build-reply-event-body event status identities comment) > "END:VCALENDAR"))) > > (mapconcat #'identity (delq nil contents) "\n")))))) > @@ -878,13 +888,13 @@ gnus-icalendar-send-buffer-by-mail > (insert "Subject: " subject) > (message-send-and-exit)))) > > -(defun gnus-icalendar-reply (data) > +(defun gnus-icalendar-reply (data &optional comment) > (let* ((handle (car data)) > (status (cadr data)) > (event (caddr data)) > (reply (gnus-icalendar-with-decoded-handle handle > (gnus-icalendar-event-reply-from-buffer > - (current-buffer) status (gnus-icalendar-identities)))) > + (current-buffer) status (gnus-icalendar-identities) comment))) > (organizer (gnus-icalendar-event:organizer event))) > > (when reply > @@ -1009,25 +1019,37 @@ gnus-icalendar-save-event > (when data > (gnus-icalendar-save-part data)))) > > -(defun gnus-icalendar-reply-accept () > - "Accept invitation in the current article." > +(defun gnus-icalendar-reply-accept (&optional comment-p) > + "Accept invitation in the current article. > + > +With a prefix `\\[universal-argument]' prompt for a comment to include > +in the reply." > (interactive nil gnus-article-mode gnus-summary-mode) > (with-current-buffer gnus-article-buffer > - (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event)) > + (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event) > + (when comment-p (read-string "Comment: "))) > (setq-local gnus-icalendar-reply-status 'accepted))) > > -(defun gnus-icalendar-reply-tentative () > - "Send tentative response to invitation in the current article." > +(defun gnus-icalendar-reply-tentative (&optional comment-p) > + "Send tentative response to invitation in the current article. > + > +With a prefix `\\[universal-argument]' prompt for a comment to include > +in the reply." > (interactive nil gnus-article-mode gnus-summary-mode) > (with-current-buffer gnus-article-buffer > - (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event)) > + (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event) > + (when comment-p (read-string "Comment: "))) > (setq-local gnus-icalendar-reply-status 'tentative))) > > -(defun gnus-icalendar-reply-decline () > - "Decline invitation in the current article." > - (interactive nil gnus-article-mode gnus-summary-mode) > +(defun gnus-icalendar-reply-decline (&optional comment-p) > + "Decline invitation in the current article. > + > +With a prefix `\\[universal-argument]' prompt for a comment to include > +in the reply." > + (interactive "P" gnus-article-mode gnus-summary-mode) > (with-current-buffer gnus-article-buffer > - (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event)) > + (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event) > + (when comment-p (read-string "Comment: "))) > (setq-local gnus-icalendar-reply-status 'declined))) > > (defun gnus-icalendar-event-export () > -- > 2.30.2 >
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Wed, 28 Aug 2024 13:48:02 GMT) Full text and rfc822 format available.Message #11 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Robert Pluim <rpluim <at> gmail.com> To: Ferdinand Pieper <list_gnu <at> pie.tf> Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrew G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, 72831 <at> debbugs.gnu.org Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Wed, 28 Aug 2024 15:45:10 +0200
>>>>> On Wed, 28 Aug 2024 14:02:42 +0300, Eli Zaretskii <eliz <at> gnu.org> said: >> From: Ferdinand Pieper <list_gnu <at> pie.tf> >> Date: Tue, 27 Aug 2024 11:58:32 +0200 >> >> Tags: patch >> >> The iCalendar RFC allows comments in an event reply to e.g. indicate >> a reason for declining. This patch implements sending an additional >> comment if the usual functions >> `gnus-icalendar-reply-[accept,decline,tentative]` (bound to `i a`, >> `i d`, `i t`) are called with a prefix argument. >> >> Please let me know any feedback regarding the patch and commit >> message formatting. Now that you have the bug number, please put (Bug#72831) somewhere in the commit message. >> >> Notably this only implements the comment functionality for the >> functions mentioned above and does not include the buttons defined >> in `gnus-icalendar-event:inline-reply-buttons`, as I am not sure how >> the `read-string` for the user's comment should be implemented for >> them. You can pass prefix args to commands bound to mouse clicks as well as keys pressed inside the button, but getting the pieces to work would take some experimentation. I donʼt think thatʼs necessary for an initial implementation though. Eli> Thanks. Eli> Robert, Andrew, and Alexandre: would you please review the proposed Eli> changes below and comment? I think a change this size requires copyright assigment, which I donʼt know if youʼve done. >> >From 8ff07723b407d56de72ddfea98b8931951bb7ad8 Mon Sep 17 00:00:00 2001 >> From: fpi <git <at> pie.tf> >> Date: Mon, 19 Aug 2024 17:18:11 +0200 >> Subject: [PATCH] Allow comments to organizer in ical event replies >> >> * lisp/gnus/gnus-icalendar.el >> (gnus-icalendar-event--build-reply-event-body): Add optional COMMENT >> argument to be inserted into the reply. >> (gnus-icalendar-event-reply-from-buffer): Add COMMENT argument to be >> passed through to gnus-icalendar-event--build-reply-event-body >> (gnus-icalendar-reply-accept): >> (gnus-icalendar-reply-tentative): >> (gnus-icalendar-reply-decline): If interactively called with a prefix >> argument ask user for a COMMENT to add to the reply. I think that if youʼre making the same comment for the three functions you can put all three in one set of (), separated by commas. >> --- >> lisp/gnus/gnus-icalendar.el | 52 ++++++++++++++++++++++++++----------- >> 1 file changed, 37 insertions(+), 15 deletions(-) >> >> diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el >> index af7284b88e8..7a295fb9ed2 100644 >> --- a/lisp/gnus/gnus-icalendar.el >> +++ b/lisp/gnus/gnus-icalendar.el >> @@ -309,7 +309,7 @@ gnus-icalendar-event-from-buffer >> ;;; gnus-icalendar-event-reply >> ;;; >> >> -(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities) >> +(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities &optional comment) >> (let ((summary-status (capitalize (symbol-name status))) >> (attendee-status (upcase (symbol-name status))) >> reply-event-lines) >> @@ -319,6 +319,10 @@ gnus-icalendar-event--build-reply-event-body >> (if (string-match "^[^:]+:" line) >> (replace-match (format "\\&%s: " summary-status) t nil line) >> line)) >> + (update-comment >> + (line) >> + (if comment (format "COMMENT:%s" comment) >> + line)) >> (update-dtstamp () >> (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) >> (attendee-matches-identity >> @@ -341,6 +345,7 @@ gnus-icalendar-event--build-reply-event-body >> (cond >> ((string= key "ATTENDEE") (update-attendee-status line)) >> ((string= key "SUMMARY") (update-summary line)) >> + ((string= key "COMMENT") (update-comment line)) >> ((string= key "DTSTAMP") (update-dtstamp)) >> ((member key '("ORGANIZER" "DTSTART" "DTEND" >> "LOCATION" "DURATION" "SEQUENCE" >> @@ -363,12 +368,17 @@ gnus-icalendar-event--build-reply-event-body >> attendee-status user-full-name user-mail-address) >> reply-event-lines)) >> >> + ;; add comment line if not existing >> + (when (and comment (not (gnus-icalendar-find-if (lambda (x) (string-match "^COMMENT" x)) >> + reply-event-lines))) >> + (push (format "COMMENT:%s" comment) reply-event-lines)) >> + So if the event was sent with a COMMENT the receiver canʼt add their own? That doesnʼt match my conception of 'reply with comment'. Iʼm hazy on whatʼs exactly allowed in ical, can you have more than one COMMENT line? Or we could combine the comments? >> (mapconcat #'identity `("BEGIN:VEVENT" >> ,@(nreverse reply-event-lines) >> "END:VEVENT") >> "\n")))) >> >> -(defun gnus-icalendar-event-reply-from-buffer (buf status identities) >> +(defun gnus-icalendar-event-reply-from-buffer (buf status identities &optional comment) >> "Build a calendar event reply for request contained in BUF. >> The reply will have STATUS (`accepted', `tentative' or `declined'). >> The reply will be composed for attendees matching any entry Could you describe the COMMENT arg in the docstring? >> @@ -396,7 +406,7 @@ gnus-icalendar-event-reply-from-buffer >> "PRODID:Gnus" >> "VERSION:2.0" >> zone >> - (gnus-icalendar-event--build-reply-event-body event status identities) >> + (gnus-icalendar-event--build-reply-event-body event status identities comment) >> "END:VCALENDAR"))) >> >> (mapconcat #'identity (delq nil contents) "\n")))))) >> @@ -878,13 +888,13 @@ gnus-icalendar-send-buffer-by-mail >> (insert "Subject: " subject) >> (message-send-and-exit)))) >> >> -(defun gnus-icalendar-reply (data) >> +(defun gnus-icalendar-reply (data &optional comment) >> (let* ((handle (car data)) >> (status (cadr data)) >> (event (caddr data)) >> (reply (gnus-icalendar-with-decoded-handle handle >> (gnus-icalendar-event-reply-from-buffer >> - (current-buffer) status (gnus-icalendar-identities)))) >> + (current-buffer) status (gnus-icalendar-identities) comment))) >> (organizer (gnus-icalendar-event:organizer event))) >> >> (when reply >> @@ -1009,25 +1019,37 @@ gnus-icalendar-save-event >> (when data >> (gnus-icalendar-save-part data)))) >> >> -(defun gnus-icalendar-reply-accept () >> - "Accept invitation in the current article." >> +(defun gnus-icalendar-reply-accept (&optional comment-p) >> + "Accept invitation in the current article. >> + >> +With a prefix `\\[universal-argument]' prompt for a comment to include >> +in the reply." I think we tend to word this as "Optional argument COMMENT-P (interactively the prefix argument) means prompt for a comment to include in the reply." >> (interactive nil gnus-article-mode gnus-summary-mode) >> (with-current-buffer gnus-article-buffer >> - (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event)) >> + (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event) >> + (when comment-p (read-string "Comment: "))) >> (setq-local gnus-icalendar-reply-status 'accepted))) >> >> -(defun gnus-icalendar-reply-tentative () >> - "Send tentative response to invitation in the current article." >> +(defun gnus-icalendar-reply-tentative (&optional comment-p) >> + "Send tentative response to invitation in the current article. >> + >> +With a prefix `\\[universal-argument]' prompt for a comment to include >> +in the reply." >> (interactive nil gnus-article-mode gnus-summary-mode) >> (with-current-buffer gnus-article-buffer >> - (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event)) >> + (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event) >> + (when comment-p (read-string "Comment: "))) >> (setq-local gnus-icalendar-reply-status 'tentative))) >> >> -(defun gnus-icalendar-reply-decline () >> - "Decline invitation in the current article." >> - (interactive nil gnus-article-mode gnus-summary-mode) >> +(defun gnus-icalendar-reply-decline (&optional comment-p) >> + "Decline invitation in the current article. >> + >> +With a prefix `\\[universal-argument]' prompt for a comment to include >> +in the reply." >> + (interactive "P" gnus-article-mode gnus-summary-mode) >> (with-current-buffer gnus-article-buffer >> - (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event)) >> + (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event) >> + (when comment-p (read-string "Comment: "))) >> (setq-local gnus-icalendar-reply-status 'declined))) >> >> (defun gnus-icalendar-event-export () >> -- >> 2.30.2 >> Ideally youʼd add test cases for this to "test/lisp/gnus/gnus-icalendar-tests.el". But thatʼs not mandatory. Robert --
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Wed, 28 Aug 2024 15:49:01 GMT) Full text and rfc822 format available.Message #14 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Robert Pluim <rpluim <at> gmail.com> Cc: 72831 <at> debbugs.gnu.org, cohen <at> andy.bu.edu, list_gnu <at> pie.tf, adl <at> lrde.epita.fr Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Wed, 28 Aug 2024 18:47:10 +0300
> From: Robert Pluim <rpluim <at> gmail.com> > Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrew G Cohen <cohen <at> andy.bu.edu>, > Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, 72831 <at> debbugs.gnu.org > Date: Wed, 28 Aug 2024 15:45:10 +0200 > > I think a change this size requires copyright assigment, which I donʼt > know if youʼve done. He did, his assignment is on file.
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Wed, 28 Aug 2024 16:42:01 GMT) Full text and rfc822 format available.Message #17 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Ferdinand Pieper <list_gnu <at> pie.tf> To: Robert Pluim <rpluim <at> gmail.com> Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrew G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, 72831 <at> debbugs.gnu.org Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Wed, 28 Aug 2024 18:35:55 +0200
[Message part 1 (text/plain, inline)]
Thanks for the review. Robert Pluim <rpluim <at> gmail.com> writes: > Now that you have the bug number, please put (Bug#72831) somewhere in > the commit message. Updated in the patch attached. > I think a change this size requires copyright assigment, which I donʼt > know if youʼve done. Copyright assignment is done. I wrote some prior contributions to org-mode. > I think that if youʼre making the same comment for the three functions > you can put all three in one set of (), separated by commas. Updated. > >> @@ -319,6 +319,10 @@ gnus-icalendar-event--build-reply-event-body > >> (if (string-match "^[^:]+:" line) > >> (replace-match (format "\\&%s: " summary-status) t nil line) > >> line)) > >> + (update-comment > >> + (line) > >> + (if comment (format "COMMENT:%s" comment) > >> + line)) > >> (update-dtstamp () > >> (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) > >> (attendee-matches-identity > >> @@ -341,6 +345,7 @@ gnus-icalendar-event--build-reply-event-body > >> (cond > >> ((string= key "ATTENDEE") (update-attendee-status line)) > >> ((string= key "SUMMARY") (update-summary line)) > >> + ((string= key "COMMENT") (update-comment line)) > >> ((string= key "DTSTAMP") (update-dtstamp)) > >> ((member key '("ORGANIZER" "DTSTART" "DTEND" > >> "LOCATION" "DURATION" "SEQUENCE" > >> @@ -363,12 +368,17 @@ gnus-icalendar-event--build-reply-event-body > >> attendee-status user-full-name user-mail-address) > >> reply-event-lines)) > >> > >> + ;; add comment line if not existing > >> + (when (and comment (not (gnus-icalendar-find-if (lambda (x) > >> (string-match "^COMMENT" x)) > >> + reply-event-lines))) > >> + (push (format "COMMENT:%s" comment) reply-event-lines)) > >> + > > So if the event was sent with a COMMENT the receiver canʼt add their > own? That doesnʼt match my conception of 'reply with comment'. Iʼm > hazy on whatʼs exactly allowed in ical, can you have more than one > COMMENT line? Or we could combine the comments? If it already exists it is replaced by the prior > >> ((string= key "COMMENT") (update-comment line)) Just if it does not exist the `(string= key "COMMENT")` never matches and we have to add the field. > >> -(defun gnus-icalendar-event-reply-from-buffer (buf status identities) > >> +(defun gnus-icalendar-event-reply-from-buffer (buf status > >> identities &optional comment) > >> "Build a calendar event reply for request contained in BUF. > >> The reply will have STATUS (`accepted', `tentative' or `declined'). > >> The reply will be composed for attendees matching any entry > > Could you describe the COMMENT arg in the docstring? Updated. > >> @@ -1009,25 +1019,37 @@ gnus-icalendar-save-event > >> (when data > >> (gnus-icalendar-save-part data)))) > >> > >> -(defun gnus-icalendar-reply-accept () > >> - "Accept invitation in the current article." > >> +(defun gnus-icalendar-reply-accept (&optional comment-p) > >> + "Accept invitation in the current article. > >> + > >> +With a prefix `\\[universal-argument]' prompt for a comment to include > >> +in the reply." > > I think we tend to word this as > > "Optional argument COMMENT-P (interactively the prefix argument) means > prompt for a comment to include in the reply." Updated using `\\[universal-argument]'. Or does that not matter here and just "prefix argument" would be fine? > Ideally youʼd add test cases for this to > "test/lisp/gnus/gnus-icalendar-tests.el". But thatʼs not mandatory. I looked into it and will add a few tests for accepting/declining events with and without comments. I will followup on this in a couple days. It might also make sense to extend the parsing of events to recognize comments (and potentially display them inside emacs. I also missed to update the interactive argument for `gnus-icalendar-reply-accept` and `gnus-icalendar-reply-tentative`, which is now fixed in the updated patch. Best,
[0001-Allow-comments-to-organizer-in-event-replies-bug-728.patch (text/x-patch, attachment)]
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Thu, 29 Aug 2024 07:55:01 GMT) Full text and rfc822 format available.Message #20 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Robert Pluim <rpluim <at> gmail.com> To: Ferdinand Pieper <list_gnu <at> pie.tf> Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrew G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, 72831 <at> debbugs.gnu.org Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Thu, 29 Aug 2024 09:52:37 +0200
>>>>> On Wed, 28 Aug 2024 18:35:55 +0200, Ferdinand Pieper <list_gnu <at> pie.tf> said: >> So if the event was sent with a COMMENT the receiver canʼt add their >> own? That doesnʼt match my conception of 'reply with comment'. Iʼm >> hazy on whatʼs exactly allowed in ical, can you have more than one >> COMMENT line? Or we could combine the comments? Ferdinand> If it already exists it is replaced by the prior >> >> ((string= key "COMMENT") (update-comment line)) Ferdinand> Just if it does not exist the `(string= key "COMMENT")` never matches and we have to add the field. Sorry, I missed that bit. >> I think we tend to word this as >> >> "Optional argument COMMENT-P (interactively the prefix argument) means >> prompt for a comment to include in the reply." Ferdinand> Updated using `\\[universal-argument]'. Or does that not matter here and just "prefix argument" would be fine? Either one is fine I think. >> Ideally youʼd add test cases for this to >> "test/lisp/gnus/gnus-icalendar-tests.el". But thatʼs not mandatory. Ferdinand> I looked into it and will add a few tests for accepting/declining events with and without comments. I will followup on this in a couple days. Ferdinand> It might also make sense to extend the parsing of events to recognize comments (and potentially display them inside emacs. That would be good as a followup patch. Robert --
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Sat, 31 Aug 2024 14:42:02 GMT) Full text and rfc822 format available.Message #23 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Ferdinand Pieper <list_gnu <at> pie.tf> To: Robert Pluim <rpluim <at> gmail.com> Cc: Eli Zaretskii <eliz <at> gnu.org>, Andrew G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, 72831 <at> debbugs.gnu.org Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Sat, 31 Aug 2024 16:31:24 +0200
[Message part 1 (text/plain, inline)]
The updated patch contains two tests to check replies with and without a comment. Let me know any feedback on these as I have never contributed tests so far and if you prefer to have code and tests split into two commits instead. Otherwise the patch should be good to be applied? Thanks!
[0001-Allow-comments-to-organizer-in-event-replies-bug-728.patch (text/x-patch, inline)]
From 5f75ab29fd0f0fbed5238ffff63c6ce13ce1f8de Mon Sep 17 00:00:00 2001 From: fpi <git <at> pie.tf> Date: Wed, 28 Aug 2024 18:33:20 +0200 Subject: [PATCH] Allow comments to organizer in event replies (bug#72831) * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--build-reply-event-body): Add optional COMMENT argument to be inserted into the reply. (gnus-icalendar-event-reply-from-buffer): Add COMMENT argument to be passed through to gnus-icalendar-event--build-reply-event-body (gnus-icalendar-reply-accept, gnus-icalendar-reply-tentative, gnus-icalendar-reply-decline): If interactively called with a prefix argument ask user for a COMMENT to add to the reply. * test/lisp/gnus/gnus-icalendar-tests.el (gnus-icalendar-accept-with-comment, gnus-icalendar-decline-withouth-changing-comment): New tests. --- lisp/gnus/gnus-icalendar.el | 61 +++++++++++++++------- test/lisp/gnus/gnus-icalendar-tests.el | 72 ++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 18 deletions(-) diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index af7284b88e8..85f1aa09a56 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -309,7 +309,7 @@ gnus-icalendar-event-from-buffer ;;; gnus-icalendar-event-reply ;;; -(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities) +(defun gnus-icalendar-event--build-reply-event-body (ical-request status identities &optional comment) (let ((summary-status (capitalize (symbol-name status))) (attendee-status (upcase (symbol-name status))) reply-event-lines) @@ -319,6 +319,10 @@ gnus-icalendar-event--build-reply-event-body (if (string-match "^[^:]+:" line) (replace-match (format "\\&%s: " summary-status) t nil line) line)) + (update-comment + (line) + (if comment (format "COMMENT:%s" comment) + line)) (update-dtstamp () (format-time-string "DTSTAMP:%Y%m%dT%H%M%SZ" nil t)) (attendee-matches-identity @@ -341,6 +345,7 @@ gnus-icalendar-event--build-reply-event-body (cond ((string= key "ATTENDEE") (update-attendee-status line)) ((string= key "SUMMARY") (update-summary line)) + ((string= key "COMMENT") (update-comment line)) ((string= key "DTSTAMP") (update-dtstamp)) ((member key '("ORGANIZER" "DTSTART" "DTEND" "LOCATION" "DURATION" "SEQUENCE" @@ -363,16 +368,24 @@ gnus-icalendar-event--build-reply-event-body attendee-status user-full-name user-mail-address) reply-event-lines)) + ;; add comment line if not existing + (when (and comment (not (gnus-icalendar-find-if (lambda (x) (string-match "^COMMENT" x)) + reply-event-lines))) + (push (format "COMMENT:%s" comment) reply-event-lines)) + (mapconcat #'identity `("BEGIN:VEVENT" ,@(nreverse reply-event-lines) "END:VEVENT") "\n")))) -(defun gnus-icalendar-event-reply-from-buffer (buf status identities) +(defun gnus-icalendar-event-reply-from-buffer (buf status identities &optional comment) "Build a calendar event reply for request contained in BUF. The reply will have STATUS (`accepted', `tentative' or `declined'). The reply will be composed for attendees matching any entry -on the IDENTITIES list." +on the IDENTITIES list. +Optional argument COMMENT will be placed in the comment field of the +reply. +" (cl-labels ((extract-block (blockname) @@ -396,7 +409,7 @@ gnus-icalendar-event-reply-from-buffer "PRODID:Gnus" "VERSION:2.0" zone - (gnus-icalendar-event--build-reply-event-body event status identities) + (gnus-icalendar-event--build-reply-event-body event status identities comment) "END:VCALENDAR"))) (mapconcat #'identity (delq nil contents) "\n")))))) @@ -878,13 +891,13 @@ gnus-icalendar-send-buffer-by-mail (insert "Subject: " subject) (message-send-and-exit)))) -(defun gnus-icalendar-reply (data) +(defun gnus-icalendar-reply (data &optional comment) (let* ((handle (car data)) (status (cadr data)) (event (caddr data)) (reply (gnus-icalendar-with-decoded-handle handle (gnus-icalendar-event-reply-from-buffer - (current-buffer) status (gnus-icalendar-identities)))) + (current-buffer) status (gnus-icalendar-identities) comment))) (organizer (gnus-icalendar-event:organizer event))) (when reply @@ -1009,25 +1022,37 @@ gnus-icalendar-save-event (when data (gnus-icalendar-save-part data)))) -(defun gnus-icalendar-reply-accept () - "Accept invitation in the current article." - (interactive nil gnus-article-mode gnus-summary-mode) +(defun gnus-icalendar-reply-accept (&optional comment-p) + "Accept invitation in the current article. + +Optional argument COMMENT-P (interactively the `\\[universal-argument]') +means prompt for a comment to include in the reply." + (interactive "P" gnus-article-mode gnus-summary-mode) (with-current-buffer gnus-article-buffer - (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event)) + (gnus-icalendar-reply (list gnus-icalendar-handle 'accepted gnus-icalendar-event) + (when comment-p (read-string "Comment: "))) (setq-local gnus-icalendar-reply-status 'accepted))) -(defun gnus-icalendar-reply-tentative () - "Send tentative response to invitation in the current article." - (interactive nil gnus-article-mode gnus-summary-mode) +(defun gnus-icalendar-reply-tentative (&optional comment-p) + "Send tentative response to invitation in the current article. + +Optional argument COMMENT-P (interactively the `\\[universal-argument]') +means prompt for a comment to include in the reply." + (interactive "P" gnus-article-mode gnus-summary-mode) (with-current-buffer gnus-article-buffer - (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event)) + (gnus-icalendar-reply (list gnus-icalendar-handle 'tentative gnus-icalendar-event) + (when comment-p (read-string "Comment: "))) (setq-local gnus-icalendar-reply-status 'tentative))) -(defun gnus-icalendar-reply-decline () - "Decline invitation in the current article." - (interactive nil gnus-article-mode gnus-summary-mode) +(defun gnus-icalendar-reply-decline (&optional comment-p) + "Decline invitation in the current article. + +Optional argument COMMENT-P (interactively the `\\[universal-argument]') +means prompt for a comment to include in the reply." + (interactive "P" gnus-article-mode gnus-summary-mode) (with-current-buffer gnus-article-buffer - (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event)) + (gnus-icalendar-reply (list gnus-icalendar-handle 'declined gnus-icalendar-event) + (when comment-p (read-string "Comment: "))) (setq-local gnus-icalendar-reply-status 'declined))) (defun gnus-icalendar-event-export () diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el index 08c85013d17..9b4ba383d5a 100644 --- a/test/lisp/gnus/gnus-icalendar-tests.el +++ b/test/lisp/gnus/gnus-icalendar-tests.el @@ -255,5 +255,77 @@ gnus-icalendary-weekly-byday <2020-09-21 14:00-14:30 +1w>"))) (setenv "TZ" tz)))) +(ert-deftest gnus-icalendar-accept-with-comment () + "" + (let ((event "BEGIN:VEVENT +DTSTART;TZID=Europe/Berlin:20200915T140000 +DTEND;TZID=Europe/Berlin:20200915T143000 +RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE +DTSTAMP:20200915T120627Z +ORGANIZER;CN=anon <at> anoncompany.com:mailto:anon <at> anoncompany.com +UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000 <at> google.com +ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE + ;CN=participant <at> anoncompany.com;X-NUM-GUESTS=0:mailto:participant <at> anoncompany.com +CREATED:20200325T095723Z +DESCRIPTION:Coffee talk +LAST-MODIFIED:20200915T120623Z +LOCATION: +SEQUENCE:0 +STATUS:CONFIRMED +SUMMARY:Casual coffee talk +TRANSP:OPAQUE +END:VEVENT") + (icalendar-identities '("participant <at> anoncompany.com"))) + (unwind-protect + (progn + (let* ((reply (with-temp-buffer + (insert event) + (gnus-icalendar-event-reply-from-buffer + (current-buffer) + 'accepted + icalendar-identities + "Can not stay long.")))) + (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply)) + (should (string-equal (match-string 1 reply) "PARTSTAT=ACCEPTED")) + (should (string-match "^COMMENT:\\(.*\\)$" reply)) + (should (string-equal (match-string 1 reply) "Can not stay long."))))))) + +(ert-deftest gnus-icalendar-decline-withouth-changing-comment () + "" + (let ((event "BEGIN:VEVENT +DTSTART;TZID=Europe/Berlin:20200915T140000 +DTEND;TZID=Europe/Berlin:20200915T143000 +RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE +DTSTAMP:20200915T120627Z +ORGANIZER;CN=anon <at> anoncompany.com:mailto:anon <at> anoncompany.com +UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000 <at> google.com +ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE + ;CN=participant <at> anoncompany.com;X-NUM-GUESTS=0:mailto:participant <at> anoncompany.com +CREATED:20200325T095723Z +DESCRIPTION:Coffee talk +LAST-MODIFIED:20200915T120623Z +COMMENT:Only available at 2pm +LOCATION: +SEQUENCE:0 +STATUS:CONFIRMED +SUMMARY:Casual coffee talk +TRANSP:OPAQUE +END:VEVENT") + (icalendar-identities '("participant <at> anoncompany.com"))) + (unwind-protect + (progn + (let* ((reply (with-temp-buffer + (insert event) + (gnus-icalendar-event-reply-from-buffer + (current-buffer) + 'declined + icalendar-identities + nil)))) + (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply)) + (should (string-equal (match-string 1 reply) "PARTSTAT=DECLINED")) + (should (string-match "^COMMENT:\\(.*\\)$" reply)) + (should (string-equal (match-string 1 reply) "Only available at 2pm")) + ))))) + (provide 'gnus-icalendar-tests) ;;; gnus-icalendar-tests.el ends here -- 2.44.1
[Message part 3 (text/plain, inline)]
Robert Pluim <rpluim <at> gmail.com> writes: >>>>>> On Wed, 28 Aug 2024 18:35:55 +0200, Ferdinand Pieper > <list_gnu <at> pie.tf> said: > >> So if the event was sent with a COMMENT the receiver canʼt add their > >> own? That doesnʼt match my conception of 'reply with comment'. Iʼm > >> hazy on whatʼs exactly allowed in ical, can you have more than one > >> COMMENT line? Or we could combine the comments? > > Ferdinand> If it already exists it is replaced by the prior > >> >> ((string= key "COMMENT") (update-comment line)) > Ferdinand> Just if it does not exist the `(string= key "COMMENT")` > Ferdinand> never matches and we have to add the field. > > Sorry, I missed that bit. > > >> I think we tend to word this as > >> > >> "Optional argument COMMENT-P (interactively the prefix argument) means > >> prompt for a comment to include in the reply." > > Ferdinand> Updated using `\\[universal-argument]'. Or does that > Ferdinand> not matter here and just "prefix argument" would be > Ferdinand> fine? > > Either one is fine I think. > > >> Ideally youʼd add test cases for this to > >> "test/lisp/gnus/gnus-icalendar-tests.el". But thatʼs not mandatory. > > Ferdinand> I looked into it and will add a few tests for > Ferdinand> accepting/declining events with and without comments. I > Ferdinand> will followup on this in a couple days. > Ferdinand> It might also make sense to extend the parsing of > Ferdinand> events to recognize comments (and potentially display > Ferdinand> them inside emacs. > > That would be good as a followup patch. > > Robert
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Sat, 07 Sep 2024 14:44:05 GMT) Full text and rfc822 format available.Message #26 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Ferdinand Pieper <list_gnu <at> pie.tf> To: 72831 <at> debbugs.gnu.org Cc: Robert Pluim <rpluim <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr>, Andrew G Cohen <cohen <at> andy.bu.edu> Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Sat, 07 Sep 2024 14:22:41 +0200
[Message part 1 (text/plain, inline)]
Any further feedback on the patch or could someone please apply the patch? Thanks! Patch once again below, this time as attachment instead of inline…
[0001-Allow-comments-to-organizer-in-event-replies-bug-728.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Ferdinand Pieper <list_gnu <at> pie.tf> writes: > The updated patch contains two tests to check replies with and without > a comment. Let me know any feedback on these as I have never > contributed tests so far and if you prefer to have code and tests > split into two commits instead. > > Otherwise the patch should be good to be applied? > > Thanks!
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Sat, 07 Sep 2024 14:58:01 GMT) Full text and rfc822 format available.Message #29 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Ferdinand Pieper <list_gnu <at> pie.tf> Cc: 72831 <at> debbugs.gnu.org, rpluim <at> gmail.com, adl <at> lrde.epita.fr, cohen <at> andy.bu.edu Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Sat, 07 Sep 2024 17:55:06 +0300
> From: Ferdinand Pieper <list_gnu <at> pie.tf> > Cc: Robert Pluim <rpluim <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>, Andrew > G Cohen <cohen <at> andy.bu.edu>, Alexandre Duret-Lutz <adl <at> lrde.epita.fr> > Date: Sat, 07 Sep 2024 14:22:41 +0200 > > Any further feedback on the patch or could someone please apply the patch? Thanks! > > Patch once again below, this time as attachment instead of inline… Thanks, I'd like to wait for a few days, to let people comment if they want.
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Sat, 07 Sep 2024 18:22:02 GMT) Full text and rfc822 format available.Message #32 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Ferdinand Pieper <list_gnu <at> pie.tf> To: Eli Zaretskii <eliz <at> gnu.org> Cc: 72831 <at> debbugs.gnu.org, rpluim <at> gmail.com, adl <at> lrde.epita.fr, cohen <at> andy.bu.edu Subject: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Sat, 07 Sep 2024 17:05:34 +0200
Eli Zaretskii <eliz <at> gnu.org> writes: > Thanks, I'd like to wait for a few days, to let people comment if they > want. Sounds good, thanks for handling it.
bug-gnu-emacs <at> gnu.org
:bug#72831
; Package emacs
.
(Wed, 11 Sep 2024 08:15:01 GMT) Full text and rfc822 format available.Message #35 received at 72831 <at> debbugs.gnu.org (full text, mbox):
From: Robert Pluim <rpluim <at> gmail.com> To: Ferdinand Pieper <list_gnu <at> pie.tf> Cc: Eli Zaretskii <eliz <at> gnu.org>, 72831 <at> debbugs.gnu.org, adl <at> lrde.epita.fr, cohen <at> andy.bu.edu Subject: Re: bug#72831: [PATCH] gnus-icalendar: Allow comments in event replies Date: Wed, 11 Sep 2024 10:13:26 +0200
tags 72831 fixed close 72831 31.1 quit >>>>> On Sat, 07 Sep 2024 17:05:34 +0200, Ferdinand Pieper <list_gnu <at> pie.tf> said: Ferdinand> Eli Zaretskii <eliz <at> gnu.org> writes: >> Thanks, I'd like to wait for a few days, to let people comment if they >> want. Ferdinand> Sounds good, thanks for handling it. I wrote a NEWS entry for this and made a few minor style and typo edits. Sorry about the delay. Closing. Committed as 8332b4dd07a Robert --
Robert Pluim <rpluim <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 11 Sep 2024 08:15:02 GMT) Full text and rfc822 format available.Robert Pluim <rpluim <at> gmail.com>
to control <at> debbugs.gnu.org
.
(Wed, 11 Sep 2024 08:15:02 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Wed, 09 Oct 2024 11:24:08 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.