(require 'time-date)
(require 'gnus-ems)
-(eval-when-compile (require 'mm-url))
+(eval-when-compile
+ (require 'mm-url)
+ (let ((features (cons 'gnus-group features)))
+ (require 'gnus-sum))
+ (unless (boundp 'gnus-cache-active-hashtb)
+ (defvar gnus-cache-active-hashtb nil)))
+
+(autoload 'gnus-agent-total-fetched-for "gnus-agent")
+(autoload 'gnus-cache-total-fetched-for "gnus-cache")
(defcustom gnus-group-archive-directory
"/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
%z A string that look like `<%s:%n>' if a foreign select method is used
%d The date the group was last entered.
%E Icon as defined by `gnus-group-icon-list'.
+%F The disk space used by the articles fetched by both the cache and agent.
%u User defined specifier. The next character in the format string should
be a letter. Gnus will call the function gnus-user-format-function-X,
where X is the letter following %u. The function will be passed a
groups.
If you use %o or %O, reading the active file will be slower and quite
-a bit of extra memory will be used. %D will also worsen performance.
-Also note that if you change the format specification to include any
-of these specs, you must probably re-start Gnus to see them go into
-effect.
+a bit of extra memory will be used. %D and %F will also worsen
+performance. Also note that if you change the format specification to
+include any of these specs, you must probably re-start Gnus to see
+them go into effect.
General format specifiers can also be used.
See Info node `(gnus)Formatting Variables'."
(defcustom gnus-group-jump-to-group-prompt nil
"Default prompt for `gnus-group-jump-to-group'.
-If non-nil, the value should be a string, e.g. \"nnml:\",
-in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
-in the minibuffer prompt."
+
+If non-nil, the value should be a string or an alist. If it is a string,
+e.g. \"nnml:\", in which case `gnus-group-jump-to-group' offers \"Group:
+nnml:\" in the minibuffer prompt.
+
+If it is an alist, it must consist of \(NUMBER . PROMPT\) pairs, for example:
+\((1 . \"\") (2 . \"nnfolder+archive:\")). The element with number 0 is
+used when no prefix argument is given to `gnus-group-jump-to-group'."
:group 'gnus-group-various
:type '(choice (string :tag "Prompt string")
- (const :tag "Empty" nil)))
+ (const :tag "Empty" nil)
+ (repeat (cons (integer :tag "Argument")
+ (string :tag "Prompt string")))))
(defvar gnus-group-listing-limit 1000
"*A limit of the number of groups when listing.
)))
?s)
(?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
- (?u gnus-tmp-user-defined ?s)))
+ (?u gnus-tmp-user-defined ?s)
+ (?F (gnus-total-fetched-for gnus-tmp-group) ?s)
+ ))
(defvar gnus-group-mode-line-format-alist
`((?S gnus-tmp-news-server ?s)
(use-local-map gnus-group-mode-map)
(buffer-disable-undo)
(setq truncate-lines t)
- (setq buffer-read-only t)
+ (setq buffer-read-only t
+ show-trailing-whitespace nil)
(gnus-set-default-directory)
(gnus-update-format-specifications nil 'group 'group-mode)
(gnus-update-group-mark-positions)
(goto-char (or pos beg))
(and pos t))))
+(defun gnus-total-fetched-for (group)
+ (let* ((size-in-cache (or (gnus-cache-total-fetched-for group) 0))
+ (size-in-agent (or (gnus-agent-total-fetched-for group) 0))
+ (size (+ size-in-cache size-in-agent))
+ (suffix '("B" "K" "M" "G"))
+ (scale 1024.0)
+ (cutoff (* 10 scale)))
+ (while (> size cutoff)
+ (setq size (/ size scale)
+ suffix (cdr suffix)))
+ (format "%5.1f%s" size (car suffix))))
+
;;; Gnus group mode commands
;; Group marking.
No article is selected automatically.
If the group is opened, just switch the summary buffer.
If ALL is non-nil, already read articles become readable.
-If ALL is a number, fetch this number of articles."
+If ALL is a positive number, fetch this number of the latest
+articles in the group.
+If ALL is a negative number, fetch this number of the earliest
+articles in the group."
(interactive "P")
(when (and (eobp) (not (gnus-group-group-name)))
(forward-line -1))
(message "Quit reading the ephemeral group")
nil)))))
-(defun gnus-group-jump-to-group (group)
- "Jump to newsgroup GROUP."
+(defun gnus-group-jump-to-group (group &optional prompt)
+ "Jump to newsgroup GROUP.
+
+If PROMPT (the prefix) is a number, use the prompt specified in
+`gnus-group-jump-to-group-prompt'."
(interactive
- (list (gnus-group-completing-read-group-name
- "Group: " gnus-active-hashtb nil
- (gnus-read-active-file-p)
- gnus-group-jump-to-group-prompt
- 'gnus-group-history)))
+ (list (mm-string-make-unibyte
+ (completing-read
+ "Group: " gnus-active-hashtb nil
+ (gnus-read-active-file-p)
+ (if current-prefix-arg
+ (cdr (assq current-prefix-arg gnus-group-jump-to-group-prompt))
+ (or (and (stringp gnus-group-jump-to-group-prompt)
+ gnus-group-jump-to-group-prompt)
+ (let ((p (cdr (assq 0 gnus-group-jump-to-group-prompt))))
+ (and (stringp p) p))))
+ 'gnus-group-history))))
(when (equal group "")
(error "Empty group name"))
(lambda (group)
(gnus-group-delete-group group nil t))))))
-(defvar gnus-cache-active-altered)
-
(defun gnus-group-delete-group (group &optional force no-prompt)
"Delete the current group. Only meaningful with editable groups.
If FORCE (the prefix) is non-nil, all the articles in the group will
(gnus-group-goto-group group)
(gnus-group-kill-group 1 t)
(gnus-set-active group nil)
- (if (boundp 'gnus-cache-active-hashtb)
- (when gnus-cache-active-hashtb
- (gnus-sethash group nil gnus-cache-active-hashtb)
- (setq gnus-cache-active-altered t)))
t))
(gnus-group-position-point)))
(list
(read-string "nnkiboze group name: ")
(read-string "Source groups (regexp): ")
- (let ((headers (mapcar (lambda (group) (list group))
+ (let ((headers (mapcar 'list
'("subject" "from" "number" "date" "message-id"
"references" "chars" "lines" "xref"
"followup" "all" "body" "head")))
(count-lines
(progn
(goto-char begin)
- (beginning-of-line)
- (point))
+ (point-at-bol))
(progn
(goto-char end)
- (beginning-of-line)
- (point))))))
+ (point-at-bol))))))
(goto-char begin)
(beginning-of-line) ;Important when LINES < 1
(gnus-group-kill-group lines)))
;; First we make sure that we have really read the active file.
(unless (gnus-read-active-file-p)
(let ((gnus-read-active-file t)
- (gnus-agent nil)) ; Trick the agent into ignoring the active file.
+ (gnus-agent gnus-plugged)); If we're actually plugged, store the active file in the agent.
(gnus-read-active-file)))
;; Find all groups and sort them.
(let ((groups
(defun gnus-group-get-new-news-this-group (&optional n dont-scan)
"Check for newly arrived news in the current group (and the N-1 next groups).
The difference between N and the number of newsgroup checked is returned.
-If N is negative, this group and the N-1 previous groups will be checked."
+If N is negative, this group and the N-1 previous groups will be checked.
+If DONT-SCAN is non-nil, scan non-activated groups as well."
(interactive "P")
(let* ((groups (gnus-group-process-prefix n))
(ret (if (numberp n) (- n (length groups)) 0))
(let ((group-buf (get-buffer gnus-group-buffer)))
(mapcar (lambda (buf)
(unless (or (member buf (list group-buf gnus-dribble-buffer))
- (progn
- (save-excursion
- (set-buffer buf)
- (eq major-mode 'message-mode))))
+ (with-current-buffer buf
+ (eq major-mode 'message-mode)))
(gnus-kill-buffer buf)))
(gnus-buffers))
(setq gnus-backlog-articles nil)
;; Suggested by mapjph@bath.ac.uk.
(completing-read
"Address: "
- (mapcar (lambda (server) (list server))
- gnus-secondary-servers)))
+ (mapcar 'list gnus-secondary-servers)))
;; We got a server name.
how))))
(gnus-browse-foreign-server method))