From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/83877 Path: news.gmane.org!not-for-mail From: Jan Tatarik Newsgroups: gmane.emacs.gnus.general Subject: PATCH: fix for gnus-icalendar handling of empty appt locations Date: Wed, 13 Nov 2013 16:10:45 +0100 Message-ID: <8738n0mj62.fsf@nb-jtatarik2.xing.hh> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1384355535 13867 80.91.229.3 (13 Nov 2013 15:12:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2013 15:12:15 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32133@lists.math.uh.edu Wed Nov 13 16:12:19 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vgc76-0003Pz-Qi for ding-account@gmane.org; Wed, 13 Nov 2013 16:12:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Vgc6l-0007bb-1Q; Wed, 13 Nov 2013 09:11:55 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Vgc6j-0007bN-8D for ding@lists.math.uh.edu; Wed, 13 Nov 2013 09:11:53 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1Vgc6h-0005pL-KE for ding@lists.math.uh.edu; Wed, 13 Nov 2013 09:11:52 -0600 Original-Received: from mail-ee0-f54.google.com ([74.125.83.54]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1Vgc6g-0001ai-5U for ding@gnus.org; Wed, 13 Nov 2013 16:11:50 +0100 Original-Received: by mail-ee0-f54.google.com with SMTP id e51so43880eek.13 for ; Wed, 13 Nov 2013 07:11:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=AcICcKw8H+IeGZxvNmfy61msLRXonY4OzSxpdUFa+tw=; b=UrMo9wWQ7lzwHUXwYYSsbhn1zbSARB/AtMa/ME0hmBQJZ1mjRtf+JnBOjGnf2BJLZ9 9nY+j+80yaXix3a9r4uziHpAx0Q332zlapTA+HnrvxfJ3K7nACl+Lh2BJvSHTLDmApO/ dXW14xGNt1b6iCMMEt0hk8tAESJ3LoSree1/Zb8gWfjMCSFwEumT7uyZfNRyVNG8uNQP qK74wkV5LyUi6fsDU5+3clboA/im4OIV6nMU1JmuNobVQEkUDBEk9B1BY2JkW0Ii0CZ/ FfY1XbgqkgZVK7pb6NDZLYRRExAAxJALEOLLJvorCf7GDE2HDGD5e3R0rJUyIQzZecAS 2F2w== X-Received: by 10.14.122.132 with SMTP id t4mr50078359eeh.20.1384355504716; Wed, 13 Nov 2013 07:11:44 -0800 (PST) Original-Received: from nb-jtatarik2.xing.hh (office.xing.com. [82.112.107.65]) by mx.google.com with ESMTPSA id z1sm89145370eeo.14.2013.11.13.07.10.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 13 Nov 2013 07:10:51 -0800 (PST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Spam-Score: -2.2 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:83877 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=fix_empty_location.patch 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 + + * 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 * 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)))) --=-=-=--