diff options
| author | Stefan Monnier | 2018-02-17 17:42:29 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2018-02-17 17:42:29 -0500 |
| commit | cdb3bda532a1ebeef7670c642be47ab1a8a1a704 (patch) | |
| tree | 4c08848ea5f141cdae290d3eec02b2f999fe4f7f | |
| parent | 296afbf75ac2a59a020d5b9669f494e1cb270588 (diff) | |
| download | emacs-cdb3bda532a1ebeef7670c642be47ab1a8a1a704.tar.gz emacs-cdb3bda532a1ebeef7670c642be47ab1a8a1a704.zip | |
* lisp/calendar/icalendar.el: Fix compilation warnings
(icalendar-export-region): Remove unused vars 'start', 'sum', and
'contents-n-summary'.
(icalendar--parse-summary-and-rest): Remove unused var 'pos-sum' and 'sum'.
(icalendar--convert-float-to-ical): Use calendar-let* to bind vars
'date' and 'entry'.
(icalendar--convert-non-recurring-all-day-to-diary):
Remove 'event' arg. Update callers.
(icalendar--convert-non-recurring-not-all-day-to-diary): Remove 'event'
and 'dtend-dec' args. Update callers.
| -rw-r--r-- | lisp/calendar/icalendar.el | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 7af1520da47..ca3adfaeeb5 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -1048,12 +1048,10 @@ written into the buffer `*icalendar-errors*'." | |||
| 1048 | (interactive "r | 1048 | (interactive "r |
| 1049 | FExport diary data into iCalendar file: ") | 1049 | FExport diary data into iCalendar file: ") |
| 1050 | (let ((result "") | 1050 | (let ((result "") |
| 1051 | (start 0) | ||
| 1052 | (entry-main "") | 1051 | (entry-main "") |
| 1053 | (entry-rest "") | 1052 | (entry-rest "") |
| 1054 | (entry-full "") | 1053 | (entry-full "") |
| 1055 | (header "") | 1054 | (header "") |
| 1056 | (contents-n-summary) | ||
| 1057 | (contents) | 1055 | (contents) |
| 1058 | (alarm) | 1056 | (alarm) |
| 1059 | (found-error nil) | 1057 | (found-error nil) |
| @@ -1073,7 +1071,8 @@ FExport diary data into iCalendar file: ") | |||
| 1073 | ;; possibly ignore hidden entries beginning with "&" | 1071 | ;; possibly ignore hidden entries beginning with "&" |
| 1074 | (if icalendar-export-hidden-diary-entries | 1072 | (if icalendar-export-hidden-diary-entries |
| 1075 | "^\\([^ \t\n#].+\\)\\(\\(\n[ \t].*\\)*\\)" | 1073 | "^\\([^ \t\n#].+\\)\\(\\(\n[ \t].*\\)*\\)" |
| 1076 | "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)") max t) | 1074 | "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)") |
| 1075 | max t) | ||
| 1077 | (setq entry-main (match-string 1)) | 1076 | (setq entry-main (match-string 1)) |
| 1078 | (if (match-beginning 2) | 1077 | (if (match-beginning 2) |
| 1079 | (setq entry-rest (match-string 2)) | 1078 | (setq entry-rest (match-string 2)) |
| @@ -1095,7 +1094,7 @@ FExport diary data into iCalendar file: ") | |||
| 1095 | (loc (cdr (assoc 'loc other-elements))) | 1094 | (loc (cdr (assoc 'loc other-elements))) |
| 1096 | (org (cdr (assoc 'org other-elements))) | 1095 | (org (cdr (assoc 'org other-elements))) |
| 1097 | (sta (cdr (assoc 'sta other-elements))) | 1096 | (sta (cdr (assoc 'sta other-elements))) |
| 1098 | (sum (cdr (assoc 'sum other-elements))) | 1097 | ;; (sum (cdr (assoc 'sum other-elements))) |
| 1099 | (url (cdr (assoc 'url other-elements))) | 1098 | (url (cdr (assoc 'url other-elements))) |
| 1100 | (uid (cdr (assoc 'uid other-elements)))) | 1099 | (uid (cdr (assoc 'uid other-elements)))) |
| 1101 | (if cla | 1100 | (if cla |
| @@ -1202,7 +1201,7 @@ Returns an alist." | |||
| 1202 | (p-uid (or (string-match "%U" icalendar-import-format) -1)) | 1201 | (p-uid (or (string-match "%U" icalendar-import-format) -1)) |
| 1203 | (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url p-uid) '<)) | 1202 | (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url p-uid) '<)) |
| 1204 | (ct 0) | 1203 | (ct 0) |
| 1205 | pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url pos-uid) | 1204 | pos-cla pos-des pos-loc pos-org pos-sta pos-url pos-uid) ;pos-sum |
| 1206 | (dotimes (i (length p-list)) | 1205 | (dotimes (i (length p-list)) |
| 1207 | ;; Use 'ct' to keep track of current position in list | 1206 | ;; Use 'ct' to keep track of current position in list |
| 1208 | (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla)) | 1207 | (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla)) |
| @@ -1222,7 +1221,8 @@ Returns an alist." | |||
| 1222 | (setq pos-sta (* 2 ct))) | 1221 | (setq pos-sta (* 2 ct))) |
| 1223 | ((and (>= p-sum 0) (= (nth i p-list) p-sum)) | 1222 | ((and (>= p-sum 0) (= (nth i p-list) p-sum)) |
| 1224 | (setq ct (+ ct 1)) | 1223 | (setq ct (+ ct 1)) |
| 1225 | (setq pos-sum (* 2 ct))) | 1224 | ;; (setq pos-sum (* 2 ct)) |
| 1225 | ) | ||
| 1226 | ((and (>= p-url 0) (= (nth i p-list) p-url)) | 1226 | ((and (>= p-url 0) (= (nth i p-list) p-url)) |
| 1227 | (setq ct (+ ct 1)) | 1227 | (setq ct (+ ct 1)) |
| 1228 | (setq pos-url (* 2 ct))) | 1228 | (setq pos-url (* 2 ct))) |
| @@ -1254,11 +1254,11 @@ Returns an alist." | |||
| 1254 | (icalendar--rris "%s" "\\(.*?\\)" s nil t) | 1254 | (icalendar--rris "%s" "\\(.*?\\)" s nil t) |
| 1255 | "\\'")) | 1255 | "\\'")) |
| 1256 | (if (string-match s summary-and-rest) | 1256 | (if (string-match s summary-and-rest) |
| 1257 | (let (cla des loc org sta sum url uid) | 1257 | (let (cla des loc org sta url uid) ;; sum |
| 1258 | (if (and pos-sum (match-beginning pos-sum)) | 1258 | ;; (if (and pos-sum (match-beginning pos-sum)) |
| 1259 | (setq sum (substring summary-and-rest | 1259 | ;; (setq sum (substring summary-and-rest |
| 1260 | (match-beginning pos-sum) | 1260 | ;; (match-beginning pos-sum) |
| 1261 | (match-end pos-sum)))) | 1261 | ;; (match-end pos-sum)))) |
| 1262 | (if (and pos-cla (match-beginning pos-cla)) | 1262 | (if (and pos-cla (match-beginning pos-cla)) |
| 1263 | (setq cla (substring summary-and-rest | 1263 | (setq cla (substring summary-and-rest |
| 1264 | (match-beginning pos-cla) | 1264 | (match-beginning pos-cla) |
| @@ -1763,8 +1763,8 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1763 | ;;BUT remove today if `diary-float' | 1763 | ;;BUT remove today if `diary-float' |
| 1764 | ;;expression does not hold true for today: | 1764 | ;;expression does not hold true for today: |
| 1765 | (when | 1765 | (when |
| 1766 | (null (let ((date (calendar-current-date)) | 1766 | (null (calendar-dlet* ((date (calendar-current-date)) |
| 1767 | (entry entry-main)) | 1767 | (entry entry-main)) |
| 1768 | (diary-float month dayname n))) | 1768 | (diary-float month dayname n))) |
| 1769 | (concat | 1769 | (concat |
| 1770 | "\nEXDATE;VALUE=DATE:" | 1770 | "\nEXDATE;VALUE=DATE:" |
| @@ -2164,7 +2164,7 @@ written into the buffer `*icalendar-errors*'." | |||
| 2164 | (rdate | 2164 | (rdate |
| 2165 | (icalendar--dmsg "rdate event") | 2165 | (icalendar--dmsg "rdate event") |
| 2166 | (setq diary-string "") | 2166 | (setq diary-string "") |
| 2167 | (mapc (lambda (datestring) | 2167 | (mapc (lambda (_datestring) |
| 2168 | (setq diary-string | 2168 | (setq diary-string |
| 2169 | (concat diary-string | 2169 | (concat diary-string |
| 2170 | (format "......")))) | 2170 | (format "......")))) |
| @@ -2174,14 +2174,14 @@ written into the buffer `*icalendar-errors*'." | |||
| 2174 | ((not (string= start-d end-d)) | 2174 | ((not (string= start-d end-d)) |
| 2175 | (setq diary-string | 2175 | (setq diary-string |
| 2176 | (icalendar--convert-non-recurring-all-day-to-diary | 2176 | (icalendar--convert-non-recurring-all-day-to-diary |
| 2177 | e start-d end-1-d)) | 2177 | start-d end-1-d)) |
| 2178 | (setq event-ok t)) | 2178 | (setq event-ok t)) |
| 2179 | ;; not all-day | 2179 | ;; not all-day |
| 2180 | ((and start-t (or (not end-t) | 2180 | ((and start-t (or (not end-t) |
| 2181 | (not (string= start-t end-t)))) | 2181 | (not (string= start-t end-t)))) |
| 2182 | (setq diary-string | 2182 | (setq diary-string |
| 2183 | (icalendar--convert-non-recurring-not-all-day-to-diary | 2183 | (icalendar--convert-non-recurring-not-all-day-to-diary |
| 2184 | e dtstart-dec dtend-dec start-t end-t)) | 2184 | dtstart-dec start-t end-t)) |
| 2185 | (setq event-ok t)) | 2185 | (setq event-ok t)) |
| 2186 | ;; all-day event | 2186 | ;; all-day event |
| 2187 | (t | 2187 | (t |
| @@ -2467,7 +2467,7 @@ END-T is the event's end time in diary format." | |||
| 2467 | e 'EXRULE)))) | 2467 | e 'EXRULE)))) |
| 2468 | result)) | 2468 | result)) |
| 2469 | 2469 | ||
| 2470 | (defun icalendar--convert-non-recurring-all-day-to-diary (event start-d end-d) | 2470 | (defun icalendar--convert-non-recurring-all-day-to-diary (start-d end-d) |
| 2471 | "Convert non-recurring iCalendar EVENT to diary format. | 2471 | "Convert non-recurring iCalendar EVENT to diary format. |
| 2472 | 2472 | ||
| 2473 | DTSTART is the decoded DTSTART property of E. | 2473 | DTSTART is the decoded DTSTART property of E. |
| @@ -2476,14 +2476,12 @@ Argument END-D gives the last day." | |||
| 2476 | (icalendar--dmsg "non-recurring all-day event") | 2476 | (icalendar--dmsg "non-recurring all-day event") |
| 2477 | (format "%%%%(and (diary-block %s %s))" start-d end-d)) | 2477 | (format "%%%%(and (diary-block %s %s))" start-d end-d)) |
| 2478 | 2478 | ||
| 2479 | (defun icalendar--convert-non-recurring-not-all-day-to-diary (event dtstart-dec | 2479 | (defun icalendar--convert-non-recurring-not-all-day-to-diary (dtstart-dec |
| 2480 | dtend-dec | 2480 | start-t |
| 2481 | start-t | 2481 | end-t) |
| 2482 | end-t) | ||
| 2483 | "Convert recurring icalendar EVENT to diary format. | 2482 | "Convert recurring icalendar EVENT to diary format. |
| 2484 | 2483 | ||
| 2485 | DTSTART-DEC is the decoded DTSTART property of E. | 2484 | DTSTART-DEC is the decoded DTSTART property of E. |
| 2486 | DTEND-DEC is the decoded DTEND property of E. | ||
| 2487 | START-T is the event's start time in diary format. | 2485 | START-T is the event's start time in diary format. |
| 2488 | END-T is the event's end time in diary format." | 2486 | END-T is the event's end time in diary format." |
| 2489 | (icalendar--dmsg "not all day event") | 2487 | (icalendar--dmsg "not all day event") |