comparison lisp/gnus/gnus-group.el @ 85712:a3c27999decb

Update Gnus to No Gnus 0.7 from the Gnus CVS trunk Revision: emacs@sv.gnu.org/emacs--devo--0--patch-911
author Miles Bader <miles@gnu.org>
date Sun, 28 Oct 2007 09:18:39 +0000
parents 2de3ac5bebfe
children ff86fe6b4194
comparison
equal deleted inserted replaced
85711:b6f5dc84b2e1 85712:a3c27999decb
45 45
46 (eval-when-compile 46 (eval-when-compile
47 (require 'mm-url) 47 (require 'mm-url)
48 (let ((features (cons 'gnus-group features))) 48 (let ((features (cons 'gnus-group features)))
49 (require 'gnus-sum)) 49 (require 'gnus-sum))
50 (defvar gnus-cache-active-hashtb)) 50 (unless (boundp 'gnus-cache-active-hashtb)
51 (defvar gnus-cache-active-hashtb nil)))
52
53 (autoload 'gnus-agent-total-fetched-for "gnus-agent")
54 (autoload 'gnus-cache-total-fetched-for "gnus-cache")
51 55
52 (defcustom gnus-group-archive-directory 56 (defcustom gnus-group-archive-directory
53 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/" 57 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
54 "*The address of the (ding) archives." 58 "*The address of the (ding) archives."
55 :group 'gnus-group-foreign 59 :group 'gnus-group-foreign
59 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/" 63 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
60 "*The address of the most recent (ding) articles." 64 "*The address of the most recent (ding) articles."
61 :group 'gnus-group-foreign 65 :group 'gnus-group-foreign
62 :type 'directory) 66 :type 'directory)
63 67
64 (defcustom gnus-no-groups-message "No gnus is bad news" 68 (defcustom gnus-no-groups-message "No Gnus is good news"
65 "*Message displayed by Gnus when no groups are available." 69 "*Message displayed by Gnus when no groups are available."
66 :group 'gnus-start 70 :group 'gnus-start
67 :type 'string) 71 :type 'string)
68 72
69 (defcustom gnus-keep-same-level nil 73 (defcustom gnus-keep-same-level nil
149 (function-item gnus-group-sort-by-method) 153 (function-item gnus-group-sort-by-method)
150 (function-item gnus-group-sort-by-server) 154 (function-item gnus-group-sort-by-server)
151 (function-item gnus-group-sort-by-rank) 155 (function-item gnus-group-sort-by-rank)
152 (function :tag "other" nil)))) 156 (function :tag "other" nil))))
153 157
154 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y:%B%(%g%)%l %O\n" 158 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y:%B%(%g%)%O\n"
155 "*Format of group lines. 159 "*Format of group lines.
156 It works along the same lines as a normal formatting string, 160 It works along the same lines as a normal formatting string,
157 with some simple extensions. 161 with some simple extensions.
158 162
159 %M Only marked articles (character, \"*\" or \" \") 163 %M Only marked articles (character, \"*\" or \" \")
177 %p Process mark (char) 181 %p Process mark (char)
178 %B Whether a summary buffer for the group is open (char, \"*\") 182 %B Whether a summary buffer for the group is open (char, \"*\")
179 %O Moderated group (string, \"(m)\" or \"\") 183 %O Moderated group (string, \"(m)\" or \"\")
180 %P Topic indentation (string) 184 %P Topic indentation (string)
181 %m Whether there is new(ish) mail in the group (char, \"%\") 185 %m Whether there is new(ish) mail in the group (char, \"%\")
182 %l Whether there are GroupLens predictions for this group (string)
183 %n Select from where (string) 186 %n Select from where (string)
184 %z A string that look like `<%s:%n>' if a foreign select method is used 187 %z A string that look like `<%s:%n>' if a foreign select method is used
185 %d The date the group was last entered. 188 %d The date the group was last entered.
186 %E Icon as defined by `gnus-group-icon-list'. 189 %E Icon as defined by `gnus-group-icon-list'.
190 %F The disk space used by the articles fetched by both the cache and agent.
187 %u User defined specifier. The next character in the format string should 191 %u User defined specifier. The next character in the format string should
188 be a letter. Gnus will call the function gnus-user-format-function-X, 192 be a letter. Gnus will call the function gnus-user-format-function-X,
189 where X is the letter following %u. The function will be passed a 193 where X is the letter following %u. The function will be passed a
190 single dummy parameter as argument. The function should return a 194 single dummy parameter as argument. The function should return a
191 string, which will be inserted into the buffer just like information 195 string, which will be inserted into the buffer just like information
196 is ignored altogether. If the spec is changed considerably, your 200 is ignored altogether. If the spec is changed considerably, your
197 output may end up looking strange when listing both alive and killed 201 output may end up looking strange when listing both alive and killed
198 groups. 202 groups.
199 203
200 If you use %o or %O, reading the active file will be slower and quite 204 If you use %o or %O, reading the active file will be slower and quite
201 a bit of extra memory will be used. %D will also worsen performance. 205 a bit of extra memory will be used. %D and %F will also worsen
202 Also note that if you change the format specification to include any 206 performance. Also note that if you change the format specification to
203 of these specs, you must probably re-start Gnus to see them go into 207 include any of these specs, you must probably re-start Gnus to see
204 effect. 208 them go into effect.
205 209
206 General format specifiers can also be used. 210 General format specifiers can also be used.
207 See Info node `(gnus)Formatting Variables'." 211 See Info node `(gnus)Formatting Variables'."
208 :link '(custom-manual "(gnus)Formatting Variables") 212 :link '(custom-manual "(gnus)Formatting Variables")
209 :group 'gnus-group-visual 213 :group 'gnus-group-visual
438 :group 'gnus-charset 442 :group 'gnus-charset
439 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset")))) 443 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
440 444
441 (defcustom gnus-group-jump-to-group-prompt nil 445 (defcustom gnus-group-jump-to-group-prompt nil
442 "Default prompt for `gnus-group-jump-to-group'. 446 "Default prompt for `gnus-group-jump-to-group'.
443 If non-nil, the value should be a string, e.g. \"nnml:\", 447
444 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\" 448 If non-nil, the value should be a string or an alist. If it is a string,
445 in the minibuffer prompt." 449 e.g. \"nnml:\", in which case `gnus-group-jump-to-group' offers \"Group:
450 nnml:\" in the minibuffer prompt.
451
452 If it is an alist, it must consist of \(NUMBER . PROMPT\) pairs, for example:
453 \((1 . \"\") (2 . \"nnfolder+archive:\")). The element with number 0 is
454 used when no prefix argument is given to `gnus-group-jump-to-group'."
446 :version "22.1" 455 :version "22.1"
447 :group 'gnus-group-various 456 :group 'gnus-group-various
448 :type '(choice (string :tag "Prompt string") 457 :type '(choice (string :tag "Prompt string")
449 (const :tag "Empty" nil))) 458 (const :tag "Empty" nil)
459 (repeat (cons (integer :tag "Argument")
460 (string :tag "Prompt string")))))
450 461
451 (defvar gnus-group-listing-limit 1000 462 (defvar gnus-group-listing-limit 1000
452 "*A limit of the number of groups when listing. 463 "*A limit of the number of groups when listing.
453 If the number of groups is larger than the limit, list them in a 464 If the number of groups is larger than the limit, list them in a
454 simple manner.") 465 simple manner.")
510 'gnus-tmp-news-method) 521 'gnus-tmp-news-method)
511 ?s) 522 ?s)
512 (?P gnus-group-indentation ?s) 523 (?P gnus-group-indentation ?s)
513 (?E gnus-tmp-group-icon ?s) 524 (?E gnus-tmp-group-icon ?s)
514 (?B gnus-tmp-summary-live ?c) 525 (?B gnus-tmp-summary-live ?c)
515 (?l gnus-tmp-grouplens ?s)
516 (?z gnus-tmp-news-method-string ?s) 526 (?z gnus-tmp-news-method-string ?s)
517 (?m (gnus-group-new-mail gnus-tmp-group) ?c) 527 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
518 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s) 528 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
519 (?u gnus-tmp-user-defined ?s))) 529 (?u gnus-tmp-user-defined ?s)
530 (?F (gnus-total-fetched-for gnus-tmp-group) ?s)
531 ))
520 532
521 (defvar gnus-group-mode-line-format-alist 533 (defvar gnus-group-mode-line-format-alist
522 `((?S gnus-tmp-news-server ?s) 534 `((?S gnus-tmp-news-server ?s)
523 (?M gnus-tmp-news-method ?s) 535 (?M gnus-tmp-news-method ?s)
524 (?u gnus-tmp-user-defined ?s) 536 (?u gnus-tmp-user-defined ?s)
646 "w" gnus-group-make-web-group 658 "w" gnus-group-make-web-group
647 "M" gnus-group-read-ephemeral-group 659 "M" gnus-group-read-ephemeral-group
648 "r" gnus-group-rename-group 660 "r" gnus-group-rename-group
649 "R" gnus-group-make-rss-group 661 "R" gnus-group-make-rss-group
650 "c" gnus-group-customize 662 "c" gnus-group-customize
663 "z" gnus-group-compact-group
651 "x" gnus-group-nnimap-expunge 664 "x" gnus-group-nnimap-expunge
652 "\177" gnus-group-delete-group 665 "\177" gnus-group-delete-group
653 [delete] gnus-group-delete-group) 666 [delete] gnus-group-delete-group)
654 667
655 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map) 668 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
728 "l" gnus-group-list-plus 741 "l" gnus-group-list-plus
729 "c" gnus-group-list-plus 742 "c" gnus-group-list-plus
730 "?" gnus-group-list-plus) 743 "?" gnus-group-list-plus)
731 744
732 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map) 745 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
733 "f" gnus-score-flush-cache) 746 "f" gnus-score-flush-cache
747 "e" gnus-score-edit-all-score)
734 748
735 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map) 749 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
736 "c" gnus-group-fetch-charter 750 "c" gnus-group-fetch-charter
737 "C" gnus-group-fetch-control 751 "C" gnus-group-fetch-control
738 "d" gnus-group-describe-group 752 "d" gnus-group-describe-group
823 :included (gnus-topic-mode-p)] 837 :included (gnus-topic-mode-p)]
824 ["Set group level..." gnus-group-set-current-level 838 ["Set group level..." gnus-group-set-current-level
825 (gnus-group-group-name)] 839 (gnus-group-group-name)]
826 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)] 840 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
827 ["Customize" gnus-group-customize (gnus-group-group-name)] 841 ["Customize" gnus-group-customize (gnus-group-group-name)]
842 ["Compact" gnus-group-compact-group
843 :active (gnus-group-group-name)]
828 ("Edit" 844 ("Edit"
829 ["Parameters" gnus-group-edit-group-parameters 845 ["Parameters" gnus-group-edit-group-parameters
830 :included (not (gnus-topic-mode-p)) 846 :included (not (gnus-topic-mode-p))
831 :active (gnus-group-group-name)] 847 :active (gnus-group-group-name)]
832 ["Parameters " gnus-topic-edit-parameters 848 ["Parameters " gnus-topic-edit-parameters
1008 `gnus-group-tool-bar-retro'." 1024 `gnus-group-tool-bar-retro'."
1009 :type '(choice (const :tag "GNOME style" gnus-group-tool-bar-gnome) 1025 :type '(choice (const :tag "GNOME style" gnus-group-tool-bar-gnome)
1010 (const :tag "Retro look" gnus-group-tool-bar-retro) 1026 (const :tag "Retro look" gnus-group-tool-bar-retro)
1011 (repeat :tag "User defined list" gmm-tool-bar-item) 1027 (repeat :tag "User defined list" gmm-tool-bar-item)
1012 (symbol)) 1028 (symbol))
1013 :version "22.1" ;; Gnus 5.10.9 1029 :version "23.0" ;; No Gnus
1014 :initialize 'custom-initialize-default 1030 :initialize 'custom-initialize-default
1015 :set 'gnus-group-tool-bar-update 1031 :set 'gnus-group-tool-bar-update
1016 :group 'gnus-group) 1032 :group 'gnus-group)
1017 1033
1018 (defcustom gnus-group-tool-bar-gnome 1034 (defcustom gnus-group-tool-bar-gnome
1051 (gnus-info-find-node "help")) 1067 (gnus-info-find-node "help"))
1052 "List of functions for the group tool bar (GNOME style). 1068 "List of functions for the group tool bar (GNOME style).
1053 1069
1054 See `gmm-tool-bar-from-list' for the format of the list." 1070 See `gmm-tool-bar-from-list' for the format of the list."
1055 :type '(repeat gmm-tool-bar-item) 1071 :type '(repeat gmm-tool-bar-item)
1056 :version "22.1" ;; Gnus 5.10.9 1072 :version "23.0" ;; No Gnus
1057 :initialize 'custom-initialize-default 1073 :initialize 'custom-initialize-default
1058 :set 'gnus-group-tool-bar-update 1074 :set 'gnus-group-tool-bar-update
1059 :group 'gnus-group) 1075 :group 'gnus-group)
1060 1076
1061 (defcustom gnus-group-tool-bar-retro 1077 (defcustom gnus-group-tool-bar-retro
1070 (gnus-group-exit "gnus/exit-gnus" gnus-group-mode-map)) 1086 (gnus-group-exit "gnus/exit-gnus" gnus-group-mode-map))
1071 "List of functions for the group tool bar (retro look). 1087 "List of functions for the group tool bar (retro look).
1072 1088
1073 See `gmm-tool-bar-from-list' for the format of the list." 1089 See `gmm-tool-bar-from-list' for the format of the list."
1074 :type '(repeat gmm-tool-bar-item) 1090 :type '(repeat gmm-tool-bar-item)
1075 :version "22.1" ;; Gnus 5.10.9 1091 :version "23.0" ;; No Gnus
1076 :initialize 'custom-initialize-default 1092 :initialize 'custom-initialize-default
1077 :set 'gnus-group-tool-bar-update 1093 :set 'gnus-group-tool-bar-update
1078 :group 'gnus-group) 1094 :group 'gnus-group)
1079 1095
1080 (defcustom gnus-group-tool-bar-zap-list t 1096 (defcustom gnus-group-tool-bar-zap-list t
1081 "List of icon items from the global tool bar. 1097 "List of icon items from the global tool bar.
1082 These items are not displayed in the Gnus group mode tool bar. 1098 These items are not displayed in the Gnus group mode tool bar.
1083 1099
1084 See `gmm-tool-bar-from-list' for the format of the list." 1100 See `gmm-tool-bar-from-list' for the format of the list."
1085 :type 'gmm-tool-bar-zap-list 1101 :type 'gmm-tool-bar-zap-list
1086 :version "22.1" ;; Gnus 5.10.9 1102 :version "23.0" ;; No Gnus
1087 :initialize 'custom-initialize-default 1103 :initialize 'custom-initialize-default
1088 :set 'gnus-group-tool-bar-update 1104 :set 'gnus-group-tool-bar-update
1089 :group 'gnus-group) 1105 :group 'gnus-group)
1090 1106
1091 (defvar image-load-path) 1107 (defvar image-load-path)
1141 (gnus-group-set-mode-line) 1157 (gnus-group-set-mode-line)
1142 (setq mode-line-process nil) 1158 (setq mode-line-process nil)
1143 (use-local-map gnus-group-mode-map) 1159 (use-local-map gnus-group-mode-map)
1144 (buffer-disable-undo) 1160 (buffer-disable-undo)
1145 (setq truncate-lines t) 1161 (setq truncate-lines t)
1146 (setq buffer-read-only t) 1162 (setq buffer-read-only t
1163 show-trailing-whitespace nil)
1147 (gnus-set-default-directory) 1164 (gnus-set-default-directory)
1148 (gnus-update-format-specifications nil 'group 'group-mode) 1165 (gnus-update-format-specifications nil 'group 'group-mode)
1149 (gnus-update-group-mark-positions) 1166 (gnus-update-group-mark-positions)
1150 (when gnus-use-undo 1167 (when gnus-use-undo
1151 (gnus-undo-mode 1)) 1168 (gnus-undo-mode 1))
1200 (gnus-carpal-setup-buffer 'group)))) 1217 (gnus-carpal-setup-buffer 'group))))
1201 1218
1202 (defun gnus-group-name-charset (method group) 1219 (defun gnus-group-name-charset (method group)
1203 (if (null method) 1220 (if (null method)
1204 (setq method (gnus-find-method-for-group group))) 1221 (setq method (gnus-find-method-for-group group)))
1205 (let ((item (assoc method gnus-group-name-charset-method-alist)) 1222 (let ((item (or (assoc method gnus-group-name-charset-method-alist)
1223 (and (consp method)
1224 (assoc (list (car method) (cadr method))
1225 gnus-group-name-charset-method-alist))))
1206 (alist gnus-group-name-charset-group-alist) 1226 (alist gnus-group-name-charset-group-alist)
1207 result) 1227 result)
1208 (if item 1228 (if item
1209 (cdr item) 1229 (cdr item)
1210 (while (setq item (pop alist)) 1230 (while (setq item (pop alist))
1242 unread (cdr gnus-group-list-mode))) 1262 unread (cdr gnus-group-list-mode)))
1243 (setq level (gnus-group-default-level level)) 1263 (setq level (gnus-group-default-level level))
1244 (gnus-group-setup-buffer) 1264 (gnus-group-setup-buffer)
1245 (gnus-update-format-specifications nil 'group 'group-mode) 1265 (gnus-update-format-specifications nil 'group 'group-mode)
1246 (let ((case-fold-search nil) 1266 (let ((case-fold-search nil)
1247 (props (text-properties-at (gnus-point-at-bol))) 1267 (props (text-properties-at (point-at-bol)))
1248 (empty (= (point-min) (point-max))) 1268 (empty (= (point-min) (point-max)))
1249 (group (gnus-group-group-name)) 1269 (group (gnus-group-group-name))
1250 number) 1270 number)
1251 (set-buffer gnus-group-buffer) 1271 (set-buffer gnus-group-buffer)
1252 (setq number (funcall gnus-group-prepare-function level unread lowest)) 1272 (setq number (funcall gnus-group-prepare-function level unread lowest))
1274 (when (not (gnus-goto-char 1294 (when (not (gnus-goto-char
1275 (text-property-any 1295 (text-property-any
1276 (point-min) (point-max) 1296 (point-min) (point-max)
1277 'gnus-group (gnus-intern-safe 1297 'gnus-group (gnus-intern-safe
1278 group gnus-active-hashtb)))) 1298 group gnus-active-hashtb))))
1279 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb)))) 1299 (let ((newsrc (cdddr (gnus-group-entry group))))
1280 (while (and newsrc 1300 (while (and newsrc
1281 (not (gnus-goto-char 1301 (not (gnus-goto-char
1282 (text-property-any 1302 (text-property-any
1283 (point-min) (point-max) 'gnus-group 1303 (point-min) (point-max) 'gnus-group
1284 (gnus-intern-safe 1304 (gnus-intern-safe
1329 (while newsrc 1349 (while newsrc
1330 (setq info (car newsrc) 1350 (setq info (car newsrc)
1331 group (gnus-info-group info) 1351 group (gnus-info-group info)
1332 params (gnus-info-params info) 1352 params (gnus-info-params info)
1333 newsrc (cdr newsrc) 1353 newsrc (cdr newsrc)
1334 unread (car (gnus-gethash group gnus-newsrc-hashtb))) 1354 unread (gnus-group-unread group))
1335 (when not-in-list 1355 (when not-in-list
1336 (setq not-in-list (delete group not-in-list))) 1356 (setq not-in-list (delete group not-in-list)))
1337 (when (gnus-group-prepare-logic 1357 (when (gnus-group-prepare-logic
1338 group 1358 group
1339 (and unread ; This group might be unchecked 1359 (and unread ; This group might be unchecked
1429 1449
1430 (defun gnus-group-update-group-line () 1450 (defun gnus-group-update-group-line ()
1431 "Update the current line in the group buffer." 1451 "Update the current line in the group buffer."
1432 (let* ((buffer-read-only nil) 1452 (let* ((buffer-read-only nil)
1433 (group (gnus-group-group-name)) 1453 (group (gnus-group-group-name))
1434 (entry (and group (gnus-gethash group gnus-newsrc-hashtb))) 1454 (entry (and group (gnus-group-entry group)))
1435 gnus-group-indentation) 1455 gnus-group-indentation)
1436 (when group 1456 (when group
1437 (and entry 1457 (and entry
1438 (not (gnus-ephemeral-group-p group)) 1458 (not (gnus-ephemeral-group-p group))
1439 (gnus-dribble-enter 1459 (gnus-dribble-enter
1446 (forward-line -1) 1466 (forward-line -1)
1447 (gnus-group-position-point)))) 1467 (gnus-group-position-point))))
1448 1468
1449 (defun gnus-group-insert-group-line-info (group) 1469 (defun gnus-group-insert-group-line-info (group)
1450 "Insert GROUP on the current line." 1470 "Insert GROUP on the current line."
1451 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)) 1471 (let ((entry (gnus-group-entry group))
1452 (gnus-group-indentation (gnus-group-group-indentation)) 1472 (gnus-group-indentation (gnus-group-group-indentation))
1453 active info) 1473 active info)
1454 (if entry 1474 (if entry
1455 (progn 1475 (progn
1456 ;; (Un)subscribed group. 1476 ;; (Un)subscribed group.
1573 gnus-tmp-group))) 1593 gnus-tmp-group)))
1574 ?* ? )) 1594 ?* ? ))
1575 (gnus-tmp-process-marked 1595 (gnus-tmp-process-marked
1576 (if (member gnus-tmp-group gnus-group-marked) 1596 (if (member gnus-tmp-group gnus-group-marked)
1577 gnus-process-mark ? )) 1597 gnus-process-mark ? ))
1578 (gnus-tmp-grouplens
1579 (or (and gnus-use-grouplens
1580 (bbb-grouplens-group-p gnus-tmp-group))
1581 ""))
1582 (buffer-read-only nil) 1598 (buffer-read-only nil)
1583 beg end 1599 beg end
1584 header gnus-tmp-header) ; passed as parameter to user-funcs. 1600 header gnus-tmp-header) ; passed as parameter to user-funcs.
1585 (beginning-of-line) 1601 (beginning-of-line)
1586 (setq beg (point)) 1602 (setq beg (point))
1613 1629
1614 (defun gnus-group-highlight-line () 1630 (defun gnus-group-highlight-line ()
1615 "Highlight the current line according to `gnus-group-highlight'." 1631 "Highlight the current line according to `gnus-group-highlight'."
1616 (let* ((list gnus-group-highlight) 1632 (let* ((list gnus-group-highlight)
1617 (p (point)) 1633 (p (point))
1618 (end (gnus-point-at-eol)) 1634 (end (point-at-eol))
1619 ;; now find out where the line starts and leave point there. 1635 ;; now find out where the line starts and leave point there.
1620 (beg (progn (beginning-of-line) (point))) 1636 (beg (progn (beginning-of-line) (point)))
1621 (group (gnus-group-group-name)) 1637 (group (gnus-group-group-name))
1622 (entry (gnus-group-entry group)) 1638 (entry (gnus-group-entry group))
1623 (unread (if (numberp (car entry)) (car entry) 0)) 1639 (unread (if (numberp (car entry)) (car entry) 0))
1664 (widen) 1680 (widen)
1665 (let ((ident (gnus-intern-safe group gnus-active-hashtb)) 1681 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1666 (loc (point-min)) 1682 (loc (point-min))
1667 found buffer-read-only) 1683 found buffer-read-only)
1668 ;; Enter the current status into the dribble buffer. 1684 ;; Enter the current status into the dribble buffer.
1669 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))) 1685 (let ((entry (gnus-group-entry group)))
1670 (when (and entry 1686 (when (and entry
1671 (not (gnus-ephemeral-group-p group))) 1687 (not (gnus-ephemeral-group-p group)))
1672 (gnus-dribble-enter 1688 (gnus-dribble-enter
1673 (concat "(gnus-group-set-info '" 1689 (concat "(gnus-group-set-info '"
1674 (gnus-prin1-to-string (nth 2 entry)) 1690 (gnus-prin1-to-string (nth 2 entry))
1689 (unless (or found visible-only) 1705 (unless (or found visible-only)
1690 ;; No such line in the buffer, find out where it's supposed to 1706 ;; No such line in the buffer, find out where it's supposed to
1691 ;; go, and insert it there (or at the end of the buffer). 1707 ;; go, and insert it there (or at the end of the buffer).
1692 (if gnus-goto-missing-group-function 1708 (if gnus-goto-missing-group-function
1693 (funcall gnus-goto-missing-group-function group) 1709 (funcall gnus-goto-missing-group-function group)
1694 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb)))) 1710 (let ((entry (cddr (gnus-group-entry group))))
1695 (while (and entry (car entry) 1711 (while (and entry (car entry)
1696 (not 1712 (not
1697 (gnus-goto-char 1713 (gnus-goto-char
1698 (text-property-any 1714 (text-property-any
1699 (point-min) (point-max) 1715 (point-min) (point-max)
1749 (list mode-string))) 1765 (list mode-string)))
1750 (set-buffer-modified-p modified)))))) 1766 (set-buffer-modified-p modified))))))
1751 1767
1752 (defun gnus-group-group-name () 1768 (defun gnus-group-group-name ()
1753 "Get the name of the newsgroup on the current line." 1769 "Get the name of the newsgroup on the current line."
1754 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group))) 1770 (let ((group (get-text-property (point-at-bol) 'gnus-group)))
1755 (when group 1771 (when group
1756 (symbol-name group)))) 1772 (symbol-name group))))
1757 1773
1758 (defun gnus-group-group-level () 1774 (defun gnus-group-group-level ()
1759 "Get the level of the newsgroup on the current line." 1775 "Get the level of the newsgroup on the current line."
1760 (get-text-property (gnus-point-at-bol) 'gnus-level)) 1776 (get-text-property (point-at-bol) 'gnus-level))
1761 1777
1762 (defun gnus-group-group-indentation () 1778 (defun gnus-group-group-indentation ()
1763 "Get the indentation of the newsgroup on the current line." 1779 "Get the indentation of the newsgroup on the current line."
1764 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation) 1780 (or (get-text-property (point-at-bol) 'gnus-indentation)
1765 (and gnus-group-indentation-function 1781 (and gnus-group-indentation-function
1766 (funcall gnus-group-indentation-function)) 1782 (funcall gnus-group-indentation-function))
1767 "")) 1783 ""))
1768 1784
1769 (defun gnus-group-group-unread () 1785 (defun gnus-group-group-unread ()
1770 "Get the number of unread articles of the newsgroup on the current line." 1786 "Get the number of unread articles of the newsgroup on the current line."
1771 (get-text-property (gnus-point-at-bol) 'gnus-unread)) 1787 (get-text-property (point-at-bol) 'gnus-unread))
1772 1788
1773 (defun gnus-group-new-mail (group) 1789 (defun gnus-group-new-mail (group)
1774 (if (nnmail-new-mail-p (gnus-group-real-name group)) 1790 (if (nnmail-new-mail-p (gnus-group-real-name group))
1775 gnus-new-mail-mark 1791 gnus-new-mail-mark
1776 ? )) 1792 ? ))
1824 (if found 1840 (if found
1825 (progn (gnus-group-position-point) t) 1841 (progn (gnus-group-position-point) t)
1826 (goto-char (or pos beg)) 1842 (goto-char (or pos beg))
1827 (and pos t)))) 1843 (and pos t))))
1828 1844
1845 (defun gnus-total-fetched-for (group)
1846 (let* ((size-in-cache (or (gnus-cache-total-fetched-for group) 0))
1847 (size-in-agent (or (gnus-agent-total-fetched-for group) 0))
1848 (size (+ size-in-cache size-in-agent))
1849 (suffix '("B" "K" "M" "G"))
1850 (scale 1024.0)
1851 (cutoff scale))
1852 (while (> size cutoff)
1853 (setq size (/ size scale)
1854 suffix (cdr suffix)))
1855 (format "%5.1f%s" size (car suffix))))
1856
1829 ;;; Gnus group mode commands 1857 ;;; Gnus group mode commands
1830 1858
1831 ;; Group marking. 1859 ;; Group marking.
1832 1860
1833 (defun gnus-group-mark-line-p () 1861 (defun gnus-group-mark-line-p ()
1845 (not (eobp))) 1873 (not (eobp)))
1846 (when (setq group (gnus-group-group-name)) 1874 (when (setq group (gnus-group-group-name))
1847 ;; Go to the mark position. 1875 ;; Go to the mark position.
1848 (beginning-of-line) 1876 (beginning-of-line)
1849 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2)) 1877 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1850 (subst-char-in-region 1878 (delete-char 1)
1851 (point) (1+ (point)) (char-after) 1879 (if unmark
1852 (if unmark 1880 (progn
1853 (progn 1881 (setq gnus-group-marked (delete group gnus-group-marked))
1854 (setq gnus-group-marked (delete group gnus-group-marked)) 1882 (insert-char ? 1 t))
1855 ? )
1856 (setq gnus-group-marked 1883 (setq gnus-group-marked
1857 (cons group (delete group gnus-group-marked))) 1884 (cons group (delete group gnus-group-marked)))
1858 gnus-process-mark))) 1885 (insert-char gnus-process-mark 1 t)))
1859 (unless no-advance 1886 (unless no-advance
1860 (gnus-group-next-group 1)) 1887 (gnus-group-next-group 1))
1861 (decf n)) 1888 (decf n))
1862 (gnus-summary-position-point) 1889 (gnus-summary-position-point)
1863 n)) 1890 n))
1869 (gnus-group-position-point)) 1896 (gnus-group-position-point))
1870 1897
1871 (defun gnus-group-unmark-all-groups () 1898 (defun gnus-group-unmark-all-groups ()
1872 "Unmark all groups." 1899 "Unmark all groups."
1873 (interactive) 1900 (interactive)
1874 (let ((groups gnus-group-marked)) 1901 (save-excursion
1875 (save-excursion 1902 (mapc 'gnus-group-remove-mark gnus-group-marked))
1876 (while groups
1877 (gnus-group-remove-mark (pop groups)))))
1878 (gnus-group-position-point)) 1903 (gnus-group-position-point))
1879 1904
1880 (defun gnus-group-mark-region (unmark beg end) 1905 (defun gnus-group-mark-region (unmark beg end)
1881 "Mark all groups between point and mark. 1906 "Mark all groups between point and mark.
1882 If UNMARK, remove the mark instead." 1907 If UNMARK, remove the mark instead."
2018 (when (eq all 0) 2043 (when (eq all 0)
2019 (setq all nil)) 2044 (setq all nil))
2020 (unless group 2045 (unless group
2021 (error "No group on current line")) 2046 (error "No group on current line"))
2022 (setq marked (gnus-info-marks 2047 (setq marked (gnus-info-marks
2023 (nth 2 (setq entry (gnus-gethash 2048 (nth 2 (setq entry (gnus-group-entry group)))))
2024 group gnus-newsrc-hashtb)))))
2025 ;; This group might be a dead group. In that case we have to get 2049 ;; This group might be a dead group. In that case we have to get
2026 ;; the number of unread articles from `gnus-active-hashtb'. 2050 ;; the number of unread articles from `gnus-active-hashtb'.
2027 (setq number 2051 (setq number
2028 (cond ((numberp all) all) 2052 (cond ((numberp all) all)
2029 (entry (car entry)) 2053 (entry (car entry))
2049 (interactive "P") 2073 (interactive "P")
2050 (when (and (eobp) (not (gnus-group-group-name))) 2074 (when (and (eobp) (not (gnus-group-group-name)))
2051 (forward-line -1)) 2075 (forward-line -1))
2052 (gnus-group-read-group all t)) 2076 (gnus-group-read-group all t))
2053 2077
2054 (defun gnus-group-quick-select-group (&optional all) 2078 (defun gnus-group-quick-select-group (&optional all group)
2055 "Select the current group \"quickly\". 2079 "Select the GROUP \"quickly\".
2056 This means that no highlighting or scoring will be performed. 2080 This means that no highlighting or scoring will be performed. If
2057 If ALL (the prefix argument) is 0, don't even generate the summary 2081 ALL (the prefix argument) is 0, don't even generate the summary
2058 buffer. 2082 buffer. If GROUP is nil, use current group.
2059 2083
2060 This might be useful if you want to toggle threading 2084 This might be useful if you want to toggle threading
2061 before entering the group." 2085 before entering the group."
2062 (interactive "P") 2086 (interactive "P")
2063 (require 'gnus-score) 2087 (require 'gnus-score)
2064 (let (gnus-visual 2088 (let (gnus-visual
2065 gnus-score-find-score-files-function 2089 gnus-score-find-score-files-function
2066 gnus-home-score-file 2090 gnus-home-score-file
2067 gnus-apply-kill-hook 2091 gnus-apply-kill-hook
2068 gnus-summary-expunge-below) 2092 gnus-summary-expunge-below)
2069 (gnus-group-read-group all t))) 2093 (gnus-group-read-group all t group)))
2070 2094
2071 (defun gnus-group-visible-select-group (&optional all) 2095 (defun gnus-group-visible-select-group (&optional all)
2072 "Select the current group without hiding any articles." 2096 "Select the current group without hiding any articles."
2073 (interactive "P") 2097 (interactive "P")
2074 (let ((gnus-inhibit-limiting t)) 2098 (let ((gnus-inhibit-limiting t))
2088 (group (gnus-group-group-name)) 2112 (group (gnus-group-group-name))
2089 (method (gnus-find-method-for-group group))) 2113 (method (gnus-find-method-for-group group)))
2090 (gnus-group-read-ephemeral-group 2114 (gnus-group-read-ephemeral-group
2091 (gnus-group-prefixed-name group method) method))) 2115 (gnus-group-prefixed-name group method) method)))
2092 2116
2117 (defun gnus-group-name-at-point ()
2118 "Return a group name from around point if it exists, or nil."
2119 (if (eq major-mode 'gnus-group-mode)
2120 (let ((group (gnus-group-group-name)))
2121 (when group
2122 (gnus-group-decoded-name group)))
2123 (let ((regexp "[][\C-@-\t\v-*,/:-@\\^`{-\C-?]*\
2124 \\(nn[a-z]+\\(?:\\+[^][\C-@-*,/:-@\\^`{-\C-?]+\\)?:\
2125 \[^][\C-@-*,./:-@\\^`{-\C-?]+\\(?:\\.[^][\C-@-*,./:-@\\^`{-\C-?]+\\)*\
2126 \\|[^][\C-@-*,./:-@\\^`{-\C-?]+\\(?:\\.[^][\C-@-*,./:-@\\^`{-\C-?]+\\)+\\)")
2127 (start (point))
2128 (case-fold-search nil))
2129 (prog1
2130 (if (or (and (not (or (eobp)
2131 (looking-at "[][\C-@-*,/;-@\\^`{-\C-?]")))
2132 (prog1 t
2133 (skip-chars-backward "^][\C-@-\t\v-*,/;-@\\^`{-\C-?"
2134 (point-at-bol))))
2135 (and (looking-at "[][\C-@-\t\v-*,/;-@\\^`{-\C-?]*$")
2136 (prog1 t
2137 (skip-chars-backward "][\C-@-\t\v-*,/;-@\\^`{-\C-?")
2138 (skip-chars-backward "^][\C-@-\t\v-*,/;-@\\^`{-\C-?"
2139 (point-at-bol))))
2140 (string-match "\\`[][\C-@-\t\v-*,/;-@\\^`{-\C-?]*\\'"
2141 (buffer-substring (point-at-bol) (point))))
2142 (when (looking-at regexp)
2143 (match-string 1))
2144 (let (group distance)
2145 (when (looking-at regexp)
2146 (setq group (match-string 1)
2147 distance (- (match-beginning 1) (match-beginning 0))))
2148 (skip-chars-backward "][\C-@-\t\v-*,/;-@\\^`{-\C-?")
2149 (skip-chars-backward "^][\C-@-\t\v-*,/;-@\\^`{-\C-?"
2150 (point-at-bol))
2151 (if (looking-at regexp)
2152 (if (and group (<= distance (- start (match-end 0))))
2153 group
2154 (match-string 1))
2155 group)))
2156 (goto-char start)))))
2157
2158 (defun gnus-group-completing-read (prompt &optional collection predicate
2159 require-match initial-input hist def
2160 &rest args)
2161 "Read a group name with completion. Non-ASCII group names are allowed.
2162 The arguments are the same as `completing-read' except that COLLECTION
2163 and HIST default to `gnus-active-hashtb' and `gnus-group-history'
2164 respectively if they are omitted."
2165 (let (group)
2166 (mapatoms (lambda (symbol)
2167 (setq group (symbol-name symbol))
2168 (set (intern (if (string-match "[^\000-\177]" group)
2169 (gnus-group-decoded-name group)
2170 group)
2171 collection)
2172 group))
2173 (prog1
2174 (or collection
2175 (setq collection (or gnus-active-hashtb [0])))
2176 (setq collection (gnus-make-hashtable (length collection)))))
2177 (setq group (apply 'completing-read prompt collection predicate
2178 require-match initial-input
2179 (or hist 'gnus-group-history)
2180 def args))
2181 (or (prog1
2182 (symbol-value (intern-soft group collection))
2183 (setq collection nil))
2184 (mm-encode-coding-string group (gnus-group-name-charset nil group)))))
2185
2093 ;;;###autoload 2186 ;;;###autoload
2094 (defun gnus-fetch-group (group &optional articles) 2187 (defun gnus-fetch-group (group &optional articles)
2095 "Start Gnus if necessary and enter GROUP. 2188 "Start Gnus if necessary and enter GROUP.
2189 If ARTICLES, display those articles.
2096 Returns whether the fetching was successful or not." 2190 Returns whether the fetching was successful or not."
2097 (interactive (list (completing-read "Group name: " gnus-active-hashtb))) 2191 (interactive (list (gnus-group-completing-read "Group name: "
2098 (unless (get-buffer gnus-group-buffer) 2192 nil nil nil
2193 (gnus-group-name-at-point))))
2194 (unless (gnus-alive-p)
2099 (gnus-no-server)) 2195 (gnus-no-server))
2100 (gnus-group-read-group articles nil group)) 2196 (gnus-group-read-group (if articles nil t) nil group articles))
2101 2197
2102 ;;;###autoload 2198 ;;;###autoload
2103 (defun gnus-fetch-group-other-frame (group) 2199 (defun gnus-fetch-group-other-frame (group)
2104 "Pop up a frame and enter GROUP." 2200 "Pop up a frame and enter GROUP."
2105 (interactive "P") 2201 (interactive "P")
2153 2249
2154 Return the name of the group if selection was successful." 2250 Return the name of the group if selection was successful."
2155 (interactive 2251 (interactive
2156 (list 2252 (list
2157 ;; (gnus-read-group "Group name: ") 2253 ;; (gnus-read-group "Group name: ")
2158 (completing-read 2254 (gnus-group-completing-read "Group: ")
2159 "Group: " gnus-active-hashtb
2160 nil nil nil
2161 'gnus-group-history)
2162 (gnus-read-method "From method: "))) 2255 (gnus-read-method "From method: ")))
2163 ;; Transform the select method into a unique server. 2256 ;; Transform the select method into a unique server.
2164 (when (stringp method) 2257 (when (stringp method)
2165 (setq method (gnus-server-to-method method))) 2258 (setq method (gnus-server-to-method method)))
2166 (setq method 2259 (setq method
2202 ;;(error nil) 2295 ;;(error nil)
2203 (quit 2296 (quit
2204 (message "Quit reading the ephemeral group") 2297 (message "Quit reading the ephemeral group")
2205 nil))))) 2298 nil)))))
2206 2299
2207 (defun gnus-group-jump-to-group (group) 2300 (defun gnus-group-jump-to-group (group &optional prompt)
2208 "Jump to newsgroup GROUP." 2301 "Jump to newsgroup GROUP.
2302
2303 If PROMPT (the prefix) is a number, use the prompt specified in
2304 `gnus-group-jump-to-group-prompt'."
2209 (interactive 2305 (interactive
2210 (list (mm-string-make-unibyte 2306 (list (gnus-group-completing-read
2211 (completing-read 2307 "Group: " nil nil (gnus-read-active-file-p)
2212 "Group: " gnus-active-hashtb nil 2308 (if current-prefix-arg
2213 (gnus-read-active-file-p) 2309 (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
2214 gnus-group-jump-to-group-prompt 2310 (or (and (stringp gnus-group-jump-to-group-prompt)
2215 'gnus-group-history)))) 2311 gnus-group-jump-to-group-prompt)
2312 (let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
2313 (and (stringp p) p)))))))
2216 2314
2217 (when (equal group "") 2315 (when (equal group "")
2218 (error "Empty group name")) 2316 (error "Empty group name"))
2219 2317
2220 (unless (gnus-ephemeral-group-p group) 2318 (unless (gnus-ephemeral-group-p group)
2358 (when best-point 2456 (when best-point
2359 (goto-char best-point)) 2457 (goto-char best-point))
2360 (gnus-group-position-point) 2458 (gnus-group-position-point)
2361 (and best-point (gnus-group-group-name)))) 2459 (and best-point (gnus-group-group-name))))
2362 2460
2461 ;; Is there something like an after-point-motion-hook?
2462 ;; (inhibit-point-motion-hooks?). Is there a tool-bar-update function?
2463
2464 ;; (defun gnus-group-menu-bar-update ()
2465 ;; (let* ((buf (list (with-current-buffer gnus-group-buffer
2466 ;; (current-buffer))))
2467 ;; (name (buffer-name (car buf))))
2468 ;; (setcdr buf
2469 ;; (if (> (length name) 27)
2470 ;; (concat (substring name 0 12)
2471 ;; "..."
2472 ;; (substring name -12))
2473 ;; name))
2474 ;; (menu-bar-update-buffers-1 buf)))
2475
2476 ;; (defun gnus-group-position-point ()
2477 ;; (gnus-goto-colon)
2478 ;; (gnus-group-menu-bar-update))
2479
2363 (defun gnus-group-first-unread-group () 2480 (defun gnus-group-first-unread-group ()
2364 "Go to the first group with unread articles." 2481 "Go to the first group with unread articles."
2365 (interactive) 2482 (interactive)
2366 (prog1 2483 (prog1
2367 (let ((opoint (point)) 2484 (let ((opoint (point))
2379 (defun gnus-group-enter-server-mode () 2496 (defun gnus-group-enter-server-mode ()
2380 "Jump to the server buffer." 2497 "Jump to the server buffer."
2381 (interactive) 2498 (interactive)
2382 (gnus-enter-server-buffer)) 2499 (gnus-enter-server-buffer))
2383 2500
2384 (defun gnus-group-make-group (name &optional method address args) 2501 (defun gnus-group-make-group-simple (&optional group)
2502 "Add a new newsgroup.
2503 The user will be prompted for GROUP."
2504 (interactive (list (gnus-group-completing-read "Group: ")))
2505 (gnus-group-make-group (gnus-group-real-name group)
2506 (gnus-group-server group)
2507 nil nil t))
2508
2509 (defun gnus-group-make-group (name &optional method address args encoded)
2385 "Add a new newsgroup. 2510 "Add a new newsgroup.
2386 The user will be prompted for a NAME, for a select METHOD, and an 2511 The user will be prompted for a NAME, for a select METHOD, and an
2387 ADDRESS." 2512 ADDRESS. NAME should be a human-readable string (i.e., not be encoded
2513 even if it contains non-ASCII characters) unless ENCODED is non-nil."
2388 (interactive 2514 (interactive
2389 (list 2515 (list
2390 (gnus-read-group "Group name: ") 2516 (gnus-read-group "Group name: ")
2391 (gnus-read-method "From method: "))) 2517 (gnus-read-method "From method: ")))
2392 2518
2393 (when (stringp method) 2519 (when (stringp method)
2394 (setq method (or (gnus-server-to-method method) method))) 2520 (setq method (or (gnus-server-to-method method) method)))
2521 (unless encoded
2522 (setq name (mm-encode-coding-string
2523 name
2524 (gnus-group-name-charset method name))))
2395 (let* ((meth (gnus-method-simplify 2525 (let* ((meth (gnus-method-simplify
2396 (when (and method 2526 (when (and method
2397 (not (gnus-server-equal method gnus-select-method))) 2527 (not (gnus-server-equal method gnus-select-method)))
2398 (if address (list (intern method) address) 2528 (if address (list (intern method) address)
2399 method)))) 2529 method))))
2400 (nname (if method (gnus-group-prefixed-name name meth) name)) 2530 (nname (if method (gnus-group-prefixed-name name meth) name))
2401 backend info) 2531 backend info)
2402 (when (gnus-gethash nname gnus-newsrc-hashtb) 2532 (when (gnus-group-entry nname)
2403 (error "Group %s already exists" (gnus-group-decoded-name nname))) 2533 (error "Group %s already exists" (gnus-group-decoded-name nname)))
2404 ;; Subscribe to the new group. 2534 ;; Subscribe to the new group.
2405 (gnus-group-change-level 2535 (gnus-group-change-level
2406 (setq info (list t nname gnus-level-default-subscribed nil nil meth)) 2536 (setq info (list t nname gnus-level-default-subscribed nil nil meth))
2407 gnus-level-default-subscribed gnus-level-killed 2537 gnus-level-default-subscribed gnus-level-killed
2408 (and (gnus-group-group-name) 2538 (and (gnus-group-group-name)
2409 (gnus-gethash (gnus-group-group-name) 2539 (gnus-group-entry (gnus-group-group-name)))
2410 gnus-newsrc-hashtb))
2411 t) 2540 t)
2412 ;; Make it active. 2541 ;; Make it active.
2413 (gnus-set-active nname (cons 1 0)) 2542 (gnus-set-active nname (cons 1 0))
2414 (unless (gnus-ephemeral-group-p name) 2543 (unless (gnus-ephemeral-group-p name)
2415 (gnus-dribble-enter 2544 (gnus-dribble-enter
2472 (if (not (gnus-request-delete-group group force)) 2601 (if (not (gnus-request-delete-group group force))
2473 (gnus-error 3 "Couldn't delete group %s" group-decoded) 2602 (gnus-error 3 "Couldn't delete group %s" group-decoded)
2474 (gnus-message 6 "Deleting group %s...done" group-decoded) 2603 (gnus-message 6 "Deleting group %s...done" group-decoded)
2475 (gnus-group-goto-group group) 2604 (gnus-group-goto-group group)
2476 (gnus-group-kill-group 1 t) 2605 (gnus-group-kill-group 1 t)
2477 (gnus-sethash group nil gnus-active-hashtb) 2606 (gnus-set-active group nil)
2478 t))) 2607 t)))
2479 (gnus-group-position-point))) 2608 (gnus-group-position-point)))
2480 2609
2481 (defun gnus-group-rename-group (group new-name) 2610 (defun gnus-group-rename-group (group new-name)
2482 "Rename group from GROUP to NEW-NAME. 2611 "Rename group from GROUP to NEW-NAME.
2639 - if t, stay silent, 2768 - if t, stay silent,
2640 - if anything else, just print a message." 2769 - if anything else, just print a message."
2641 (interactive) 2770 (interactive)
2642 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help"))) 2771 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2643 (file (nnheader-find-etc-directory "gnus-tut.txt" t))) 2772 (file (nnheader-find-etc-directory "gnus-tut.txt" t)))
2644 (if (gnus-gethash name gnus-newsrc-hashtb) 2773 (if (gnus-group-entry name)
2645 (cond ((eq noerror nil) 2774 (cond ((eq noerror nil)
2646 (error "Documentation group already exists")) 2775 (error "Documentation group already exists"))
2647 ((eq noerror t) 2776 ((eq noerror t)
2648 ;; stay silent 2777 ;; stay silent
2649 ) 2778 )
2682 ((= char ?g) 'guess) 2811 ((= char ?g) 'guess)
2683 (t (setq err (format "%c unknown. " char)) 2812 (t (setq err (format "%c unknown. " char))
2684 nil)))) 2813 nil))))
2685 (setq type found))) 2814 (setq type found)))
2686 (setq file (expand-file-name file)) 2815 (setq file (expand-file-name file))
2687 (let ((name (gnus-generate-new-group-name 2816 (let* ((name (gnus-generate-new-group-name
2688 (gnus-group-prefixed-name 2817 (gnus-group-prefixed-name
2689 (file-name-nondirectory file) '(nndoc "")))) 2818 (file-name-nondirectory file) '(nndoc ""))))
2690 (encodable (mm-coding-system-p 'utf-8))) 2819 (method (list 'nndoc file
2820 (list 'nndoc-address file)
2821 (list 'nndoc-article-type (or type 'guess))))
2822 (coding (gnus-group-name-charset method name)))
2823 (setcar (cdr method) (mm-encode-coding-string file coding))
2691 (gnus-group-make-group 2824 (gnus-group-make-group
2692 (if encodable 2825 (mm-encode-coding-string (gnus-group-real-name name) coding)
2693 (mm-encode-coding-string (gnus-group-real-name name) 'utf-8) 2826 method nil nil t)))
2694 (gnus-group-real-name name))
2695 (list 'nndoc (if encodable
2696 (mm-encode-coding-string file 'utf-8)
2697 file)
2698 (list 'nndoc-address file)
2699 (list 'nndoc-article-type (or type 'guess))))))
2700 2827
2701 (defvar nnweb-type-definition) 2828 (defvar nnweb-type-definition)
2702 (defvar gnus-group-web-type-history nil) 2829 (defvar gnus-group-web-type-history nil)
2703 (defvar gnus-group-web-search-history nil) 2830 (defvar gnus-group-web-search-history nil)
2704 (defun gnus-group-make-web-group (&optional solid) 2831 (defun gnus-group-make-web-group (&optional solid)
2748 (require 'nnrss) 2875 (require 'nnrss)
2749 (if (not url) 2876 (if (not url)
2750 (setq url (read-from-minibuffer "URL to Search for RSS: "))) 2877 (setq url (read-from-minibuffer "URL to Search for RSS: ")))
2751 (let ((feedinfo (nnrss-discover-feed url))) 2878 (let ((feedinfo (nnrss-discover-feed url)))
2752 (if feedinfo 2879 (if feedinfo
2753 (let ((title (gnus-newsgroup-savable-name 2880 (let* ((title (gnus-newsgroup-savable-name
2754 (read-from-minibuffer "Title: " 2881 (read-from-minibuffer "Title: "
2755 (gnus-newsgroup-savable-name 2882 (gnus-newsgroup-savable-name
2756 (or (cdr (assoc 'title 2883 (or (cdr (assoc 'title
2757 feedinfo)) 2884 feedinfo))
2758 ""))))) 2885 "")))))
2759 (desc (read-from-minibuffer "Description: " 2886 (desc (read-from-minibuffer "Description: "
2760 (cdr (assoc 'description 2887 (cdr (assoc 'description
2761 feedinfo)))) 2888 feedinfo))))
2762 (href (cdr (assoc 'href feedinfo))) 2889 (href (cdr (assoc 'href feedinfo)))
2763 (encodable (mm-coding-system-p 'utf-8))) 2890 (coding (gnus-group-name-charset '(nnrss "") title)))
2764 (when encodable 2891 (when coding
2765 ;; Unify non-ASCII text. 2892 ;; Unify non-ASCII text.
2766 (setq title (mm-decode-coding-string 2893 (setq title (mm-decode-coding-string
2767 (mm-encode-coding-string title 'utf-8) 'utf-8))) 2894 (mm-encode-coding-string title coding)
2768 (gnus-group-make-group (if encodable 2895 coding)))
2769 (mm-encode-coding-string title 'utf-8) 2896 (gnus-group-make-group title '(nnrss ""))
2770 title)
2771 '(nnrss ""))
2772 (push (list title href desc) nnrss-group-alist) 2897 (push (list title href desc) nnrss-group-alist)
2773 (nnrss-save-server-data nil)) 2898 (nnrss-save-server-data nil))
2774 (error "No feeds found for %s" url)))) 2899 (error "No feeds found for %s" url))))
2775 2900
2776 (defvar nnwarchive-type-definition) 2901 (defvar nnwarchive-type-definition)
2813 "Create the (ding) Gnus archive group of the most recent articles. 2938 "Create the (ding) Gnus archive group of the most recent articles.
2814 Given a prefix, create a full group." 2939 Given a prefix, create a full group."
2815 (interactive "P") 2940 (interactive "P")
2816 (let ((group (gnus-group-prefixed-name 2941 (let ((group (gnus-group-prefixed-name
2817 (if all "ding.archives" "ding.recent") '(nndir "")))) 2942 (if all "ding.archives" "ding.recent") '(nndir ""))))
2818 (when (gnus-gethash group gnus-newsrc-hashtb) 2943 (when (gnus-group-entry group)
2819 (error "Archive group already exists")) 2944 (error "Archive group already exists"))
2820 (gnus-group-make-group 2945 (gnus-group-make-group
2821 (gnus-group-real-name group) 2946 (gnus-group-real-name group)
2822 (list 'nndir (if all "hpc" "edu") 2947 (list 'nndir (if all "hpc" "edu")
2823 (list 'nndir-directory 2948 (list 'nndir-directory
2837 (unless (file-directory-p dir) 2962 (unless (file-directory-p dir)
2838 (error "Not a directory")) 2963 (error "Not a directory"))
2839 (let ((ext "") 2964 (let ((ext "")
2840 (i 0) 2965 (i 0)
2841 group) 2966 group)
2842 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb)) 2967 (while (or (not group) (gnus-group-entry group))
2843 (setq group 2968 (setq group
2844 (gnus-group-prefixed-name 2969 (gnus-group-prefixed-name
2845 (expand-file-name ext dir) 2970 (expand-file-name ext dir)
2846 '(nndir ""))) 2971 '(nndir "")))
2847 (setq ext (format "<%d>" (setq i (1+ i))))) 2972 (setq ext (format "<%d>" (setq i (1+ i)))))
2856 score file entries for articles to include in the group." 2981 score file entries for articles to include in the group."
2857 (interactive 2982 (interactive
2858 (list 2983 (list
2859 (read-string "nnkiboze group name: ") 2984 (read-string "nnkiboze group name: ")
2860 (read-string "Source groups (regexp): ") 2985 (read-string "Source groups (regexp): ")
2861 (let ((headers (mapcar (lambda (group) (list group)) 2986 (let ((headers (mapcar 'list
2862 '("subject" "from" "number" "date" "message-id" 2987 '("subject" "from" "number" "date" "message-id"
2863 "references" "chars" "lines" "xref" 2988 "references" "chars" "lines" "xref"
2864 "followup" "all" "body" "head"))) 2989 "followup" "all" "body" "head")))
2865 scores header regexp regexps) 2990 scores header regexp regexps)
2866 (while (not (equal "" (setq header (completing-read 2991 (while (not (equal "" (setq header (completing-read
2907 "Create a new, fresh, empty virtual group." 3032 "Create a new, fresh, empty virtual group."
2908 (interactive "sCreate new, empty virtual group: ") 3033 (interactive "sCreate new, empty virtual group: ")
2909 (let* ((method (list 'nnvirtual "^$")) 3034 (let* ((method (list 'nnvirtual "^$"))
2910 (pgroup (gnus-group-prefixed-name group method))) 3035 (pgroup (gnus-group-prefixed-name group method)))
2911 ;; Check whether it exists already. 3036 ;; Check whether it exists already.
2912 (when (gnus-gethash pgroup gnus-newsrc-hashtb) 3037 (when (gnus-group-entry pgroup)
2913 (error "Group %s already exists" pgroup)) 3038 (error "Group %s already exists" pgroup))
2914 ;; Subscribe the new group after the group on the current line. 3039 ;; Subscribe the new group after the group on the current line.
2915 (gnus-subscribe-group pgroup (gnus-group-group-name) method) 3040 (gnus-subscribe-group pgroup (gnus-group-group-name) method)
2916 (gnus-group-update-group pgroup) 3041 (gnus-group-update-group pgroup)
2917 (forward-line -1) 3042 (forward-line -1)
3079 3204
3080 (defun gnus-group-sort-selected-flat (groups func reverse) 3205 (defun gnus-group-sort-selected-flat (groups func reverse)
3081 (let (entries infos) 3206 (let (entries infos)
3082 ;; First find all the group entries for these groups. 3207 ;; First find all the group entries for these groups.
3083 (while groups 3208 (while groups
3084 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb)) 3209 (push (nthcdr 2 (gnus-group-entry (pop groups)))
3085 entries)) 3210 entries))
3086 ;; Then sort the infos. 3211 ;; Then sort the infos.
3087 (setq infos 3212 (setq infos
3088 (sort 3213 (sort
3089 (mapcar 3214 (mapcar
3160 (string< (gnus-group-real-name (gnus-info-group info1)) 3285 (string< (gnus-group-real-name (gnus-info-group info1))
3161 (gnus-group-real-name (gnus-info-group info2)))) 3286 (gnus-group-real-name (gnus-info-group info2))))
3162 3287
3163 (defun gnus-group-sort-by-unread (info1 info2) 3288 (defun gnus-group-sort-by-unread (info1 info2)
3164 "Sort by number of unread articles." 3289 "Sort by number of unread articles."
3165 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb))) 3290 (let ((n1 (gnus-group-unread (gnus-info-group info1)))
3166 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb)))) 3291 (n2 (gnus-group-unread (gnus-info-group info2))))
3167 (< (or (and (numberp n1) n1) 0) 3292 (< (or (and (numberp n1) n1) 0)
3168 (or (and (numberp n2) n2) 0)))) 3293 (or (and (numberp n2) n2) 0))))
3169 3294
3170 (defun gnus-group-sort-by-level (info1 info2) 3295 (defun gnus-group-sort-by-level (info1 info2)
3171 "Sort by level." 3296 "Sort by level."
3281 ;; Virtual groups have to be given special treatment. 3406 ;; Virtual groups have to be given special treatment.
3282 (let ((method (gnus-find-method-for-group group))) 3407 (let ((method (gnus-find-method-for-group group)))
3283 (when (eq 'nnvirtual (car method)) 3408 (when (eq 'nnvirtual (car method))
3284 (nnvirtual-catchup-group 3409 (nnvirtual-catchup-group
3285 (gnus-group-real-name group) (nth 1 method) all))) 3410 (gnus-group-real-name group) (nth 1 method) all)))
3286 (if (>= (gnus-group-level group) gnus-level-zombie) 3411 (cond
3287 (gnus-message 2 "Dead groups can't be caught up") 3412 ((>= (gnus-group-level group) gnus-level-zombie)
3288 (if (prog1 3413 (gnus-message 2 "Dead groups can't be caught up"))
3289 (gnus-group-goto-group group) 3414 ((prog1
3290 (gnus-group-catchup group all)) 3415 (gnus-group-goto-group group)
3291 (gnus-group-update-group-line) 3416 (gnus-group-catchup group all))
3292 (setq ret (1+ ret))))) 3417 (gnus-group-update-group-line))
3418 (t
3419 (setq ret (1+ ret)))))
3293 (gnus-group-next-unread-group 1) 3420 (gnus-group-next-unread-group 1)
3294 ret))) 3421 ret)))
3295 3422
3296 (defun gnus-group-catchup-current-all (&optional n) 3423 (defun gnus-group-catchup-current-all (&optional n)
3297 "Mark all articles in current newsgroup as read. 3424 "Mark all articles in current newsgroup as read.
3302 (defun gnus-group-catchup (group &optional all) 3429 (defun gnus-group-catchup (group &optional all)
3303 "Mark all articles in GROUP as read. 3430 "Mark all articles in GROUP as read.
3304 If ALL is non-nil, all articles are marked as read. 3431 If ALL is non-nil, all articles are marked as read.
3305 The return value is the number of articles that were marked as read, 3432 The return value is the number of articles that were marked as read,
3306 or nil if no action could be taken." 3433 or nil if no action could be taken."
3307 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb)) 3434 (let* ((entry (gnus-group-entry group))
3308 (num (car entry)) 3435 (num (car entry))
3309 (marks (nth 3 (nth 2 entry))) 3436 (marks (gnus-info-marks (nth 2 entry)))
3310 (unread (gnus-sequence-of-unread-articles group))) 3437 (unread (gnus-sequence-of-unread-articles group)))
3311 ;; Remove entries for this group. 3438 ;; Remove entries for this group.
3312 (nnmail-purge-split-history (gnus-group-real-name group)) 3439 (nnmail-purge-split-history (gnus-group-real-name group))
3313 ;; Do the updating only if the newsgroup isn't killed. 3440 ;; Do the updating only if the newsgroup isn't killed.
3314 (if (not (numberp (car entry))) 3441 (if (not (numberp (car entry)))
3319 (gnus-request-set-mark group (list (list (cdr (assq 'tick marks)) 3446 (gnus-request-set-mark group (list (list (cdr (assq 'tick marks))
3320 'del '(tick)) 3447 'del '(tick))
3321 (list (cdr (assq 'dormant marks)) 3448 (list (cdr (assq 'dormant marks))
3322 'del '(dormant)))) 3449 'del '(dormant))))
3323 (setq unread (gnus-range-add (gnus-range-add 3450 (setq unread (gnus-range-add (gnus-range-add
3324 unread (cdr (assq 'dormant marks))) 3451 unread (cdr (assq 'dormant marks)))
3325 (cdr (assq 'tick marks)))) 3452 (cdr (assq 'tick marks))))
3326 (gnus-add-marked-articles group 'tick nil nil 'force) 3453 (gnus-add-marked-articles group 'tick nil nil 'force)
3327 (gnus-add-marked-articles group 'dormant nil nil 'force)) 3454 (gnus-add-marked-articles group 'dormant nil nil 'force))
3328 ;; Do auto-expirable marks if that's required. 3455 ;; Do auto-expirable marks if that's required.
3329 (when (gnus-group-auto-expirable-p group) 3456 (when (gnus-group-auto-expirable-p group)
3330 (gnus-range-map (lambda (article) 3457 (gnus-range-map
3331 (gnus-add-marked-articles group 'expire (list article)) 3458 (lambda (article)
3332 (gnus-request-set-mark group (list (list (list article) 'add '(expire))))) 3459 (gnus-add-marked-articles group 'expire (list article))
3333 unread)) 3460 (gnus-request-set-mark group (list (list (list article)
3461 'add '(expire)))))
3462 unread))
3334 (let ((gnus-newsgroup-name group)) 3463 (let ((gnus-newsgroup-name group))
3335 (gnus-run-hooks 'gnus-group-catchup-group-hook)) 3464 (gnus-run-hooks 'gnus-group-catchup-group-hook))
3336 num))) 3465 num)))
3337 3466
3338 (defun gnus-group-expire-articles (&optional n) 3467 (defun gnus-group-expire-articles (&optional n)
3410 (int-to-string (or (gnus-group-group-level) 3539 (int-to-string (or (gnus-group-group-level)
3411 gnus-level-default-subscribed)) 3540 gnus-level-default-subscribed))
3412 s)))))) 3541 s))))))
3413 (unless (and (>= level 1) (<= level gnus-level-killed)) 3542 (unless (and (>= level 1) (<= level gnus-level-killed))
3414 (error "Invalid level: %d" level)) 3543 (error "Invalid level: %d" level))
3415 (let ((groups (gnus-group-process-prefix n)) 3544 (dolist (group (gnus-group-process-prefix n))
3416 group) 3545 (gnus-group-remove-mark group)
3417 (while (setq group (pop groups)) 3546 (gnus-message 6 "Changed level of %s from %d to %d"
3418 (gnus-group-remove-mark group) 3547 (gnus-group-decoded-name group)
3419 (gnus-message 6 "Changed level of %s from %d to %d" 3548 (or (gnus-group-group-level) gnus-level-killed)
3420 (gnus-group-decoded-name group) 3549 level)
3421 (or (gnus-group-group-level) gnus-level-killed) 3550 (gnus-group-change-level
3422 level) 3551 group level (or (gnus-group-group-level) gnus-level-killed))
3423 (gnus-group-change-level 3552 (gnus-group-update-group-line))
3424 group level (or (gnus-group-group-level) gnus-level-killed))
3425 (gnus-group-update-group-line)))
3426 (gnus-group-position-point)) 3553 (gnus-group-position-point))
3427 3554
3428 (defun gnus-group-unsubscribe (&optional n) 3555 (defun gnus-group-unsubscribe (&optional n)
3429 "Unsubscribe the current group." 3556 "Unsubscribe the current group."
3430 (interactive "P") 3557 (interactive "P")
3458 3585
3459 (defun gnus-group-unsubscribe-group (group &optional level silent) 3586 (defun gnus-group-unsubscribe-group (group &optional level silent)
3460 "Toggle subscription to GROUP. 3587 "Toggle subscription to GROUP.
3461 Killed newsgroups are subscribed. If SILENT, don't try to update the 3588 Killed newsgroups are subscribed. If SILENT, don't try to update the
3462 group line." 3589 group line."
3463 (interactive 3590 (interactive (list (gnus-group-completing-read
3464 (list (completing-read 3591 "Group: " nil nil (gnus-read-active-file-p))))
3465 "Group: " gnus-active-hashtb nil 3592 (let ((newsrc (gnus-group-entry group)))
3466 (gnus-read-active-file-p)
3467 nil
3468 'gnus-group-history)))
3469 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
3470 (cond 3593 (cond
3471 ((string-match "^[ \t]*$" group) 3594 ((string-match "^[ \t]*$" group)
3472 (error "Empty group name")) 3595 (error "Empty group name"))
3473 (newsrc 3596 (newsrc
3474 ;; Toggle subscription flag. 3597 ;; Toggle subscription flag.
3488 (if level level gnus-level-default-subscribed) 3611 (if level level gnus-level-default-subscribed)
3489 (or (and (member group gnus-zombie-list) 3612 (or (and (member group gnus-zombie-list)
3490 gnus-level-zombie) 3613 gnus-level-zombie)
3491 gnus-level-killed) 3614 gnus-level-killed)
3492 (when (gnus-group-group-name) 3615 (when (gnus-group-group-name)
3493 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb))) 3616 (gnus-group-entry (gnus-group-group-name))))
3494 (unless silent 3617 (unless silent
3495 (gnus-group-update-group group))) 3618 (gnus-group-update-group group)))
3496 (t (error "No such newsgroup: %s" group))) 3619 (t (error "No such newsgroup: %s" group)))
3497 (gnus-group-position-point))) 3620 (gnus-group-position-point)))
3498 3621
3527 ;; Count lines. 3650 ;; Count lines.
3528 (save-excursion 3651 (save-excursion
3529 (count-lines 3652 (count-lines
3530 (progn 3653 (progn
3531 (goto-char begin) 3654 (goto-char begin)
3532 (beginning-of-line) 3655 (point-at-bol))
3533 (point))
3534 (progn 3656 (progn
3535 (goto-char end) 3657 (goto-char end)
3536 (beginning-of-line) 3658 (point-at-bol))))))
3537 (point))))))
3538 (goto-char begin) 3659 (goto-char begin)
3539 (beginning-of-line) ;Important when LINES < 1 3660 (beginning-of-line) ;Important when LINES < 1
3540 (gnus-group-kill-group lines))) 3661 (gnus-group-kill-group lines)))
3541 3662
3542 (defun gnus-group-kill-group (&optional n discard) 3663 (defun gnus-group-kill-group (&optional n discard)
3556 (push (setq group (pop groups)) out) 3677 (push (setq group (pop groups)) out)
3557 (gnus-group-remove-mark group) 3678 (gnus-group-remove-mark group)
3558 (setq level (gnus-group-group-level)) 3679 (setq level (gnus-group-group-level))
3559 (gnus-delete-line) 3680 (gnus-delete-line)
3560 (when (and (not discard) 3681 (when (and (not discard)
3561 (setq entry (gnus-gethash group gnus-newsrc-hashtb))) 3682 (setq entry (gnus-group-entry group)))
3562 (gnus-undo-register 3683 (gnus-undo-register
3563 `(progn 3684 `(progn
3564 (gnus-group-goto-group ,(gnus-group-group-name)) 3685 (gnus-group-goto-group ,(gnus-group-group-name))
3565 (gnus-group-yank-group))) 3686 (gnus-group-yank-group)))
3566 (push (cons (car entry) (nth 2 entry)) 3687 (push (cons (car entry) (nth 2 entry))
3579 gnus-newsrc-alist)) 3700 gnus-newsrc-alist))
3580 (when gnus-group-change-level-function 3701 (when gnus-group-change-level-function
3581 (funcall gnus-group-change-level-function 3702 (funcall gnus-group-change-level-function
3582 group gnus-level-killed 3)) 3703 group gnus-level-killed 3))
3583 (cond 3704 (cond
3584 ((setq entry (gnus-gethash group gnus-newsrc-hashtb)) 3705 ((setq entry (gnus-group-entry group))
3585 (push (cons (car entry) (nth 2 entry)) 3706 (push (cons (car entry) (nth 2 entry))
3586 gnus-list-of-killed-groups) 3707 gnus-list-of-killed-groups)
3587 (setcdr (cdr entry) (cdddr entry))) 3708 (setcdr (cdr entry) (cdddr entry)))
3588 ((member group gnus-zombie-list) 3709 ((member group gnus-zombie-list)
3589 (setq gnus-zombie-list (delete group gnus-zombie-list)))) 3710 (setq gnus-zombie-list (delete group gnus-zombie-list))))
3612 ;; other newsgroups in this buffer, just make this newsgroup the 3733 ;; other newsgroups in this buffer, just make this newsgroup the
3613 ;; first newsgroup. 3734 ;; first newsgroup.
3614 (setq prev (gnus-group-group-name)) 3735 (setq prev (gnus-group-group-name))
3615 (gnus-group-change-level 3736 (gnus-group-change-level
3616 info (gnus-info-level (cdr info)) gnus-level-killed 3737 info (gnus-info-level (cdr info)) gnus-level-killed
3617 (and prev (gnus-gethash prev gnus-newsrc-hashtb)) 3738 (and prev (gnus-group-entry prev))
3618 t) 3739 t)
3619 (gnus-group-insert-group-line-info group) 3740 (gnus-group-insert-group-line-info group)
3620 (gnus-undo-register 3741 (gnus-undo-register
3621 `(when (gnus-group-goto-group ,group) 3742 `(when (gnus-group-goto-group ,group)
3622 (gnus-group-kill-group 1)))) 3743 (gnus-group-kill-group 1))))
3771 (progn 3892 (progn
3772 (gnus-read-active-file) 3893 (gnus-read-active-file)
3773 (gnus-get-unread-articles arg)) 3894 (gnus-get-unread-articles arg))
3774 (let ((gnus-read-active-file (if arg nil gnus-read-active-file))) 3895 (let ((gnus-read-active-file (if arg nil gnus-read-active-file)))
3775 (gnus-get-unread-articles arg))) 3896 (gnus-get-unread-articles arg)))
3897 (gnus-check-reasonable-setup)
3776 (gnus-run-hooks 'gnus-after-getting-new-news-hook) 3898 (gnus-run-hooks 'gnus-after-getting-new-news-hook)
3777 (gnus-group-list-groups (and (numberp arg) 3899 (gnus-group-list-groups (and (numberp arg)
3778 (max (car gnus-group-list-mode) arg))))) 3900 (max (car gnus-group-list-mode) arg)))))
3779 3901
3780 (defun gnus-group-get-new-news-this-group (&optional n dont-scan) 3902 (defun gnus-group-get-new-news-this-group (&optional n dont-scan)
3795 (gnus-run-hooks 'gnus-get-new-news-hook) 3917 (gnus-run-hooks 'gnus-get-new-news-hook)
3796 (while (setq group (pop groups)) 3918 (while (setq group (pop groups))
3797 (gnus-group-remove-mark group) 3919 (gnus-group-remove-mark group)
3798 ;; Bypass any previous denials from the server. 3920 ;; Bypass any previous denials from the server.
3799 (gnus-remove-denial (setq method (gnus-find-method-for-group group))) 3921 (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
3800 (if (gnus-activate-group group (if dont-scan nil 'scan)) 3922 (if (gnus-activate-group group (if dont-scan nil 'scan) nil method)
3801 (progn 3923 (let ((info (gnus-get-info group))
3802 (gnus-get-unread-articles-in-group 3924 (active (gnus-active group)))
3803 (gnus-get-info group) (gnus-active group) t) 3925 (when info
3926 (gnus-request-update-info info method))
3927 (gnus-get-unread-articles-in-group info active)
3804 (unless (gnus-virtual-group-p group) 3928 (unless (gnus-virtual-group-p group)
3805 (gnus-close-group group)) 3929 (gnus-close-group group))
3806 (when gnus-agent 3930 (when gnus-agent
3807 (gnus-agent-save-group-info 3931 (gnus-agent-save-group-info
3808 method (gnus-group-real-name group) (gnus-active group))) 3932 method (gnus-group-real-name group) active))
3809 (gnus-group-update-group group)) 3933 (gnus-group-update-group group))
3810 (if (eq (gnus-server-status (gnus-find-method-for-group group)) 3934 (if (eq (gnus-server-status (gnus-find-method-for-group group))
3811 'denied) 3935 'denied)
3812 (gnus-error 3 "Server denied access") 3936 (gnus-error 3 "Server denied access")
3813 (gnus-error 3 "%s error: %s" group (gnus-status-message group))))) 3937 (gnus-error 3 "%s error: %s" group (gnus-status-message group)))))
3849 (defun gnus-group-fetch-charter (group) 3973 (defun gnus-group-fetch-charter (group)
3850 "Fetch the charter for the current group. 3974 "Fetch the charter for the current group.
3851 If given a prefix argument, prompt for a group." 3975 If given a prefix argument, prompt for a group."
3852 (interactive 3976 (interactive
3853 (list (or (when current-prefix-arg 3977 (list (or (when current-prefix-arg
3854 (completing-read "Group: " gnus-active-hashtb)) 3978 (gnus-group-completing-read "Group: "))
3855 (gnus-group-group-name) 3979 (gnus-group-group-name)
3856 gnus-newsgroup-name))) 3980 gnus-newsgroup-name)))
3857 (unless group 3981 (unless group
3858 (error "No group name given")) 3982 (error "No group name given"))
3859 (require 'mm-url) 3983 (require 'mm-url)
3877 (defun gnus-group-fetch-control (group) 4001 (defun gnus-group-fetch-control (group)
3878 "Fetch the archived control messages for the current group. 4002 "Fetch the archived control messages for the current group.
3879 If given a prefix argument, prompt for a group." 4003 If given a prefix argument, prompt for a group."
3880 (interactive 4004 (interactive
3881 (list (or (when current-prefix-arg 4005 (list (or (when current-prefix-arg
3882 (completing-read "Group: " gnus-active-hashtb)) 4006 (gnus-group-completing-read "Group: "))
3883 (gnus-group-group-name) 4007 (gnus-group-group-name)
3884 gnus-newsgroup-name))) 4008 gnus-newsgroup-name)))
3885 (unless group 4009 (unless group
3886 (error "No group name given")) 4010 (error "No group name given"))
3887 (let ((name (gnus-group-real-name group)) 4011 (let ((name (gnus-group-real-name group))
4103 (interactive) 4227 (interactive)
4104 (gnus-run-hooks 'gnus-suspend-gnus-hook) 4228 (gnus-run-hooks 'gnus-suspend-gnus-hook)
4105 (gnus-offer-save-summaries) 4229 (gnus-offer-save-summaries)
4106 ;; Kill Gnus buffers except for group mode buffer. 4230 ;; Kill Gnus buffers except for group mode buffer.
4107 (let ((group-buf (get-buffer gnus-group-buffer))) 4231 (let ((group-buf (get-buffer gnus-group-buffer)))
4108 (mapcar (lambda (buf) 4232 (dolist (buf (gnus-buffers))
4109 (unless (or (member buf (list group-buf gnus-dribble-buffer)) 4233 (unless (or (eq buf group-buf)
4110 (progn 4234 (eq buf gnus-dribble-buffer)
4111 (save-excursion 4235 (with-current-buffer buf
4112 (set-buffer buf) 4236 (eq major-mode 'message-mode)))
4113 (eq major-mode 'message-mode)))) 4237 (gnus-kill-buffer buf)))
4114 (gnus-kill-buffer buf)))
4115 (gnus-buffers))
4116 (setq gnus-backlog-articles nil) 4238 (setq gnus-backlog-articles nil)
4117 (gnus-kill-gnus-frames) 4239 (gnus-kill-gnus-frames)
4118 (when group-buf 4240 (when group-buf
4119 (bury-buffer group-buf) 4241 (bury-buffer group-buf)
4120 (delete-windows-on group-buf t)))) 4242 (delete-windows-on group-buf t))))
4194 (if (assoc how gnus-valid-select-methods) 4316 (if (assoc how gnus-valid-select-methods)
4195 (list (intern how) 4317 (list (intern how)
4196 ;; Suggested by mapjph@bath.ac.uk. 4318 ;; Suggested by mapjph@bath.ac.uk.
4197 (completing-read 4319 (completing-read
4198 "Address: " 4320 "Address: "
4199 (mapcar (lambda (server) (list server)) 4321 (mapcar 'list gnus-secondary-servers)))
4200 gnus-secondary-servers)))
4201 ;; We got a server name. 4322 ;; We got a server name.
4202 how)))) 4323 how))))
4203 (gnus-browse-foreign-server method)) 4324 (gnus-browse-foreign-server method))
4204 4325
4205 (defun gnus-group-set-info (info &optional method-only-group part) 4326 (defun gnus-group-set-info (info &optional method-only-group part)
4206 (when (or info part) 4327 (when (or info part)
4207 (let* ((entry (gnus-gethash 4328 (let* ((entry (gnus-group-entry
4208 (or method-only-group (gnus-info-group info)) 4329 (or method-only-group (gnus-info-group info))))
4209 gnus-newsrc-hashtb))
4210 (part-info info) 4330 (part-info info)
4211 (info (if method-only-group (nth 2 entry) info)) 4331 (info (if method-only-group (nth 2 entry) info))
4212 method) 4332 method)
4213 (when method-only-group 4333 (when method-only-group
4214 (unless entry 4334 (unless entry
4237 (gnus-group-make-group 4357 (gnus-group-make-group
4238 (gnus-group-real-name (gnus-info-group info)) 4358 (gnus-group-real-name (gnus-info-group info))
4239 (if (stringp method) method 4359 (if (stringp method) method
4240 (prin1-to-string (car method))) 4360 (prin1-to-string (car method)))
4241 (and (consp method) 4361 (and (consp method)
4242 (nth 1 (gnus-info-method info)))) 4362 (nth 1 (gnus-info-method info)))
4363 nil t)
4243 ;; It's a native group. 4364 ;; It's a native group.
4244 (gnus-group-make-group (gnus-info-group info)))) 4365 (gnus-group-make-group (gnus-info-group info) nil nil nil t)))
4245 (gnus-message 6 "Note: New group created") 4366 (gnus-message 6 "Note: New group created")
4246 (setq entry 4367 (setq entry
4247 (gnus-gethash (gnus-group-prefixed-name 4368 (gnus-group-entry (gnus-group-prefixed-name
4248 (gnus-group-real-name (gnus-info-group info)) 4369 (gnus-group-real-name (gnus-info-group info))
4249 (or (gnus-info-method info) gnus-select-method)) 4370 (or (gnus-info-method info) gnus-select-method))))))
4250 gnus-newsrc-hashtb))))
4251 ;; Whether it was a new group or not, we now have the entry, so we 4371 ;; Whether it was a new group or not, we now have the entry, so we
4252 ;; can do the update. 4372 ;; can do the update.
4253 (if entry 4373 (if entry
4254 (progn 4374 (progn
4255 (setcar (nthcdr 2 entry) info) 4375 (setcar (nthcdr 2 entry) info)
4458 (gnus-group-make-articles-read group (list article)) 4578 (gnus-group-make-articles-read group (list article))
4459 (when (gnus-group-auto-expirable-p group) 4579 (when (gnus-group-auto-expirable-p group)
4460 (gnus-add-marked-articles 4580 (gnus-add-marked-articles
4461 group 'expire (list article)))))) 4581 group 'expire (list article))))))
4462 4582
4583
4584 ;;;
4585 ;;; Group compaction. -- dvl
4586 ;;;
4587
4588 (defun gnus-group-compact-group (group)
4589 "Compact the current group.
4590 Compaction means removing gaps between article numbers. Hence, this
4591 operation is only meaningful for back ends using one file per article
4592 \(e.g. nnml).
4593
4594 Note: currently only implemented in nnml."
4595 (interactive (list (gnus-group-group-name)))
4596 (unless group
4597 (error "No group to compact"))
4598 (unless (gnus-check-backend-function 'request-compact-group group)
4599 (error "This back end does not support group compaction"))
4600 (let ((group-decoded (gnus-group-decoded-name group)))
4601 (gnus-message 6 "\
4602 Compacting group %s... (this may take a long time)"
4603 group-decoded)
4604 (prog1
4605 (if (not (gnus-request-compact-group group))
4606 (gnus-error 3 "Couldn't compact group %s" group-decoded)
4607 (gnus-message 6 "Compacting group %s...done" group-decoded)
4608 t)
4609 ;; Invalidate the "original article" buffer which might be out of date.
4610 ;; #### NOTE: Yes, this might be a bit rude, but since compaction
4611 ;; #### will not happen very often, I think this is acceptable.
4612 (let ((original (get-buffer gnus-original-article-buffer)))
4613 (and original (gnus-kill-buffer original)))
4614 ;; Update the group line to reflect new information (art number etc).
4615 (gnus-group-update-group-line))))
4616
4463 (provide 'gnus-group) 4617 (provide 'gnus-group)
4464 4618
4465 ;;; arch-tag: 2eb5440f-0bca-4091-814c-e37817536af6 4619 ;;; arch-tag: 2eb5440f-0bca-4091-814c-e37817536af6
4466 ;;; gnus-group.el ends here 4620 ;;; gnus-group.el ends here