diff options
| author | Stefan Kangas | 2019-10-21 18:49:04 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2019-10-21 18:53:46 +0200 |
| commit | 8f9ed4c71d22288c38331199fd556acf65752d0d (patch) | |
| tree | d58f7dcd7e5e752727485a5fa8a0e27e25755d54 | |
| parent | 61fb5214816ef3d57e676d900e499ffcd079a1f9 (diff) | |
| download | emacs-8f9ed4c71d22288c38331199fd556acf65752d0d.tar.gz emacs-8f9ed4c71d22288c38331199fd556acf65752d0d.zip | |
Remove XEmacs compat code from icalendar.el (Bug#37816)
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import)
(icalendar--parse-summary-and-rest)
(icalendar--convert-ordinary-to-ical)
(icalendar--convert-weekly-to-ical)
(icalendar--convert-yearly-to-ical)
(icalendar--convert-block-to-ical)
(icalendar--convert-cyclic-to-ical)
(icalendar--convert-anniversary-to-ical)
(icalendar--format-ical-event)
(icalendar--convert-recurring-to-diary): Remove XEmacs compat code.
(icalendar--rris): Declare obsolete.
| -rw-r--r-- | lisp/calendar/icalendar.el | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el index 3ae0fcbe977..63d09dc4c24 100644 --- a/lisp/calendar/icalendar.el +++ b/lisp/calendar/icalendar.el | |||
| @@ -347,14 +347,9 @@ mix of different line endings." | |||
| 347 | (defsubst icalendar--rris (regexp rep string &optional fixedcase literal) | 347 | (defsubst icalendar--rris (regexp rep string &optional fixedcase literal) |
| 348 | "Replace regular expression in string. | 348 | "Replace regular expression in string. |
| 349 | Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to | 349 | Pass arguments REGEXP REP STRING FIXEDCASE LITERAL to |
| 350 | `replace-regexp-in-string' (Emacs) or to `replace-in-string' (XEmacs)." | 350 | `replace-regexp-in-string'." |
| 351 | (cond ((fboundp 'replace-regexp-in-string) | 351 | (declare (obsolete replace-regexp-in-string "27.1")) |
| 352 | ;; Emacs: | 352 | (replace-regexp-in-string regexp rep string fixedcase literal)) |
| 353 | (replace-regexp-in-string regexp rep string fixedcase literal)) | ||
| 354 | ((fboundp 'replace-in-string) | ||
| 355 | ;; XEmacs: | ||
| 356 | (save-match-data ;; apparently XEmacs needs save-match-data | ||
| 357 | (replace-in-string string regexp rep literal))))) | ||
| 358 | 353 | ||
| 359 | (defun icalendar--read-element (invalue inparams) | 354 | (defun icalendar--read-element (invalue inparams) |
| 360 | "Recursively read the next iCalendar element in the current buffer. | 355 | "Recursively read the next iCalendar element in the current buffer. |
| @@ -978,14 +973,14 @@ TIMESTRING and has the same result as \"9:00\"." | |||
| 978 | 973 | ||
| 979 | (defun icalendar--convert-string-for-export (string) | 974 | (defun icalendar--convert-string-for-export (string) |
| 980 | "Escape comma and other critical characters in STRING." | 975 | "Escape comma and other critical characters in STRING." |
| 981 | (icalendar--rris "," "\\\\," string)) | 976 | (replace-regexp-in-string "," "\\\\," string)) |
| 982 | 977 | ||
| 983 | (defun icalendar--convert-string-for-import (string) | 978 | (defun icalendar--convert-string-for-import (string) |
| 984 | "Remove escape chars for comma, semicolon etc. from STRING." | 979 | "Remove escape chars for comma, semicolon etc. from STRING." |
| 985 | (icalendar--rris | 980 | (replace-regexp-in-string |
| 986 | "\\\\n" "\n " (icalendar--rris | 981 | "\\\\n" "\n " (replace-regexp-in-string |
| 987 | "\\\\\"" "\"" (icalendar--rris | 982 | "\\\\\"" "\"" (replace-regexp-in-string |
| 988 | "\\\\;" ";" (icalendar--rris | 983 | "\\\\;" ";" (replace-regexp-in-string |
| 989 | "\\\\," "," string))))) | 984 | "\\\\," "," string))))) |
| 990 | 985 | ||
| 991 | ;; ====================================================================== | 986 | ;; ====================================================================== |
| @@ -1232,7 +1227,7 @@ Returns an alist." | |||
| 1232 | (setq ct (+ ct 1)) | 1227 | (setq ct (+ ct 1)) |
| 1233 | (setq pos-uid (* 2 ct)))) ) | 1228 | (setq pos-uid (* 2 ct)))) ) |
| 1234 | (mapc (lambda (ij) | 1229 | (mapc (lambda (ij) |
| 1235 | (setq s (icalendar--rris (car ij) (cadr ij) s t t))) | 1230 | (setq s (replace-regexp-in-string (car ij) (cadr ij) s t t))) |
| 1236 | (list | 1231 | (list |
| 1237 | ;; summary must be first! because of %s | 1232 | ;; summary must be first! because of %s |
| 1238 | (list "%s" | 1233 | (list "%s" |
| @@ -1253,7 +1248,7 @@ Returns an alist." | |||
| 1253 | (concat "\\(" icalendar-import-format-uid "\\)??")))) | 1248 | (concat "\\(" icalendar-import-format-uid "\\)??")))) |
| 1254 | ;; Need the \' regexp in order to detect multi-line items | 1249 | ;; Need the \' regexp in order to detect multi-line items |
| 1255 | (setq s (concat "\\`" | 1250 | (setq s (concat "\\`" |
| 1256 | (icalendar--rris "%s" "\\(.*?\\)" s nil t) | 1251 | (replace-regexp-in-string "%s" "\\(.*?\\)" s nil t) |
| 1257 | "\\'")) | 1252 | "\\'")) |
| 1258 | (if (string-match s summary-and-rest) | 1253 | (if (string-match s summary-and-rest) |
| 1259 | (let (cla des loc org sta url uid) ;; sum | 1254 | (let (cla des loc org sta url uid) ;; sum |
| @@ -1395,7 +1390,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1395 | (when starttimestring | 1390 | (when starttimestring |
| 1396 | (unless endtimestring | 1391 | (unless endtimestring |
| 1397 | (let ((time | 1392 | (let ((time |
| 1398 | (read (icalendar--rris "^T0?" "" | 1393 | (read (replace-regexp-in-string "^T0?" "" |
| 1399 | starttimestring)))) | 1394 | starttimestring)))) |
| 1400 | (if (< time 230000) | 1395 | (if (< time 230000) |
| 1401 | ;; Case: ends on same day | 1396 | ;; Case: ends on same day |
| @@ -1483,7 +1478,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1483 | (when starttimestring | 1478 | (when starttimestring |
| 1484 | (unless endtimestring | 1479 | (unless endtimestring |
| 1485 | (let ((time (read | 1480 | (let ((time (read |
| 1486 | (icalendar--rris "^T0?" "" | 1481 | (replace-regexp-in-string "^T0?" "" |
| 1487 | starttimestring)))) | 1482 | starttimestring)))) |
| 1488 | (setq endtimestring (format "T%06d" | 1483 | (setq endtimestring (format "T%06d" |
| 1489 | (+ 10000 time)))))) | 1484 | (+ 10000 time)))))) |
| @@ -1570,7 +1565,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1570 | (when starttimestring | 1565 | (when starttimestring |
| 1571 | (unless endtimestring | 1566 | (unless endtimestring |
| 1572 | (let ((time (read | 1567 | (let ((time (read |
| 1573 | (icalendar--rris "^T0?" "" | 1568 | (replace-regexp-in-string "^T0?" "" |
| 1574 | starttimestring)))) | 1569 | starttimestring)))) |
| 1575 | (setq endtimestring (format "T%06d" | 1570 | (setq endtimestring (format "T%06d" |
| 1576 | (+ 10000 time)))))) | 1571 | (+ 10000 time)))))) |
| @@ -1704,7 +1699,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1704 | (when starttimestring | 1699 | (when starttimestring |
| 1705 | (unless endtimestring | 1700 | (unless endtimestring |
| 1706 | (let ((time | 1701 | (let ((time |
| 1707 | (read (icalendar--rris "^T0?" "" | 1702 | (read (replace-regexp-in-string "^T0?" "" |
| 1708 | starttimestring)))) | 1703 | starttimestring)))) |
| 1709 | (setq endtimestring (format "T%06d" | 1704 | (setq endtimestring (format "T%06d" |
| 1710 | (+ 10000 time)))))) | 1705 | (+ 10000 time)))))) |
| @@ -1747,7 +1742,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1747 | (n (nth 3 sexp)) | 1742 | (n (nth 3 sexp)) |
| 1748 | (day (nth 4 sexp)) | 1743 | (day (nth 4 sexp)) |
| 1749 | (summary | 1744 | (summary |
| 1750 | (replace-regexp-in-string | 1745 | (replace-regexp-in-string |
| 1751 | "\\(^\s+\\|\s+$\\)" "" | 1746 | "\\(^\s+\\|\s+$\\)" "" |
| 1752 | (buffer-substring (point) (point-max))))) | 1747 | (buffer-substring (point) (point-max))))) |
| 1753 | 1748 | ||
| @@ -1857,7 +1852,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1857 | (when starttimestring | 1852 | (when starttimestring |
| 1858 | (unless endtimestring | 1853 | (unless endtimestring |
| 1859 | (let ((time | 1854 | (let ((time |
| 1860 | (read (icalendar--rris "^T0?" "" | 1855 | (read (replace-regexp-in-string "^T0?" "" |
| 1861 | starttimestring)))) | 1856 | starttimestring)))) |
| 1862 | (setq endtimestring (format "T%06d" | 1857 | (setq endtimestring (format "T%06d" |
| 1863 | (+ 10000 time)))))) | 1858 | (+ 10000 time)))))) |
| @@ -1926,7 +1921,7 @@ entries. ENTRY-MAIN is the first line of the diary entry." | |||
| 1926 | (when starttimestring | 1921 | (when starttimestring |
| 1927 | (unless endtimestring | 1922 | (unless endtimestring |
| 1928 | (let ((time | 1923 | (let ((time |
| 1929 | (read (icalendar--rris "^T0?" "" | 1924 | (read (replace-regexp-in-string "^T0?" "" |
| 1930 | starttimestring)))) | 1925 | starttimestring)))) |
| 1931 | (setq endtimestring (format "T%06d" | 1926 | (setq endtimestring (format "T%06d" |
| 1932 | (+ 10000 time)))))) | 1927 | (+ 10000 time)))))) |
| @@ -2051,12 +2046,12 @@ buffer `*icalendar-errors*'." | |||
| 2051 | (formatted-contents "")) | 2046 | (formatted-contents "")) |
| 2052 | (when (and contents (> (length contents) 0)) | 2047 | (when (and contents (> (length contents) 0)) |
| 2053 | (setq formatted-contents | 2048 | (setq formatted-contents |
| 2054 | (icalendar--rris "%s" | 2049 | (replace-regexp-in-string "%s" |
| 2055 | (icalendar--convert-string-for-import | 2050 | (icalendar--convert-string-for-import |
| 2056 | contents) | 2051 | contents) |
| 2057 | (symbol-value format) | 2052 | (symbol-value format) |
| 2058 | t t))) | 2053 | t t))) |
| 2059 | (setq string (icalendar--rris spec | 2054 | (setq string (replace-regexp-in-string spec |
| 2060 | formatted-contents | 2055 | formatted-contents |
| 2061 | string | 2056 | string |
| 2062 | t t)))) | 2057 | t t)))) |
| @@ -2450,7 +2445,7 @@ END-T is the event's end time in diary format." | |||
| 2450 | (ex-d (icalendar--datetime-to-diary-date | 2445 | (ex-d (icalendar--datetime-to-diary-date |
| 2451 | ex-start))) | 2446 | ex-start))) |
| 2452 | (setq result | 2447 | (setq result |
| 2453 | (icalendar--rris "^%%(\\(and \\)?" | 2448 | (replace-regexp-in-string "^%%(\\(and \\)?" |
| 2454 | (format | 2449 | (format |
| 2455 | "%%%%(and (not (diary-date %s)) " | 2450 | "%%%%(and (not (diary-date %s)) " |
| 2456 | ex-d) | 2451 | ex-d) |