aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-09-17 13:22:32 -0400
committerStefan Monnier2013-09-17 13:22:32 -0400
commitc2e9e9ef6fdd6be93ebc5a143aea6a7716fe8ed7 (patch)
tree2823d7ccefe20c6473b0e441cdfbbebeeb949354
parent0791d107eddb1ff08b321b204427fd3599e0b2cb (diff)
downloademacs-c2e9e9ef6fdd6be93ebc5a143aea6a7716fe8ed7.tar.gz
emacs-c2e9e9ef6fdd6be93ebc5a143aea6a7716fe8ed7.zip
* lisp/gnus/gnus-agent.el (gnus-category-mode): Use define-derived-mode.
(gnus-agent-mode): Use derived-mode-p. (gnus-agent-rename-group, gnus-agent-delete-group): Don't bind gnus-command-method and *-command-method to nil, but bind gnus-command-method to *-command-method instead! (gnus-agent-fetch-articles): Remove unused var `id'. (gnus-agent-fetch-headers): Remove unused arg `force'. (gnus-agent-braid-nov): Remove unused arg `group'. Adjust callers. (gnus-agent-save-alist, gnus-agent-save-local): Remove unused `item'. (gnus-agent-short-article, gnus-agent-long-article) (gnus-agent-low-score, gnus-agent-high-score): Move declaration before first use. (gnus-agent-fetch-group-1): Remove unused vars `arts', `category', `score-param'. (gnus-tmp-name, gnus-tmp-groups): Defvar them. (gnus-get-predicate): Push in front of the cache, rather than end. (gnus-agent-expire-current-dirs, gnus-agent-expire-stats): Defvar them. (gnus-agent-expire-group-1): Use push. Don't abuse dyn-binding. (gnus-agent-expire-unagentized-dirs): Don't rebind gnus-agent-expire-current-dirs since the defvar silences the warning. (gnus-agent-retrieve-headers): Remove unused var `cached-articles'. (gnus-agent-regenerate-group): Remove unused vars `point' and `dl'. (gnus-agent-regenerate): Simplify interactive spec and doc. * lisp/gnus/gnus-eform.el (gnus-edit-form-mode): Use define-derived-mode. * lisp/gnus/gnus-salt.el (gnus-tree-mode): Use define-derived-mode. Use save-current-buffer. (gnus-tree-mode-map): Initialize in the declaration. (gnus-pick-mouse-pick-region): Remove unused var `fun'. (scroll-in-place): Defvar it. (gnus-tmp-*): Defvar them. (gnus-get-tree-buffer): Use derived-mode-p. (gnus--let-eval): New macro. (gnus-tree-highlight-node): Use it to avoid dynamic binding of non-prefixed variables. (gnus-tree-open, gnus-tree-close): Remove unused arg `group'. * lisp/gnus/gnus-sum.el (gnus-summary-highlight): Remove `below' from the list of vars since it doesn't seem to be available. (gnus-set-global-variables, gnus-summary-read-group-1) (gnus-select-newsgroup, gnus-handle-ephemeral-exit) (gnus-summary-display-article, gnus-summary-select-article) (gnus-summary-next-article, gnus-offer-save-summaries) (gnus-summary-generic-mark): Use derived-mode-p. (gnus-summary-read-group-1, gnus-summary-exit) (gnus-summary-exit-no-update, gnus-kill-or-deaden-summary): Adjust calls to gnus-tree-close and gnus-tree-open.
-rw-r--r--lisp/gnus/ChangeLog51
-rw-r--r--lisp/gnus/gnus-agent.el160
-rw-r--r--lisp/gnus/gnus-eform.el10
-rw-r--r--lisp/gnus/gnus-salt.el100
-rw-r--r--lisp/gnus/gnus-sum.el36
5 files changed, 202 insertions, 155 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index f9c0c7b287e..d673a18cb1d 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,54 @@
12013-09-17 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * gnus-salt.el (gnus-tree-mode): Use define-derived-mode.
4 Use save-current-buffer.
5 (gnus-tree-mode-map): Initialize in the declaration.
6 (gnus-pick-mouse-pick-region): Remove unused var `fun'.
7 (scroll-in-place): Defvar it.
8 (gnus-tmp-*): Defvar them.
9 (gnus-get-tree-buffer): Use derived-mode-p.
10 (gnus--let-eval): New macro.
11 (gnus-tree-highlight-node): Use it to avoid dynamic binding of
12 non-prefixed variables.
13 (gnus-tree-open, gnus-tree-close): Remove unused arg `group'.
14
15 * gnus-sum.el (gnus-summary-highlight): Remove `below' from the list of
16 vars since it doesn't seem to be available.
17 (gnus-set-global-variables, gnus-summary-read-group-1)
18 (gnus-select-newsgroup, gnus-handle-ephemeral-exit)
19 (gnus-summary-display-article, gnus-summary-select-article)
20 (gnus-summary-next-article, gnus-offer-save-summaries)
21 (gnus-summary-generic-mark): Use derived-mode-p.
22 (gnus-summary-read-group-1, gnus-summary-exit)
23 (gnus-summary-exit-no-update, gnus-kill-or-deaden-summary):
24 Adjust calls to gnus-tree-close and gnus-tree-open.
25
26 * gnus-eform.el (gnus-edit-form-mode): Use define-derived-mode.
27
28 * gnus-agent.el (gnus-category-mode): Use define-derived-mode.
29 (gnus-agent-mode): Use derived-mode-p.
30 (gnus-agent-rename-group, gnus-agent-delete-group): Don't bind
31 gnus-command-method and *-command-method to nil, but bind
32 gnus-command-method to *-command-method instead!
33 (gnus-agent-fetch-articles): Remove unused var `id'.
34 (gnus-agent-fetch-headers): Remove unused arg `force'.
35 (gnus-agent-braid-nov): Remove unused arg `group'. Adjust callers.
36 (gnus-agent-save-alist, gnus-agent-save-local): Remove unused `item'.
37 (gnus-agent-short-article, gnus-agent-long-article)
38 (gnus-agent-low-score, gnus-agent-high-score): Move declaration before
39 first use.
40 (gnus-agent-fetch-group-1): Remove unused vars `arts', `category',
41 `score-param'.
42 (gnus-tmp-name, gnus-tmp-groups): Defvar them.
43 (gnus-get-predicate): Push in front of the cache, rather than end.
44 (gnus-agent-expire-current-dirs, gnus-agent-expire-stats): Defvar them.
45 (gnus-agent-expire-group-1): Use push. Don't abuse dyn-binding.
46 (gnus-agent-expire-unagentized-dirs): Don't rebind
47 gnus-agent-expire-current-dirs since the defvar silences the warning.
48 (gnus-agent-retrieve-headers): Remove unused var `cached-articles'.
49 (gnus-agent-regenerate-group): Remove unused vars `point' and `dl'.
50 (gnus-agent-regenerate): Simplify interactive spec and doc.
51
12013-09-17 Katsumi Yamaoka <yamaoka@jpl.org> 522013-09-17 Katsumi Yamaoka <yamaoka@jpl.org>
2 53
3 * gnus-int.el (gnus-open-server): Silence compiler. 54 * gnus-int.el (gnus-open-server): Silence compiler.
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 1d0f346e10f..10ee230a814 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -492,7 +492,7 @@ manipulated as follows:
492 (push (cons mode (symbol-value (intern (format "gnus-agent-%s-mode-map" 492 (push (cons mode (symbol-value (intern (format "gnus-agent-%s-mode-map"
493 buffer)))) 493 buffer))))
494 minor-mode-map-alist)) 494 minor-mode-map-alist))
495 (when (eq major-mode 'gnus-group-mode) 495 (when (derived-mode-p 'gnus-group-mode)
496 (let ((init-plugged gnus-plugged) 496 (let ((init-plugged gnus-plugged)
497 (gnus-agent-go-online nil)) 497 (gnus-agent-go-online nil))
498 ;; g-a-t-p does nothing when gnus-plugged isn't changed. 498 ;; g-a-t-p does nothing when gnus-plugged isn't changed.
@@ -881,11 +881,11 @@ Depends upon the caller to determine whether group renaming is
881supported." 881supported."
882 (let* ((old-command-method (gnus-find-method-for-group old-group)) 882 (let* ((old-command-method (gnus-find-method-for-group old-group))
883 (old-path (directory-file-name 883 (old-path (directory-file-name
884 (let (gnus-command-method old-command-method) 884 (let ((gnus-command-method old-command-method))
885 (gnus-agent-group-pathname old-group)))) 885 (gnus-agent-group-pathname old-group))))
886 (new-command-method (gnus-find-method-for-group new-group)) 886 (new-command-method (gnus-find-method-for-group new-group))
887 (new-path (directory-file-name 887 (new-path (directory-file-name
888 (let (gnus-command-method new-command-method) 888 (let ((gnus-command-method new-command-method))
889 (gnus-agent-group-pathname new-group)))) 889 (gnus-agent-group-pathname new-group))))
890 (file-name-coding-system nnmail-pathname-coding-system)) 890 (file-name-coding-system nnmail-pathname-coding-system))
891 (gnus-rename-file old-path new-path t) 891 (gnus-rename-file old-path new-path t)
@@ -914,19 +914,18 @@ Depends upon the caller to determine whether group deletion is
914supported." 914supported."
915 (let* ((command-method (gnus-find-method-for-group group)) 915 (let* ((command-method (gnus-find-method-for-group group))
916 (path (directory-file-name 916 (path (directory-file-name
917 (let (gnus-command-method command-method) 917 (let ((gnus-command-method command-method))
918 (gnus-agent-group-pathname group)))) 918 (gnus-agent-group-pathname group))))
919 (file-name-coding-system nnmail-pathname-coding-system)) 919 (file-name-coding-system nnmail-pathname-coding-system))
920 (gnus-delete-directory path) 920 (gnus-delete-directory path)
921 921
922 (let* ((real-group (gnus-group-real-name group))) 922 (let* ((real-group (gnus-group-real-name group)))
923 (gnus-agent-save-group-info command-method real-group nil) 923 (gnus-agent-save-group-info command-method real-group nil)
924 924 ;; FIXME: Does gnus-agent-get-local have any useful side-effect?
925 (let ((local (gnus-agent-get-local group 925 (gnus-agent-get-local group real-group command-method)
926 real-group command-method))) 926 (gnus-agent-set-local group
927 (gnus-agent-set-local group 927 nil nil
928 nil nil 928 real-group command-method))))
929 real-group command-method)))))
930 929
931;;; 930;;;
932;;; Server mode commands 931;;; Server mode commands
@@ -1549,7 +1548,7 @@ downloaded into the agent."
1549 (dir (gnus-agent-group-pathname group)) 1548 (dir (gnus-agent-group-pathname group))
1550 (date (time-to-days (current-time))) 1549 (date (time-to-days (current-time)))
1551 (case-fold-search t) 1550 (case-fold-search t)
1552 pos crosses id 1551 pos crosses
1553 (file-name-coding-system nnmail-pathname-coding-system)) 1552 (file-name-coding-system nnmail-pathname-coding-system))
1554 1553
1555 (setcar selected-sets (nreverse (car selected-sets))) 1554 (setcar selected-sets (nreverse (car selected-sets)))
@@ -1603,11 +1602,6 @@ downloaded into the agent."
1603 (goto-char (match-end 0))) 1602 (goto-char (match-end 0)))
1604 (gnus-agent-crosspost crosses (caar pos) date))) 1603 (gnus-agent-crosspost crosses (caar pos) date)))
1605 (goto-char (point-min)) 1604 (goto-char (point-min))
1606 (if (not (re-search-forward
1607 "^Message-ID: *<\\([^>\n]+\\)>" nil t))
1608 (setq id "No-Message-ID-in-article")
1609 (setq id (buffer-substring
1610 (match-beginning 1) (match-end 1))))
1611 (let ((coding-system-for-write 1605 (let ((coding-system-for-write
1612 gnus-agent-file-coding-system)) 1606 gnus-agent-file-coding-system))
1613 (write-region (point-min) (point-max) 1607 (write-region (point-min) (point-max)
@@ -1832,7 +1826,7 @@ variables. Returns the first non-nil value found."
1832 . gnus-agent-enable-expiration) 1826 . gnus-agent-enable-expiration)
1833 (agent-predicate . gnus-agent-predicate))))))) 1827 (agent-predicate . gnus-agent-predicate)))))))
1834 1828
1835(defun gnus-agent-fetch-headers (group &optional force) 1829(defun gnus-agent-fetch-headers (group)
1836 "Fetch interesting headers into the agent. The group's overview 1830 "Fetch interesting headers into the agent. The group's overview
1837file will be updated to include the headers while a list of available 1831file will be updated to include the headers while a list of available
1838article numbers will be returned." 1832article numbers will be returned."
@@ -1931,7 +1925,7 @@ article numbers will be returned."
1931 ;; NOTE: Call g-a-brand-nov even when the file does not 1925 ;; NOTE: Call g-a-brand-nov even when the file does not
1932 ;; exist. As a minimum, it will validate the article 1926 ;; exist. As a minimum, it will validate the article
1933 ;; numbers already in the buffer. 1927 ;; numbers already in the buffer.
1934 (gnus-agent-braid-nov group articles file) 1928 (gnus-agent-braid-nov articles file)
1935 (let ((coding-system-for-write 1929 (let ((coding-system-for-write
1936 gnus-agent-file-coding-system)) 1930 gnus-agent-file-coding-system))
1937 (gnus-agent-check-overview-buffer) 1931 (gnus-agent-check-overview-buffer)
@@ -1980,7 +1974,7 @@ article numbers will be returned."
1980 (set-buffer nntp-server-buffer) 1974 (set-buffer nntp-server-buffer)
1981 (insert-buffer-substring gnus-agent-overview-buffer b e)))) 1975 (insert-buffer-substring gnus-agent-overview-buffer b e))))
1982 1976
1983(defun gnus-agent-braid-nov (group articles file) 1977(defun gnus-agent-braid-nov (articles file)
1984 "Merge agent overview data with given file. 1978 "Merge agent overview data with given file.
1985Takes unvalidated headers for ARTICLES from 1979Takes unvalidated headers for ARTICLES from
1986`gnus-agent-overview-buffer' and validated headers from the given 1980`gnus-agent-overview-buffer' and validated headers from the given
@@ -2154,7 +2148,7 @@ doesn't exist, to valid the overview buffer."
2154 (let* ((file-name-coding-system nnmail-pathname-coding-system) 2148 (let* ((file-name-coding-system nnmail-pathname-coding-system)
2155 (prev (cons nil gnus-agent-article-alist)) 2149 (prev (cons nil gnus-agent-article-alist))
2156 (all prev) 2150 (all prev)
2157 print-level print-length item article) 2151 print-level print-length article)
2158 (while (setq article (pop articles)) 2152 (while (setq article (pop articles))
2159 (while (and (cdr prev) 2153 (while (and (cdr prev)
2160 (< (caadr prev) article)) 2154 (< (caadr prev) article))
@@ -2288,7 +2282,7 @@ modified) original contents, they are first saved to their own file."
2288 (file-name-coding-system nnmail-pathname-coding-system)) 2282 (file-name-coding-system nnmail-pathname-coding-system))
2289 (with-temp-file dest 2283 (with-temp-file dest
2290 (let ((gnus-command-method (symbol-value (intern "+method" my-obarray))) 2284 (let ((gnus-command-method (symbol-value (intern "+method" my-obarray)))
2291 print-level print-length item article 2285 print-level print-length
2292 (standard-output (current-buffer))) 2286 (standard-output (current-buffer)))
2293 (mapatoms (lambda (symbol) 2287 (mapatoms (lambda (symbol)
2294 (cond ((not (boundp symbol)) 2288 (cond ((not (boundp symbol))
@@ -2411,6 +2405,18 @@ modified) original contents, they are first saved to their own file."
2411 (gnus-run-hooks 'gnus-agent-fetched-hook) 2405 (gnus-run-hooks 'gnus-agent-fetched-hook)
2412 (gnus-message 6 "Finished fetching articles into the Gnus agent")))) 2406 (gnus-message 6 "Finished fetching articles into the Gnus agent"))))
2413 2407
2408(defvar gnus-agent-short-article 500
2409 "Articles that have fewer lines than this are short.")
2410
2411(defvar gnus-agent-long-article 1000
2412 "Articles that have more lines than this are long.")
2413
2414(defvar gnus-agent-low-score 0
2415 "Articles that have a score lower than this have a low score.")
2416
2417(defvar gnus-agent-high-score 0
2418 "Articles that have a score higher than this have a high score.")
2419
2414(defun gnus-agent-fetch-group-1 (group method) 2420(defun gnus-agent-fetch-group-1 (group method)
2415 "Fetch GROUP." 2421 "Fetch GROUP."
2416 (let ((gnus-command-method method) 2422 (let ((gnus-command-method method)
@@ -2427,8 +2433,8 @@ modified) original contents, they are first saved to their own file."
2427 2433
2428 gnus-headers 2434 gnus-headers
2429 gnus-score 2435 gnus-score
2430 articles arts 2436 articles
2431 category predicate info marks score-param 2437 predicate info marks
2432 ) 2438 )
2433 (unless (gnus-check-group group) 2439 (unless (gnus-check-group group)
2434 (error "Can't open server for %s" group)) 2440 (error "Can't open server for %s" group))
@@ -2471,9 +2477,6 @@ modified) original contents, they are first saved to their own file."
2471 ;; timeout reason. If so, recreate it. 2477 ;; timeout reason. If so, recreate it.
2472 (gnus-agent-create-buffer) 2478 (gnus-agent-create-buffer)
2473 2479
2474 ;; Figure out how to select articles in this group
2475 (setq category (gnus-group-category group))
2476
2477 (setq predicate 2480 (setq predicate
2478 (gnus-get-predicate 2481 (gnus-get-predicate
2479 (gnus-agent-find-parameter group 'agent-predicate))) 2482 (gnus-agent-find-parameter group 'agent-predicate)))
@@ -2624,23 +2627,14 @@ General format specifiers can also be used. See Info node
2624(defvar gnus-agent-predicate 'false 2627(defvar gnus-agent-predicate 'false
2625 "The selection predicate used when no other source is available.") 2628 "The selection predicate used when no other source is available.")
2626 2629
2627(defvar gnus-agent-short-article 500
2628 "Articles that have fewer lines than this are short.")
2629
2630(defvar gnus-agent-long-article 1000
2631 "Articles that have more lines than this are long.")
2632
2633(defvar gnus-agent-low-score 0
2634 "Articles that have a score lower than this have a low score.")
2635
2636(defvar gnus-agent-high-score 0
2637 "Articles that have a score higher than this have a high score.")
2638
2639 2630
2640;;; Internal variables. 2631;;; Internal variables.
2641 2632
2642(defvar gnus-category-buffer "*Agent Category*") 2633(defvar gnus-category-buffer "*Agent Category*")
2643 2634
2635(defvar gnus-tmp-name)
2636(defvar gnus-tmp-groups)
2637
2644(defvar gnus-category-line-format-alist 2638(defvar gnus-category-line-format-alist
2645 `((?c gnus-tmp-name ?s) 2639 `((?c gnus-tmp-name ?s)
2646 (?g gnus-tmp-groups ?d))) 2640 (?g gnus-tmp-groups ?d)))
@@ -2692,7 +2686,7 @@ General format specifiers can also be used. See Info node
2692 2686
2693 (gnus-run-hooks 'gnus-category-menu-hook))) 2687 (gnus-run-hooks 'gnus-category-menu-hook)))
2694 2688
2695(defun gnus-category-mode () 2689(define-derived-mode gnus-category-mode fundamental-mode "Category"
2696 "Major mode for listing and editing agent categories. 2690 "Major mode for listing and editing agent categories.
2697 2691
2698All normal editing commands are switched off. 2692All normal editing commands are switched off.
@@ -2703,20 +2697,14 @@ For more in-depth information on this mode, read the manual
2703The following commands are available: 2697The following commands are available:
2704 2698
2705\\{gnus-category-mode-map}" 2699\\{gnus-category-mode-map}"
2706 (interactive)
2707 (when (gnus-visual-p 'category-menu 'menu) 2700 (when (gnus-visual-p 'category-menu 'menu)
2708 (gnus-category-make-menu-bar)) 2701 (gnus-category-make-menu-bar))
2709 (kill-all-local-variables)
2710 (gnus-simplify-mode-line) 2702 (gnus-simplify-mode-line)
2711 (setq major-mode 'gnus-category-mode)
2712 (setq mode-name "Category")
2713 (gnus-set-default-directory) 2703 (gnus-set-default-directory)
2714 (setq mode-line-process nil) 2704 (setq mode-line-process nil)
2715 (use-local-map gnus-category-mode-map)
2716 (buffer-disable-undo) 2705 (buffer-disable-undo)
2717 (setq truncate-lines t) 2706 (setq truncate-lines t)
2718 (setq buffer-read-only t) 2707 (setq buffer-read-only t))
2719 (gnus-run-mode-hooks 'gnus-category-mode-hook))
2720 2708
2721(defalias 'gnus-category-position-point 'gnus-goto-colon) 2709(defalias 'gnus-category-position-point 'gnus-goto-colon)
2722 2710
@@ -2992,9 +2980,7 @@ The following commands are available:
2992 "Return the function implementing PREDICATE." 2980 "Return the function implementing PREDICATE."
2993 (or (cdr (assoc predicate gnus-category-predicate-cache)) 2981 (or (cdr (assoc predicate gnus-category-predicate-cache))
2994 (let ((func (gnus-category-make-function predicate))) 2982 (let ((func (gnus-category-make-function predicate)))
2995 (setq gnus-category-predicate-cache 2983 (push (cons predicate func) gnus-category-predicate-cache)
2996 (nconc gnus-category-predicate-cache
2997 (list (cons predicate func))))
2998 func))) 2984 func)))
2999 2985
3000(defun gnus-predicate-implies-unread (predicate) 2986(defun gnus-predicate-implies-unread (predicate)
@@ -3066,6 +3052,9 @@ articles."
3066 (or (gnus-gethash group gnus-category-group-cache) 3052 (or (gnus-gethash group gnus-category-group-cache)
3067 (assq 'default gnus-category-alist))) 3053 (assq 'default gnus-category-alist)))
3068 3054
3055(defvar gnus-agent-expire-current-dirs)
3056(defvar gnus-agent-expire-stats)
3057
3069(defun gnus-agent-expire-group (group &optional articles force) 3058(defun gnus-agent-expire-group (group &optional articles force)
3070 "Expire all old articles in GROUP. 3059 "Expire all old articles in GROUP.
3071If you want to force expiring of certain articles, this function can 3060If you want to force expiring of certain articles, this function can
@@ -3080,7 +3069,7 @@ FORCE is equivalent to setting the expiration predicates to true."
3080 3069
3081 (if (not group) 3070 (if (not group)
3082 (gnus-agent-expire articles group force) 3071 (gnus-agent-expire articles group force)
3083 (let ( ;; Bind gnus-agent-expire-stats to enable tracking of 3072 (let (;; Bind gnus-agent-expire-stats to enable tracking of
3084 ;; expiration statistics of this single group 3073 ;; expiration statistics of this single group
3085 (gnus-agent-expire-stats (list 0 0 0.0))) 3074 (gnus-agent-expire-stats (list 0 0 0.0)))
3086 (if (or (not (eq articles t)) 3075 (if (or (not (eq articles t))
@@ -3117,9 +3106,7 @@ FORCE is equivalent to setting the expiration predicates to true."
3117 (gnus-agent-with-refreshed-group 3106 (gnus-agent-with-refreshed-group
3118 group 3107 group
3119 (when (boundp 'gnus-agent-expire-current-dirs) 3108 (when (boundp 'gnus-agent-expire-current-dirs)
3120 (set 'gnus-agent-expire-current-dirs 3109 (push dir gnus-agent-expire-current-dirs))
3121 (cons dir
3122 (symbol-value 'gnus-agent-expire-current-dirs))))
3123 3110
3124 (if (and (not force) 3111 (if (and (not force)
3125 (eq 'DISABLE (gnus-agent-find-parameter group 3112 (eq 'DISABLE (gnus-agent-find-parameter group
@@ -3263,24 +3250,24 @@ line." (point) nov-file)))
3263 ;; only problem is that much of it is spread across multiple 3250 ;; only problem is that much of it is spread across multiple
3264 ;; entries. Sort then MERGE!! 3251 ;; entries. Sort then MERGE!!
3265 (gnus-message 7 "gnus-agent-expire: Sorting entries... ") 3252 (gnus-message 7 "gnus-agent-expire: Sorting entries... ")
3266 ;; If two entries have the same article-number then sort by 3253 (setq dlist
3267 ;; ascending keep_flag. 3254 (sort dlist
3268 (let ((special 0) 3255 (lambda (a b)
3269 (marked 1) 3256 (cond ((< (nth 0 a) (nth 0 b))
3270 (unread 2)) 3257 t)
3271 (setq dlist 3258 ((> (nth 0 a) (nth 0 b))
3272 (sort dlist 3259 nil)
3273 (lambda (a b) 3260 (t
3274 (cond ((< (nth 0 a) (nth 0 b)) 3261 ;; If two entries have the same article-number
3275 t) 3262 ;; then sort by ascending keep_flag.
3276 ((> (nth 0 a) (nth 0 b)) 3263 (let* ((kf-score '((special . 0)
3277 nil) 3264 (marked . 1)
3278 (t 3265 (unread . 2)))
3279 (let ((a (or (symbol-value (nth 2 a)) 3266 (a (or (cdr (assq (nth 2 a) kf-score))
3280 3)) 3267 3))
3281 (b (or (symbol-value (nth 2 b)) 3268 (b (or (cdr (assq (nth 2 b) kf-score))
3282 3))) 3269 3)))
3283 (<= a b)))))))) 3270 (<= a b)))))))
3284 (gnus-message 7 "gnus-agent-expire: Sorting entries... Done") 3271 (gnus-message 7 "gnus-agent-expire: Sorting entries... Done")
3285 (gnus-message 7 "gnus-agent-expire: Merging entries... ") 3272 (gnus-message 7 "gnus-agent-expire: Merging entries... ")
3286 (let ((dlist dlist)) 3273 (let ((dlist dlist))
@@ -3474,7 +3461,7 @@ expiration tests failed." decoded article-number)
3474 (gnus-summary-update-info)))) 3461 (gnus-summary-update-info))))
3475 3462
3476 (when (boundp 'gnus-agent-expire-stats) 3463 (when (boundp 'gnus-agent-expire-stats)
3477 (let ((stats (symbol-value 'gnus-agent-expire-stats))) 3464 (let ((stats gnus-agent-expire-stats))
3478 (incf (nth 2 stats) bytes-freed) 3465 (incf (nth 2 stats) bytes-freed)
3479 (incf (nth 1 stats) files-deleted) 3466 (incf (nth 1 stats) files-deleted)
3480 (incf (nth 0 stats) nov-entries-deleted))) 3467 (incf (nth 0 stats) nov-entries-deleted)))
@@ -3534,7 +3521,7 @@ articles in every agentized group? "))
3534(defun gnus-agent-expire-done-message () 3521(defun gnus-agent-expire-done-message ()
3535 (if (and (> gnus-verbose 4) 3522 (if (and (> gnus-verbose 4)
3536 (boundp 'gnus-agent-expire-stats)) 3523 (boundp 'gnus-agent-expire-stats))
3537 (let* ((stats (symbol-value 'gnus-agent-expire-stats)) 3524 (let* ((stats gnus-agent-expire-stats)
3538 (size (nth 2 stats)) 3525 (size (nth 2 stats))
3539 (units '(B KB MB GB))) 3526 (units '(B KB MB GB)))
3540 (while (and (> size 1024.0) 3527 (while (and (> size 1024.0)
@@ -3553,16 +3540,10 @@ articles in every agentized group? "))
3553 (when (and gnus-agent-expire-unagentized-dirs 3540 (when (and gnus-agent-expire-unagentized-dirs
3554 (boundp 'gnus-agent-expire-current-dirs)) 3541 (boundp 'gnus-agent-expire-current-dirs))
3555 (let* ((keep (gnus-make-hashtable)) 3542 (let* ((keep (gnus-make-hashtable))
3556 ;; Formally bind gnus-agent-expire-current-dirs so that the
3557 ;; compiler will not complain about free references.
3558 (gnus-agent-expire-current-dirs
3559 (symbol-value 'gnus-agent-expire-current-dirs))
3560 dir
3561 (file-name-coding-system nnmail-pathname-coding-system)) 3543 (file-name-coding-system nnmail-pathname-coding-system))
3562 3544
3563 (gnus-sethash gnus-agent-directory t keep) 3545 (gnus-sethash gnus-agent-directory t keep)
3564 (while gnus-agent-expire-current-dirs 3546 (dolist (dir gnus-agent-expire-current-dirs)
3565 (setq dir (pop gnus-agent-expire-current-dirs))
3566 (when (and (stringp dir) 3547 (when (and (stringp dir)
3567 (file-directory-p dir)) 3548 (file-directory-p dir))
3568 (while (not (gnus-gethash dir keep)) 3549 (while (not (gnus-gethash dir keep))
@@ -3715,7 +3696,7 @@ has been fetched."
3715 (let ((gnus-decode-encoded-word-function 'identity) 3696 (let ((gnus-decode-encoded-word-function 'identity)
3716 (gnus-decode-encoded-address-function 'identity) 3697 (gnus-decode-encoded-address-function 'identity)
3717 (file (gnus-agent-article-name ".overview" group)) 3698 (file (gnus-agent-article-name ".overview" group))
3718 cached-articles uncached-articles 3699 uncached-articles
3719 (file-name-coding-system nnmail-pathname-coding-system)) 3700 (file-name-coding-system nnmail-pathname-coding-system))
3720 (gnus-make-directory (nnheader-translate-file-chars 3701 (gnus-make-directory (nnheader-translate-file-chars
3721 (file-name-directory file) t)) 3702 (file-name-directory file) t))
@@ -3812,7 +3793,7 @@ has been fetched."
3812 ;; Merge the temp buffer with the known headers (found on 3793 ;; Merge the temp buffer with the known headers (found on
3813 ;; disk in FILE) into the nntp-server-buffer 3794 ;; disk in FILE) into the nntp-server-buffer
3814 (when uncached-articles 3795 (when uncached-articles
3815 (gnus-agent-braid-nov group uncached-articles file)) 3796 (gnus-agent-braid-nov uncached-articles file))
3816 3797
3817 ;; Save the new set of known headers to FILE 3798 ;; Save the new set of known headers to FILE
3818 (set-buffer nntp-server-buffer) 3799 (set-buffer nntp-server-buffer)
@@ -3907,7 +3888,6 @@ If REREAD is not nil, downloaded articles are marked as unread."
3907 (gnus-find-method-for-group group))) 3888 (gnus-find-method-for-group group)))
3908 (file (gnus-agent-article-name ".overview" group)) 3889 (file (gnus-agent-article-name ".overview" group))
3909 (dir (file-name-directory file)) 3890 (dir (file-name-directory file))
3910 point
3911 (file-name-coding-system nnmail-pathname-coding-system) 3891 (file-name-coding-system nnmail-pathname-coding-system)
3912 (downloaded (if (file-exists-p dir) 3892 (downloaded (if (file-exists-p dir)
3913 (sort (delq nil (mapcar (lambda (name) 3893 (sort (delq nil (mapcar (lambda (name)
@@ -3916,7 +3896,7 @@ If REREAD is not nil, downloaded articles are marked as unread."
3916 (directory-files dir nil "^[0-9]+$" t))) 3896 (directory-files dir nil "^[0-9]+$" t)))
3917 '>) 3897 '>)
3918 (progn (gnus-make-directory dir) nil))) 3898 (progn (gnus-make-directory dir) nil)))
3919 dl nov-arts 3899 nov-arts
3920 alist header 3900 alist header
3921 regenerated) 3901 regenerated)
3922 3902
@@ -4099,16 +4079,16 @@ If REREAD is not nil, downloaded articles are marked as unread."
4099 regenerated))) 4079 regenerated)))
4100 4080
4101;;;###autoload 4081;;;###autoload
4102(defun gnus-agent-regenerate (&optional clean reread) 4082(defun gnus-agent-regenerate (&optional _clean reread)
4103 "Regenerate all agent covered files. 4083 "Regenerate all agent covered files.
4104If CLEAN, obsolete (ignore)." 4084CLEAN is obsolete and ignored."
4105 (interactive "P") 4085 (interactive)
4106 (let (regenerated) 4086 (let (regenerated)
4107 (gnus-message 4 "Regenerating Gnus agent files...") 4087 (gnus-message 4 "Regenerating Gnus agent files...")
4108 (dolist (gnus-command-method (gnus-agent-covered-methods)) 4088 (dolist (gnus-command-method (gnus-agent-covered-methods))
4109 (dolist (group (gnus-groups-from-server gnus-command-method)) 4089 (dolist (group (gnus-groups-from-server gnus-command-method))
4110 (setq regenerated (or (gnus-agent-regenerate-group group reread) 4090 (setq regenerated (or (gnus-agent-regenerate-group group reread)
4111 regenerated)))) 4091 regenerated))))
4112 (gnus-message 4 "Regenerating Gnus agent files...done") 4092 (gnus-message 4 "Regenerating Gnus agent files...done")
4113 4093
4114 regenerated)) 4094 regenerated))
diff --git a/lisp/gnus/gnus-eform.el b/lisp/gnus/gnus-eform.el
index 6790803305a..00e27876088 100644
--- a/lisp/gnus/gnus-eform.el
+++ b/lisp/gnus/gnus-eform.el
@@ -67,21 +67,15 @@
67 ["Exit" gnus-edit-form-exit t])) 67 ["Exit" gnus-edit-form-exit t]))
68 (gnus-run-hooks 'gnus-edit-form-menu-hook))) 68 (gnus-run-hooks 'gnus-edit-form-menu-hook)))
69 69
70(defun gnus-edit-form-mode () 70(define-derived-mode gnus-edit-form-mode fundamental-mode "Edit Form"
71 "Major mode for editing forms. 71 "Major mode for editing forms.
72It is a slightly enhanced emacs-lisp-mode. 72It is a slightly enhanced emacs-lisp-mode.
73 73
74\\{gnus-edit-form-mode-map}" 74\\{gnus-edit-form-mode-map}"
75 (interactive)
76 (when (gnus-visual-p 'group-menu 'menu) 75 (when (gnus-visual-p 'group-menu 'menu)
77 (gnus-edit-form-make-menu-bar)) 76 (gnus-edit-form-make-menu-bar))
78 (kill-all-local-variables)
79 (setq major-mode 'gnus-edit-form-mode)
80 (setq mode-name "Edit Form")
81 (use-local-map gnus-edit-form-mode-map)
82 (make-local-variable 'gnus-edit-form-done-function) 77 (make-local-variable 'gnus-edit-form-done-function)
83 (make-local-variable 'gnus-prev-winconf) 78 (make-local-variable 'gnus-prev-winconf))
84 (gnus-run-mode-hooks 'gnus-edit-form-mode-hook))
85 79
86(defun gnus-edit-form (form documentation exit-func &optional layout) 80(defun gnus-edit-form (form documentation exit-func &optional layout)
87 "Edit FORM in a new buffer. 81 "Edit FORM in a new buffer.
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
index 6b8e105e6b8..77fe0d3bb14 100644
--- a/lisp/gnus/gnus-salt.el
+++ b/lisp/gnus/gnus-salt.el
@@ -292,22 +292,25 @@ This must be bound to a button-down mouse event."
292 (mouse-scroll-subr start-window 292 (mouse-scroll-subr start-window
293 (1+ (- mouse-row bottom))))))))))) 293 (1+ (- mouse-row bottom)))))))))))
294 (when (consp event) 294 (when (consp event)
295 (let ((fun (key-binding (vector (car event))))) 295 (let (;; (fun (key-binding (vector (car event))))
296 )
296 ;; Run the binding of the terminating up-event, if possible. 297 ;; Run the binding of the terminating up-event, if possible.
297 ;; In the case of a multiple click, it gives the wrong results, 298 ;; In the case of a multiple click, it gives the wrong results,
298 ;; because it would fail to set up a region. 299 ;; because it would fail to set up a region.
299 (when nil 300 (when nil
300 ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun)) 301 ;; (and (= (mod mouse-selection-click-count 3) 0) (fboundp fun))
301 ;; In this case, we can just let the up-event execute normally. 302 ;; In this case, we can just let the up-event execute normally.
302 (let ((end (event-end event))) 303 (let ((end (event-end event)))
303 ;; Set the position in the event before we replay it, 304 ;; Set the position in the event before we replay it,
304 ;; because otherwise it may have a position in the wrong 305 ;; because otherwise it may have a position in the wrong
305 ;; buffer. 306 ;; buffer.
306 (setcar (cdr end) end-of-range) 307 (setcar (cdr end) end-of-range)
307 ;; Delete the overlay before calling the function, 308 ;; Delete the overlay before calling the function,
308 ;; because delete-overlay increases buffer-modified-tick. 309 ;; because delete-overlay increases buffer-modified-tick.
309 (push event unread-command-events)))))))) 310 (push event unread-command-events))))))))
310 311
312(defvar scroll-in-place)
313
311(defun gnus-pick-next-page () 314(defun gnus-pick-next-page ()
312 "Go to the next page. If at the end of the buffer, start reading articles." 315 "Go to the next page. If at the end of the buffer, start reading articles."
313 (interactive) 316 (interactive)
@@ -356,7 +359,7 @@ This must be bound to a button-down mouse event."
356 (when (gnus-visual-p 'binary-menu 'menu) 359 (when (gnus-visual-p 'binary-menu 'menu)
357 (gnus-binary-make-menu-bar))))) 360 (gnus-binary-make-menu-bar)))))
358 361
359(defun gnus-binary-display-article (article &optional all-header) 362(defun gnus-binary-display-article (article &optional _all-header)
360 "Run ARTICLE through the binary decode functions." 363 "Run ARTICLE through the binary decode functions."
361 (when (gnus-summary-goto-subject article) 364 (when (gnus-summary-goto-subject article)
362 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic))) 365 (let ((gnus-view-pseudos (or gnus-view-pseudos 'automatic)))
@@ -423,6 +426,13 @@ Two predefined functions are available:
423 426
424;;; Internal variables. 427;;; Internal variables.
425 428
429(defvar gnus-tmp-name)
430(defvar gnus-tmp-from)
431(defvar gnus-tmp-number)
432(defvar gnus-tmp-open-bracket)
433(defvar gnus-tmp-close-bracket)
434(defvar gnus-tmp-subject)
435
426(defvar gnus-tree-line-format-alist 436(defvar gnus-tree-line-format-alist
427 `((?n gnus-tmp-name ?s) 437 `((?n gnus-tmp-name ?s)
428 (?f gnus-tmp-from ?s) 438 (?f gnus-tmp-from ?s)
@@ -442,23 +452,23 @@ Two predefined functions are available:
442(defvar gnus-tree-displayed-thread nil) 452(defvar gnus-tree-displayed-thread nil)
443(defvar gnus-tree-inhibit nil) 453(defvar gnus-tree-inhibit nil)
444 454
445(defvar gnus-tree-mode-map nil) 455(defvar gnus-tree-mode-map
446(put 'gnus-tree-mode 'mode-class 'special) 456 (let ((map (make-keymap)))
457 (suppress-keymap map)
458 (gnus-define-keys
459 map
460 "\r" gnus-tree-select-article
461 gnus-mouse-2 gnus-tree-pick-article
462 "\C-?" gnus-tree-read-summary-keys
463 "h" gnus-tree-show-summary
447 464
448(unless gnus-tree-mode-map 465 "\C-c\C-i" gnus-info-find-node)
449 (setq gnus-tree-mode-map (make-keymap))
450 (suppress-keymap gnus-tree-mode-map)
451 (gnus-define-keys
452 gnus-tree-mode-map
453 "\r" gnus-tree-select-article
454 gnus-mouse-2 gnus-tree-pick-article
455 "\C-?" gnus-tree-read-summary-keys
456 "h" gnus-tree-show-summary
457 466
458 "\C-c\C-i" gnus-info-find-node) 467 (substitute-key-definition
468 'undefined 'gnus-tree-read-summary-keys map)
469 map))
459 470
460 (substitute-key-definition 471(put 'gnus-tree-mode 'mode-class 'special)
461 'undefined 'gnus-tree-read-summary-keys gnus-tree-mode-map))
462 472
463(defun gnus-tree-make-menu-bar () 473(defun gnus-tree-make-menu-bar ()
464 (unless (boundp 'gnus-tree-menu) 474 (unless (boundp 'gnus-tree-menu)
@@ -467,26 +477,20 @@ Two predefined functions are available:
467 '("Tree" 477 '("Tree"
468 ["Select article" gnus-tree-select-article t])))) 478 ["Select article" gnus-tree-select-article t]))))
469 479
470(defun gnus-tree-mode () 480(define-derived-mode gnus-tree-mode fundamental-mode "Tree"
471 "Major mode for displaying thread trees." 481 "Major mode for displaying thread trees."
472 (interactive)
473 (gnus-set-format 'tree-mode) 482 (gnus-set-format 'tree-mode)
474 (gnus-set-format 'tree t) 483 (gnus-set-format 'tree t)
475 (when (gnus-visual-p 'tree-menu 'menu) 484 (when (gnus-visual-p 'tree-menu 'menu)
476 (gnus-tree-make-menu-bar)) 485 (gnus-tree-make-menu-bar))
477 (kill-all-local-variables)
478 (gnus-simplify-mode-line) 486 (gnus-simplify-mode-line)
479 (setq mode-name "Tree")
480 (setq major-mode 'gnus-tree-mode)
481 (use-local-map gnus-tree-mode-map)
482 (buffer-disable-undo) 487 (buffer-disable-undo)
483 (setq buffer-read-only t) 488 (setq buffer-read-only t)
484 (setq truncate-lines t) 489 (setq truncate-lines t)
485 (save-excursion 490 (save-current-buffer
486 (gnus-set-work-buffer) 491 (gnus-set-work-buffer)
487 (gnus-tree-node-insert (make-mail-header "") nil) 492 (gnus-tree-node-insert (make-mail-header "") nil)
488 (setq gnus-tree-node-length (1- (point)))) 493 (setq gnus-tree-node-length (1- (point)))))
489 (gnus-run-mode-hooks 'gnus-tree-mode-hook))
490 494
491(defun gnus-tree-read-summary-keys (&optional arg) 495(defun gnus-tree-read-summary-keys (&optional arg)
492 "Read a summary buffer key sequence and execute it." 496 "Read a summary buffer key sequence and execute it."
@@ -562,7 +566,7 @@ Two predefined functions are available:
562(defun gnus-get-tree-buffer () 566(defun gnus-get-tree-buffer ()
563 "Return the tree buffer properly initialized." 567 "Return the tree buffer properly initialized."
564 (with-current-buffer (gnus-get-buffer-create gnus-tree-buffer) 568 (with-current-buffer (gnus-get-buffer-create gnus-tree-buffer)
565 (unless (eq major-mode 'gnus-tree-mode) 569 (unless (derived-mode-p 'gnus-tree-mode)
566 (gnus-tree-mode)) 570 (gnus-tree-mode))
567 (current-buffer))) 571 (current-buffer)))
568 572
@@ -571,7 +575,7 @@ Two predefined functions are available:
571 (not (one-window-p))) 575 (not (one-window-p)))
572 (let ((windows 0) 576 (let ((windows 0)
573 tot-win-height) 577 tot-win-height)
574 (walk-windows (lambda (window) (incf windows))) 578 (walk-windows (lambda (_window) (incf windows)))
575 (setq tot-win-height 579 (setq tot-win-height
576 (- (frame-height) 580 (- (frame-height)
577 (* window-min-height (1- windows)) 581 (* window-min-height (1- windows))
@@ -642,23 +646,41 @@ Two predefined functions are available:
642 (when (or t (gnus-visual-p 'tree-highlight 'highlight)) 646 (when (or t (gnus-visual-p 'tree-highlight 'highlight))
643 (gnus-tree-highlight-node gnus-tmp-number beg end)))) 647 (gnus-tree-highlight-node gnus-tmp-number beg end))))
644 648
649(defmacro gnus--let-eval (bindings evalsym &rest body)
650 "Build an environment in which to evaluate expressions.
651BINDINGS is a `let'-style list of bindings to use for the environment.
652EVALSYM is then bound in BODY to a function that takes a sexp and evaluates
653it in the environment specified by BINDINGS."
654 (declare (indent 2) (debug ((&rest (sym form)) sym body)))
655 (if (ignore-errors (let ((x 3)) (eq (eval '(- x 1) '((x . 4))) x)))
656 ;; Use lexical vars if possible.
657 `(let* ((env (list ,@(mapcar (lambda (binding)
658 `(cons ',(car binding) ,(cadr binding)))
659 bindings)))
660 (,evalsym (lambda (exp) (eval exp env))))
661 ,@body)
662 `(let (,@bindings (,evalsym #'eval)) ,@body)))
663
645(defun gnus-tree-highlight-node (article beg end) 664(defun gnus-tree-highlight-node (article beg end)
646 "Highlight current line according to `gnus-summary-highlight'." 665 "Highlight current line according to `gnus-summary-highlight'."
647 (let ((list gnus-summary-highlight) 666 (let ((list gnus-summary-highlight)
648 face) 667 face)
649 (with-current-buffer gnus-summary-buffer 668 (with-current-buffer gnus-summary-buffer
650 (let* ((score (or (cdr (assq article gnus-newsgroup-scored)) 669 (let ((uncached (memq article gnus-newsgroup-undownloaded)))
670 (gnus--let-eval
671 ((score (or (cdr (assq article gnus-newsgroup-scored))
651 gnus-summary-default-score 0)) 672 gnus-summary-default-score 0))
652 (default gnus-summary-default-score) 673 (default gnus-summary-default-score)
653 (default-high gnus-summary-default-high-score) 674 (default-high gnus-summary-default-high-score)
654 (default-low gnus-summary-default-low-score) 675 (default-low gnus-summary-default-low-score)
655 (uncached (memq article gnus-newsgroup-undownloaded)) 676 (uncached uncached)
656 (downloaded (not uncached)) 677 (downloaded (not uncached))
657 (mark (or (gnus-summary-article-mark article) gnus-unread-mark))) 678 (mark (or (gnus-summary-article-mark article) gnus-unread-mark)))
658 ;; Eval the cars of the lists until we find a match. 679 evalfun
659 (while (and list 680 ;; Eval the cars of the lists until we find a match.
660 (not (eval (caar list)))) 681 (while (and list
661 (setq list (cdr list))))) 682 (not (funcall evalfun (caar list))))
683 (setq list (cdr list))))))
662 (unless (eq (setq face (cdar list)) (gnus-get-text-property-excluding-characters-with-faces beg 'face)) 684 (unless (eq (setq face (cdar list)) (gnus-get-text-property-excluding-characters-with-faces beg 'face))
663 (gnus-put-text-property-excluding-characters-with-faces 685 (gnus-put-text-property-excluding-characters-with-faces
664 beg end 'face 686 beg end 'face
@@ -814,10 +836,10 @@ Two predefined functions are available:
814 (gnus-generate-tree top) 836 (gnus-generate-tree top)
815 (setq gnus-tree-displayed-thread top)))))) 837 (setq gnus-tree-displayed-thread top))))))
816 838
817(defun gnus-tree-open (group) 839(defun gnus-tree-open ()
818 (gnus-get-tree-buffer)) 840 (gnus-get-tree-buffer))
819 841
820(defun gnus-tree-close (group) 842(defun gnus-tree-close ()
821 (gnus-kill-buffer gnus-tree-buffer)) 843 (gnus-kill-buffer gnus-tree-buffer))
822 844
823(defun gnus-tree-perhaps-minimize () 845(defun gnus-tree-perhaps-minimize ()
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 94f4e703180..61cf7ec5b61 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1140,7 +1140,6 @@ score: The article's score.
1140default: The default article score. 1140default: The default article score.
1141default-high: The default score for high scored articles. 1141default-high: The default score for high scored articles.
1142default-low: The default score for low scored articles. 1142default-low: The default score for low scored articles.
1143below: The score below which articles are automatically marked as read.
1144mark: The article's mark. 1143mark: The article's mark.
1145uncached: Non-nil if the article is uncached." 1144uncached: Non-nil if the article is uncached."
1146 :group 'gnus-summary-visual 1145 :group 'gnus-summary-visual
@@ -3104,6 +3103,7 @@ buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3104The following commands are available: 3103The following commands are available:
3105 3104
3106\\{gnus-summary-mode-map}" 3105\\{gnus-summary-mode-map}"
3106 ;; FIXME: Use define-derived-mode.
3107 (interactive) 3107 (interactive)
3108 (kill-all-local-variables) 3108 (kill-all-local-variables)
3109 (let ((gnus-summary-local-variables gnus-newsgroup-variables)) 3109 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
@@ -3542,7 +3542,7 @@ If the setup was successful, non-nil is returned."
3542 "Set the global equivalents of the buffer-local variables. 3542 "Set the global equivalents of the buffer-local variables.
3543They are set to the latest values they had. These reflect the summary 3543They are set to the latest values they had. These reflect the summary
3544buffer that was in action when the last article was fetched." 3544buffer that was in action when the last article was fetched."
3545 (when (eq major-mode 'gnus-summary-mode) 3545 (when (derived-mode-p 'gnus-summary-mode)
3546 (setq gnus-summary-buffer (current-buffer)) 3546 (setq gnus-summary-buffer (current-buffer))
3547 (let ((name gnus-newsgroup-name) 3547 (let ((name gnus-newsgroup-name)
3548 (marked gnus-newsgroup-marked) 3548 (marked gnus-newsgroup-marked)
@@ -3990,7 +3990,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
3990 t) 3990 t)
3991 ;; We couldn't select this group. 3991 ;; We couldn't select this group.
3992 ((null did-select) 3992 ((null did-select)
3993 (when (and (eq major-mode 'gnus-summary-mode) 3993 (when (and (derived-mode-p 'gnus-summary-mode)
3994 (not (equal (current-buffer) kill-buffer))) 3994 (not (equal (current-buffer) kill-buffer)))
3995 (kill-buffer (current-buffer)) 3995 (kill-buffer (current-buffer))
3996 (if (not quit-config) 3996 (if (not quit-config)
@@ -4009,7 +4009,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
4009 ;; The user did a `C-g' while prompting for number of articles, 4009 ;; The user did a `C-g' while prompting for number of articles,
4010 ;; so we exit this group. 4010 ;; so we exit this group.
4011 ((eq did-select 'quit) 4011 ((eq did-select 'quit)
4012 (and (eq major-mode 'gnus-summary-mode) 4012 (and (derived-mode-p 'gnus-summary-mode)
4013 (not (equal (current-buffer) kill-buffer)) 4013 (not (equal (current-buffer) kill-buffer))
4014 (kill-buffer (current-buffer))) 4014 (kill-buffer (current-buffer)))
4015 (when kill-buffer 4015 (when kill-buffer
@@ -4052,7 +4052,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
4052 (unless no-display 4052 (unless no-display
4053 (gnus-summary-prepare)) 4053 (gnus-summary-prepare))
4054 (when gnus-use-trees 4054 (when gnus-use-trees
4055 (gnus-tree-open group) 4055 (gnus-tree-open)
4056 (setq gnus-summary-highlight-line-function 4056 (setq gnus-summary-highlight-line-function
4057 'gnus-tree-highlight-article)) 4057 'gnus-tree-highlight-article))
4058 ;; If the summary buffer is empty, but there are some low-scored 4058 ;; If the summary buffer is empty, but there are some low-scored
@@ -5612,7 +5612,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
5612 (or (and entry (not (eq (car entry) t))) ; Either it's active... 5612 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5613 (gnus-activate-group group) ; Or we can activate it... 5613 (gnus-activate-group group) ; Or we can activate it...
5614 (progn ; Or we bug out. 5614 (progn ; Or we bug out.
5615 (when (equal major-mode 'gnus-summary-mode) 5615 (when (derived-mode-p 'gnus-summary-mode)
5616 (gnus-kill-buffer (current-buffer))) 5616 (gnus-kill-buffer (current-buffer)))
5617 (error 5617 (error
5618 "Couldn't activate group %s: %s" 5618 "Couldn't activate group %s: %s"
@@ -5620,7 +5620,7 @@ If SELECT-ARTICLES, only select those articles from GROUP."
5620 (mm-decode-coding-string (gnus-status-message group) charset)))) 5620 (mm-decode-coding-string (gnus-status-message group) charset))))
5621 5621
5622 (unless (gnus-request-group group t) 5622 (unless (gnus-request-group group t)
5623 (when (equal major-mode 'gnus-summary-mode) 5623 (when (derived-mode-p 'gnus-summary-mode)
5624 (gnus-kill-buffer (current-buffer))) 5624 (gnus-kill-buffer (current-buffer)))
5625 (error "Couldn't request group %s: %s" 5625 (error "Couldn't request group %s: %s"
5626 (mm-decode-coding-string group charset) 5626 (mm-decode-coding-string group charset)
@@ -7257,7 +7257,7 @@ If FORCE (the prefix), also save the .newsrc file(s)."
7257 (when gnus-suppress-duplicates 7257 (when gnus-suppress-duplicates
7258 (gnus-dup-enter-articles)) 7258 (gnus-dup-enter-articles))
7259 (when gnus-use-trees 7259 (when gnus-use-trees
7260 (gnus-tree-close group)) 7260 (gnus-tree-close))
7261 (when gnus-use-cache 7261 (when gnus-use-cache
7262 (gnus-cache-write-active)) 7262 (gnus-cache-write-active))
7263 ;; Remove entries for this group. 7263 ;; Remove entries for this group.
@@ -7360,7 +7360,7 @@ If FORCE (the prefix), also save the .newsrc file(s)."
7360 (unless gnus-single-article-buffer 7360 (unless gnus-single-article-buffer
7361 (setq gnus-article-current nil)) 7361 (setq gnus-article-current nil))
7362 (when gnus-use-trees 7362 (when gnus-use-trees
7363 (gnus-tree-close group)) 7363 (gnus-tree-close))
7364 (gnus-async-prefetch-remove-group group) 7364 (gnus-async-prefetch-remove-group group)
7365 (when (get-buffer gnus-article-buffer) 7365 (when (get-buffer gnus-article-buffer)
7366 (bury-buffer gnus-article-buffer)) 7366 (bury-buffer gnus-article-buffer))
@@ -7383,9 +7383,9 @@ The state which existed when entering the ephemeral is reset."
7383 (unless (eq (cdr quit-config) 'group) 7383 (unless (eq (cdr quit-config) 'group)
7384 (setq gnus-current-select-method 7384 (setq gnus-current-select-method
7385 (gnus-find-method-for-group gnus-newsgroup-name))) 7385 (gnus-find-method-for-group gnus-newsgroup-name)))
7386 (cond ((eq major-mode 'gnus-summary-mode) 7386 (cond ((derived-mode-p 'gnus-summary-mode)
7387 (gnus-set-global-variables)) 7387 (gnus-set-global-variables))
7388 ((eq major-mode 'gnus-article-mode) 7388 ((derived-mode-p 'gnus-article-mode)
7389 (save-current-buffer 7389 (save-current-buffer
7390 ;; The `gnus-summary-buffer' variable may point 7390 ;; The `gnus-summary-buffer' variable may point
7391 ;; to the old summary buffer when using a single 7391 ;; to the old summary buffer when using a single
@@ -7400,7 +7400,7 @@ The state which existed when entering the ephemeral is reset."
7400 (gnus-configure-windows 'pick 'force) 7400 (gnus-configure-windows 'pick 'force)
7401 (gnus-configure-windows (cdr quit-config) 'force)) 7401 (gnus-configure-windows (cdr quit-config) 'force))
7402 (gnus-configure-windows (cdr quit-config) 'force)) 7402 (gnus-configure-windows (cdr quit-config) 'force))
7403 (when (eq major-mode 'gnus-summary-mode) 7403 (when (derived-mode-p 'gnus-summary-mode)
7404 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect 7404 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7405 next-unread-noselect)) 7405 next-unread-noselect))
7406 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit 7406 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
@@ -7470,7 +7470,7 @@ The state which existed when entering the ephemeral is reset."
7470 (when (and gnus-use-trees 7470 (when (and gnus-use-trees
7471 (gnus-buffer-exists-p buffer)) 7471 (gnus-buffer-exists-p buffer))
7472 (with-current-buffer buffer 7472 (with-current-buffer buffer
7473 (gnus-tree-close gnus-newsgroup-name))) 7473 (gnus-tree-close)))
7474 (gnus-kill-buffer buffer)) 7474 (gnus-kill-buffer buffer))
7475 ;; Deaden the buffer. 7475 ;; Deaden the buffer.
7476 ((gnus-buffer-exists-p buffer) 7476 ((gnus-buffer-exists-p buffer)
@@ -7699,7 +7699,7 @@ Given a prefix, will force an `article' buffer configuration."
7699 "Display ARTICLE in article buffer." 7699 "Display ARTICLE in article buffer."
7700 (unless (and (gnus-buffer-live-p gnus-article-buffer) 7700 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7701 (with-current-buffer gnus-article-buffer 7701 (with-current-buffer gnus-article-buffer
7702 (eq major-mode 'gnus-article-mode))) 7702 (derived-mode-p 'gnus-article-mode)))
7703 (gnus-article-setup-buffer)) 7703 (gnus-article-setup-buffer))
7704 (gnus-set-global-variables) 7704 (gnus-set-global-variables)
7705 (with-current-buffer gnus-article-buffer 7705 (with-current-buffer gnus-article-buffer
@@ -7731,7 +7731,7 @@ non-nil, the article will be re-fetched even if it already present in
7731the article buffer. If PSEUDO is non-nil, pseudo-articles will also 7731the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7732be displayed." 7732be displayed."
7733 ;; Make sure we are in the summary buffer to work around bbdb bug. 7733 ;; Make sure we are in the summary buffer to work around bbdb bug.
7734 (unless (eq major-mode 'gnus-summary-mode) 7734 (unless (derived-mode-p 'gnus-summary-mode)
7735 (set-buffer gnus-summary-buffer)) 7735 (set-buffer gnus-summary-buffer))
7736 (let ((article (or article (gnus-summary-article-number))) 7736 (let ((article (or article (gnus-summary-article-number)))
7737 (all-headers (not (not all-headers))) ;Must be t or nil. 7737 (all-headers (not (not all-headers))) ;Must be t or nil.
@@ -7783,7 +7783,7 @@ If SUBJECT, only articles with SUBJECT are selected.
7783If BACKWARD, the previous article is selected instead of the next." 7783If BACKWARD, the previous article is selected instead of the next."
7784 (interactive "P") 7784 (interactive "P")
7785 ;; Make sure we are in the summary buffer. 7785 ;; Make sure we are in the summary buffer.
7786 (unless (eq major-mode 'gnus-summary-mode) 7786 (unless (derived-mode-p 'gnus-summary-mode)
7787 (set-buffer gnus-summary-buffer)) 7787 (set-buffer gnus-summary-buffer))
7788 (cond 7788 (cond
7789 ;; Is there such an article? 7789 ;; Is there such an article?
@@ -12680,7 +12680,7 @@ UNREAD is a sorted list."
12680 (string-match "Summary" buffer) 12680 (string-match "Summary" buffer)
12681 (with-current-buffer buffer 12681 (with-current-buffer buffer
12682 ;; We check that this is, indeed, a summary buffer. 12682 ;; We check that this is, indeed, a summary buffer.
12683 (and (eq major-mode 'gnus-summary-mode) 12683 (and (derived-mode-p 'gnus-summary-mode)
12684 ;; Also make sure this isn't bogus. 12684 ;; Also make sure this isn't bogus.
12685 gnus-newsgroup-prepared 12685 gnus-newsgroup-prepared
12686 ;; Also make sure that this isn't a 12686 ;; Also make sure that this isn't a
@@ -12815,7 +12815,7 @@ returned."
12815 12815
12816(defun gnus-summary-generic-mark (n mark move unread) 12816(defun gnus-summary-generic-mark (n mark move unread)
12817 "Mark N articles with MARK." 12817 "Mark N articles with MARK."
12818 (unless (eq major-mode 'gnus-summary-mode) 12818 (unless (derived-mode-p 'gnus-summary-mode)
12819 (error "This command can only be used in the summary buffer")) 12819 (error "This command can only be used in the summary buffer"))
12820 (gnus-summary-show-thread) 12820 (gnus-summary-show-thread)
12821 (let ((nummove 12821 (let ((nummove