* lisp/gnus/nnmaildir.el: Silence lexical warnings
* lisp/gnus/nnmaildir.el (nnmaildir--prepare): Use a more functional style. (nnmaildir--update-nov): Remove unused var `numdir'. (nnmaildir-request-type, nnmaildir--scan, nnmaildir-request-newgroups) (nnmaildir-request-group, nnmaildir-request-create-group) (nnmaildir-request-post, nnmaildir-request-move-article) (nnmaildir-request-accept-article, nnmaildir-active-number): Mark unused args. (nnmaildir-get-new-mail, nnmaildir-group-alist) (nnmaildir-active-file): Declare. (nnmaildir-request-scan): Remove unused vars `group' and `grp-dir'. (nnmaildir-request-update-info): Remove unused vars `dotfile', `num', `mark', `end', `new-mark', and `mark-sym'. (nnmaildir-retrieve-headers): Remove unused args `srv-dir', `dir', `nlist2'. (nnmaildir-request-expire-articles): Remove unused vars `article', `stop' and `nlist2'. (nnmaildir-request-set-mark): Remove unused vars `begin', `article' and `end'. Use nnmaildir--article when dyn-binding is needed. Give the value directly in the `let' for `del-mark', `del-action', `add-action', and `set-action'. Don't use `add-to-list' on a local var. (nnmaildir-close-server): Declare those local vars that need to be dyn-bound.
This commit is contained in:
parent
9b891278cf
commit
1b51e23aea
1 changed files with 63 additions and 58 deletions
|
@ -333,29 +333,24 @@ by nnmaildir-request-article.")
|
||||||
;; given group, if non-nil, be the current group of the current server. Then
|
;; given group, if non-nil, be the current group of the current server. Then
|
||||||
;; return the group object for the current group.
|
;; return the group object for the current group.
|
||||||
(defun nnmaildir--prepare (server group)
|
(defun nnmaildir--prepare (server group)
|
||||||
(let (x groups)
|
(catch 'return
|
||||||
(catch 'return
|
(if (null server)
|
||||||
(if (null server)
|
(unless (setq server nnmaildir--cur-server)
|
||||||
(unless (setq server nnmaildir--cur-server)
|
|
||||||
(throw 'return nil))
|
|
||||||
(unless (setq server (intern-soft server nnmaildir--servers))
|
|
||||||
(throw 'return nil))
|
(throw 'return nil))
|
||||||
(setq server (symbol-value server)
|
(unless (setq server (intern-soft server nnmaildir--servers))
|
||||||
nnmaildir--cur-server server))
|
|
||||||
(unless (setq groups (nnmaildir--srv-groups server))
|
|
||||||
(throw 'return nil))
|
(throw 'return nil))
|
||||||
(unless (nnmaildir--srv-method server)
|
(setq server (symbol-value server)
|
||||||
(setq x (concat "nnmaildir:" (nnmaildir--srv-address server))
|
nnmaildir--cur-server server))
|
||||||
x (gnus-server-to-method x))
|
(let ((groups (nnmaildir--srv-groups server)))
|
||||||
(unless x (throw 'return nil))
|
(when groups
|
||||||
(setf (nnmaildir--srv-method server) x))
|
(unless (nnmaildir--srv-method server)
|
||||||
(if (null group)
|
(setf (nnmaildir--srv-method server)
|
||||||
(unless (setq group (nnmaildir--srv-curgrp server))
|
(or (gnus-server-to-method
|
||||||
(throw 'return nil))
|
(concat "nnmaildir:" (nnmaildir--srv-address server)))
|
||||||
(unless (setq group (intern-soft group groups))
|
(throw 'return nil))))
|
||||||
(throw 'return nil))
|
(if (null group)
|
||||||
(setq group (symbol-value group)))
|
(nnmaildir--srv-curgrp server)
|
||||||
group)))
|
(symbol-value (intern-soft group groups)))))))
|
||||||
|
|
||||||
(defun nnmaildir--tab-to-space (string)
|
(defun nnmaildir--tab-to-space (string)
|
||||||
(let ((pos 0))
|
(let ((pos 0))
|
||||||
|
@ -428,7 +423,7 @@ by nnmaildir-request-article.")
|
||||||
(srv-dir (nnmaildir--srv-dir server))
|
(srv-dir (nnmaildir--srv-dir server))
|
||||||
(storage-version 1) ;; [version article-number msgid [...nov...]]
|
(storage-version 1) ;; [version article-number msgid [...nov...]]
|
||||||
dir gname pgname msgdir prefix suffix file attr mtime novdir novfile
|
dir gname pgname msgdir prefix suffix file attr mtime novdir novfile
|
||||||
nov msgid nov-beg nov-mid nov-end field val old-extra num numdir
|
nov msgid nov-beg nov-mid nov-end field val old-extra num
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(setq gname (nnmaildir--grp-name group)
|
(setq gname (nnmaildir--grp-name group)
|
||||||
|
@ -668,7 +663,7 @@ by nnmaildir-request-article.")
|
||||||
"/" "\\057" 'literal)
|
"/" "\\057" 'literal)
|
||||||
":" "\\072" 'literal))
|
":" "\\072" 'literal))
|
||||||
|
|
||||||
(defun nnmaildir-request-type (group &optional article)
|
(defun nnmaildir-request-type (_group &optional _article)
|
||||||
'mail)
|
'mail)
|
||||||
|
|
||||||
(defun nnmaildir-status-message (&optional server)
|
(defun nnmaildir-status-message (&optional server)
|
||||||
|
@ -768,7 +763,7 @@ by nnmaildir-request-article.")
|
||||||
(if (> (aref a 1) (aref b 1)) (throw 'return nil))
|
(if (> (aref a 1) (aref b 1)) (throw 'return nil))
|
||||||
(string-lessp (aref a 2) (aref b 2))))
|
(string-lessp (aref a 2) (aref b 2))))
|
||||||
|
|
||||||
(defun nnmaildir--scan (gname scan-msgs groups method srv-dir srv-ls)
|
(defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(let ((36h-ago (- (car (current-time)) 2))
|
(let ((36h-ago (- (car (current-time)) 2))
|
||||||
absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
|
absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
|
||||||
|
@ -883,6 +878,10 @@ by nnmaildir-request-article.")
|
||||||
(setf (nnmaildir--grp-cur group) cattr)))
|
(setf (nnmaildir--grp-cur group) cattr)))
|
||||||
t))
|
t))
|
||||||
|
|
||||||
|
(defvar nnmaildir-get-new-mail)
|
||||||
|
(defvar nnmaildir-group-alist)
|
||||||
|
(defvar nnmaildir-active-file)
|
||||||
|
|
||||||
(defun nnmaildir-request-scan (&optional scan-group server)
|
(defun nnmaildir-request-scan (&optional scan-group server)
|
||||||
(let ((coding-system-for-write nnheader-file-coding-system)
|
(let ((coding-system-for-write nnheader-file-coding-system)
|
||||||
(buffer-file-coding-system nil)
|
(buffer-file-coding-system nil)
|
||||||
|
@ -890,7 +889,7 @@ by nnmaildir-request-article.")
|
||||||
(nnmaildir-get-new-mail t)
|
(nnmaildir-get-new-mail t)
|
||||||
(nnmaildir-group-alist nil)
|
(nnmaildir-group-alist nil)
|
||||||
(nnmaildir-active-file nil)
|
(nnmaildir-active-file nil)
|
||||||
x srv-ls srv-dir method groups target-prefix group dirs grp-dir seen
|
x srv-ls srv-dir method groups target-prefix dirs seen
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(nnmaildir--prepare server nil)
|
(nnmaildir--prepare server nil)
|
||||||
(setq srv-ls (nnmaildir--srv-ls nnmaildir--cur-server)
|
(setq srv-ls (nnmaildir--srv-ls nnmaildir--cur-server)
|
||||||
|
@ -966,7 +965,7 @@ by nnmaildir-request-article.")
|
||||||
(nnmaildir--srv-groups nnmaildir--cur-server))))
|
(nnmaildir--srv-groups nnmaildir--cur-server))))
|
||||||
t)
|
t)
|
||||||
|
|
||||||
(defun nnmaildir-request-newgroups (date &optional server)
|
(defun nnmaildir-request-newgroups (_date &optional server)
|
||||||
(nnmaildir-request-list server))
|
(nnmaildir-request-list server))
|
||||||
|
|
||||||
(defun nnmaildir-retrieve-groups (groups &optional server)
|
(defun nnmaildir-retrieve-groups (groups &optional server)
|
||||||
|
@ -995,9 +994,9 @@ by nnmaildir-request-article.")
|
||||||
(nnmaildir--srvgrp-dir
|
(nnmaildir--srvgrp-dir
|
||||||
(nnmaildir--srv-dir nnmaildir--cur-server) gname)))
|
(nnmaildir--srv-dir nnmaildir--cur-server) gname)))
|
||||||
(curdir-mtime (nth 5 (file-attributes curdir)))
|
(curdir-mtime (nth 5 (file-attributes curdir)))
|
||||||
pgname flist always-marks never-marks old-marks dotfile num dir
|
pgname flist always-marks never-marks old-marks dir
|
||||||
all-marks marks mark ranges markdir read end new-marks ls
|
all-marks marks ranges markdir read ls
|
||||||
old-mmth new-mmth mtime mark-sym existing missing deactivate-mark)
|
old-mmth new-mmth mtime existing missing deactivate-mark)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(unless group
|
(unless group
|
||||||
(setf (nnmaildir--srv-error nnmaildir--cur-server)
|
(setf (nnmaildir--srv-error nnmaildir--cur-server)
|
||||||
|
@ -1096,7 +1095,7 @@ by nnmaildir-request-article.")
|
||||||
(setf (nnmaildir--grp-mmth group) new-mmth)
|
(setf (nnmaildir--grp-mmth group) new-mmth)
|
||||||
info)))
|
info)))
|
||||||
|
|
||||||
(defun nnmaildir-request-group (gname &optional server fast info)
|
(defun nnmaildir-request-group (gname &optional server fast _info)
|
||||||
(let ((group (nnmaildir--prepare server gname))
|
(let ((group (nnmaildir--prepare server gname))
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
|
@ -1119,7 +1118,7 @@ by nnmaildir-request-article.")
|
||||||
(insert " " (gnus-replace-in-string gname " " "\\ " t) "\n")
|
(insert " " (gnus-replace-in-string gname " " "\\ " t) "\n")
|
||||||
t))))
|
t))))
|
||||||
|
|
||||||
(defun nnmaildir-request-create-group (gname &optional server args)
|
(defun nnmaildir-request-create-group (gname &optional server _args)
|
||||||
(nnmaildir--prepare server nil)
|
(nnmaildir--prepare server nil)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(let ((target-prefix (nnmaildir--srv-target-prefix nnmaildir--cur-server))
|
(let ((target-prefix (nnmaildir--srv-target-prefix nnmaildir--cur-server))
|
||||||
|
@ -1265,7 +1264,7 @@ by nnmaildir-request-article.")
|
||||||
|
|
||||||
(defun nnmaildir-retrieve-headers (articles &optional gname server fetch-old)
|
(defun nnmaildir-retrieve-headers (articles &optional gname server fetch-old)
|
||||||
(let ((group (nnmaildir--prepare server gname))
|
(let ((group (nnmaildir--prepare server gname))
|
||||||
srv-dir dir nlist mlist article num start stop nov nlist2 insert-nov
|
nlist mlist article num start stop nov insert-nov
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(setq insert-nov
|
(setq insert-nov
|
||||||
(lambda (article)
|
(lambda (article)
|
||||||
|
@ -1290,9 +1289,7 @@ by nnmaildir-request-article.")
|
||||||
(erase-buffer)
|
(erase-buffer)
|
||||||
(setq mlist (nnmaildir--grp-mlist group)
|
(setq mlist (nnmaildir--grp-mlist group)
|
||||||
nlist (nnmaildir--grp-nlist group)
|
nlist (nnmaildir--grp-nlist group)
|
||||||
gname (nnmaildir--grp-name group)
|
gname (nnmaildir--grp-name group))
|
||||||
srv-dir (nnmaildir--srv-dir nnmaildir--cur-server)
|
|
||||||
dir (nnmaildir--srvgrp-dir srv-dir gname))
|
|
||||||
(cond
|
(cond
|
||||||
((null nlist))
|
((null nlist))
|
||||||
((and fetch-old (not (numberp fetch-old)))
|
((and fetch-old (not (numberp fetch-old)))
|
||||||
|
@ -1363,7 +1360,7 @@ by nnmaildir-request-article.")
|
||||||
(nnheader-insert-file-contents nnmaildir-article-file-name))
|
(nnheader-insert-file-contents nnmaildir-article-file-name))
|
||||||
(cons gname num-msgid))))
|
(cons gname num-msgid))))
|
||||||
|
|
||||||
(defun nnmaildir-request-post (&optional server)
|
(defun nnmaildir-request-post (&optional _server)
|
||||||
(let (message-required-mail-headers)
|
(let (message-required-mail-headers)
|
||||||
(funcall message-send-mail-function)))
|
(funcall message-send-mail-function)))
|
||||||
|
|
||||||
|
@ -1405,7 +1402,7 @@ by nnmaildir-request-article.")
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
(defun nnmaildir-request-move-article (article gname server accept-form
|
(defun nnmaildir-request-move-article (article gname server accept-form
|
||||||
&optional last move-is-internal)
|
&optional _last _move-is-internal)
|
||||||
(let ((group (nnmaildir--prepare server gname))
|
(let ((group (nnmaildir--prepare server gname))
|
||||||
pgname suffix result nnmaildir--file deactivate-mark)
|
pgname suffix result nnmaildir--file deactivate-mark)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
|
@ -1442,7 +1439,7 @@ by nnmaildir-request-article.")
|
||||||
(nnmaildir--expired-article group article))
|
(nnmaildir--expired-article group article))
|
||||||
result)))
|
result)))
|
||||||
|
|
||||||
(defun nnmaildir-request-accept-article (gname &optional server last)
|
(defun nnmaildir-request-accept-article (gname &optional server _last)
|
||||||
(let ((group (nnmaildir--prepare server gname))
|
(let ((group (nnmaildir--prepare server gname))
|
||||||
(coding-system-for-write nnheader-file-coding-system)
|
(coding-system-for-write nnheader-file-coding-system)
|
||||||
(buffer-file-coding-system nil)
|
(buffer-file-coding-system nil)
|
||||||
|
@ -1546,7 +1543,7 @@ by nnmaildir-request-article.")
|
||||||
ga))
|
ga))
|
||||||
group-art)))))
|
group-art)))))
|
||||||
|
|
||||||
(defun nnmaildir-active-number (gname)
|
(defun nnmaildir-active-number (_gname)
|
||||||
0)
|
0)
|
||||||
|
|
||||||
(declare-function gnus-group-mark-article-read "gnus-group" (group article))
|
(declare-function gnus-group-mark-article-read "gnus-group" (group article))
|
||||||
|
@ -1554,8 +1551,8 @@ by nnmaildir-request-article.")
|
||||||
(defun nnmaildir-request-expire-articles (ranges &optional gname server force)
|
(defun nnmaildir-request-expire-articles (ranges &optional gname server force)
|
||||||
(let ((no-force (not force))
|
(let ((no-force (not force))
|
||||||
(group (nnmaildir--prepare server gname))
|
(group (nnmaildir--prepare server gname))
|
||||||
pgname time boundary bound-iter high low target dir nlist nlist2
|
pgname time boundary bound-iter high low target dir nlist
|
||||||
stop article didnt nnmaildir--file nnmaildir-article-file-name
|
didnt nnmaildir--file nnmaildir-article-file-name
|
||||||
deactivate-mark)
|
deactivate-mark)
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(unless group
|
(unless group
|
||||||
|
@ -1637,6 +1634,8 @@ by nnmaildir-request-article.")
|
||||||
(erase-buffer))
|
(erase-buffer))
|
||||||
didnt)))
|
didnt)))
|
||||||
|
|
||||||
|
(defvar nnmaildir--article)
|
||||||
|
|
||||||
(defun nnmaildir-request-set-mark (gname actions &optional server)
|
(defun nnmaildir-request-set-mark (gname actions &optional server)
|
||||||
(let* ((group (nnmaildir--prepare server gname))
|
(let* ((group (nnmaildir--prepare server gname))
|
||||||
(curdir (nnmaildir--cur
|
(curdir (nnmaildir--cur
|
||||||
|
@ -1646,27 +1645,30 @@ by nnmaildir-request-article.")
|
||||||
(coding-system-for-write nnheader-file-coding-system)
|
(coding-system-for-write nnheader-file-coding-system)
|
||||||
(buffer-file-coding-system nil)
|
(buffer-file-coding-system nil)
|
||||||
(file-coding-system-alist nil)
|
(file-coding-system-alist nil)
|
||||||
del-mark del-action add-action set-action marksdir nlist
|
marksdir nlist
|
||||||
ranges begin end article all-marks todo-marks mdir mfile
|
ranges all-marks todo-marks mdir mfile
|
||||||
pgname ls permarkfile deactivate-mark)
|
pgname ls permarkfile deactivate-mark
|
||||||
(setq del-mark
|
(del-mark
|
||||||
(lambda (mark)
|
(lambda (mark)
|
||||||
(let ((prefix (nnmaildir--art-prefix article))
|
(let ((prefix (nnmaildir--art-prefix nnmaildir--article))
|
||||||
(suffix (nnmaildir--art-suffix article))
|
(suffix (nnmaildir--art-suffix nnmaildir--article))
|
||||||
(flag (nnmaildir--mark-to-flag mark)))
|
(flag (nnmaildir--mark-to-flag mark)))
|
||||||
(when flag
|
(when flag
|
||||||
;; If this mark corresponds to a flag, remove the flag from
|
;; If this mark corresponds to a flag, remove the flag from
|
||||||
;; the file name.
|
;; the file name.
|
||||||
(nnmaildir--article-set-flags
|
(nnmaildir--article-set-flags
|
||||||
article (nnmaildir--remove-flag flag suffix) curdir))
|
nnmaildir--article (nnmaildir--remove-flag flag suffix)
|
||||||
|
curdir))
|
||||||
;; We still want to delete the hardlink in the marks dir if
|
;; We still want to delete the hardlink in the marks dir if
|
||||||
;; present, regardless of whether this mark has a maildir flag or
|
;; present, regardless of whether this mark has a maildir flag or
|
||||||
;; not, to avoid getting out of sync.
|
;; not, to avoid getting out of sync.
|
||||||
(setq mfile (nnmaildir--subdir marksdir (symbol-name mark))
|
(setq mfile (nnmaildir--subdir marksdir (symbol-name mark))
|
||||||
mfile (concat mfile prefix))
|
mfile (concat mfile prefix))
|
||||||
(nnmaildir--unlink mfile)))
|
(nnmaildir--unlink mfile))))
|
||||||
del-action (lambda (article) (mapcar del-mark todo-marks))
|
(del-action (lambda (article)
|
||||||
add-action
|
(let ((nnmaildir--article article))
|
||||||
|
(mapcar del-mark todo-marks))))
|
||||||
|
(add-action
|
||||||
(lambda (article)
|
(lambda (article)
|
||||||
(mapcar
|
(mapcar
|
||||||
(lambda (mark)
|
(lambda (mark)
|
||||||
|
@ -1695,13 +1697,14 @@ by nnmaildir-request-article.")
|
||||||
(rename-file permarkfilenew permarkfile 'replace)
|
(rename-file permarkfilenew permarkfile 'replace)
|
||||||
(add-name-to-file permarkfile mfile)))
|
(add-name-to-file permarkfile mfile)))
|
||||||
(t (signal (car err) (cdr err))))))))
|
(t (signal (car err) (cdr err))))))))
|
||||||
todo-marks))
|
todo-marks)))
|
||||||
set-action (lambda (article)
|
(set-action (lambda (article)
|
||||||
(funcall add-action article)
|
(funcall add-action article)
|
||||||
(mapcar (lambda (mark)
|
(let ((nnmaildir--article article))
|
||||||
(unless (memq mark todo-marks)
|
(mapcar (lambda (mark)
|
||||||
(funcall del-mark mark)))
|
(unless (memq mark todo-marks)
|
||||||
all-marks)))
|
(funcall del-mark mark)))
|
||||||
|
all-marks)))))
|
||||||
(catch 'return
|
(catch 'return
|
||||||
(unless group
|
(unless group
|
||||||
(setf (nnmaildir--srv-error nnmaildir--cur-server)
|
(setf (nnmaildir--srv-error nnmaildir--cur-server)
|
||||||
|
@ -1728,7 +1731,7 @@ by nnmaildir-request-article.")
|
||||||
(setq ranges (car action)
|
(setq ranges (car action)
|
||||||
todo-marks (caddr action))
|
todo-marks (caddr action))
|
||||||
(dolist (mark todo-marks)
|
(dolist (mark todo-marks)
|
||||||
(add-to-list 'all-marks mark))
|
(pushnew mark all-marks :test #'equal))
|
||||||
(if (numberp (cdr ranges)) (setq ranges (list ranges)))
|
(if (numberp (cdr ranges)) (setq ranges (list ranges)))
|
||||||
(nnmaildir--nlist-iterate nlist ranges
|
(nnmaildir--nlist-iterate nlist ranges
|
||||||
(cond ((eq 'del (cadr action)) del-action)
|
(cond ((eq 'del (cadr action)) del-action)
|
||||||
|
@ -1775,6 +1778,8 @@ by nnmaildir-request-article.")
|
||||||
t)))
|
t)))
|
||||||
|
|
||||||
(defun nnmaildir-close-server (&optional server)
|
(defun nnmaildir-close-server (&optional server)
|
||||||
|
(defvar flist) (defvar ls) (defvar dirs) (defvar dir)
|
||||||
|
(defvar files) (defvar file) (defvar x)
|
||||||
(let (flist ls dirs dir files file x)
|
(let (flist ls dirs dir files file x)
|
||||||
(nnmaildir--prepare server nil)
|
(nnmaildir--prepare server nil)
|
||||||
(when nnmaildir--cur-server
|
(when nnmaildir--cur-server
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue