]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/imap.el (imap-mailbox-close): Use proper closures
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 May 2021 23:12:11 +0000 (19:12 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 18 May 2021 23:12:11 +0000 (19:12 -0400)
Also, remove redundant `:group` args, and prefer #' to quote function names

lisp/net/imap.el

index d29584e55bd0557234f8449566dc48730df4ae77..6ca76f1f99424c181b16c3cd3373369f753b3df0 100644 (file)
 %l with the value of `imap-default-user'.  The program should accept
 IMAP commands on stdin and return responses to stdout.  Each entry in
 the list is tried until a successful connection is made."
-  :group 'imap
   :type '(repeat string))
 
 (defcustom imap-gssapi-program (list
@@ -173,7 +172,6 @@ the list is tried until a successful connection is made."
 %l with the value of `imap-default-user'.  The program should accept
 IMAP commands on stdin and return responses to stdout.  Each entry in
 the list is tried until a successful connection is made."
-  :group 'imap
   :type '(repeat string))
 
 (defcustom imap-shell-program '("ssh %s imapd"
@@ -186,7 +184,6 @@ number on server, %g with `imap-shell-host', and %l with
 `imap-default-user'.  The program should read IMAP commands from stdin
 and write IMAP response to stdout.  Each entry in the list is tried
 until a successful connection is made."
-  :group 'imap
   :type '(repeat string))
 
 (defcustom imap-process-connection-type nil
@@ -198,7 +195,6 @@ system has no ptys or if all ptys are busy: then a pipe is used
 in any case.  The value takes effect when an IMAP server is
 opened; changing it after that has no effect."
   :version "22.1"
-  :group 'imap
   :type 'boolean)
 
 (defcustom imap-use-utf7 t
@@ -206,7 +202,6 @@ opened; changing it after that has no effect."
 Since the UTF7 decoding currently only decodes into ISO-8859-1
 characters, you may disable this decoding if you need to access UTF7
 encoded mailboxes which doesn't translate into ISO-8859-1."
-  :group 'imap
   :type 'boolean)
 
 (defcustom imap-log nil
@@ -217,7 +212,6 @@ It is not written to disk, however.  Do not enable this
 variable unless you are comfortable with that.
 
 See also `imap-debug'."
-  :group 'imap
   :type 'boolean)
 
 (defcustom imap-debug nil
@@ -232,17 +226,14 @@ variable unless you are comfortable with that.
 
 This variable only takes effect when loading the `imap' library.
 See also `imap-log'."
-  :group 'imap
   :type 'boolean)
 
 (defcustom imap-shell-host "gateway"
   "Hostname of rlogin proxy."
-  :group 'imap
   :type 'string)
 
 (defcustom imap-default-user (user-login-name)
   "Default username to use."
-  :group 'imap
   :type 'string)
 
 (defcustom imap-read-timeout (if (memq system-type '(windows-nt cygwin))
@@ -250,12 +241,10 @@ See also `imap-log'."
                               0.1)
   "How long to wait between checking for the end of output.
 Shorter values mean quicker response, but is more CPU intensive."
-  :type 'number
-  :group 'imap)
+  :type 'number)
 
 (defcustom imap-store-password nil
   "If non-nil, store session password without prompting."
-  :group 'imap
   :type 'boolean)
 
 ;;; Various variables
@@ -987,8 +976,8 @@ t if it successfully authenticates, nil otherwise."
                                    "imap" buffer imap-server imap-port)
                         ((error quit) nil)))
     (when imap-process
-      (set-process-filter imap-process 'imap-arrival-filter)
-      (set-process-sentinel imap-process 'imap-sentinel)
+      (set-process-filter imap-process #'imap-arrival-filter)
+      (set-process-sentinel imap-process #'imap-sentinel)
       (while (and (eq imap-state 'initial)
                  (memq (process-status imap-process) '(open run)))
        (message "Waiting for response from %s..." imap-server)
@@ -1012,7 +1001,7 @@ necessary.  If nil, the buffer name is generated."
   (with-current-buffer (get-buffer-create buffer)
     (if (imap-opened buffer)
        (imap-close buffer))
-    (mapc 'make-local-variable imap-local-variables)
+    (mapc #'make-local-variable imap-local-variables)
     (set-buffer-multibyte nil)
     (buffer-disable-undo)
     (setq imap-server (or server imap-server))
@@ -1034,7 +1023,7 @@ necessary.  If nil, the buffer name is generated."
              ;; Stream changed?
              (if (not (eq imap-default-stream stream))
                   (with-current-buffer (generate-new-buffer " *temp*")
-                   (mapc 'make-local-variable imap-local-variables)
+                   (mapc #'make-local-variable imap-local-variables)
                    (set-buffer-multibyte nil)
                    (buffer-disable-undo)
                    (setq imap-server (or server imap-server))
@@ -1078,7 +1067,6 @@ necessary.  If nil, the buffer name is generated."
   "If non-nil, check if IMAP is open.
 See the function `imap-ping-server'."
   :version "23.1" ;; No Gnus
-  :group 'imap
   :type 'boolean)
 
 (defun imap-opened (&optional buffer)
@@ -1346,16 +1334,16 @@ If BUFFER is nil the current buffer is assumed."
     (when imap-current-mailbox
       (if asynch
          (imap-add-callback (imap-send-command "CLOSE")
-                            `(lambda (tag status)
-                               (message "IMAP mailbox `%s' closed... %s"
-                                        imap-current-mailbox status)
-                               (when (eq ,imap-current-mailbox
-                                         imap-current-mailbox)
-                                 ;; Don't wipe out data if another mailbox
-                                 ;; was selected...
-                                 (setq imap-current-mailbox nil
-                                       imap-message-data nil
-                                       imap-state 'auth))))
+                            (let ((cmb imap-current-mailbox))
+                              (lambda (_tag status)
+                                (message "IMAP mailbox `%s' closed... %s"
+                                         imap-current-mailbox status)
+                                (when (eq cmb imap-current-mailbox)
+                                  ;; Don't wipe out data if another mailbox
+                                  ;; was selected...
+                                  (setq imap-current-mailbox nil
+                                        imap-message-data nil
+                                        imap-state 'auth)))))
        (when (imap-ok-p (imap-send-command-wait "CLOSE"))
          (setq imap-current-mailbox nil
                imap-message-data nil
@@ -1740,8 +1728,8 @@ See `imap-enable-exchange-bug-workaround'."
        (prog1
            (and (imap-fetch-safe '("*" . "*:*") "UID")
                 (list (imap-mailbox-get-1 'uidvalidity mailbox)
-                      (apply 'max (imap-message-map
-                                   (lambda (uid _prop) uid) 'UID))))
+                      (apply #'max (imap-message-map
+                                    (lambda (uid _prop) uid) 'UID))))
          (if old-mailbox
              (imap-mailbox-select old-mailbox (eq state 'examine))
            (imap-mailbox-unselect)))))))
@@ -1786,7 +1774,7 @@ first element.  The rest of list contains the saved articles' UIDs."
        (prog1
            (and (imap-fetch-safe '("*" . "*:*") "UID")
                 (list (imap-mailbox-get-1 'uidvalidity mailbox)
-                      (apply 'max (imap-message-map
+                      (apply #'max (imap-message-map
                                    (lambda (uid _prop) uid) 'UID))))
          (if old-mailbox
              (imap-mailbox-select old-mailbox (eq state 'examine))
@@ -1820,7 +1808,7 @@ on failure."
                      (numberp (nth 9 body)))
                 (nth 9 body))
                (t 0))
-       (apply '+ (mapcar 'imap-body-lines body)))
+       (apply #'+ (mapcar #'imap-body-lines body)))
     0))
 
 (defun imap-envelope-from (from)
@@ -2424,7 +2412,7 @@ Return nil if no complete line has arrived."
         (buffer-substring (point) (1- (re-search-forward "[] ]" nil t)))))
     (if (eq (char-before) ? )
        (prog1
-           (mapconcat 'identity (cons section (imap-parse-header-list)) " ")
+           (mapconcat #'identity (cons section (imap-parse-header-list)) " ")
          (search-forward "]" nil t))
       section)))