emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r103306: Merge changes made in Gnus t


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103306: Merge changes made in Gnus trunk.
Date: Wed, 16 Feb 2011 23:12:47 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103306
author: Gnus developers <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Wed 2011-02-16 23:12:47 +0000
message:
  Merge changes made in Gnus trunk.
  
  gnus-sum.el (gnus-propagate-marks): Change default to t again, since nil 
means that nnimap doesn't get updated.
  auth-source.el (auth-source-netrc-create): Return a synthetic search result 
when the user doesn't want to write to the file.
   (auth-source-netrc-search): Expect a synthetic result and proceed 
accordingly.
   (auth-source-cache-expiry): New variable to override `password-cache-expiry'.
   (auth-source-remember): Use it.
  nnimap.el (nnimap-credentials): Remove the `inhibit-create' parameter.  
Create entry if necessary by using :create t.
   (nnimap-open-connection-1): Don't pass `inhibit-create'.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/auth-source.el
  lisp/gnus/gnus-sum.el
  lisp/gnus/nnimap.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2011-02-16 00:00:21 +0000
+++ b/lisp/gnus/ChangeLog       2011-02-16 23:12:47 +0000
@@ -1,3 +1,22 @@
+2011-02-16  Lars Ingebrigtsen  <address@hidden>
+
+       * gnus-sum.el (gnus-propagate-marks): Change default to t again, since
+       nil means that nnimap doesn't get updated.
+
+2011-02-16  Teodor Zlatanov  <address@hidden>
+
+       * auth-source.el (auth-source-netrc-create): Return a synthetic search
+       result when the user doesn't want to write to the file.
+       (auth-source-netrc-search): Expect a synthetic result and proceed
+       accordingly.
+       (auth-source-cache-expiry): New variable to override
+       `password-cache-expiry'.
+       (auth-source-remember): Use it.
+
+       * nnimap.el (nnimap-credentials): Remove the `inhibit-create'
+       parameter.  Create entry if necessary by using :create t.
+       (nnimap-open-connection-1): Don't pass `inhibit-create'.
+
 2011-02-15  Teodor Zlatanov  <address@hidden>
 
        * auth-source.el (auth-source-debug): Enable by default and don't

=== modified file 'lisp/gnus/auth-source.el'
--- a/lisp/gnus/auth-source.el  2011-02-16 00:00:21 +0000
+++ b/lisp/gnus/auth-source.el  2011-02-16 23:12:47 +0000
@@ -61,6 +61,18 @@
   :version "23.1" ;; No Gnus
   :group 'gnus)
 
+;;;###autoload
+(defcustom auth-source-cache-expiry 7200
+  "How many seconds passwords are cached, or nil to disable
+expiring.  Overrides `password-cache-expiry' through a
+let-binding."
+  :group 'auth-source
+  :type '(choice (const :tag "Never" nil)
+                 (const :tag "All Day" 86400)
+                 (const :tag "2 Hours" 7200)
+                 (const :tag "30 Minutes" 1800)
+                 (integer :tag "Seconds")))
+
 (defclass auth-source-backend ()
   ((type :initarg :type
          :initform 'netrc
@@ -588,8 +600,9 @@
 
 (defun auth-source-remember (spec found)
   "Remember FOUND search results for SPEC."
-  (password-cache-add
-   (concat auth-source-magic (format "%S" spec)) found))
+  (let ((password-cache-expiry auth-source-cache-expiry))
+    (password-cache-add
+     (concat auth-source-magic (format "%S" spec)) found)))
 
 (defun auth-source-recall (spec)
   "Recall FOUND search results for SPEC."
@@ -808,14 +821,17 @@
     (when (and create
                (= 0 (length results)))
 
-      ;; create based on the spec
-      (apply (slot-value backend 'create-function) spec)
-      ;; turn off the :create key
-      (setq spec (plist-put spec :create nil))
-      ;; run the search again to get the updated data
-      ;; the result will be returned, even if the search fails
-      (setq results (apply 'auth-source-netrc-search spec)))
+      ;; create based on the spec and record the value
+      (setq results (or
+                     ;; if the user did not want to create the entry
+                     ;; in the file, it will be returned
+                     (apply (slot-value backend 'create-function) spec)
+                     ;; if not, we do the search again without :create
+                     ;; to get the updated data.
 
+                     ;; the result will be returned, even if the search fails
+                     (apply 'auth-source-netrc-search
+                            (plist-put spec :create nil)))))
     results))
 
 ;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
@@ -833,7 +849,9 @@
          (file (oref backend source))
          (add "")
          ;; `valist' is an alist
-         valist)
+         valist
+         ;; `artificial' will be returned if no creation is needed
+         artificial)
 
     ;; only for base required elements (defined as function parameters):
     ;; fill in the valist with whatever data we may have from the search
@@ -902,6 +920,14 @@
                        nil nil default))
                      (t data))))
 
+        (when data
+          (setq artificial (plist-put artificial
+                                      (intern (concat ":" (symbol-name r)))
+                                      (if (eq r 'secret)
+                                          (lexical-let ((data data))
+                                            (lambda () data))
+                                        data))))
+
         ;; when r is not an empty string...
         (when (and (stringp data)
                    (< 0 (length data)))
@@ -935,14 +961,17 @@
       (goto-char (point-max))
 
       ;; ask AFTER we've successfully opened the file
-      (when (y-or-n-p (format "Add to file %s: line [%s]" file add))
-        (unless (bolp)
-          (insert "\n"))
-        (insert add "\n")
-        (write-region (point-min) (point-max) file nil 'silent)
-        (auth-source-do-debug
-         "auth-source-netrc-create: wrote 1 new line to %s"
-         file)))))
+      (if (y-or-n-p (format "Add to file %s: line [%s]" file add))
+          (progn
+            (unless (bolp)
+              (insert "\n"))
+            (insert add "\n")
+            (write-region (point-min) (point-max) file nil 'silent)
+            (auth-source-do-debug
+             "auth-source-netrc-create: wrote 1 new line to %s"
+             file)
+            nil)
+        (list artificial)))))
 
 ;;; Backend specific parsing: Secrets API backend
 

=== modified file 'lisp/gnus/gnus-sum.el'
--- a/lisp/gnus/gnus-sum.el     2011-02-15 11:24:37 +0000
+++ b/lisp/gnus/gnus-sum.el     2011-02-16 23:12:47 +0000
@@ -1234,11 +1234,10 @@
   :type 'boolean
   :group 'gnus-summary-marks)
 
-(defcustom gnus-propagate-marks nil
+(defcustom gnus-propagate-marks t
   "If non-nil, Gnus will store and retrieve marks from the backends.
 This means that marks will be stored both in .newsrc.eld and in
 the backend, and will slow operation down somewhat."
-  :version "24.1"
   :type 'boolean
   :group 'gnus-summary-marks)
 

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2011-02-14 04:23:59 +0000
+++ b/lisp/gnus/nnimap.el       2011-02-16 23:12:47 +0000
@@ -276,13 +276,11 @@
     (push (current-buffer) nnimap-process-buffers)
     (current-buffer)))
 
-(defun nnimap-credentials (address ports &optional inhibit-create)
+(defun nnimap-credentials (address ports)
   (let* ((found (nth 0 (auth-source-search :max 1
                                            :host address
                                            :port ports
-                                           :create (if inhibit-create
-                                                       nil
-                                                     (null ports)))))
+                                           :create t)))
          (user (plist-get found :user))
          (secret (plist-get found :secret))
          (secret (if (functionp secret) (funcall secret) secret)))
@@ -389,7 +387,7 @@
                                 (list
                                  (nnoo-current-server 'nnimap)
                                  nnimap-address)
-                                ports t))))
+                                ports))))
                  (setq nnimap-object nil)
                (let ((nnimap-inhibit-logging t))
                  (setq login-result


reply via email to

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