diff options
| author | Stefan Monnier | 2017-11-02 23:52:06 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2017-11-02 23:52:06 -0400 |
| commit | 770f245cdf2cf9e74e49bb32afb77562d9b1ad6d (patch) | |
| tree | 5c0aab6af0ed1121dcc689834d71a5cd8c01353d | |
| parent | 731ab5bce5678e7b51f1e7ee21d895b456b04a26 (diff) | |
| download | emacs-770f245cdf2cf9e74e49bb32afb77562d9b1ad6d.tar.gz emacs-770f245cdf2cf9e74e49bb32afb77562d9b1ad6d.zip | |
* lisp/gnus/gnus.el: Use lexical-binding and cl-lib
Remove unneeded use of `eval-when' for gnus-splash hack.
(gnus-find-subscribed-addresses): Don't use `add-to-list' with local var.
(gnus-info-buffer): Declare var.
(gnus-interactive): Remove unused arg `params'.
(gnus-symbolic-argument): Remove unused arg `arg`.
(gnus-sloppily-equal-method-parameters): Use \' to match end of string.
(gnus-short-group-name): Remove unused var `name'.
| -rw-r--r-- | lisp/gnus/gnus.el | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 10b6db6ebb5..01e75120434 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; gnus.el --- a newsreader for GNU Emacs | 1 | ;;; gnus.el --- a newsreader for GNU Emacs -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1987-1990, 1993-1998, 2000-2017 Free Software | 3 | ;; Copyright (C) 1987-1990, 1993-1998, 2000-2017 Free Software |
| 4 | ;; Foundation, Inc. | 4 | ;; Foundation, Inc. |
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | (run-hooks 'gnus-load-hook) | 30 | (run-hooks 'gnus-load-hook) |
| 31 | 31 | ||
| 32 | (eval-when-compile (require 'cl)) | 32 | (eval-when-compile (require 'cl-lib)) |
| 33 | (require 'wid-edit) | 33 | (require 'wid-edit) |
| 34 | (require 'mm-util) | 34 | (require 'mm-util) |
| 35 | (require 'nnheader) | 35 | (require 'nnheader) |
| @@ -971,12 +971,11 @@ be set in `.emacs' instead." | |||
| 971 | (cons (car list) (list :type type :data data))) | 971 | (cons (car list) (list :type type :data data))) |
| 972 | list))) | 972 | list))) |
| 973 | 973 | ||
| 974 | (eval-when (load) | 974 | (let ((command (format "%s" this-command))) |
| 975 | (let ((command (format "%s" this-command))) | 975 | (when (string-match "gnus" command) |
| 976 | (when (string-match "gnus" command) | 976 | (if (eq 'gnus-other-frame this-command) |
| 977 | (if (string-match "gnus-other-frame" command) | 977 | (gnus-get-buffer-create gnus-group-buffer) |
| 978 | (gnus-get-buffer-create gnus-group-buffer) | 978 | (gnus-splash)))) |
| 979 | (gnus-splash))))) | ||
| 980 | 979 | ||
| 981 | ;;; Do the rest. | 980 | ;;; Do the rest. |
| 982 | 981 | ||
| @@ -2344,7 +2343,7 @@ Disabling the agent may result in noticeable loss of performance." | |||
| 2344 | :group 'gnus-agent | 2343 | :group 'gnus-agent |
| 2345 | :type 'boolean) | 2344 | :type 'boolean) |
| 2346 | 2345 | ||
| 2347 | (defcustom gnus-other-frame-function 'gnus | 2346 | (defcustom gnus-other-frame-function #'gnus |
| 2348 | "Function called by the command `gnus-other-frame' when starting Gnus." | 2347 | "Function called by the command `gnus-other-frame' when starting Gnus." |
| 2349 | :group 'gnus-start | 2348 | :group 'gnus-start |
| 2350 | :type '(choice (function-item gnus) | 2349 | :type '(choice (function-item gnus) |
| @@ -2352,7 +2351,9 @@ Disabling the agent may result in noticeable loss of performance." | |||
| 2352 | (function-item gnus-slave) | 2351 | (function-item gnus-slave) |
| 2353 | (function-item gnus-slave-no-server))) | 2352 | (function-item gnus-slave-no-server))) |
| 2354 | 2353 | ||
| 2355 | (defcustom gnus-other-frame-resume-function 'gnus-group-get-new-news | 2354 | (declare-function gnus-group-get-new-news "gnus-group") |
| 2355 | |||
| 2356 | (defcustom gnus-other-frame-resume-function #'gnus-group-get-new-news | ||
| 2356 | "Function called by the command `gnus-other-frame' when resuming Gnus." | 2357 | "Function called by the command `gnus-other-frame' when resuming Gnus." |
| 2357 | :version "24.4" | 2358 | :version "24.4" |
| 2358 | :group 'gnus-start | 2359 | :group 'gnus-start |
| @@ -2420,7 +2421,7 @@ a string, be sure to use a valid format, see RFC 2616." | |||
| 2420 | ) | 2421 | ) |
| 2421 | (defvar gnus-agent-target-move-group-header "X-Gnus-Agent-Move-To") | 2422 | (defvar gnus-agent-target-move-group-header "X-Gnus-Agent-Move-To") |
| 2422 | (defvar gnus-draft-meta-information-header "X-Draft-From") | 2423 | (defvar gnus-draft-meta-information-header "X-Draft-From") |
| 2423 | (defvar gnus-group-get-parameter-function 'gnus-group-get-parameter) | 2424 | (defvar gnus-group-get-parameter-function #'gnus-group-get-parameter) |
| 2424 | (defvar gnus-original-article-buffer " *Original Article*") | 2425 | (defvar gnus-original-article-buffer " *Original Article*") |
| 2425 | (defvar gnus-newsgroup-name nil) | 2426 | (defvar gnus-newsgroup-name nil) |
| 2426 | (defvar gnus-ephemeral-servers nil) | 2427 | (defvar gnus-ephemeral-servers nil) |
| @@ -2622,7 +2623,6 @@ gnus-registry.el will populate this if it's loaded.") | |||
| 2622 | (nthcdr 3 package) | 2623 | (nthcdr 3 package) |
| 2623 | (cdr package))))) | 2624 | (cdr package))))) |
| 2624 | '(("info" :interactive t Info-goto-node) | 2625 | '(("info" :interactive t Info-goto-node) |
| 2625 | ("pp" pp-to-string) | ||
| 2626 | ("qp" quoted-printable-decode-region quoted-printable-decode-string) | 2626 | ("qp" quoted-printable-decode-region quoted-printable-decode-string) |
| 2627 | ("ps-print" ps-print-preprint) | 2627 | ("ps-print" ps-print-preprint) |
| 2628 | ("message" :interactive t | 2628 | ("message" :interactive t |
| @@ -3046,9 +3046,9 @@ with a `subscribed' parameter." | |||
| 3046 | (or (gnus-group-fast-parameter group 'to-address) | 3046 | (or (gnus-group-fast-parameter group 'to-address) |
| 3047 | (gnus-group-fast-parameter group 'to-list)))) | 3047 | (gnus-group-fast-parameter group 'to-list)))) |
| 3048 | (when address | 3048 | (when address |
| 3049 | (add-to-list 'addresses address)))) | 3049 | (cl-pushnew address addresses :test #'equal)))) |
| 3050 | (when addresses | 3050 | (when addresses |
| 3051 | (list (mapconcat 'regexp-quote addresses "\\|"))))) | 3051 | (list (mapconcat #'regexp-quote addresses "\\|"))))) |
| 3052 | 3052 | ||
| 3053 | (defmacro gnus-string-or (&rest strings) | 3053 | (defmacro gnus-string-or (&rest strings) |
| 3054 | "Return the first element of STRINGS that is a non-blank string. | 3054 | "Return the first element of STRINGS that is a non-blank string. |
| @@ -3101,6 +3101,8 @@ If ARG, insert string at point." | |||
| 3101 | minor least) | 3101 | minor least) |
| 3102 | (format "%d.%02d%02d" major minor least)))))) | 3102 | (format "%d.%02d%02d" major minor least)))))) |
| 3103 | 3103 | ||
| 3104 | (defvar gnus-info-buffer) | ||
| 3105 | |||
| 3104 | (defun gnus-info-find-node (&optional nodename) | 3106 | (defun gnus-info-find-node (&optional nodename) |
| 3105 | "Find Info documentation of Gnus." | 3107 | "Find Info documentation of Gnus." |
| 3106 | (interactive) | 3108 | (interactive) |
| @@ -3120,7 +3122,7 @@ If ARG, insert string at point." | |||
| 3120 | (defvar gnus-current-prefix-symbols nil | 3122 | (defvar gnus-current-prefix-symbols nil |
| 3121 | "List of current prefix symbols.") | 3123 | "List of current prefix symbols.") |
| 3122 | 3124 | ||
| 3123 | (defun gnus-interactive (string &optional params) | 3125 | (defun gnus-interactive (string) |
| 3124 | "Return a list that can be fed to `interactive'. | 3126 | "Return a list that can be fed to `interactive'. |
| 3125 | See `interactive' for full documentation. | 3127 | See `interactive' for full documentation. |
| 3126 | 3128 | ||
| @@ -3212,9 +3214,9 @@ g -- Group name." | |||
| 3212 | (setq out (delq 'gnus-prefix-nil out)) | 3214 | (setq out (delq 'gnus-prefix-nil out)) |
| 3213 | (nreverse out))) | 3215 | (nreverse out))) |
| 3214 | 3216 | ||
| 3215 | (defun gnus-symbolic-argument (&optional arg) | 3217 | (defun gnus-symbolic-argument () |
| 3216 | "Read a symbolic argument and a command, and then execute command." | 3218 | "Read a symbolic argument and a command, and then execute command." |
| 3217 | (interactive "P") | 3219 | (interactive) |
| 3218 | (let* ((in-command (this-command-keys)) | 3220 | (let* ((in-command (this-command-keys)) |
| 3219 | (command in-command) | 3221 | (command in-command) |
| 3220 | gnus-current-prefix-symbols | 3222 | gnus-current-prefix-symbols |
| @@ -3330,16 +3332,15 @@ that that variable is buffer-local to the summary buffers." | |||
| 3330 | (throw 'server-name (car name-method)))) | 3332 | (throw 'server-name (car name-method)))) |
| 3331 | gnus-server-method-cache)) | 3333 | gnus-server-method-cache)) |
| 3332 | 3334 | ||
| 3333 | (mapc | 3335 | (dolist (server-alist |
| 3334 | (lambda (server-alist) | 3336 | (list gnus-server-alist |
| 3335 | (mapc (lambda (name-method) | 3337 | gnus-predefined-server-alist)) |
| 3336 | (when (gnus-methods-equal-p (cdr name-method) method) | 3338 | (mapc (lambda (name-method) |
| 3337 | (unless (member name-method gnus-server-method-cache) | 3339 | (when (gnus-methods-equal-p (cdr name-method) method) |
| 3338 | (push name-method gnus-server-method-cache)) | 3340 | (unless (member name-method gnus-server-method-cache) |
| 3339 | (throw 'server-name (car name-method)))) | 3341 | (push name-method gnus-server-method-cache)) |
| 3340 | server-alist)) | 3342 | (throw 'server-name (car name-method)))) |
| 3341 | (list gnus-server-alist | 3343 | server-alist)) |
| 3342 | gnus-predefined-server-alist)) | ||
| 3343 | 3344 | ||
| 3344 | (let* ((name (if (member (cadr method) '(nil "")) | 3345 | (let* ((name (if (member (cadr method) '(nil "")) |
| 3345 | (format "%s" (car method)) | 3346 | (format "%s" (car method)) |
| @@ -3441,26 +3442,26 @@ that that variable is buffer-local to the summary buffers." | |||
| 3441 | (let ((p1 (copy-sequence (cddr m1))) | 3442 | (let ((p1 (copy-sequence (cddr m1))) |
| 3442 | (p2 (copy-sequence (cddr m2))) | 3443 | (p2 (copy-sequence (cddr m2))) |
| 3443 | e1 e2) | 3444 | e1 e2) |
| 3444 | (block nil | 3445 | (cl-block nil |
| 3445 | (while (setq e1 (pop p1)) | 3446 | (while (setq e1 (pop p1)) |
| 3446 | (unless (setq e2 (assq (car e1) p2)) | 3447 | (unless (setq e2 (assq (car e1) p2)) |
| 3447 | ;; The parameter doesn't exist in p2. | 3448 | ;; The parameter doesn't exist in p2. |
| 3448 | (return nil)) | 3449 | (cl-return nil)) |
| 3449 | (setq p2 (delq e2 p2)) | 3450 | (setq p2 (delq e2 p2)) |
| 3450 | (unless (equal e1 e2) | 3451 | (unless (equal e1 e2) |
| 3451 | (if (not (and (stringp (cadr e1)) | 3452 | (if (not (and (stringp (cadr e1)) |
| 3452 | (stringp (cadr e2)))) | 3453 | (stringp (cadr e2)))) |
| 3453 | (return nil) | 3454 | (cl-return nil) |
| 3454 | ;; Special-case string parameter comparison so that we | 3455 | ;; Special-case string parameter comparison so that we |
| 3455 | ;; can uniquify them. | 3456 | ;; can uniquify them. |
| 3456 | (let ((s1 (cadr e1)) | 3457 | (let ((s1 (cadr e1)) |
| 3457 | (s2 (cadr e2))) | 3458 | (s2 (cadr e2))) |
| 3458 | (when (string-match "/$" s1) | 3459 | (when (string-match "/\\'" s1) |
| 3459 | (setq s1 (directory-file-name s1))) | 3460 | (setq s1 (directory-file-name s1))) |
| 3460 | (when (string-match "/$" s2) | 3461 | (when (string-match "/\\'" s2) |
| 3461 | (setq s2 (directory-file-name s2))) | 3462 | (setq s2 (directory-file-name s2))) |
| 3462 | (unless (equal s1 s2) | 3463 | (unless (equal s1 s2) |
| 3463 | (return nil)))))) | 3464 | (cl-return nil)))))) |
| 3464 | ;; If p2 now is empty, they were equal. | 3465 | ;; If p2 now is empty, they were equal. |
| 3465 | (null p2)))) | 3466 | (null p2)))) |
| 3466 | 3467 | ||
| @@ -3848,8 +3849,7 @@ If SCORE is nil, add 1 to the score of GROUP." | |||
| 3848 | "Collapse GROUP name LEVELS. | 3849 | "Collapse GROUP name LEVELS. |
| 3849 | Select methods are stripped and any remote host name is stripped down to | 3850 | Select methods are stripped and any remote host name is stripped down to |
| 3850 | just the host name." | 3851 | just the host name." |
| 3851 | (let* ((name "") | 3852 | (let* ((foreign "") |
| 3852 | (foreign "") | ||
| 3853 | (depth 0) | 3853 | (depth 0) |
| 3854 | (skip 1) | 3854 | (skip 1) |
| 3855 | (levels (or levels | 3855 | (levels (or levels |
| @@ -3891,13 +3891,13 @@ just the host name." | |||
| 3891 | gsep ".")) | 3891 | gsep ".")) |
| 3892 | (setq levels (- glen levels)) | 3892 | (setq levels (- glen levels)) |
| 3893 | (dolist (g glist) | 3893 | (dolist (g glist) |
| 3894 | (push (if (>= (decf levels) 0) | 3894 | (push (if (>= (cl-decf levels) 0) |
| 3895 | (if (zerop (length g)) | 3895 | (if (zerop (length g)) |
| 3896 | "" | 3896 | "" |
| 3897 | (substring g 0 1)) | 3897 | (substring g 0 1)) |
| 3898 | g) | 3898 | g) |
| 3899 | res)) | 3899 | res)) |
| 3900 | (concat foreign (mapconcat 'identity (nreverse res) gsep)))))) | 3900 | (concat foreign (mapconcat #'identity (nreverse res) gsep)))))) |
| 3901 | 3901 | ||
| 3902 | (defun gnus-narrow-to-body () | 3902 | (defun gnus-narrow-to-body () |
| 3903 | "Narrow to the body of an article." | 3903 | "Narrow to the body of an article." |
| @@ -4139,7 +4139,7 @@ Allow completion over sensible values." | |||
| 4139 | gnus-server-alist)) | 4139 | gnus-server-alist)) |
| 4140 | (method | 4140 | (method |
| 4141 | (gnus-completing-read | 4141 | (gnus-completing-read |
| 4142 | prompt (mapcar 'car servers) | 4142 | prompt (mapcar #'car servers) |
| 4143 | t nil 'gnus-method-history))) | 4143 | t nil 'gnus-method-history))) |
| 4144 | (cond | 4144 | (cond |
| 4145 | ((equal method "") | 4145 | ((equal method "") |
| @@ -4252,13 +4252,13 @@ current display is used." | |||
| 4252 | (progn (switch-to-buffer gnus-group-buffer) | 4252 | (progn (switch-to-buffer gnus-group-buffer) |
| 4253 | (funcall gnus-other-frame-resume-function arg)) | 4253 | (funcall gnus-other-frame-resume-function arg)) |
| 4254 | (funcall gnus-other-frame-function arg) | 4254 | (funcall gnus-other-frame-function arg) |
| 4255 | (add-hook 'gnus-exit-gnus-hook 'gnus-delete-gnus-frame) | 4255 | (add-hook 'gnus-exit-gnus-hook #'gnus-delete-gnus-frame) |
| 4256 | ;; One might argue that `gnus-delete-gnus-frame' should not be called | 4256 | ;; One might argue that `gnus-delete-gnus-frame' should not be called |
| 4257 | ;; from `gnus-suspend-gnus-hook', but, on the other hand, one might | 4257 | ;; from `gnus-suspend-gnus-hook', but, on the other hand, one might |
| 4258 | ;; argue that it should. No matter what you think, for the sake of | 4258 | ;; argue that it should. No matter what you think, for the sake of |
| 4259 | ;; those who want it to be called from it, please keep (defun | 4259 | ;; those who want it to be called from it, please keep (defun |
| 4260 | ;; gnus-delete-gnus-frame) even if you remove the next `add-hook'. | 4260 | ;; gnus-delete-gnus-frame) even if you remove the next `add-hook'. |
| 4261 | (add-hook 'gnus-suspend-gnus-hook 'gnus-delete-gnus-frame))))) | 4261 | (add-hook 'gnus-suspend-gnus-hook #'gnus-delete-gnus-frame))))) |
| 4262 | 4262 | ||
| 4263 | ;;;###autoload | 4263 | ;;;###autoload |
| 4264 | (defun gnus (&optional arg dont-connect slave) | 4264 | (defun gnus (&optional arg dont-connect slave) |