emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master fbd2ea1 2/2: Fix two parse-time-months invalid assu


From: Paul Eggert
Subject: [Emacs-diffs] master fbd2ea1 2/2: Fix two parse-time-months invalid assumptions
Date: Thu, 1 Aug 2019 18:47:21 -0400 (EDT)

branch: master
commit fbd2ea1f73f3262636efacfe77ad33dc8a4d826f
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix two parse-time-months invalid assumptions
    
    * lisp/gnus/nnimap.el: Do not require parse-time.
    * lisp/gnus/nnimap.el (nnimap-find-expired-articles):
    * lisp/net/pop3.el (pop3-make-date):
    Just use system-time-locale and format-time-string; no need to
    refer to parse-time-months.
    * lisp/net/pop3.el (parse-time-months): Remove defvar.
    * lisp/net/tramp-smb.el (tramp-smb-read-file-entry):
    Add FIXME comment about this.
---
 lisp/gnus/nnimap.el   |  9 ++-------
 lisp/net/pop3.el      | 16 +++-------------
 lisp/net/tramp-smb.el |  3 +++
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index c6eaa54..0c5aaf3 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -36,7 +36,6 @@
 (require 'nnoo)
 (require 'netrc)
 (require 'utf7)
-(require 'parse-time)
 (require 'nnmail)
 
 (autoload 'auth-source-forget+ "auth-source")
@@ -1097,12 +1096,8 @@ textual parts.")
        (let ((result
               (nnimap-command
                "UID SEARCH SENTBEFORE %s"
-               (format-time-string
-                (format "%%d-%s-%%Y"
-                        (upcase
-                         (car (rassoc (decoded-time-month (decode-time cutoff))
-                                      parse-time-months))))
-                cutoff))))
+               (let ((system-time-locale "C"))
+                 (upcase (format-time-string "%d-%b-%Y" cutoff))))))
          (and (car result)
               (delete 0 (mapcar #'string-to-number
                                 (cdr (assoc "SEARCH" (cdr result)))))))))))
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index ddb4139..4bf50c0 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -35,7 +35,6 @@
 (eval-when-compile (require 'cl-lib))
 
 (require 'mail-utils)
-(defvar parse-time-months)
 
 (defgroup pop3 nil
   "Post Office Protocol."
@@ -609,18 +608,9 @@ Return the response string if optional second argument is 
non-nil."
 (defun pop3-make-date (&optional now)
   "Make a valid date header.
 If NOW, use that time instead."
-  (require 'parse-time)
-  (let* ((now (or now (current-time)))
-        (zone (decoded-time-zone (decode-time now))))
-    (when (< zone 0)
-      (setq zone (- zone)))
-    (concat
-     (format-time-string "%d" now)
-     ;; The month name of the %b spec is locale-specific.  Pfff.
-     (format " %s "
-            (capitalize (car (rassoc (decoded-time-month (decode-time now))
-                                     parse-time-months))))
-     (format-time-string "%Y %H:%M:%S %z" now))))
+  ;; The month name of the %b spec is locale-specific.  Pfff.
+  (let ((system-time-locale "C"))
+    (format-time-string "%d %b %Y %T %z" now)))
 
 (defun pop3-munge-message-separator (start end)
   "Check to see if a message separator exists.  If not, generate one."
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 9b87ed4..568c6cb 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1814,6 +1814,9 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
            (if (and sec min hour day month year)
                (encode-time
                 sec min hour day
+                ;; FIXME: Won't this fail if parse-time-months is configured
+                ;; by the user?  See "The date/time prompt" in the Org manual.
+                ;; If the code is OK as-is, perhaps explain why in a comment.
                 (cdr (assoc (downcase month) parse-time-months))
                 year)
              tramp-time-dont-know))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]