diff options
Diffstat (limited to 'lisp/gnus/nnml.el')
-rw-r--r-- | lisp/gnus/nnml.el | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el index ebececa3ce2..18acc73aadd 100644 --- a/lisp/gnus/nnml.el +++ b/lisp/gnus/nnml.el @@ -1,4 +1,4 @@ -;;; nnml.el --- mail spool access for Gnus +;;; nnml.el --- mail spool access for Gnus -*- lexical-binding: t; -*- ;; Copyright (C) 1995-2021 Free Software Foundation, Inc. @@ -111,7 +111,7 @@ non-nil.") (nnoo-define-basics nnml) -(defun nnml-group-pathname (group &optional file server) +(defun nnml-group-pathname (group &optional file _server) "Return an absolute file name of FILE for GROUP on SERVER." (nnmail-group-pathname group nnml-directory file)) @@ -215,7 +215,7 @@ non-nil.") (cons (if group-num (car group-num) group) (string-to-number (file-name-nondirectory path))))))) -(deffoo nnml-request-group (group &optional server dont-check info) +(deffoo nnml-request-group (group &optional server dont-check _info) (let ((file-name-coding-system nnmail-pathname-coding-system)) (cond ((not (nnml-possibly-change-directory group server)) @@ -252,11 +252,11 @@ non-nil.") (t (nnmail-get-new-mail 'nnml 'nnml-save-incremental-nov nnml-directory nil)))) -(deffoo nnml-close-group (group &optional server) +(deffoo nnml-close-group (_group &optional _server) (setq nnml-article-file-alist nil) t) -(deffoo nnml-request-create-group (group &optional server args) +(deffoo nnml-request-create-group (group &optional server _args) (nnml-possibly-change-directory nil server) (nnmail-activate 'nnml) (cond @@ -278,12 +278,12 @@ non-nil.") (let* ((file-name-coding-system nnmail-pathname-coding-system) (articles (nnml-directory-articles nnml-current-directory))) (when articles - (setcar active (apply 'min articles)) - (setcdr active (apply 'max articles)))) + (setcar active (apply #'min articles)) + (setcdr active (apply #'max articles)))) (nnmail-save-active nnml-group-alist nnml-active-file) t)))) -(deffoo nnml-request-list (&optional server) +(deffoo nnml-request-list (&optional _server) (save-excursion (let ((nnmail-file-coding-system nnmail-active-file-coding-system) (file-name-coding-system nnmail-pathname-coding-system)) @@ -291,10 +291,10 @@ non-nil.") (setq nnml-group-alist (nnmail-get-active)) t)) -(deffoo nnml-request-newgroups (date &optional server) +(deffoo nnml-request-newgroups (_date &optional server) (nnml-request-list server)) -(deffoo nnml-request-list-newsgroups (&optional server) +(deffoo nnml-request-list-newsgroups (&optional _server) (save-excursion (nnmail-find-file nnml-newsgroups-file))) @@ -307,7 +307,7 @@ non-nil.") article rest mod-time number target) (nnmail-activate 'nnml) - (setq active-articles (sort active-articles '<)) + (setq active-articles (sort active-articles #'<)) ;; Articles not listed in active-articles are already gone, ;; so don't try to expire them. (setq articles (gnus-sorted-intersection articles active-articles)) @@ -353,14 +353,14 @@ non-nil.") (let ((active (nth 1 (assoc-string group nnml-group-alist)))) (when active (setcar active (or (and active-articles - (apply 'min active-articles)) + (apply #'min active-articles)) (1+ (cdr active))))) (nnmail-save-active nnml-group-alist nnml-active-file)) (nnml-save-nov) (nconc rest articles))) (deffoo nnml-request-move-article - (article group server accept-form &optional last move-is-internal) + (article group server accept-form &optional last _move-is-internal) (let ((buf (gnus-get-buffer-create " *nnml move*")) (file-name-coding-system nnmail-pathname-coding-system) result) @@ -374,7 +374,7 @@ non-nil.") nnml-article-file-alist) (with-current-buffer buf (insert-buffer-substring nntp-server-buffer) - (setq result (eval accept-form)) + (setq result (eval accept-form t)) (kill-buffer (current-buffer)) result)) (progn @@ -411,8 +411,8 @@ non-nil.") (and (nnmail-activate 'nnml) (if (and (not (setq result (nnmail-article-group - `(lambda (group) - (nnml-active-number group ,server))))) + (lambda (group) + (nnml-active-number group server))))) (yes-or-no-p "Moved to `junk' group; delete article? ")) (setq result 'junk) (setq result (car (nnml-save-mail result server t)))) @@ -705,7 +705,7 @@ article number. This function is called narrowed to an article." (setq nnml-article-file-alist (sort (nnml-current-group-article-to-file-alist) - 'car-less-than-car))) + #'car-less-than-car))) (setq active (if nnml-article-file-alist (cons (caar nnml-article-file-alist) @@ -769,8 +769,24 @@ article number. This function is called narrowed to an article." (let ((headers (nnheader-parse-head t))) (setf (mail-header-chars headers) chars) (setf (mail-header-number headers) number) + ;; If there's non-ASCII raw characters in the data, + ;; RFC2047-encode them to avoid having arbitrary data in the + ;; .overview file. + (nnml--encode-headers headers) headers)))) +(defun nnml--encode-headers (headers) + (let ((subject (mail-header-subject headers)) + (rfc2047-encoding-type 'mime)) + (unless (string-match "\\`[[:ascii:]]*\\'" subject) + (setf (mail-header-subject headers) + (mail-encode-encoded-word-string subject t)))) + (let ((from (mail-header-from headers)) + (rfc2047-encoding-type 'address-mime)) + (unless (string-match "\\`[[:ascii:]]*\\'" from) + (setf (mail-header-from headers) + (rfc2047-encode-string from t))))) + (defun nnml-get-nov-buffer (group &optional incrementalp) (let ((buffer (gnus-get-buffer-create (format " *nnml %soverview %s*" @@ -840,7 +856,7 @@ Unless no-active is non-nil, update the active file too." (nnml-generate-nov-databases-directory dir seen))) ;; Do this directory. (let ((nnml-files (sort (nnheader-article-to-file-alist dir) - 'car-less-than-car))) + #'car-less-than-car))) (if (not nnml-files) (let* ((group (nnheader-file-to-group (directory-file-name dir) nnml-directory)) @@ -873,7 +889,7 @@ Unless no-active is non-nil, update the active file too." (let* ((dir (file-name-as-directory dir)) (nov (concat dir nnml-nov-file-name)) (nov-buffer (gnus-get-buffer-create " *nov*")) - chars file headers) + chars headers) ;; file (with-current-buffer nov-buffer ;; Init the nov buffer. (buffer-disable-undo) @@ -994,7 +1010,7 @@ Use the nov database for the current group if available." (unless nnml-article-file-alist (setq nnml-article-file-alist (sort (nnml-current-group-article-to-file-alist) - 'car-less-than-car))) + #'car-less-than-car))) (if (not nnml-article-file-alist) ;; The group is empty: do nothing but return t t |