1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-28 01:00:52 -07:00

Remove final uses of 'cl' in lisp/net

* lisp/net/pop3.el: Use lexical-binding and cl-lib.
(pop3-write-to-file): Remove unused var 'start'.
(pop3-make-date): Remove unused var 'sign'.

* lisp/net/rfc2104.el: Use lexical-binding and cl-lib.

* lisp/net/shr-color.el: Use lexical-binding and cl-lib.

* lisp/net/sieve-manage.el: Use lexical-binding and cl-lib.
This commit is contained in:
Stefan Monnier 2018-01-23 14:42:43 -05:00
parent e41c1dc99e
commit 18139139c9
4 changed files with 40 additions and 45 deletions

View file

@ -1,4 +1,4 @@
;;; pop3.el --- Post Office Protocol (RFC 1460) interface
;;; pop3.el --- Post Office Protocol (RFC 1460) interface -*- lexical-binding:t -*-
;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
@ -32,7 +32,7 @@
;;; Code:
(eval-when-compile (require 'cl))
(eval-when-compile (require 'cl-lib))
(require 'mail-utils)
(defvar parse-time-months)
@ -237,8 +237,8 @@ Use streaming commands."
(setq start-point
(pop3-wait-for-messages process pop3-stream-length
total-size start-point))
(incf waited-for pop3-stream-length))
(incf i))
(cl-incf waited-for pop3-stream-length))
(cl-incf i))
(pop3-wait-for-messages process (- count waited-for)
total-size start-point)))
@ -249,7 +249,7 @@ Use streaming commands."
(or (not total-size)
(re-search-forward "^\\.\r?\n" nil t)))
(re-search-forward "^-ERR " nil t))
(decf count)
(cl-decf count)
(setq start-point (point)))
(unless (memq (process-status process) '(open run))
(error "pop3 process died"))
@ -269,7 +269,6 @@ Use streaming commands."
(defun pop3-write-to-file (file messages)
(let ((pop-buffer (current-buffer))
(start (point-min))
beg end
temp-buffer)
(with-temp-buffer
@ -280,7 +279,6 @@ Use streaming commands."
(forward-line 1)
(setq beg (point))
(when (re-search-forward "^\\.\r?\n" nil t)
(setq start (point))
(forward-line -1)
(setq end (point)))
(with-current-buffer temp-buffer
@ -369,7 +367,7 @@ Use streaming commands."
(while (> i 0)
(unless (member (nth (1- i) pop3-uidl) saved)
(push i messages))
(decf i)))
(cl-decf i)))
(when messages
(setq list (pop3-list process)
size 0)
@ -399,7 +397,7 @@ Return non-nil if it is necessary to update the local UIDL file."
(unless (member (setq uidl (nth i pop3-uidl)) (cdr saved))
(push ctime new)
(push uidl new))
(decf i)))
(cl-decf i)))
(pop3-uidl
(setq new (mapcan (lambda (elt) (list elt ctime)) pop3-uidl))))
(when new (setq mod t))
@ -424,7 +422,7 @@ Return non-nil if it is necessary to update the local UIDL file."
(push uidl new)))
;; Mails having been deleted in the server.
(setq mod t))
(decf i 2))
(cl-decf i 2))
(cond (saved
(setcdr saved new))
(srvr
@ -440,7 +438,7 @@ Return non-nil if it is necessary to update the local UIDL file."
(while (> i 0)
(when (member (nth (1- i) pop3-uidl) dele)
(push i uidl))
(decf i))
(cl-decf i))
(when uidl
(pop3-send-streaming-command process "DELE" uidl nil)))
mod))
@ -620,10 +618,8 @@ Return the response string if optional second argument is non-nil."
If NOW, use that time instead."
(require 'parse-time)
(let* ((now (or now (current-time)))
(zone (nth 8 (decode-time now)))
(sign "+"))
(zone (nth 8 (decode-time now))))
(when (< zone 0)
(setq sign "-")
(setq zone (- zone)))
(concat
(format-time-string "%d" now)
@ -785,7 +781,7 @@ Otherwise, return the size of the message-id MSG"
(pop3-send-command process (format "DELE %s" msg))
(pop3-read-response process))
(defun pop3-noop (process msg)
(defun pop3-noop (process _msg)
"No-operation."
(pop3-send-command process "NOOP")
(pop3-read-response process))

View file

@ -1,4 +1,4 @@
;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes
;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes -*- lexical-binding:t -*-
;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
@ -55,7 +55,7 @@
;;; Code:
(eval-when-compile (require 'cl))
(eval-when-compile (require 'cl-lib))
;; Magic character for inner HMAC round. 0x36 == 54 == '6'
(defconst rfc2104-ipad ?\x36)
@ -101,7 +101,7 @@ In XEmacs return just STRING."
(opad (make-string (+ block-length hash-length) rfc2104-opad))
c partial)
;; Prefix *pad with key, appropriately XORed.
(do ((i 0 (1+ i)))
(cl-do ((i 0 (1+ i)))
((= len i))
(setq c (aref key i))
(aset ipad i (logxor rfc2104-ipad c))
@ -110,8 +110,8 @@ In XEmacs return just STRING."
(setq partial (rfc2104-string-make-unibyte
(funcall hash (concat ipad text))))
;; Pack latter part of opad.
(do ((r 0 (+ 2 r))
(w block-length (1+ w)))
(cl-do ((r 0 (+ 2 r))
(w block-length (1+ w)))
((= (* 2 hash-length) r))
(aset opad w
(+ (* 16 (aref rfc2104-nybbles (aref partial r)))

View file

@ -1,4 +1,4 @@
;;; shr-color.el --- Simple HTML Renderer color management
;;; shr-color.el --- Simple HTML Renderer color management -*- lexical-binding:t -*-
;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
@ -27,7 +27,7 @@
;;; Code:
(require 'color)
(eval-when-compile (require 'cl))
(eval-when-compile (require 'cl-lib))
(defgroup shr-color nil
"Simple HTML Renderer colors"
@ -209,8 +209,8 @@ This will convert \"80 %\" to 204, \"100 %\" to 255 but \"123\" to \"123\"."
(defun shr-color-hue-to-rgb (x y h)
"Convert X Y H to RGB value."
(when (< h 0) (incf h))
(when (> h 1) (decf h))
(when (< h 0) (cl-incf h))
(when (> h 1) (cl-decf h))
(cond ((< h (/ 6.0)) (+ x (* (- y x) h 6)))
((< h 0.5) y)
((< h (/ 2.0 3.0)) (+ x (* (- y x) (- (/ 2.0 3.0) h) 6)))
@ -258,8 +258,7 @@ Like rgb() or hsl()."
(let ((h (/ (string-to-number (match-string-no-properties 1 color)) 360.0))
(s (/ (string-to-number (match-string-no-properties 2 color)) 100.0))
(l (/ (string-to-number (match-string-no-properties 3 color)) 100.0)))
(destructuring-bind (r g b)
(shr-color-hsl-to-rgb-fractions h s l)
(pcase-let ((`(,r ,g ,b) (shr-color-hsl-to-rgb-fractions h s l)))
(color-rgb-to-hex r g b 2))))
;; Color names
((cdr (assoc-string color shr-color-html-colors-alist t)))

View file

@ -1,4 +1,4 @@
;;; sieve-manage.el --- Implementation of the managesieve protocol in elisp
;;; sieve-manage.el --- Implementation of the managesieve protocol in elisp -*- lexical-binding:t -*-
;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
@ -75,7 +75,7 @@
(require 'password-cache)
(require 'password))
(eval-when-compile (require 'cl))
(eval-when-compile (require 'cl-lib))
(require 'sasl)
(require 'starttls)
(autoload 'sasl-find-mechanism "sasl")
@ -182,7 +182,7 @@ Valid states are `closed', `initial', `nonauth', and `auth'.")
(generate-new-buffer (format " *sieve %s:%s*"
sieve-manage-server
sieve-manage-port))
(mapc 'make-local-variable sieve-manage-local-variables)
(mapc #'make-local-variable sieve-manage-local-variables)
(mm-enable-multibyte)
(buffer-disable-undo)
(current-buffer)))
@ -206,19 +206,19 @@ Return the buffer associated with the connection."
(with-current-buffer buffer
(sieve-manage-erase)
(setq sieve-manage-state 'initial)
(destructuring-bind (proc . props)
(open-network-stream
"SIEVE" buffer server port
:type stream
:capability-command "CAPABILITY\r\n"
:end-of-command "^\\(OK\\|NO\\).*\n"
:success "^OK.*\n"
:return-list t
:starttls-function
(lambda (capabilities)
(when (and (not sieve-manage-ignore-starttls)
(string-match "\\bSTARTTLS\\b" capabilities))
"STARTTLS\r\n")))
(pcase-let ((`(,proc . ,props)
(open-network-stream
"SIEVE" buffer server port
:type stream
:capability-command "CAPABILITY\r\n"
:end-of-command "^\\(OK\\|NO\\).*\n"
:success "^OK.*\n"
:return-list t
:starttls-function
(lambda (capabilities)
(when (and (not sieve-manage-ignore-starttls)
(string-match "\\bSTARTTLS\\b" capabilities))
"STARTTLS\r\n")))))
(setq sieve-manage-process proc)
(setq sieve-manage-capability
(sieve-manage-parse-capability (plist-get props :capabilities)))
@ -250,7 +250,7 @@ Return the buffer associated with the connection."
;; somehow.
`(lambda (prompt) ,(copy-sequence user-password)))
(step (sasl-next-step client nil))
(tag (sieve-manage-send
(_tag (sieve-manage-send
(concat
"AUTHENTICATE \""
mech
@ -373,11 +373,11 @@ to work in."
;; Choose authenticator
(when (and (null sieve-manage-auth)
(not (eq sieve-manage-state 'auth)))
(dolist (auth sieve-manage-authenticators)
(cl-dolist (auth sieve-manage-authenticators)
(when (funcall (nth 1 (assq auth sieve-manage-authenticator-alist))
buffer)
(setq sieve-manage-auth auth)
(return)))
(cl-return)))
(unless sieve-manage-auth
(error "Couldn't figure out authenticator for server")))
(sieve-manage-erase)