* PATCH: fix for gnus-icalendar handling of empty appt locations
@ 2013-11-13 15:10 Jan Tatarik
2013-11-13 20:45 ` Adam Sjøgren
0 siblings, 1 reply; 2+ messages in thread
From: Jan Tatarik @ 2013-11-13 15:10 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
Hi,
enclosed is a fix for handling of appointments with empty location field.
The current version will show 'Location: nil' in the article buffer, and
when exported to org, the outline heading will read something like
'Summary (nil)'.
With this patch, we don't show the nil value anymore.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix_empty_location.patch --]
[-- Type: text/x-diff, Size: 2828 bytes --]
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 88d6d894b41e27b511796e2ba91854cf6bf74997..6e98f8f2d4e95cb3a8be5cd14a819cf77302d78d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2013-11-13 Jan Tatarik <jan.tatarik@gmail.com>
+
+ * gnus-icalendar.el (gnus-icalendar--format-summary-line)
+ (gnus-icalendar-event->org-entry)
+ (gnus-icalendar--update-org-event)
+ (gnus-icalendar-event->gnus-calendar): Fix empty location handling.
+
2013-11-12 Jan Tatarik <jan.tatarik@gmail.com>
* gnus-icalendar.el (gnus-icalendar-event-from-ical):
diff --git a/lisp/gnus-icalendar.el b/lisp/gnus-icalendar.el
index f3b62381b47e79b7f260d5ad8c46ad498096c7d9..cbb285529ea46192857f7056506fb644387f76b9 100644
--- a/lisp/gnus-icalendar.el
+++ b/lisp/gnus-icalendar.el
@@ -361,6 +361,11 @@ Return nil for non-recurring EVENT."
(format "<%s %s-%s%s>" start-date start-time end-time repeat)
(format "<%s %s>--<%s %s>" start-date start-time end-date end-time))))
+(defun gnus-icalendar--format-summary-line (summary &optional location)
+ (if location
+ (format "%s (%s)" summary location)
+ (format "%s" summary)))
+
;; TODO: make the template customizable
(defmethod gnus-icalendar-event->org-entry ((event gnus-icalendar-event) reply-status)
"Return string with new `org-mode' entry describing EVENT."
@@ -378,7 +383,8 @@ Return nil for non-recurring EVENT."
("RRULE" . ,(gnus-icalendar-event:recur event))
("REPLY" . ,reply))))
- (insert (format "* %s (%s)\n\n" summary location))
+ (insert (format "* %s\n\n"
+ (gnus-icalendar--format-summary-line summary location)))
(mapc (lambda (prop)
(org-entry-put (point) (car prop) (cdr prop)))
props))
@@ -443,7 +449,7 @@ is searched."
(headline (delq nil (list
(org-entry-get (point) "TODO")
(when priority (format "[#%s]" priority))
- (format "%s (%s)" summary location)
+ (gnus-icalendar--format-summary-line summary location)
(org-entry-get (point) "TAGS")))))
(re-search-forward "^\\*+ " (line-end-position))
@@ -591,7 +597,7 @@ is searched."
(with-slots (organizer summary description location recur uid method rsvp) event
(let ((headers `(("Summary" ,summary)
- ("Location" ,location)
+ ("Location" ,(or location ""))
("Time" ,(gnus-icalendar-event:org-timestamp event))
("Organizer" ,organizer)
("Method" ,method))))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-13 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 15:10 PATCH: fix for gnus-icalendar handling of empty appt locations Jan Tatarik
2013-11-13 20:45 ` Adam Sjøgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).