From b9dcddc1f9a3e84d73342507416a7c7e292ad427 Mon Sep 17 00:00:00 2001 From: Christian Blades Date: Thu, 9 Mar 2017 19:50:40 -0500 Subject: [PATCH] =?UTF-8?q?replace=20description=20lines=20that=20begin=20?= =?UTF-8?q?with=20'*'=20with=20'=E2=9C=B1'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this is to address issues like #29 when event descriptions that include '*' can break gcal synchronization --- org-gcal.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/org-gcal.el b/org-gcal.el index eb38be7..70c9324 100644 --- a/org-gcal.el +++ b/org-gcal.el @@ -311,13 +311,14 @@ (when (plist-get (cadr tobj) :hour-start) t))) (desc (if (plist-get (cadr elem) :contents-begin) - (replace-regexp-in-string - "\\`\\(?: *<[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].*?>$\\)\n?\n?" "" - (replace-regexp-in-string - " *:PROPERTIES:\n \\(.*\\(?:\n.*\\)*?\\) :END:\n\n" "" - (buffer-substring-no-properties - (plist-get (cadr elem) :contents-begin) - (plist-get (cadr elem) :contents-end)))) ""))) + (replace-regexp-in-string "^✱" "*" + (replace-regexp-in-string + "\\`\\(?: *<[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].*?>$\\)\n?\n?" "" + (replace-regexp-in-string + " *:PROPERTIES:\n \\(.*\\(?:\n.*\\)*?\\) :END:\n\n" "" + (buffer-substring-no-properties + (plist-get (cadr elem) :contents-begin) + (plist-get (cadr elem) :contents-end))))) ""))) (org-gcal--post-event start end smry loc desc id nil skip-import)))) (defun org-gcal-request-authorization () @@ -591,7 +592,7 @@ TO. Instead an empty string is returned." end (org-gcal--iso-previous-day end)))))) "\n" (when desc "\n") - desc + (when desc (replace-regexp-in-string "^\*" "✱" desc)) (when desc (if (string= "\n" (org-gcal--safe-substring desc -1)) "" "\n"))))) (defun org-gcal--format-date (str format &optional tz)