diff options
| author | Stefan Monnier | 2021-01-30 16:45:25 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2021-01-30 17:30:08 -0500 |
| commit | 9be4f41b4254c029fc328b10ecef4e71cd2ca024 (patch) | |
| tree | fe7acbcc2bd8041d559775b9c02d15fa72cae7a3 | |
| parent | acf4ec23d966b6bc92c61b557148afc88f20f99e (diff) | |
| download | emacs-9be4f41b4254c029fc328b10ecef4e71cd2ca024.tar.gz emacs-9be4f41b4254c029fc328b10ecef4e71cd2ca024.zip | |
* lisp/gnus: Misc simplifications found during conversion to lexical
* lisp/gnus/nnoo.el (noo-import-1, nnoo-define-skeleton-1): Use `dolist`.
(noo-map-functions, nnoo-define-basics): Directly emit the code rather than
going through an intermediate function; this also avoids the use of `eval`.
(noo-map-functions-1, nnoo-define-basics-1): Delete functions,
folded into their corresponding macro.
* lisp/gnus/gmm-utils.el (gmm-tool-bar-from-list): Demote `eval` to
`symbol-value`.
* lisp/gnus/gnus-art.el (gnus-button-handle-describe-key): Avoid `eval`
since `kbd` is a function nowadays.
(gnus-treat-part-number): Rename from `part-number`.
(gnus-treat-total-parts): Rename from `total-parts`.
(gnus-treat-article, gnus-treat-predicate): Adjust accordingly.
* lisp/gnus/gnus-cache.el (gnus-agent-load-alist): Use `declare-function`.
* lisp/gnus/gnus-group.el (gnus-cache-active-hashtb): Use `defvar`.
(gnus-group-iterate): Make it a normal function since lexical scoping
avoids the risk of name capture anyway.
(gnus-group-delete-articles): Actually use the `oldp` arg.
* lisp/gnus/gnus-html.el (gnus-html-wash-images): Fix debug message so
it's emitted after the `url` var it prints is actually initialized.
And avoid `setq` while we're at it.
* lisp/gnus/gnus-msg.el (gnus-group-mail, gnus-group-news)
(gnus-summary-mail-other-window, gnus-summary-news-other-window):
Merge `let`s using `let*`.
* lisp/gnus/gnus-spec.el (gnus-update-format-specifications):
Tighten the scope of `buffer`, and tighten a regexp.
(gnus-parse-simple-format): Reduce code duplication.
* lisp/gnus/gnus-start.el (gnus-child-mode): Don't `defvar` it since we
never use that variable and accordingly don't define it as a minor mode.
* lisp/gnus/gnus-util.el (gnus-byte-compile): Simplify so it obeys
`gnus-use-byte-compile` not just on the first call.
(iswitchb-minibuffer-setup): Declare.
* lisp/gnus/mail-source.el (mail-source-bind-1)
(mail-source-bind-common-1): Use `mapcar`.
(mail-source-set-common-1): Use `dolist`.
(display-time-event-handler): Declare.
* lisp/gnus/mml-smime.el (mml-smime-epg-verify): Reduce code duplication.
* lisp/gnus/mml.el (mml-parse-1): Reduce code duplication.
* lisp/gnus/mml2015.el (mml2015-epg-verify): Reduce code duplication.
* lisp/gnus/nnmail.el (nnmail-get-split-group): Tighten regexp.
(nnmail-split-it): Reduce code duplication.
* lisp/gnus/nnweb.el (nnweb-request-article): Avoid `setq`.
* lisp/gnus/spam.el (BBDB): Use the `noerror` arg of `require`, and
define all the functions for BBDB regardless if the require succeeded.
(spam-exists-in-BBDB-p): Don't inline, not worth it.
| -rw-r--r-- | lisp/gnus/gmm-utils.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-agent.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 14 | ||||
| -rw-r--r-- | lisp/gnus/gnus-cache.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 50 | ||||
| -rw-r--r-- | lisp/gnus/gnus-html.el | 116 | ||||
| -rw-r--r-- | lisp/gnus/gnus-msg.el | 122 | ||||
| -rw-r--r-- | lisp/gnus/gnus-spec.el | 38 | ||||
| -rw-r--r-- | lisp/gnus/gnus-start.el | 9 | ||||
| -rw-r--r-- | lisp/gnus/gnus-util.el | 17 | ||||
| -rw-r--r-- | lisp/gnus/gnus-uu.el | 1 | ||||
| -rw-r--r-- | lisp/gnus/mail-source.el | 34 | ||||
| -rw-r--r-- | lisp/gnus/mm-partial.el | 5 | ||||
| -rw-r--r-- | lisp/gnus/mm-util.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/mml-smime.el | 8 | ||||
| -rw-r--r-- | lisp/gnus/mml.el | 32 | ||||
| -rw-r--r-- | lisp/gnus/mml2015.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/nnbabyl.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/nnmail.el | 15 | ||||
| -rw-r--r-- | lisp/gnus/nnmairix.el | 6 | ||||
| -rw-r--r-- | lisp/gnus/nnoo.el | 103 | ||||
| -rw-r--r-- | lisp/gnus/nnweb.el | 10 | ||||
| -rw-r--r-- | lisp/gnus/spam.el | 167 |
23 files changed, 374 insertions, 398 deletions
diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el index c64bfea7caf..3542587319d 100644 --- a/lisp/gnus/gmm-utils.el +++ b/lisp/gnus/gmm-utils.el | |||
| @@ -231,7 +231,7 @@ DEFAULT-MAP specifies the default key map for ICON-LIST." | |||
| 231 | props))) | 231 | props))) |
| 232 | t)) | 232 | t)) |
| 233 | (if (symbolp icon-list) | 233 | (if (symbolp icon-list) |
| 234 | (eval icon-list) | 234 | (symbol-value icon-list) |
| 235 | icon-list)) | 235 | icon-list)) |
| 236 | map)) | 236 | map)) |
| 237 | 237 | ||
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index cb679b849f5..9af19bd02ca 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el | |||
| @@ -735,7 +735,7 @@ be a select method." | |||
| 735 | (interactive "P") | 735 | (interactive "P") |
| 736 | (unless gnus-plugged | 736 | (unless gnus-plugged |
| 737 | (error "Groups can't be fetched when Gnus is unplugged")) | 737 | (error "Groups can't be fetched when Gnus is unplugged")) |
| 738 | (gnus-group-iterate n 'gnus-agent-fetch-group)) | 738 | (gnus-group-iterate n #'gnus-agent-fetch-group)) |
| 739 | 739 | ||
| 740 | (defun gnus-agent-fetch-group (&optional group) | 740 | (defun gnus-agent-fetch-group (&optional group) |
| 741 | "Put all new articles in GROUP into the Agent." | 741 | "Put all new articles in GROUP into the Agent." |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 7e5439a217e..4034d362af4 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -7617,7 +7617,7 @@ Calls `describe-variable' or `describe-function'." | |||
| 7617 | "Call `describe-key' when pushing the corresponding URL button." | 7617 | "Call `describe-key' when pushing the corresponding URL button." |
| 7618 | (let* ((key-string | 7618 | (let* ((key-string |
| 7619 | (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)) | 7619 | (replace-regexp-in-string gnus-button-handle-describe-prefix "" url)) |
| 7620 | (keys (ignore-errors (eval `(kbd ,key-string))))) | 7620 | (keys (ignore-errors (kbd key-string)))) |
| 7621 | (if keys | 7621 | (if keys |
| 7622 | (describe-key keys) | 7622 | (describe-key keys) |
| 7623 | (gnus-message 3 "Invalid key sequence in button: %s" key-string)))) | 7623 | (gnus-message 3 "Invalid key sequence in button: %s" key-string)))) |
| @@ -8516,8 +8516,8 @@ For example: | |||
| 8516 | (defvar gnus-inhibit-article-treatments nil) | 8516 | (defvar gnus-inhibit-article-treatments nil) |
| 8517 | 8517 | ||
| 8518 | ;; Dynamic variables. | 8518 | ;; Dynamic variables. |
| 8519 | (defvar part-number) ;FIXME: Lacks a "gnus-" prefix. | 8519 | (defvar gnus-treat-part-number) |
| 8520 | (defvar total-parts) ;FIXME: Lacks a "gnus-" prefix. | 8520 | (defvar gnus-treat-total-parts) |
| 8521 | (defvar gnus-treat-type) | 8521 | (defvar gnus-treat-type) |
| 8522 | (defvar gnus-treat-condition) | 8522 | (defvar gnus-treat-condition) |
| 8523 | (defvar gnus-treat-length) | 8523 | (defvar gnus-treat-length) |
| @@ -8525,8 +8525,8 @@ For example: | |||
| 8525 | (defun gnus-treat-article (condition | 8525 | (defun gnus-treat-article (condition |
| 8526 | &optional part-num total type) | 8526 | &optional part-num total type) |
| 8527 | (let ((gnus-treat-condition condition) | 8527 | (let ((gnus-treat-condition condition) |
| 8528 | (part-number part-num) | 8528 | (gnus-treat-part-number part-num) |
| 8529 | (total-parts total) | 8529 | (gnus-treat-total-parts total) |
| 8530 | (gnus-treat-type type) | 8530 | (gnus-treat-type type) |
| 8531 | (gnus-treat-length (- (point-max) (point-min))) | 8531 | (gnus-treat-length (- (point-max) (point-min))) |
| 8532 | (alist gnus-treatment-function-alist) | 8532 | (alist gnus-treatment-function-alist) |
| @@ -8586,9 +8586,9 @@ For example: | |||
| 8586 | ((eq val 'head) | 8586 | ((eq val 'head) |
| 8587 | nil) | 8587 | nil) |
| 8588 | ((eq val 'first) | 8588 | ((eq val 'first) |
| 8589 | (eq part-number 1)) | 8589 | (eq gnus-treat-part-number 1)) |
| 8590 | ((eq val 'last) | 8590 | ((eq val 'last) |
| 8591 | (eq part-number total-parts)) | 8591 | (eq gnus-treat-part-number gnus-treat-total-parts)) |
| 8592 | ((numberp val) | 8592 | ((numberp val) |
| 8593 | (< gnus-treat-length val)) | 8593 | (< gnus-treat-length val)) |
| 8594 | (t | 8594 | (t |
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el index bea3d3bf03f..b17a11276c2 100644 --- a/lisp/gnus/gnus-cache.el +++ b/lisp/gnus/gnus-cache.el | |||
| @@ -29,9 +29,7 @@ | |||
| 29 | (require 'gnus) | 29 | (require 'gnus) |
| 30 | (require 'gnus-sum) | 30 | (require 'gnus-sum) |
| 31 | 31 | ||
| 32 | (eval-when-compile | 32 | (declare-function gnus-agent-load-alist "gnus-agent" (group)) |
| 33 | (unless (fboundp 'gnus-agent-load-alist) | ||
| 34 | (defun gnus-agent-load-alist (group)))) | ||
| 35 | 33 | ||
| 36 | (defcustom gnus-cache-active-file | 34 | (defcustom gnus-cache-active-file |
| 37 | (expand-file-name "active" gnus-cache-directory) | 35 | (expand-file-name "active" gnus-cache-directory) |
| @@ -55,7 +53,7 @@ | |||
| 55 | If you only want to cache your nntp groups, you could set this | 53 | If you only want to cache your nntp groups, you could set this |
| 56 | variable to \"^nntp\". | 54 | variable to \"^nntp\". |
| 57 | 55 | ||
| 58 | If a group matches both gnus-cacheable-groups and gnus-uncacheable-groups | 56 | If a group matches both `gnus-cacheable-groups' and `gnus-uncacheable-groups' |
| 59 | it's not cached." | 57 | it's not cached." |
| 60 | :group 'gnus-cache | 58 | :group 'gnus-cache |
| 61 | :type '(choice (const :tag "off" nil) | 59 | :type '(choice (const :tag "off" nil) |
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index a165752881a..0444b05450b 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -40,9 +40,9 @@ | |||
| 40 | (require 'mm-url) | 40 | (require 'mm-url) |
| 41 | (require 'subr-x) | 41 | (require 'subr-x) |
| 42 | (let ((features (cons 'gnus-group features))) | 42 | (let ((features (cons 'gnus-group features))) |
| 43 | (require 'gnus-sum)) | 43 | (require 'gnus-sum))) |
| 44 | (unless (boundp 'gnus-cache-active-hashtb) | 44 | |
| 45 | (defvar gnus-cache-active-hashtb nil))) | 45 | (defvar gnus-cache-active-hashtb) |
| 46 | 46 | ||
| 47 | (defvar tool-bar-mode) | 47 | (defvar tool-bar-mode) |
| 48 | 48 | ||
| @@ -505,7 +505,8 @@ simple manner." | |||
| 505 | (+ number | 505 | (+ number |
| 506 | (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) | 506 | (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) |
| 507 | (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))))) | 507 | (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))))) |
| 508 | (t number)) ?s) | 508 | (t number)) |
| 509 | ?s) | ||
| 509 | (?R gnus-tmp-number-of-read ?s) | 510 | (?R gnus-tmp-number-of-read ?s) |
| 510 | (?U (if (gnus-active gnus-tmp-group) | 511 | (?U (if (gnus-active gnus-tmp-group) |
| 511 | (gnus-number-of-unseen-articles-in-group gnus-tmp-group) | 512 | (gnus-number-of-unseen-articles-in-group gnus-tmp-group) |
| @@ -516,7 +517,8 @@ simple manner." | |||
| 516 | (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d) | 517 | (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d) |
| 517 | (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d) | 518 | (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d) |
| 518 | (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) | 519 | (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) |
| 519 | (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d) | 520 | (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) |
| 521 | ?d) | ||
| 520 | (?g gnus-tmp-group ?s) | 522 | (?g gnus-tmp-group ?s) |
| 521 | (?G gnus-tmp-qualified-group ?s) | 523 | (?G gnus-tmp-qualified-group ?s) |
| 522 | (?c (gnus-short-group-name gnus-tmp-group) | 524 | (?c (gnus-short-group-name gnus-tmp-group) |
| @@ -1541,7 +1543,8 @@ if it is a string, only list groups matching REGEXP." | |||
| 1541 | (gnus-tmp-news-method-string | 1543 | (gnus-tmp-news-method-string |
| 1542 | (if gnus-tmp-method | 1544 | (if gnus-tmp-method |
| 1543 | (format "(%s:%s)" (car gnus-tmp-method) | 1545 | (format "(%s:%s)" (car gnus-tmp-method) |
| 1544 | (cadr gnus-tmp-method)) "")) | 1546 | (cadr gnus-tmp-method)) |
| 1547 | "")) | ||
| 1545 | (gnus-tmp-marked-mark | 1548 | (gnus-tmp-marked-mark |
| 1546 | (if (and (numberp number) | 1549 | (if (and (numberp number) |
| 1547 | (zerop number) | 1550 | (zerop number) |
| @@ -1985,31 +1988,18 @@ Take into consideration N (the prefix) and the list of marked groups." | |||
| 1985 | (let ((group (gnus-group-group-name))) | 1988 | (let ((group (gnus-group-group-name))) |
| 1986 | (and group (list group)))))) | 1989 | (and group (list group)))))) |
| 1987 | 1990 | ||
| 1988 | ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't | 1991 | (defun gnus-group-iterate (arg function) |
| 1989 | ;;; imagine why I went through these contortions... | 1992 | "Iterate FUNCTION over all process/prefixed groups. |
| 1990 | (eval-and-compile | ||
| 1991 | (let ((function (make-symbol "gnus-group-iterate-function")) | ||
| 1992 | (window (make-symbol "gnus-group-iterate-window")) | ||
| 1993 | (groups (make-symbol "gnus-group-iterate-groups")) | ||
| 1994 | (group (make-symbol "gnus-group-iterate-group"))) | ||
| 1995 | (eval | ||
| 1996 | `(defun gnus-group-iterate (arg ,function) | ||
| 1997 | "Iterate FUNCTION over all process/prefixed groups. | ||
| 1998 | FUNCTION will be called with the group name as the parameter | 1993 | FUNCTION will be called with the group name as the parameter |
| 1999 | and with point over the group in question." | 1994 | and with point over the group in question." |
| 2000 | (let ((,groups (gnus-group-process-prefix arg)) | 1995 | (declare (indent 1)) |
| 2001 | (,window (selected-window)) | 1996 | (let ((window (selected-window))) |
| 2002 | ,group) | 1997 | (dolist (group (gnus-group-process-prefix arg)) |
| 2003 | (while ,groups | 1998 | (select-window window) |
| 2004 | (setq ,group (car ,groups) | 1999 | (gnus-group-remove-mark group) |
| 2005 | ,groups (cdr ,groups)) | 2000 | (save-selected-window |
| 2006 | (select-window ,window) | 2001 | (save-excursion |
| 2007 | (gnus-group-remove-mark ,group) | 2002 | (funcall function group)))))) |
| 2008 | (save-selected-window | ||
| 2009 | (save-excursion | ||
| 2010 | (funcall ,function ,group))))))))) | ||
| 2011 | |||
| 2012 | (put 'gnus-group-iterate 'lisp-indent-function 1) | ||
| 2013 | 2003 | ||
| 2014 | ;; Selecting groups. | 2004 | ;; Selecting groups. |
| 2015 | 2005 | ||
| @@ -2807,7 +2797,7 @@ not-expirable articles, too." | |||
| 2807 | (format "Do you really want to delete these %d articles forever? " | 2797 | (format "Do you really want to delete these %d articles forever? " |
| 2808 | (length articles))) | 2798 | (length articles))) |
| 2809 | (gnus-request-expire-articles articles group | 2799 | (gnus-request-expire-articles articles group |
| 2810 | (if current-prefix-arg | 2800 | (if oldp |
| 2811 | nil | 2801 | nil |
| 2812 | 'force))))) | 2802 | 'force))))) |
| 2813 | 2803 | ||
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 855d085c3a9..6a0cc0b47dc 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el | |||
| @@ -151,7 +151,7 @@ fit these criteria." | |||
| 151 | 151 | ||
| 152 | (defun gnus-html-wash-images () | 152 | (defun gnus-html-wash-images () |
| 153 | "Run through current buffer and replace img tags by images." | 153 | "Run through current buffer and replace img tags by images." |
| 154 | (let (tag parameters string start end images url alt-text | 154 | (let (tag parameters string start end images |
| 155 | inhibit-images blocked-images) | 155 | inhibit-images blocked-images) |
| 156 | (if (buffer-live-p gnus-summary-buffer) | 156 | (if (buffer-live-p gnus-summary-buffer) |
| 157 | (with-current-buffer gnus-summary-buffer | 157 | (with-current-buffer gnus-summary-buffer |
| @@ -169,65 +169,65 @@ fit these criteria." | |||
| 169 | (delete-region (match-beginning 0) (match-end 0))) | 169 | (delete-region (match-beginning 0) (match-end 0))) |
| 170 | (setq end (point)) | 170 | (setq end (point)) |
| 171 | (when (string-match "src=\"\\([^\"]+\\)" parameters) | 171 | (when (string-match "src=\"\\([^\"]+\\)" parameters) |
| 172 | (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" url) | 172 | (let ((url (gnus-html-encode-url (match-string 1 parameters))) |
| 173 | (setq url (gnus-html-encode-url (match-string 1 parameters)) | 173 | (alt-text (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)" |
| 174 | alt-text (when (string-match "\\(alt\\|title\\)=\"\\([^\"]+\\)" | 174 | parameters) |
| 175 | parameters) | 175 | (xml-substitute-special (match-string 2 parameters))))) |
| 176 | (xml-substitute-special (match-string 2 parameters)))) | 176 | (gnus-message 8 "gnus-html-wash-tags: fetching image URL %s" url) |
| 177 | (add-text-properties | 177 | (add-text-properties |
| 178 | start end | 178 | start end |
| 179 | (list 'image-url url | 179 | (list 'image-url url |
| 180 | 'image-displayer `(lambda (url start end) | 180 | 'image-displayer `(lambda (url start end) |
| 181 | (gnus-html-display-image url start end | 181 | (gnus-html-display-image url start end |
| 182 | ,alt-text)) | 182 | ,alt-text)) |
| 183 | 'help-echo alt-text | 183 | 'help-echo alt-text |
| 184 | 'button t | 184 | 'button t |
| 185 | 'keymap gnus-html-image-map | 185 | 'keymap gnus-html-image-map |
| 186 | 'gnus-image (list url start end alt-text))) | 186 | 'gnus-image (list url start end alt-text))) |
| 187 | (if (string-match "\\`cid:" url) | 187 | (if (string-match "\\`cid:" url) |
| 188 | ;; URLs with cid: have their content stashed in other | 188 | ;; URLs with cid: have their content stashed in other |
| 189 | ;; parts of the MIME structure, so just insert them | 189 | ;; parts of the MIME structure, so just insert them |
| 190 | ;; immediately. | 190 | ;; immediately. |
| 191 | (let* ((handle (mm-get-content-id (substring url (match-end 0)))) | 191 | (let* ((handle (mm-get-content-id (substring url (match-end 0)))) |
| 192 | (image (when (and handle | 192 | (image (when (and handle |
| 193 | (not inhibit-images)) | 193 | (not inhibit-images)) |
| 194 | (gnus-create-image | 194 | (gnus-create-image |
| 195 | (mm-with-part handle (buffer-string)) | 195 | (mm-with-part handle (buffer-string)) |
| 196 | nil t)))) | 196 | nil t)))) |
| 197 | (if image | 197 | (if image |
| 198 | (gnus-add-image | 198 | (gnus-add-image |
| 199 | 'cid | 199 | 'cid |
| 200 | (gnus-put-image | 200 | (gnus-put-image |
| 201 | (gnus-rescale-image | 201 | (gnus-rescale-image |
| 202 | image (gnus-html-maximum-image-size)) | 202 | image (gnus-html-maximum-image-size)) |
| 203 | (gnus-string-or (prog1 | 203 | (gnus-string-or (prog1 |
| 204 | (buffer-substring start end) | 204 | (buffer-substring start end) |
| 205 | (delete-region start end)) | 205 | (delete-region start end)) |
| 206 | "*") | 206 | "*") |
| 207 | 'cid)) | 207 | 'cid)) |
| 208 | (make-text-button start end | ||
| 209 | 'help-echo url | ||
| 210 | 'keymap gnus-html-image-map))) | ||
| 211 | ;; Normal, external URL. | ||
| 212 | (if (or inhibit-images | ||
| 213 | (gnus-html-image-url-blocked-p url blocked-images)) | ||
| 208 | (make-text-button start end | 214 | (make-text-button start end |
| 209 | 'help-echo url | 215 | 'help-echo url |
| 210 | 'keymap gnus-html-image-map))) | 216 | 'keymap gnus-html-image-map) |
| 211 | ;; Normal, external URL. | 217 | ;; Non-blocked url |
| 212 | (if (or inhibit-images | 218 | (let ((width |
| 213 | (gnus-html-image-url-blocked-p url blocked-images)) | 219 | (when (string-match "width=\"?\\([0-9]+\\)" parameters) |
| 214 | (make-text-button start end | 220 | (string-to-number (match-string 1 parameters)))) |
| 215 | 'help-echo url | 221 | (height |
| 216 | 'keymap gnus-html-image-map) | 222 | (when (string-match "height=\"?\\([0-9]+\\)" parameters) |
| 217 | ;; Non-blocked url | 223 | (string-to-number (match-string 1 parameters))))) |
| 218 | (let ((width | 224 | ;; Don't fetch images that are really small. They're |
| 219 | (when (string-match "width=\"?\\([0-9]+\\)" parameters) | 225 | ;; probably tracking pictures. |
| 220 | (string-to-number (match-string 1 parameters)))) | 226 | (when (and (or (null height) |
| 221 | (height | 227 | (> height 4)) |
| 222 | (when (string-match "height=\"?\\([0-9]+\\)" parameters) | 228 | (or (null width) |
| 223 | (string-to-number (match-string 1 parameters))))) | 229 | (> width 4))) |
| 224 | ;; Don't fetch images that are really small. They're | 230 | (gnus-html-display-image url start end alt-text)))))))))) |
| 225 | ;; probably tracking pictures. | ||
| 226 | (when (and (or (null height) | ||
| 227 | (> height 4)) | ||
| 228 | (or (null width) | ||
| 229 | (> width 4))) | ||
| 230 | (gnus-html-display-image url start end alt-text))))))))) | ||
| 231 | 231 | ||
| 232 | (defun gnus-html-display-image (url start end &optional alt-text) | 232 | (defun gnus-html-display-image (url start end &optional alt-text) |
| 233 | "Display image at URL on text from START to END. | 233 | "Display image at URL on text from START to END. |
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 9ca82f881a8..49be7047855 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el | |||
| @@ -610,19 +610,19 @@ If ARG is 1, prompt for a group name to find the posting style." | |||
| 610 | (interactive "P") | 610 | (interactive "P") |
| 611 | ;; We can't `let' gnus-newsgroup-name here, since that leads | 611 | ;; We can't `let' gnus-newsgroup-name here, since that leads |
| 612 | ;; to local variables leaking. | 612 | ;; to local variables leaking. |
| 613 | (let ((group gnus-newsgroup-name) | 613 | (let* ((group gnus-newsgroup-name) |
| 614 | ;; make sure last viewed article doesn't affect posting styles: | 614 | ;; make sure last viewed article doesn't affect posting styles: |
| 615 | (gnus-article-copy) | 615 | (gnus-article-copy) |
| 616 | (buffer (current-buffer))) | 616 | (buffer (current-buffer)) |
| 617 | (let ((gnus-newsgroup-name | 617 | (gnus-newsgroup-name |
| 618 | (if arg | 618 | (if arg |
| 619 | (if (= 1 (prefix-numeric-value arg)) | 619 | (if (= 1 (prefix-numeric-value arg)) |
| 620 | (gnus-group-completing-read | 620 | (gnus-group-completing-read |
| 621 | "Use posting style of group" | 621 | "Use posting style of group" |
| 622 | nil (gnus-read-active-file-p)) | 622 | nil (gnus-read-active-file-p)) |
| 623 | (gnus-group-group-name)) | 623 | (gnus-group-group-name)) |
| 624 | ""))) | 624 | ""))) |
| 625 | (gnus-setup-message 'message (message-mail))))) | 625 | (gnus-setup-message 'message (message-mail)))) |
| 626 | 626 | ||
| 627 | (defun gnus-group-news (&optional arg) | 627 | (defun gnus-group-news (&optional arg) |
| 628 | "Start composing a news. | 628 | "Start composing a news. |
| @@ -635,21 +635,21 @@ network. The corresponding back end must have a `request-post' method." | |||
| 635 | (interactive "P") | 635 | (interactive "P") |
| 636 | ;; We can't `let' gnus-newsgroup-name here, since that leads | 636 | ;; We can't `let' gnus-newsgroup-name here, since that leads |
| 637 | ;; to local variables leaking. | 637 | ;; to local variables leaking. |
| 638 | (let ((group gnus-newsgroup-name) | 638 | (let* ((group gnus-newsgroup-name) |
| 639 | ;; make sure last viewed article doesn't affect posting styles: | 639 | ;; make sure last viewed article doesn't affect posting styles: |
| 640 | (gnus-article-copy) | 640 | (gnus-article-copy) |
| 641 | (buffer (current-buffer))) | 641 | (buffer (current-buffer)) |
| 642 | (let ((gnus-newsgroup-name | 642 | (gnus-newsgroup-name |
| 643 | (if arg | 643 | (if arg |
| 644 | (if (= 1 (prefix-numeric-value arg)) | 644 | (if (= 1 (prefix-numeric-value arg)) |
| 645 | (gnus-group-completing-read "Use group" | 645 | (gnus-group-completing-read "Use group" |
| 646 | nil | 646 | nil |
| 647 | (gnus-read-active-file-p)) | 647 | (gnus-read-active-file-p)) |
| 648 | (gnus-group-group-name)) | 648 | (gnus-group-group-name)) |
| 649 | ""))) | 649 | ""))) |
| 650 | (gnus-setup-message | 650 | (gnus-setup-message |
| 651 | 'message | 651 | 'message |
| 652 | (message-news (gnus-group-real-name gnus-newsgroup-name)))))) | 652 | (message-news (gnus-group-real-name gnus-newsgroup-name))))) |
| 653 | 653 | ||
| 654 | (defun gnus-group-post-news (&optional arg) | 654 | (defun gnus-group-post-news (&optional arg) |
| 655 | "Start composing a message (a news by default). | 655 | "Start composing a message (a news by default). |
| @@ -678,19 +678,19 @@ posting style." | |||
| 678 | (interactive "P") | 678 | (interactive "P") |
| 679 | ;; We can't `let' gnus-newsgroup-name here, since that leads | 679 | ;; We can't `let' gnus-newsgroup-name here, since that leads |
| 680 | ;; to local variables leaking. | 680 | ;; to local variables leaking. |
| 681 | (let ((group gnus-newsgroup-name) | 681 | (let* ((group gnus-newsgroup-name) |
| 682 | ;; make sure last viewed article doesn't affect posting styles: | 682 | ;; make sure last viewed article doesn't affect posting styles: |
| 683 | (gnus-article-copy) | 683 | (gnus-article-copy) |
| 684 | (buffer (current-buffer))) | 684 | (buffer (current-buffer)) |
| 685 | (let ((gnus-newsgroup-name | 685 | (gnus-newsgroup-name |
| 686 | (if arg | 686 | (if arg |
| 687 | (if (= 1 (prefix-numeric-value arg)) | 687 | (if (= 1 (prefix-numeric-value arg)) |
| 688 | (gnus-group-completing-read "Use group" | 688 | (gnus-group-completing-read "Use group" |
| 689 | nil | 689 | nil |
| 690 | (gnus-read-active-file-p)) | 690 | (gnus-read-active-file-p)) |
| 691 | "") | 691 | "") |
| 692 | gnus-newsgroup-name))) | 692 | gnus-newsgroup-name))) |
| 693 | (gnus-setup-message 'message (message-mail))))) | 693 | (gnus-setup-message 'message (message-mail)))) |
| 694 | 694 | ||
| 695 | (defun gnus-summary-news-other-window (&optional arg) | 695 | (defun gnus-summary-news-other-window (&optional arg) |
| 696 | "Start composing a news in another window. | 696 | "Start composing a news in another window. |
| @@ -703,26 +703,26 @@ network. The corresponding back end must have a `request-post' method." | |||
| 703 | (interactive "P") | 703 | (interactive "P") |
| 704 | ;; We can't `let' gnus-newsgroup-name here, since that leads | 704 | ;; We can't `let' gnus-newsgroup-name here, since that leads |
| 705 | ;; to local variables leaking. | 705 | ;; to local variables leaking. |
| 706 | (let ((group gnus-newsgroup-name) | 706 | (let* ((group gnus-newsgroup-name) |
| 707 | ;; make sure last viewed article doesn't affect posting styles: | 707 | ;; make sure last viewed article doesn't affect posting styles: |
| 708 | (gnus-article-copy) | 708 | (gnus-article-copy) |
| 709 | (buffer (current-buffer))) | 709 | (buffer (current-buffer)) |
| 710 | (let ((gnus-newsgroup-name | 710 | (gnus-newsgroup-name |
| 711 | (if arg | 711 | (if arg |
| 712 | (if (= 1 (prefix-numeric-value arg)) | 712 | (if (= 1 (prefix-numeric-value arg)) |
| 713 | (gnus-group-completing-read "Use group" | 713 | (gnus-group-completing-read "Use group" |
| 714 | nil | 714 | nil |
| 715 | (gnus-read-active-file-p)) | 715 | (gnus-read-active-file-p)) |
| 716 | "") | 716 | "") |
| 717 | gnus-newsgroup-name))) | 717 | gnus-newsgroup-name))) |
| 718 | (gnus-setup-message | 718 | (gnus-setup-message |
| 719 | 'message | 719 | 'message |
| 720 | (progn | 720 | (progn |
| 721 | (message-news (gnus-group-real-name gnus-newsgroup-name)) | 721 | (message-news (gnus-group-real-name gnus-newsgroup-name)) |
| 722 | (setq-local gnus-discouraged-post-methods | 722 | (setq-local gnus-discouraged-post-methods |
| 723 | (remove | 723 | (remove |
| 724 | (car (gnus-find-method-for-group gnus-newsgroup-name)) | 724 | (car (gnus-find-method-for-group gnus-newsgroup-name)) |
| 725 | gnus-discouraged-post-methods))))))) | 725 | gnus-discouraged-post-methods)))))) |
| 726 | 726 | ||
| 727 | (defun gnus-summary-post-news (&optional arg) | 727 | (defun gnus-summary-post-news (&optional arg) |
| 728 | "Start composing a message. Post to the current group by default. | 728 | "Start composing a message. Post to the current group by default. |
diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el index 0dfa9f99d35..a50d9f3a5f4 100644 --- a/lisp/gnus/gnus-spec.el +++ b/lisp/gnus/gnus-spec.el | |||
| @@ -151,9 +151,9 @@ Return a list of updated types." | |||
| 151 | (when (and (boundp buffer) | 151 | (when (and (boundp buffer) |
| 152 | (setq val (symbol-value buffer)) | 152 | (setq val (symbol-value buffer)) |
| 153 | (gnus-buffer-live-p val)) | 153 | (gnus-buffer-live-p val)) |
| 154 | (set-buffer val)) | 154 | (set-buffer val))) |
| 155 | (setq new-format (symbol-value | 155 | (setq new-format (symbol-value |
| 156 | (intern (format "gnus-%s-line-format" type))))) | 156 | (intern (format "gnus-%s-line-format" type)))) |
| 157 | (setq entry (cdr (assq type gnus-format-specs))) | 157 | (setq entry (cdr (assq type gnus-format-specs))) |
| 158 | (if (and (car entry) | 158 | (if (and (car entry) |
| 159 | (equal (car entry) new-format)) | 159 | (equal (car entry) new-format)) |
| @@ -170,7 +170,7 @@ Return a list of updated types." | |||
| 170 | new-format | 170 | new-format |
| 171 | (symbol-value | 171 | (symbol-value |
| 172 | (intern (format "gnus-%s-line-format-alist" type))) | 172 | (intern (format "gnus-%s-line-format-alist" type))) |
| 173 | (not (string-match "mode$" (symbol-name type)))))) | 173 | (not (string-match "mode\\'" (symbol-name type)))))) |
| 174 | ;; Enter the new format spec into the list. | 174 | ;; Enter the new format spec into the list. |
| 175 | (if entry | 175 | (if entry |
| 176 | (progn | 176 | (progn |
| @@ -526,13 +526,13 @@ or to characters when given a pad value." | |||
| 526 | (if (eq spec ?%) | 526 | (if (eq spec ?%) |
| 527 | ;; "%%" just results in a "%". | 527 | ;; "%%" just results in a "%". |
| 528 | (insert "%") | 528 | (insert "%") |
| 529 | (cond | 529 | (setq elem |
| 530 | ;; Do tilde forms. | 530 | (cond |
| 531 | ((eq spec ?@) | 531 | ;; Do tilde forms. |
| 532 | (setq elem (list tilde-form ?s))) | 532 | ((eq spec ?@) |
| 533 | ;; Treat user defined format specifiers specially. | 533 | (list tilde-form ?s)) |
| 534 | (user-defined | 534 | ;; Treat user defined format specifiers specially. |
| 535 | (setq elem | 535 | (user-defined |
| 536 | (list | 536 | (list |
| 537 | (list (intern (format | 537 | (list (intern (format |
| 538 | (if (stringp user-defined) | 538 | (if (stringp user-defined) |
| @@ -540,14 +540,14 @@ or to characters when given a pad value." | |||
| 540 | "gnus-user-format-function-%c") | 540 | "gnus-user-format-function-%c") |
| 541 | user-defined)) | 541 | user-defined)) |
| 542 | 'gnus-tmp-header) | 542 | 'gnus-tmp-header) |
| 543 | ?s))) | 543 | ?s)) |
| 544 | ;; Find the specification from `spec-alist'. | 544 | ;; Find the specification from `spec-alist'. |
| 545 | ((setq elem (cdr (assq (or extended-spec spec) spec-alist)))) | 545 | ((cdr (assq (or extended-spec spec) spec-alist))) |
| 546 | ;; We used to use "%l" for displaying the grouplens score. | 546 | ;; We used to use "%l" for displaying the grouplens score. |
| 547 | ((eq spec ?l) | 547 | ((eq spec ?l) |
| 548 | (setq elem '("" ?s))) | 548 | '("" ?s)) |
| 549 | (t | 549 | (t |
| 550 | (setq elem '("*" ?s)))) | 550 | '("*" ?s)))) |
| 551 | (setq elem-type (cadr elem)) | 551 | (setq elem-type (cadr elem)) |
| 552 | ;; Insert the new format elements. | 552 | ;; Insert the new format elements. |
| 553 | (when pad-width | 553 | (when pad-width |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index a3159595c45..1554635a3f2 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -2337,7 +2337,7 @@ If FORCE is non-nil, the .newsrc file is read." | |||
| 2337 | gnus-newsrc-file-version gnus-version))))))) | 2337 | gnus-newsrc-file-version gnus-version))))))) |
| 2338 | 2338 | ||
| 2339 | (defun gnus-convert-mark-converter-prompt (converter no-prompt) | 2339 | (defun gnus-convert-mark-converter-prompt (converter no-prompt) |
| 2340 | "Indicate whether CONVERTER requires gnus-convert-old-newsrc to | 2340 | "Indicate whether CONVERTER requires `gnus-convert-old-newsrc' to |
| 2341 | display the conversion prompt. NO-PROMPT may be nil (prompt), | 2341 | display the conversion prompt. NO-PROMPT may be nil (prompt), |
| 2342 | t (no prompt), or any form that can be called as a function. | 2342 | t (no prompt), or any form that can be called as a function. |
| 2343 | The form should return either t or nil." | 2343 | The form should return either t or nil." |
| @@ -2989,13 +2989,12 @@ SPECIFIC-VARIABLES, or those in `gnus-variable-list'." | |||
| 2989 | ;;; Child functions. | 2989 | ;;; Child functions. |
| 2990 | ;;; | 2990 | ;;; |
| 2991 | 2991 | ||
| 2992 | (defvar gnus-child-mode nil) | 2992 | ;; (defvar gnus-child-mode nil) |
| 2993 | 2993 | ||
| 2994 | (defun gnus-child-mode () | 2994 | (defun gnus-child-mode () |
| 2995 | "Minor mode for child Gnusae." | 2995 | "Minor mode for child Gnusae." |
| 2996 | ;; FIXME: gnus-child-mode appears to never be set (i.e. it'll always be nil): | 2996 | ;; FIXME: gnus-child-mode appears to never be set (i.e. it'll always be nil). |
| 2997 | ;; Remove, or fix and use define-minor-mode. | 2997 | ;; (add-minor-mode 'gnus-child-mode " Child" (make-sparse-keymap)) |
| 2998 | (add-minor-mode 'gnus-child-mode " Child" (make-sparse-keymap)) | ||
| 2999 | (gnus-run-hooks 'gnus-child-mode-hook)) | 2998 | (gnus-run-hooks 'gnus-child-mode-hook)) |
| 3000 | 2999 | ||
| 3001 | (define-obsolete-function-alias 'gnus-slave-mode #'gnus-child-mode "28.1") | 3000 | (define-obsolete-function-alias 'gnus-slave-mode #'gnus-child-mode "28.1") |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index b8451028d1e..408293f1a16 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -1203,9 +1203,7 @@ ARG is passed to the first function." | |||
| 1203 | (string-equal (downcase x) (downcase y))))) | 1203 | (string-equal (downcase x) (downcase y))))) |
| 1204 | 1204 | ||
| 1205 | (defcustom gnus-use-byte-compile t | 1205 | (defcustom gnus-use-byte-compile t |
| 1206 | "If non-nil, byte-compile crucial run-time code. | 1206 | "If non-nil, byte-compile crucial run-time code." |
| 1207 | Setting it to nil has no effect after the first time `gnus-byte-compile' | ||
| 1208 | is run." | ||
| 1209 | :type 'boolean | 1207 | :type 'boolean |
| 1210 | :version "22.1" | 1208 | :version "22.1" |
| 1211 | :group 'gnus-various) | 1209 | :group 'gnus-various) |
| @@ -1213,13 +1211,8 @@ is run." | |||
| 1213 | (defun gnus-byte-compile (form) | 1211 | (defun gnus-byte-compile (form) |
| 1214 | "Byte-compile FORM if `gnus-use-byte-compile' is non-nil." | 1212 | "Byte-compile FORM if `gnus-use-byte-compile' is non-nil." |
| 1215 | (if gnus-use-byte-compile | 1213 | (if gnus-use-byte-compile |
| 1216 | (progn | 1214 | (let ((byte-compile-warnings '(unresolved callargs redefine))) |
| 1217 | (require 'bytecomp) | 1215 | (byte-compile form)) |
| 1218 | (defalias 'gnus-byte-compile | ||
| 1219 | (lambda (form) | ||
| 1220 | (let ((byte-compile-warnings '(unresolved callargs redefine))) | ||
| 1221 | (byte-compile form)))) | ||
| 1222 | (gnus-byte-compile form)) | ||
| 1223 | form)) | 1216 | form)) |
| 1224 | 1217 | ||
| 1225 | (defun gnus-remassoc (key alist) | 1218 | (defun gnus-remassoc (key alist) |
| @@ -1385,6 +1378,7 @@ SPEC is a predicate specifier that contains stuff like `or', `and', | |||
| 1385 | (declare-function iswitchb-read-buffer "iswitchb" | 1378 | (declare-function iswitchb-read-buffer "iswitchb" |
| 1386 | (prompt &optional default require-match | 1379 | (prompt &optional default require-match |
| 1387 | _predicate start matches-set)) | 1380 | _predicate start matches-set)) |
| 1381 | (declare-function iswitchb-minibuffer-setup "iswitchb") | ||
| 1388 | (defvar iswitchb-temp-buflist) | 1382 | (defvar iswitchb-temp-buflist) |
| 1389 | (defvar iswitchb-mode) | 1383 | (defvar iswitchb-mode) |
| 1390 | 1384 | ||
| @@ -1449,7 +1443,8 @@ CHOICE is a list of the choice char and help message at IDX." | |||
| 1449 | prompt | 1443 | prompt |
| 1450 | (concat | 1444 | (concat |
| 1451 | (mapconcat (lambda (s) (char-to-string (car s))) | 1445 | (mapconcat (lambda (s) (char-to-string (car s))) |
| 1452 | choice ", ") ", ?")) | 1446 | choice ", ") |
| 1447 | ", ?")) | ||
| 1453 | (setq tchar (read-char)) | 1448 | (setq tchar (read-char)) |
| 1454 | (when (not (assq tchar choice)) | 1449 | (when (not (assq tchar choice)) |
| 1455 | (setq tchar nil) | 1450 | (setq tchar nil) |
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el index 2bc1f864deb..e4aaf92c89c 100644 --- a/lisp/gnus/gnus-uu.el +++ b/lisp/gnus/gnus-uu.el | |||
| @@ -1949,6 +1949,7 @@ The user will be asked for a file name." | |||
| 1949 | (gnus-uu-choose-action file-name gnus-uu-ext-to-mime-list) | 1949 | (gnus-uu-choose-action file-name gnus-uu-ext-to-mime-list) |
| 1950 | file-name)) | 1950 | file-name)) |
| 1951 | (insert (format "Content-Transfer-Encoding: %s\n\n" encoding)) | 1951 | (insert (format "Content-Transfer-Encoding: %s\n\n" encoding)) |
| 1952 | ;; FIXME: Shouldn't we set-buffer before saving the restriction? --Stef | ||
| 1952 | (save-restriction | 1953 | (save-restriction |
| 1953 | (set-buffer gnus-message-buffer) | 1954 | (set-buffer gnus-message-buffer) |
| 1954 | (goto-char (point-min)) | 1955 | (goto-char (point-min)) |
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el index 212657aec26..4f02d86f441 100644 --- a/lisp/gnus/mail-source.el +++ b/lisp/gnus/mail-source.el | |||
| @@ -380,13 +380,10 @@ All keywords that can be used must be listed here.")) | |||
| 380 | ;; suitable for usage in a `let' form | 380 | ;; suitable for usage in a `let' form |
| 381 | (eval-and-compile | 381 | (eval-and-compile |
| 382 | (defun mail-source-bind-1 (type) | 382 | (defun mail-source-bind-1 (type) |
| 383 | (let* ((defaults (cdr (assq type mail-source-keyword-map))) | 383 | (mapcar (lambda (default) |
| 384 | default bind) | 384 | (list (mail-source-strip-keyword (car default)) |
| 385 | (while (setq default (pop defaults)) | 385 | nil)) |
| 386 | (push (list (mail-source-strip-keyword (car default)) | 386 | (cdr (assq type mail-source-keyword-map))))) |
| 387 | nil) | ||
| 388 | bind)) | ||
| 389 | bind))) | ||
| 390 | 387 | ||
| 391 | (defmacro mail-source-bind (type-source &rest body) | 388 | (defmacro mail-source-bind (type-source &rest body) |
| 392 | "Return a `let' form that binds all variables in source TYPE. | 389 | "Return a `let' form that binds all variables in source TYPE. |
| @@ -476,20 +473,16 @@ the `mail-source-keyword-map' variable." | |||
| 476 | 473 | ||
| 477 | (eval-and-compile | 474 | (eval-and-compile |
| 478 | (defun mail-source-bind-common-1 () | 475 | (defun mail-source-bind-common-1 () |
| 479 | (let* ((defaults mail-source-common-keyword-map) | 476 | (mapcar (lambda (default) |
| 480 | default bind) | 477 | (list (mail-source-strip-keyword (car default)) |
| 481 | (while (setq default (pop defaults)) | 478 | nil)) |
| 482 | (push (list (mail-source-strip-keyword (car default)) | 479 | mail-source-common-keyword-map))) |
| 483 | nil) | ||
| 484 | bind)) | ||
| 485 | bind))) | ||
| 486 | 480 | ||
| 487 | (defun mail-source-set-common-1 (source) | 481 | (defun mail-source-set-common-1 (source) |
| 488 | (let* ((type (pop source)) | 482 | (let* ((type (pop source)) |
| 489 | (defaults mail-source-common-keyword-map) | ||
| 490 | (defaults-1 (cdr (assq type mail-source-keyword-map))) | 483 | (defaults-1 (cdr (assq type mail-source-keyword-map))) |
| 491 | default value keyword) | 484 | value keyword) |
| 492 | (while (setq default (pop defaults)) | 485 | (dolist (default mail-source-common-keyword-map) |
| 493 | (set (mail-source-strip-keyword (setq keyword (car default))) | 486 | (set (mail-source-strip-keyword (setq keyword (car default))) |
| 494 | (if (setq value (plist-get source keyword)) | 487 | (if (setq value (plist-get source keyword)) |
| 495 | (mail-source-value value) | 488 | (mail-source-value value) |
| @@ -919,7 +912,7 @@ authentication. To do that, you need to set the | |||
| 919 | `message-send-mail-function' variable as `message-smtpmail-send-it' | 912 | `message-send-mail-function' variable as `message-smtpmail-send-it' |
| 920 | and put the following line in your ~/.gnus.el file: | 913 | and put the following line in your ~/.gnus.el file: |
| 921 | 914 | ||
| 922 | \(add-hook \\='message-send-mail-hook \\='mail-source-touch-pop) | 915 | \(add-hook \\='message-send-mail-hook #\\='mail-source-touch-pop) |
| 923 | 916 | ||
| 924 | See the Gnus manual for details." | 917 | See the Gnus manual for details." |
| 925 | (let ((sources (if mail-source-primary-source | 918 | (let ((sources (if mail-source-primary-source |
| @@ -963,6 +956,8 @@ See the Gnus manual for details." | |||
| 963 | ;; (element 0 of the vector is nil if the timer is active). | 956 | ;; (element 0 of the vector is nil if the timer is active). |
| 964 | (aset mail-source-report-new-mail-idle-timer 0 nil))) | 957 | (aset mail-source-report-new-mail-idle-timer 0 nil))) |
| 965 | 958 | ||
| 959 | (declare-function display-time-event-handler "time" ()) | ||
| 960 | |||
| 966 | (defun mail-source-report-new-mail (arg) | 961 | (defun mail-source-report-new-mail (arg) |
| 967 | "Toggle whether to report when new mail is available. | 962 | "Toggle whether to report when new mail is available. |
| 968 | This only works when `display-time' is enabled." | 963 | This only works when `display-time' is enabled." |
| @@ -1075,7 +1070,8 @@ This only works when `display-time' is enabled." | |||
| 1075 | (if (and (imap-open server port stream authentication buf) | 1070 | (if (and (imap-open server port stream authentication buf) |
| 1076 | (imap-authenticate | 1071 | (imap-authenticate |
| 1077 | user (or (cdr (assoc from mail-source-password-cache)) | 1072 | user (or (cdr (assoc from mail-source-password-cache)) |
| 1078 | password) buf)) | 1073 | password) |
| 1074 | buf)) | ||
| 1079 | (let ((mailbox-list (if (listp mailbox) mailbox (list mailbox)))) | 1075 | (let ((mailbox-list (if (listp mailbox) mailbox (list mailbox)))) |
| 1080 | (dolist (mailbox mailbox-list) | 1076 | (dolist (mailbox mailbox-list) |
| 1081 | (when (imap-mailbox-select mailbox nil buf) | 1077 | (when (imap-mailbox-select mailbox nil buf) |
diff --git a/lisp/gnus/mm-partial.el b/lisp/gnus/mm-partial.el index 165c19139ce..8d4913e6fbd 100644 --- a/lisp/gnus/mm-partial.el +++ b/lisp/gnus/mm-partial.el | |||
| @@ -39,7 +39,8 @@ | |||
| 39 | gnus-newsgroup-name) | 39 | gnus-newsgroup-name) |
| 40 | (when (search-forward id nil t) | 40 | (when (search-forward id nil t) |
| 41 | (let ((nhandles (mm-dissect-buffer | 41 | (let ((nhandles (mm-dissect-buffer |
| 42 | nil gnus-article-loose-mime)) nid) | 42 | nil gnus-article-loose-mime)) |
| 43 | nid) | ||
| 43 | (if (consp (car nhandles)) | 44 | (if (consp (car nhandles)) |
| 44 | (mm-destroy-parts nhandles) | 45 | (mm-destroy-parts nhandles) |
| 45 | (setq nid (cdr (assq 'id | 46 | (setq nid (cdr (assq 'id |
| @@ -90,7 +91,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing." | |||
| 90 | (if ntotal | 91 | (if ntotal |
| 91 | (if total | 92 | (if total |
| 92 | (unless (eq total ntotal) | 93 | (unless (eq total ntotal) |
| 93 | (error "The numbers of total are different")) | 94 | (error "The numbers of total are different")) |
| 94 | (setq total ntotal))) | 95 | (setq total ntotal))) |
| 95 | (unless (< nn n) | 96 | (unless (< nn n) |
| 96 | (unless (eq nn n) | 97 | (unless (eq nn n) |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 329b9e8884d..be279b6cf1f 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -144,9 +144,9 @@ is not available." | |||
| 144 | ;; on there being some coding system matching each `mime-charset' | 144 | ;; on there being some coding system matching each `mime-charset' |
| 145 | ;; property defined, as there should be.) | 145 | ;; property defined, as there should be.) |
| 146 | ((and (mm-coding-system-p charset) | 146 | ((and (mm-coding-system-p charset) |
| 147 | ;;; Doing this would potentially weed out incorrect charsets. | 147 | ;; Doing this would potentially weed out incorrect charsets. |
| 148 | ;;; charset | 148 | ;; charset |
| 149 | ;;; (eq charset (coding-system-get charset 'mime-charset)) | 149 | ;; (eq charset (coding-system-get charset 'mime-charset)) |
| 150 | ) | 150 | ) |
| 151 | charset) | 151 | charset) |
| 152 | ;; Use coding system Emacs knows. | 152 | ;; Use coding system Emacs knows. |
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el index e97e3e9a06e..eabb56b3038 100644 --- a/lisp/gnus/mml-smime.el +++ b/lisp/gnus/mml-smime.el | |||
| @@ -369,7 +369,7 @@ Content-Disposition: attachment; filename=smime.p7s | |||
| 369 | (goto-char (point-max))))) | 369 | (goto-char (point-max))))) |
| 370 | 370 | ||
| 371 | (defun mml-smime-epg-encrypt (cont) | 371 | (defun mml-smime-epg-encrypt (cont) |
| 372 | (let* ((inhibit-redisplay t) | 372 | (let* ((inhibit-redisplay t) ;FIXME: Why? |
| 373 | (boundary (mml-compute-boundary cont)) | 373 | (boundary (mml-compute-boundary cont)) |
| 374 | (cipher (mml-secure-epg-encrypt 'CMS cont))) | 374 | (cipher (mml-secure-epg-encrypt 'CMS cont))) |
| 375 | (delete-region (point-min) (point-max)) | 375 | (delete-region (point-min) (point-max)) |
| @@ -410,9 +410,9 @@ Content-Disposition: attachment; filename=smime.p7m | |||
| 410 | (setq plain (epg-verify-string context (mm-get-part signature) part)) | 410 | (setq plain (epg-verify-string context (mm-get-part signature) part)) |
| 411 | (error | 411 | (error |
| 412 | (mm-sec-error 'gnus-info "Failed") | 412 | (mm-sec-error 'gnus-info "Failed") |
| 413 | (if (eq (car error) 'quit) | 413 | (mm-sec-status 'gnus-details (if (eq (car error) 'quit) |
| 414 | (mm-sec-status 'gnus-details "Quit.") | 414 | "Quit." |
| 415 | (mm-sec-status 'gnus-details (format "%S" error))) | 415 | (format "%S" error))) |
| 416 | (throw 'error handle))) | 416 | (throw 'error handle))) |
| 417 | (mm-sec-status | 417 | (mm-sec-status |
| 418 | 'gnus-info | 418 | 'gnus-info |
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index acde958c05b..54f8715baf0 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el | |||
| @@ -241,22 +241,24 @@ part. This is for the internal use, you should never modify the value.") | |||
| 241 | (method (cdr (assq 'method taginfo))) | 241 | (method (cdr (assq 'method taginfo))) |
| 242 | tags) | 242 | tags) |
| 243 | (save-excursion | 243 | (save-excursion |
| 244 | (if (re-search-forward | 244 | (setq secure-mode |
| 245 | "<#/?\\(multipart\\|part\\|external\\|mml\\)." nil t) | 245 | (if (re-search-forward |
| 246 | (setq secure-mode "multipart") | 246 | "<#/?\\(multipart\\|part\\|external\\|mml\\)." |
| 247 | (setq secure-mode "part"))) | 247 | nil t) |
| 248 | "multipart" | ||
| 249 | "part"))) | ||
| 248 | (save-excursion | 250 | (save-excursion |
| 249 | (goto-char location) | 251 | (goto-char location) |
| 250 | (re-search-forward "<#secure[^\n]*>\n")) | 252 | (re-search-forward "<#secure[^\n]*>\n")) |
| 251 | (delete-region (match-beginning 0) (match-end 0)) | 253 | (delete-region (match-beginning 0) (match-end 0)) |
| 252 | (cond ((string= mode "sign") | 254 | (setq tags (cond ((string= mode "sign") |
| 253 | (setq tags (list "sign" method))) | 255 | (list "sign" method)) |
| 254 | ((string= mode "encrypt") | 256 | ((string= mode "encrypt") |
| 255 | (setq tags (list "encrypt" method))) | 257 | (list "encrypt" method)) |
| 256 | ((string= mode "signencrypt") | 258 | ((string= mode "signencrypt") |
| 257 | (setq tags (list "sign" method "encrypt" method))) | 259 | (list "sign" method "encrypt" method)) |
| 258 | (t | 260 | (t |
| 259 | (error "Unknown secure mode %s" mode))) | 261 | (error "Unknown secure mode %s" mode)))) |
| 260 | (eval `(mml-insert-tag ,secure-mode | 262 | (eval `(mml-insert-tag ,secure-mode |
| 261 | ,@tags | 263 | ,@tags |
| 262 | ,(if keyfile "keyfile") | 264 | ,(if keyfile "keyfile") |
| @@ -1598,7 +1600,8 @@ or the `pop-to-buffer' function." | |||
| 1598 | (interactive "P") | 1600 | (interactive "P") |
| 1599 | (setq mml-preview-buffer (generate-new-buffer | 1601 | (setq mml-preview-buffer (generate-new-buffer |
| 1600 | (concat (if raw "*Raw MIME preview of " | 1602 | (concat (if raw "*Raw MIME preview of " |
| 1601 | "*MIME preview of ") (buffer-name)))) | 1603 | "*MIME preview of ") |
| 1604 | (buffer-name)))) | ||
| 1602 | (require 'gnus-msg) ; for gnus-setup-posting-charset | 1605 | (require 'gnus-msg) ; for gnus-setup-posting-charset |
| 1603 | (save-excursion | 1606 | (save-excursion |
| 1604 | (let* ((buf (current-buffer)) | 1607 | (let* ((buf (current-buffer)) |
| @@ -1655,7 +1658,8 @@ or the `pop-to-buffer' function." | |||
| 1655 | (use-local-map nil) | 1658 | (use-local-map nil) |
| 1656 | (add-hook 'kill-buffer-hook | 1659 | (add-hook 'kill-buffer-hook |
| 1657 | (lambda () | 1660 | (lambda () |
| 1658 | (mm-destroy-parts gnus-article-mime-handles)) nil t) | 1661 | (mm-destroy-parts gnus-article-mime-handles)) |
| 1662 | nil t) | ||
| 1659 | (setq buffer-read-only t) | 1663 | (setq buffer-read-only t) |
| 1660 | (local-set-key "q" (lambda () (interactive) (kill-buffer nil))) | 1664 | (local-set-key "q" (lambda () (interactive) (kill-buffer nil))) |
| 1661 | (local-set-key "=" (lambda () (interactive) (delete-other-windows))) | 1665 | (local-set-key "=" (lambda () (interactive) (delete-other-windows))) |
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el index 8eda59372fb..53454bf16d8 100644 --- a/lisp/gnus/mml2015.el +++ b/lisp/gnus/mml2015.el | |||
| @@ -869,9 +869,9 @@ If set, it overrides the setting of `mml2015-sign-with-sender'." | |||
| 869 | (setq plain (epg-verify-string context signature part)) | 869 | (setq plain (epg-verify-string context signature part)) |
| 870 | (error | 870 | (error |
| 871 | (mm-sec-error 'gnus-info "Failed") | 871 | (mm-sec-error 'gnus-info "Failed") |
| 872 | (if (eq (car error) 'quit) | 872 | (mm-sec-status 'gnus-details (if (eq (car error) 'quit) |
| 873 | (mm-sec-status 'gnus-details "Quit.") | 873 | "Quit." |
| 874 | (mm-sec-status 'gnus-details (mml2015-format-error error))) | 874 | (mml2015-format-error error))) |
| 875 | (throw 'error handle))) | 875 | (throw 'error handle))) |
| 876 | (mm-sec-status 'gnus-info | 876 | (mm-sec-status 'gnus-info |
| 877 | (mml2015-epg-verify-result-to-string | 877 | (mml2015-epg-verify-result-to-string |
diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el index 5149acc0e72..41f7f62fae6 100644 --- a/lisp/gnus/nnbabyl.el +++ b/lisp/gnus/nnbabyl.el | |||
| @@ -263,7 +263,8 @@ | |||
| 263 | (nnmail-expired-article-p | 263 | (nnmail-expired-article-p |
| 264 | newsgroup | 264 | newsgroup |
| 265 | (buffer-substring | 265 | (buffer-substring |
| 266 | (point) (progn (end-of-line) (point))) force)) | 266 | (point) (progn (end-of-line) (point))) |
| 267 | force)) | ||
| 267 | (progn | 268 | (progn |
| 268 | (unless (eq nnmail-expiry-target 'delete) | 269 | (unless (eq nnmail-expiry-target 'delete) |
| 269 | (with-temp-buffer | 270 | (with-temp-buffer |
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index 59d61379f14..251ae657bbf 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el | |||
| @@ -712,7 +712,7 @@ If SOURCE is a directory spec, try to return the group name component." | |||
| 712 | (if (eq (car source) 'directory) | 712 | (if (eq (car source) 'directory) |
| 713 | (let ((file (file-name-nondirectory file))) | 713 | (let ((file (file-name-nondirectory file))) |
| 714 | (mail-source-bind (directory source) | 714 | (mail-source-bind (directory source) |
| 715 | (if (string-match (concat (regexp-quote suffix) "$") file) | 715 | (if (string-match (concat (regexp-quote suffix) "\\'") file) |
| 716 | (substring file 0 (match-beginning 0)) | 716 | (substring file 0 (match-beginning 0)) |
| 717 | nil))) | 717 | nil))) |
| 718 | nil)) | 718 | nil)) |
| @@ -1339,7 +1339,8 @@ to actually put the message in the right group." | |||
| 1339 | (let ((success t)) | 1339 | (let ((success t)) |
| 1340 | (dolist (mbx (message-unquote-tokens | 1340 | (dolist (mbx (message-unquote-tokens |
| 1341 | (message-tokenize-header | 1341 | (message-tokenize-header |
| 1342 | (message-fetch-field "Newsgroups") ", ")) success) | 1342 | (message-fetch-field "Newsgroups") ", ")) |
| 1343 | success) | ||
| 1343 | (let ((to-newsgroup (gnus-group-prefixed-name mbx gnus-command-method))) | 1344 | (let ((to-newsgroup (gnus-group-prefixed-name mbx gnus-command-method))) |
| 1344 | (or (gnus-active to-newsgroup) | 1345 | (or (gnus-active to-newsgroup) |
| 1345 | (gnus-activate-group to-newsgroup) | 1346 | (gnus-activate-group to-newsgroup) |
| @@ -1433,11 +1434,11 @@ See the documentation for the variable `nnmail-split-fancy' for details." | |||
| 1433 | ;; we do not exclude foo.list just because | 1434 | ;; we do not exclude foo.list just because |
| 1434 | ;; the header is: ``To: x-foo, foo'' | 1435 | ;; the header is: ``To: x-foo, foo'' |
| 1435 | (goto-char end) | 1436 | (goto-char end) |
| 1436 | (if (and (re-search-backward (cadr split-rest) | 1437 | (setq split-rest |
| 1437 | after-header-name t) | 1438 | (unless (and (re-search-backward (cadr split-rest) |
| 1438 | (> (match-end 0) start-of-value)) | 1439 | after-header-name t) |
| 1439 | (setq split-rest nil) | 1440 | (> (match-end 0) start-of-value)) |
| 1440 | (setq split-rest (cddr split-rest)))) | 1441 | (cddr split-rest)))) |
| 1441 | (when split-rest | 1442 | (when split-rest |
| 1442 | (goto-char end) | 1443 | (goto-char end) |
| 1443 | ;; Someone might want to do a \N sub on this match, so | 1444 | ;; Someone might want to do a \N sub on this match, so |
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el index 5e8ad4fa9ae..8b3ab40e225 100644 --- a/lisp/gnus/nnmairix.el +++ b/lisp/gnus/nnmairix.el | |||
| @@ -676,9 +676,9 @@ Other back ends might or might not work.") | |||
| 676 | (autoload 'nnimap-request-update-info-internal "nnimap") | 676 | (autoload 'nnimap-request-update-info-internal "nnimap") |
| 677 | 677 | ||
| 678 | (deffoo nnmairix-request-marks (group info &optional server) | 678 | (deffoo nnmairix-request-marks (group info &optional server) |
| 679 | ;; propagate info from underlying IMAP folder to nnmairix group | 679 | ;; propagate info from underlying IMAP folder to nnmairix group |
| 680 | ;; This is currently experimental and must be explicitly activated | 680 | ;; This is currently experimental and must be explicitly activated |
| 681 | ;; with nnmairix-propagate-marks-to-nnmairix-group | 681 | ;; with nnmairix-propagate-marks-to-nnmairix-group |
| 682 | (when server | 682 | (when server |
| 683 | (nnmairix-open-server server)) | 683 | (nnmairix-open-server server)) |
| 684 | (let* ((qualgroup (gnus-group-prefixed-name | 684 | (let* ((qualgroup (gnus-group-prefixed-name |
diff --git a/lisp/gnus/nnoo.el b/lisp/gnus/nnoo.el index cd0a5e6de99..39469d140d9 100644 --- a/lisp/gnus/nnoo.el +++ b/lisp/gnus/nnoo.el | |||
| @@ -85,20 +85,14 @@ | |||
| 85 | 85 | ||
| 86 | (defun nnoo-import-1 (backend imports) | 86 | (defun nnoo-import-1 (backend imports) |
| 87 | (let ((call-function | 87 | (let ((call-function |
| 88 | (if (symbolp (car imports)) (pop imports) 'nnoo-parent-function)) | 88 | (if (symbolp (car imports)) (pop imports) #'nnoo-parent-function))) |
| 89 | imp functions function) | 89 | (dolist (imp imports) |
| 90 | (while (setq imp (pop imports)) | 90 | (dolist (fun (or (cdr imp) (nnoo-functions (car imp)))) |
| 91 | (setq functions | 91 | (let ((function (nnoo-symbol backend (nnoo-rest-symbol fun)))) |
| 92 | (or (cdr imp) | 92 | (unless (fboundp function) |
| 93 | (nnoo-functions (car imp)))) | 93 | ;; FIXME: Use `defalias' and closures to avoid `eval'. |
| 94 | (while functions | 94 | (eval `(deffoo ,function (&rest args) |
| 95 | (unless (fboundp | 95 | (,call-function ',backend ',fun args))))))))) |
| 96 | (setq function | ||
| 97 | (nnoo-symbol backend | ||
| 98 | (nnoo-rest-symbol (car functions))))) | ||
| 99 | (eval `(deffoo ,function (&rest args) | ||
| 100 | (,call-function ',backend ',(car functions) args)))) | ||
| 101 | (pop functions))))) | ||
| 102 | 96 | ||
| 103 | (defun nnoo-parent-function (backend function args) | 97 | (defun nnoo-parent-function (backend function args) |
| 104 | (let ((pbackend (nnoo-backend function)) | 98 | (let ((pbackend (nnoo-backend function)) |
| @@ -131,22 +125,21 @@ | |||
| 131 | 125 | ||
| 132 | (defmacro nnoo-map-functions (backend &rest maps) | 126 | (defmacro nnoo-map-functions (backend &rest maps) |
| 133 | (declare (indent 1)) | 127 | (declare (indent 1)) |
| 134 | `(nnoo-map-functions-1 ',backend ',maps)) | 128 | `(progn |
| 135 | 129 | ,@(mapcar | |
| 136 | (defun nnoo-map-functions-1 (backend maps) | 130 | (lambda (m) |
| 137 | (let (m margs i) | 131 | (let ((margs nil)) |
| 138 | (while (setq m (pop maps)) | 132 | (dotimes (i (length (cdr m))) |
| 139 | (setq i 0 | 133 | (push (if (numberp (nth i (cdr m))) |
| 140 | margs nil) | 134 | `(nth ,i args) |
| 141 | (while (< i (length (cdr m))) | 135 | (nth i (cdr m))) |
| 142 | (if (numberp (nth i (cdr m))) | 136 | margs)) |
| 143 | (push `(nth ,i args) margs) | 137 | `(deffoo ,(nnoo-symbol backend (nnoo-rest-symbol (car m))) |
| 144 | (push (nth i (cdr m)) margs)) | ||
| 145 | (cl-incf i)) | ||
| 146 | (eval `(deffoo ,(nnoo-symbol backend (nnoo-rest-symbol (car m))) | ||
| 147 | (&rest args) | 138 | (&rest args) |
| 139 | (ignore args) ;; Not always used! | ||
| 148 | (nnoo-parent-function ',backend ',(car m) | 140 | (nnoo-parent-function ',backend ',(car m) |
| 149 | ,(cons 'list (nreverse margs)))))))) | 141 | ,(cons 'list (nreverse margs)))))) |
| 142 | maps))) | ||
| 150 | 143 | ||
| 151 | (defun nnoo-backend (symbol) | 144 | (defun nnoo-backend (symbol) |
| 152 | (string-match "^[^-]+-" (symbol-name symbol)) | 145 | (string-match "^[^-]+-" (symbol-name symbol)) |
| @@ -273,19 +266,27 @@ | |||
| 273 | 266 | ||
| 274 | (defmacro nnoo-define-basics (backend) | 267 | (defmacro nnoo-define-basics (backend) |
| 275 | "Define `close-server', `server-opened' and `status-message'." | 268 | "Define `close-server', `server-opened' and `status-message'." |
| 276 | `(eval-and-compile | 269 | (let ((form |
| 277 | (nnoo-define-basics-1 ',backend))) | 270 | ;; We wrap the definitions in `when t' here so that a subsequent |
| 278 | 271 | ;; "real" definition of one those doesn't trigger a "defined multiple | |
| 279 | (defun nnoo-define-basics-1 (backend) | 272 | ;; times" warning. |
| 280 | (dolist (function '(server-opened status-message)) | 273 | `(when t |
| 281 | (eval `(deffoo ,(nnoo-symbol backend function) (&optional server) | 274 | ,@(mapcar (lambda (fun) |
| 282 | (,(nnoo-symbol 'nnoo function) ',backend server)))) | 275 | `(deffoo ,(nnoo-symbol backend fun) (&optional server) |
| 283 | (dolist (function '(close-server)) | 276 | (,(nnoo-symbol 'nnoo fun) ',backend server))) |
| 284 | (eval `(deffoo ,(nnoo-symbol backend function) (&optional server defs) | 277 | '(server-opened status-message)) |
| 285 | (,(nnoo-symbol 'nnoo function) ',backend server)))) | 278 | (deffoo ,(nnoo-symbol backend 'close-server) (&optional server _defs) |
| 286 | (eval `(deffoo ,(nnoo-symbol backend 'open-server) | 279 | (,(nnoo-symbol 'nnoo 'close-server) ',backend server)) |
| 287 | (server &optional defs) | 280 | (deffoo ,(nnoo-symbol backend 'open-server) (server &optional defs) |
| 288 | (nnoo-change-server ',backend server defs)))) | 281 | (nnoo-change-server ',backend server defs))))) |
| 282 | ;; Wrapping with `when' has the downside that the compiler now doesn't | ||
| 283 | ;; "know" that these functions are defined, so to avoid "not known to be | ||
| 284 | ;; defined" warnings we eagerly define them during the compilation. | ||
| 285 | ;; This is fairly nasty since it will override previous "real" definitions | ||
| 286 | ;; (e.g. when compiling this in an Emacs instance that's running Gnus), but | ||
| 287 | ;; that's also what the previous code did, so it sucks but is not worse. | ||
| 288 | (eval form t) | ||
| 289 | form)) | ||
| 289 | 290 | ||
| 290 | (defmacro nnoo-define-skeleton (backend) | 291 | (defmacro nnoo-define-skeleton (backend) |
| 291 | "Define all required backend functions for BACKEND. | 292 | "Define all required backend functions for BACKEND. |
| @@ -294,17 +295,17 @@ All functions will return nil and report an error." | |||
| 294 | (nnoo-define-skeleton-1 ',backend))) | 295 | (nnoo-define-skeleton-1 ',backend))) |
| 295 | 296 | ||
| 296 | (defun nnoo-define-skeleton-1 (backend) | 297 | (defun nnoo-define-skeleton-1 (backend) |
| 297 | (let ((functions '(retrieve-headers | 298 | (dolist (op '(retrieve-headers |
| 298 | request-close request-article | 299 | request-close request-article |
| 299 | request-group close-group | 300 | request-group close-group |
| 300 | request-list request-post request-list-newsgroups)) | 301 | request-list request-post request-list-newsgroups)) |
| 301 | function fun) | 302 | (let ((fun (nnoo-symbol backend op))) |
| 302 | (while (setq function (pop functions)) | 303 | (unless (fboundp fun) |
| 303 | (when (not (fboundp (setq fun (nnoo-symbol backend function)))) | 304 | ;; FIXME: Use `defalias' and closures to avoid `eval'. |
| 304 | (eval `(deffoo ,fun | 305 | (eval `(deffoo ,fun |
| 305 | (&rest args) | 306 | (&rest _args) |
| 306 | (nnheader-report ',backend ,(format "%s-%s not implemented" | 307 | (nnheader-report ',backend ,(format "%s-%s not implemented" |
| 307 | backend function)))))))) | 308 | backend op)))))))) |
| 308 | 309 | ||
| 309 | (defun nnoo-set (server &rest args) | 310 | (defun nnoo-set (server &rest args) |
| 310 | (let ((parents (nnoo-parents (car server))) | 311 | (let ((parents (nnoo-parents (car server))) |
diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el index 2a948254717..dd71bea72e2 100644 --- a/lisp/gnus/nnweb.el +++ b/lisp/gnus/nnweb.el | |||
| @@ -154,17 +154,17 @@ Valid types include `google', `dejanews', and `gmane'.") | |||
| 154 | (and (stringp article) | 154 | (and (stringp article) |
| 155 | (nnweb-definition 'id t) | 155 | (nnweb-definition 'id t) |
| 156 | (let ((fetch (nnweb-definition 'id)) | 156 | (let ((fetch (nnweb-definition 'id)) |
| 157 | art active) | 157 | (art (when (string-match "^<\\(.*\\)>$" article) |
| 158 | (when (string-match "^<\\(.*\\)>$" article) | 158 | (match-string 1 article))) |
| 159 | (setq art (match-string 1 article))) | 159 | active) |
| 160 | (when (and fetch art) | 160 | (when (and fetch art) |
| 161 | (setq url (format fetch | 161 | (setq url (format fetch |
| 162 | (mm-url-form-encode-xwfu art))) | 162 | (mm-url-form-encode-xwfu art))) |
| 163 | (mm-url-insert url) | 163 | (mm-url-insert url) |
| 164 | (if (nnweb-definition 'reference t) | 164 | (if (nnweb-definition 'reference t) |
| 165 | (setq article | 165 | (setq article |
| 166 | (funcall (nnweb-definition | 166 | (funcall (nnweb-definition 'reference) |
| 167 | 'reference) article))))))) | 167 | article))))))) |
| 168 | (unless nnheader-callback-function | 168 | (unless nnheader-callback-function |
| 169 | (funcall (nnweb-definition 'article))) | 169 | (funcall (nnweb-definition 'article))) |
| 170 | (nnheader-report 'nnweb "Fetched article %s" article) | 170 | (nnheader-report 'nnweb "Fetched article %s" article) |
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el index 3f4fd3614ee..00dcd00ceab 100644 --- a/lisp/gnus/spam.el +++ b/lisp/gnus/spam.el | |||
| @@ -321,8 +321,8 @@ Default to t if one of the spam-use-* variables is set." | |||
| 321 | :type 'string | 321 | :type 'string |
| 322 | :group 'spam) | 322 | :group 'spam) |
| 323 | 323 | ||
| 324 | ;;; TODO: deprecate this variable, it's confusing since it's a list of strings, | 324 | ;; TODO: deprecate this variable, it's confusing since it's a list of strings, |
| 325 | ;;; not regular expressions | 325 | ;; not regular expressions |
| 326 | (defcustom spam-junk-mailgroups (cons | 326 | (defcustom spam-junk-mailgroups (cons |
| 327 | spam-split-group | 327 | spam-split-group |
| 328 | '("mail.junk" "poste.pourriel")) | 328 | '("mail.junk" "poste.pourriel")) |
| @@ -1836,7 +1836,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 1836 | ;; return the number of articles processed | 1836 | ;; return the number of articles processed |
| 1837 | (length articles)))) | 1837 | (length articles)))) |
| 1838 | 1838 | ||
| 1839 | ;;; log a ham- or spam-processor invocation to the registry | 1839 | ;; log a ham- or spam-processor invocation to the registry |
| 1840 | (defun spam-log-processing-to-registry (id type classification backend group) | 1840 | (defun spam-log-processing-to-registry (id type classification backend group) |
| 1841 | (when spam-log-to-registry | 1841 | (when spam-log-to-registry |
| 1842 | (if (and (stringp id) | 1842 | (if (and (stringp id) |
| @@ -1855,7 +1855,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 1855 | "%s call with bad ID, type, classification, spam-backend, or group" | 1855 | "%s call with bad ID, type, classification, spam-backend, or group" |
| 1856 | "spam-log-processing-to-registry"))))) | 1856 | "spam-log-processing-to-registry"))))) |
| 1857 | 1857 | ||
| 1858 | ;;; check if a ham- or spam-processor registration has been done | 1858 | ;; check if a ham- or spam-processor registration has been done |
| 1859 | (defun spam-log-registered-p (id type) | 1859 | (defun spam-log-registered-p (id type) |
| 1860 | (when spam-log-to-registry | 1860 | (when spam-log-to-registry |
| 1861 | (if (and (stringp id) | 1861 | (if (and (stringp id) |
| @@ -1868,8 +1868,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 1868 | "spam-log-registered-p")) | 1868 | "spam-log-registered-p")) |
| 1869 | nil)))) | 1869 | nil)))) |
| 1870 | 1870 | ||
| 1871 | ;;; check what a ham- or spam-processor registration says | 1871 | ;; check what a ham- or spam-processor registration says |
| 1872 | ;;; returns nil if conflicting registrations are found | 1872 | ;; returns nil if conflicting registrations are found |
| 1873 | (defun spam-log-registration-type (id type) | 1873 | (defun spam-log-registration-type (id type) |
| 1874 | (let ((count 0) | 1874 | (let ((count 0) |
| 1875 | decision) | 1875 | decision) |
| @@ -1885,7 +1885,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 1885 | decision))) | 1885 | decision))) |
| 1886 | 1886 | ||
| 1887 | 1887 | ||
| 1888 | ;;; check if a ham- or spam-processor registration needs to be undone | 1888 | ;; check if a ham- or spam-processor registration needs to be undone |
| 1889 | (defun spam-log-unregistration-needed-p (id type classification backend) | 1889 | (defun spam-log-unregistration-needed-p (id type classification backend) |
| 1890 | (when spam-log-to-registry | 1890 | (when spam-log-to-registry |
| 1891 | (if (and (stringp id) | 1891 | (if (and (stringp id) |
| @@ -1908,7 +1908,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 1908 | nil)))) | 1908 | nil)))) |
| 1909 | 1909 | ||
| 1910 | 1910 | ||
| 1911 | ;;; undo a ham- or spam-processor registration (the group is not used) | 1911 | ;; undo a ham- or spam-processor registration (the group is not used) |
| 1912 | (defun spam-log-undo-registration (id type classification backend | 1912 | (defun spam-log-undo-registration (id type classification backend |
| 1913 | &optional group) | 1913 | &optional group) |
| 1914 | (when (and spam-log-to-registry | 1914 | (when (and spam-log-to-registry |
| @@ -2034,94 +2034,83 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 2034 | 2034 | ||
| 2035 | ;;{{{ BBDB | 2035 | ;;{{{ BBDB |
| 2036 | 2036 | ||
| 2037 | ;;; original idea for spam-check-BBDB from Alexander Kotelnikov | 2037 | ;; original idea for spam-check-BBDB from Alexander Kotelnikov |
| 2038 | ;;; <sacha@giotto.sj.ru> | 2038 | ;; <sacha@giotto.sj.ru> |
| 2039 | 2039 | ||
| 2040 | ;; all this is done inside a condition-case to trap errors | 2040 | ;; all this is done inside a condition-case to trap errors |
| 2041 | 2041 | ||
| 2042 | ;; Autoloaded in message, which we require. | 2042 | ;; Autoloaded in message, which we require. |
| 2043 | (declare-function gnus-extract-address-components "gnus-util" (from)) | 2043 | (declare-function gnus-extract-address-components "gnus-util" (from)) |
| 2044 | 2044 | ||
| 2045 | (eval-and-compile | 2045 | (require 'bbdb nil 'noerror) |
| 2046 | (condition-case nil | 2046 | (require 'bbdb-com nil 'noerror) |
| 2047 | (progn | 2047 | |
| 2048 | (require 'bbdb) | 2048 | (declare-function bbdb-records "bbdb" ()) |
| 2049 | (require 'bbdb-com)) | 2049 | (declare-function bbdb-gethash "bbdb" (key &optional predicate)) |
| 2050 | (file-error | 2050 | (declare-function bbdb-create-internal "bbdb-com" (&rest spec)) |
| 2051 | ;; `bbdb-records' should not be bound as an autoload function | 2051 | |
| 2052 | ;; before loading bbdb because of `bbdb-hashtable-size'. | 2052 | ;; when the BBDB changes, we want to clear out our cache |
| 2053 | (defalias 'bbdb-buffer 'ignore) | 2053 | (defun spam-clear-cache-BBDB (&rest immaterial) |
| 2054 | (defalias 'bbdb-create-internal 'ignore) | 2054 | (spam-clear-cache 'spam-use-BBDB)) |
| 2055 | (defalias 'bbdb-records 'ignore) | 2055 | |
| 2056 | (defalias 'spam-BBDB-register-routine 'ignore) | 2056 | (when (featurep 'bbdb-com) |
| 2057 | (defalias 'spam-enter-ham-BBDB 'ignore) | 2057 | (add-hook 'bbdb-change-hook #'spam-clear-cache-BBDB)) |
| 2058 | (defalias 'spam-exists-in-BBDB-p 'ignore) | 2058 | |
| 2059 | (defalias 'bbdb-gethash 'ignore) | 2059 | (defun spam-enter-ham-BBDB (addresses &optional remove) |
| 2060 | nil))) | 2060 | "Enter an address into the BBDB; implies ham (non-spam) sender" |
| 2061 | 2061 | (dolist (from addresses) | |
| 2062 | (eval-and-compile | 2062 | (when (stringp from) |
| 2063 | (when (featurep 'bbdb-com) | 2063 | (let* ((parsed-address (gnus-extract-address-components from)) |
| 2064 | ;; when the BBDB changes, we want to clear out our cache | 2064 | (name (or (nth 0 parsed-address) "Ham Sender")) |
| 2065 | (defun spam-clear-cache-BBDB (&rest immaterial) | 2065 | (remove-function (if remove |
| 2066 | (spam-clear-cache 'spam-use-BBDB)) | 2066 | 'bbdb-delete-record-internal |
| 2067 | 2067 | 'ignore)) | |
| 2068 | (add-hook 'bbdb-change-hook 'spam-clear-cache-BBDB) | 2068 | (net-address (nth 1 parsed-address)) |
| 2069 | 2069 | (record (and net-address | |
| 2070 | (defun spam-enter-ham-BBDB (addresses &optional remove) | 2070 | (spam-exists-in-BBDB-p net-address)))) |
| 2071 | "Enter an address into the BBDB; implies ham (non-spam) sender" | 2071 | (when net-address |
| 2072 | (dolist (from addresses) | 2072 | (gnus-message 6 "%s address %s %s BBDB" |
| 2073 | (when (stringp from) | 2073 | (if remove "Deleting" "Adding") |
| 2074 | (let* ((parsed-address (gnus-extract-address-components from)) | 2074 | from |
| 2075 | (name (or (nth 0 parsed-address) "Ham Sender")) | 2075 | (if remove "from" "to")) |
| 2076 | (remove-function (if remove | 2076 | (if record |
| 2077 | 'bbdb-delete-record-internal | 2077 | (funcall remove-function record) |
| 2078 | 'ignore)) | 2078 | (bbdb-create-internal name nil net-address nil nil |
| 2079 | (net-address (nth 1 parsed-address)) | 2079 | "ham sender added by spam.el"))))))) |
| 2080 | (record (and net-address | 2080 | |
| 2081 | (spam-exists-in-BBDB-p net-address)))) | 2081 | (defun spam-BBDB-register-routine (articles &optional unregister) |
| 2082 | (when net-address | 2082 | (let (addresses) |
| 2083 | (gnus-message 6 "%s address %s %s BBDB" | 2083 | (dolist (article articles) |
| 2084 | (if remove "Deleting" "Adding") | 2084 | (when (stringp (spam-fetch-field-from-fast article)) |
| 2085 | from | 2085 | (push (spam-fetch-field-from-fast article) addresses))) |
| 2086 | (if remove "from" "to")) | 2086 | ;; now do the register/unregister action |
| 2087 | (if record | 2087 | (spam-enter-ham-BBDB addresses unregister))) |
| 2088 | (funcall remove-function record) | 2088 | |
| 2089 | (bbdb-create-internal name nil net-address nil nil | 2089 | (defun spam-BBDB-unregister-routine (articles) |
| 2090 | "ham sender added by spam.el"))))))) | 2090 | (spam-BBDB-register-routine articles t)) |
| 2091 | 2091 | ||
| 2092 | (defun spam-BBDB-register-routine (articles &optional unregister) | 2092 | (defun spam-exists-in-BBDB-p (net) |
| 2093 | (let (addresses) | 2093 | (when (and (stringp net) (not (zerop (length net)))) |
| 2094 | (dolist (article articles) | 2094 | (bbdb-records) |
| 2095 | (when (stringp (spam-fetch-field-from-fast article)) | 2095 | (bbdb-gethash (downcase net)))) |
| 2096 | (push (spam-fetch-field-from-fast article) addresses))) | 2096 | |
| 2097 | ;; now do the register/unregister action | 2097 | (defun spam-check-BBDB () |
| 2098 | (spam-enter-ham-BBDB addresses unregister))) | 2098 | "Mail from people in the BBDB is classified as ham or non-spam" |
| 2099 | 2099 | (let ((net (message-fetch-field "from"))) | |
| 2100 | (defun spam-BBDB-unregister-routine (articles) | 2100 | (when net |
| 2101 | (spam-BBDB-register-routine articles t)) | 2101 | (setq net (nth 1 (gnus-extract-address-components net))) |
| 2102 | 2102 | (if (spam-exists-in-BBDB-p net) | |
| 2103 | (defsubst spam-exists-in-BBDB-p (net) | 2103 | t |
| 2104 | (when (and (stringp net) (not (zerop (length net)))) | 2104 | (if spam-use-BBDB-exclusive |
| 2105 | (bbdb-records) | 2105 | spam-split-group |
| 2106 | (bbdb-gethash (downcase net)))) | 2106 | nil))))) |
| 2107 | |||
| 2108 | (defun spam-check-BBDB () | ||
| 2109 | "Mail from people in the BBDB is classified as ham or non-spam" | ||
| 2110 | (let ((net (message-fetch-field "from"))) | ||
| 2111 | (when net | ||
| 2112 | (setq net (nth 1 (gnus-extract-address-components net))) | ||
| 2113 | (if (spam-exists-in-BBDB-p net) | ||
| 2114 | t | ||
| 2115 | (if spam-use-BBDB-exclusive | ||
| 2116 | spam-split-group | ||
| 2117 | nil))))))) | ||
| 2118 | 2107 | ||
| 2119 | ;;}}} | 2108 | ;;}}} |
| 2120 | 2109 | ||
| 2121 | ;;{{{ ifile | 2110 | ;;{{{ ifile |
| 2122 | 2111 | ||
| 2123 | ;;; check the ifile backend; return nil if the mail was NOT classified | 2112 | ;; check the ifile backend; return nil if the mail was NOT classified |
| 2124 | ;;; as spam | 2113 | ;; as spam |
| 2125 | 2114 | ||
| 2126 | 2115 | ||
| 2127 | (defun spam-get-ifile-database-parameter () | 2116 | (defun spam-get-ifile-database-parameter () |
| @@ -2240,7 +2229,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." | |||
| 2240 | (let ((kill-whole-line t)) | 2229 | (let ((kill-whole-line t)) |
| 2241 | (kill-line))) | 2230 | (kill-line))) |
| 2242 | 2231 | ||
| 2243 | ;;; address can be a list, too | 2232 | ;; address can be a list, too |
| 2244 | (defun spam-enter-whitelist (address &optional remove) | 2233 | (defun spam-enter-whitelist (address &optional remove) |
| 2245 | "Enter ADDRESS (list or single) into the whitelist. | 2234 | "Enter ADDRESS (list or single) into the whitelist. |
| 2246 | With a non-nil REMOVE, remove them." | 2235 | With a non-nil REMOVE, remove them." |
| @@ -2249,7 +2238,7 @@ With a non-nil REMOVE, remove them." | |||
| 2249 | (setq spam-whitelist-cache nil) | 2238 | (setq spam-whitelist-cache nil) |
| 2250 | (spam-clear-cache 'spam-use-whitelist)) | 2239 | (spam-clear-cache 'spam-use-whitelist)) |
| 2251 | 2240 | ||
| 2252 | ;;; address can be a list, too | 2241 | ;; address can be a list, too |
| 2253 | (defun spam-enter-blacklist (address &optional remove) | 2242 | (defun spam-enter-blacklist (address &optional remove) |
| 2254 | "Enter ADDRESS (list or single) into the blacklist. | 2243 | "Enter ADDRESS (list or single) into the blacklist. |
| 2255 | With a non-nil REMOVE, remove them." | 2244 | With a non-nil REMOVE, remove them." |
| @@ -2310,8 +2299,8 @@ With a non-nil REMOVE, remove the ADDRESSES." | |||
| 2310 | (cl-return))) | 2299 | (cl-return))) |
| 2311 | found))) | 2300 | found))) |
| 2312 | 2301 | ||
| 2313 | ;;; returns t if the sender is in the whitelist, nil or | 2302 | ;; returns t if the sender is in the whitelist, nil or |
| 2314 | ;;; spam-split-group otherwise | 2303 | ;; spam-split-group otherwise |
| 2315 | (defun spam-check-whitelist () | 2304 | (defun spam-check-whitelist () |
| 2316 | ;; FIXME! Should it detect when file timestamps change? | 2305 | ;; FIXME! Should it detect when file timestamps change? |
| 2317 | (unless spam-whitelist-cache | 2306 | (unless spam-whitelist-cache |