diff options
| author | Gnus developers | 2014-03-23 23:14:52 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2014-03-23 23:14:52 +0000 |
| commit | 7a31038fd91fec168aa6ff5d09ce9bfc819d25d5 (patch) | |
| tree | c76aab1953e66c6e1e39bcdbb0ed8afe9ce3c61e | |
| parent | 4d2226bff09b794fe2f5db3b2ae3b5b48188d4a7 (diff) | |
| download | emacs-7a31038fd91fec168aa6ff5d09ce9bfc819d25d5.tar.gz emacs-7a31038fd91fec168aa6ff5d09ce9bfc819d25d5.zip | |
Merge from Gnus git master
2014-02-04 Lars Ingebrigtsen <larsi@gnus.org>
* calendar/parse-time.el (parse-time-iso8601-regexp)
(parse-iso8601-time-string): Copied from `url-dav' so that we can use
it more generally.
2014-02-01 Lars Ingebrigtsen <larsi@gnus.org>
* net/dns.el (network-interface-list): Define for XEmacs.
2014-01-31 Magnus Henoch <magnus.henoch@gmail.com>
* net/dns.el (dns-servers-up-to-date-p): New function to see whether
the network interfaces changed.
(dns-query): Use it to flush the data.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/calendar/parse-time.el | 62 | ||||
| -rw-r--r-- | lisp/mail/hashcash.el | 4 | ||||
| -rw-r--r-- | lisp/net/dns.el | 23 |
4 files changed, 99 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd87881c9ba..b89cbc28461 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2014-03-23 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * calendar/parse-time.el (parse-time-iso8601-regexp) | ||
| 4 | (parse-iso8601-time-string): Copied from `url-dav' so that we can use | ||
| 5 | it more generally. | ||
| 6 | |||
| 7 | 2014-03-23 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 8 | |||
| 9 | * net/dns.el (network-interface-list): Define for XEmacs. | ||
| 10 | |||
| 11 | 2014-03-23 Magnus Henoch <magnus.henoch@gmail.com> | ||
| 12 | |||
| 13 | * net/dns.el (dns-servers-up-to-date-p): New function to see whether | ||
| 14 | the network interfaces changed. | ||
| 15 | (dns-query): Use it to flush the data. | ||
| 16 | |||
| 1 | 2014-03-23 Juanma Barranquero <lekktu@gmail.com> | 17 | 2014-03-23 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 18 | ||
| 3 | * vc/vc.el (vc-rollback): Use set-buffer-modified-p. | 19 | * vc/vc.el (vc-rollback): Use set-buffer-modified-p. |
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index 79569f2142c..6bfccec94c6 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el | |||
| @@ -218,6 +218,68 @@ unknown are returned as nil." | |||
| 218 | (rplaca (nthcdr (pop slots) time) new-val)))))))) | 218 | (rplaca (nthcdr (pop slots) time) new-val)))))))) |
| 219 | time)) | 219 | time)) |
| 220 | 220 | ||
| 221 | (defconst parse-time-iso8601-regexp | ||
| 222 | (let* ((dash "-?") | ||
| 223 | (colon ":?") | ||
| 224 | (4digit "\\([0-9][0-9][0-9][0-9]\\)") | ||
| 225 | (2digit "\\([0-9][0-9]\\)") | ||
| 226 | (date-fullyear 4digit) | ||
| 227 | (date-month 2digit) | ||
| 228 | (date-mday 2digit) | ||
| 229 | (time-hour 2digit) | ||
| 230 | (time-minute 2digit) | ||
| 231 | (time-second 2digit) | ||
| 232 | (time-secfrac "\\(\\.[0-9]+\\)?") | ||
| 233 | (time-numoffset (concat "[-+]\\(" time-hour "\\):" time-minute)) | ||
| 234 | (time-offset (concat "Z" time-numoffset)) | ||
| 235 | (partial-time (concat time-hour colon time-minute colon time-second | ||
| 236 | time-secfrac)) | ||
| 237 | (full-date (concat date-fullyear dash date-month dash date-mday)) | ||
| 238 | (full-time (concat partial-time time-offset)) | ||
| 239 | (date-time (concat full-date "T" full-time))) | ||
| 240 | (list (concat "^" full-date) | ||
| 241 | (concat "T" partial-time) | ||
| 242 | (concat "Z" time-numoffset))) | ||
| 243 | "List of regular expressions matching ISO 8601 dates. | ||
| 244 | 1st regular expression matches the date. | ||
| 245 | 2nd regular expression matches the time. | ||
| 246 | 3rd regular expression matches the (optional) timezone specification.") | ||
| 247 | |||
| 248 | (defun parse-iso8601-time-string (date-string) | ||
| 249 | (let* ((date-re (nth 0 parse-time-iso8601-regexp)) | ||
| 250 | (time-re (nth 1 parse-time-iso8601-regexp)) | ||
| 251 | (tz-re (nth 2 parse-time-iso8601-regexp)) | ||
| 252 | re-start | ||
| 253 | time seconds minute hour fractional-seconds | ||
| 254 | day month year day-of-week dst tz) | ||
| 255 | ;; We need to populate 'time' with | ||
| 256 | ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ) | ||
| 257 | |||
| 258 | ;; Nobody else handles iso8601 correctly, let's do it ourselves. | ||
| 259 | (when (string-match date-re date-string re-start) | ||
| 260 | (setq year (string-to-number (match-string 1 date-string)) | ||
| 261 | month (string-to-number (match-string 2 date-string)) | ||
| 262 | day (string-to-number (match-string 3 date-string)) | ||
| 263 | re-start (match-end 0)) | ||
| 264 | (when (string-match time-re date-string re-start) | ||
| 265 | (setq hour (string-to-number (match-string 1 date-string)) | ||
| 266 | minute (string-to-number (match-string 2 date-string)) | ||
| 267 | seconds (string-to-number (match-string 3 date-string)) | ||
| 268 | fractional-seconds (string-to-number (or | ||
| 269 | (match-string 4 date-string) | ||
| 270 | "0")) | ||
| 271 | re-start (match-end 0)) | ||
| 272 | (when (string-match tz-re date-string re-start) | ||
| 273 | (setq tz (match-string 1 date-string))) | ||
| 274 | (setq time (list seconds minute hour day month year day-of-week dst tz)))) | ||
| 275 | |||
| 276 | ;; Fall back to having Gnus do fancy things for us. | ||
| 277 | (when (not time) | ||
| 278 | (setq time (parse-time-string date-string))) | ||
| 279 | |||
| 280 | (and time | ||
| 281 | (apply 'encode-time time)))) | ||
| 282 | |||
| 221 | (provide 'parse-time) | 283 | (provide 'parse-time) |
| 222 | 284 | ||
| 223 | ;;; parse-time.el ends here | 285 | ;;; parse-time.el ends here |
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el index 2224884eede..fb8dfba8554 100644 --- a/lisp/mail/hashcash.el +++ b/lisp/mail/hashcash.el | |||
| @@ -47,10 +47,6 @@ | |||
| 47 | 47 | ||
| 48 | ;;; Code: | 48 | ;;; Code: |
| 49 | 49 | ||
| 50 | ;; For Emacs <22.2 and XEmacs. | ||
| 51 | (eval-and-compile | ||
| 52 | (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) | ||
| 53 | |||
| 54 | (eval-when-compile (require 'cl)) ; for case | 50 | (eval-when-compile (require 'cl)) ; for case |
| 55 | 51 | ||
| 56 | (defgroup hashcash nil | 52 | (defgroup hashcash nil |
diff --git a/lisp/net/dns.el b/lisp/net/dns.el index e52ead1fb72..ea1c805c6b9 100644 --- a/lisp/net/dns.el +++ b/lisp/net/dns.el | |||
| @@ -31,6 +31,12 @@ | |||
| 31 | "List of DNS servers to query. | 31 | "List of DNS servers to query. |
| 32 | If nil, /etc/resolv.conf and nslookup will be consulted.") | 32 | If nil, /etc/resolv.conf and nslookup will be consulted.") |
| 33 | 33 | ||
| 34 | (defvar dns-servers-valid-for-interfaces nil | ||
| 35 | "The return value of `network-interface-list' when `dns-servers' was set. | ||
| 36 | If the set of network interfaces and/or their IP addresses | ||
| 37 | change, then presumably the list of DNS servers needs to be | ||
| 38 | updated. Set this variable to t to disable the check.") | ||
| 39 | |||
| 34 | ;;; Internal code: | 40 | ;;; Internal code: |
| 35 | 41 | ||
| 36 | (defvar dns-query-types | 42 | (defvar dns-query-types |
| @@ -297,6 +303,17 @@ If TCP-P, the first two bytes of the package with be the length field." | |||
| 297 | (t string))) | 303 | (t string))) |
| 298 | (goto-char point)))) | 304 | (goto-char point)))) |
| 299 | 305 | ||
| 306 | (declare-function network-interface-list "process.c") | ||
| 307 | |||
| 308 | (defun dns-servers-up-to-date-p () | ||
| 309 | "Return false if we need to recheck the list of DNS servers." | ||
| 310 | (and dns-servers | ||
| 311 | (or (eq dns-servers-valid-for-interfaces t) | ||
| 312 | ;; `network-interface-list' was introduced in Emacs 22.1. | ||
| 313 | (not (fboundp 'network-interface-list)) | ||
| 314 | (equal dns-servers-valid-for-interfaces | ||
| 315 | (network-interface-list))))) | ||
| 316 | |||
| 300 | (defun dns-set-servers () | 317 | (defun dns-set-servers () |
| 301 | "Set `dns-servers' to a list of DNS servers or nil if none are found. | 318 | "Set `dns-servers' to a list of DNS servers or nil if none are found. |
| 302 | Parses \"/etc/resolv.conf\" or calls \"nslookup\"." | 319 | Parses \"/etc/resolv.conf\" or calls \"nslookup\"." |
| @@ -314,7 +331,9 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"." | |||
| 314 | (goto-char (point-min)) | 331 | (goto-char (point-min)) |
| 315 | (re-search-forward | 332 | (re-search-forward |
| 316 | "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t) | 333 | "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t) |
| 317 | (setq dns-servers (list (match-string 1))))))) | 334 | (setq dns-servers (list (match-string 1)))))) |
| 335 | (when (fboundp 'network-interface-list) | ||
| 336 | (setq dns-servers-valid-for-interfaces (network-interface-list)))) | ||
| 318 | 337 | ||
| 319 | (defun dns-read-txt (string) | 338 | (defun dns-read-txt (string) |
| 320 | (if (> (length string) 1) | 339 | (if (> (length string) 1) |
| @@ -378,7 +397,7 @@ Parses \"/etc/resolv.conf\" or calls \"nslookup\"." | |||
| 378 | If FULLP, return the entire record returned. | 397 | If FULLP, return the entire record returned. |
| 379 | If REVERSEP, look up an IP address." | 398 | If REVERSEP, look up an IP address." |
| 380 | (setq type (or type 'A)) | 399 | (setq type (or type 'A)) |
| 381 | (unless dns-servers | 400 | (unless (dns-servers-up-to-date-p) |
| 382 | (dns-set-servers)) | 401 | (dns-set-servers)) |
| 383 | 402 | ||
| 384 | (when reversep | 403 | (when reversep |