(require 'nnheader)
(require 'message)
(require 'nnmail)
+(require 'backquote)
(eval-when-compile (require 'cl))
+;;;###autoload
(defvar gnus-directory (or (getenv "SAVEDIR") "~/News/")
"*Directory variable from which all other Gnus file variables are derived.")
(defvar gnus-group-catchup-group-hook nil
"*A hook run when catching up a group from the group buffer.")
+(defvar gnus-group-update-group-hook nil
+ "*A hook called when updating group lines.")
+
(defvar gnus-open-server-hook nil
"*A hook called just before opening connection to the news server.")
"gnus-bug@ifi.uio.no (The Gnus Bugfixing Girls + Boys)"
"The mail address of the Gnus maintainers.")
-(defconst gnus-version "September Gnus v0.97"
+(defconst gnus-version-number "5.2.10"
"Version number for this version of Gnus.")
+(defconst gnus-version (format "Gnus v%s" gnus-version-number)
+ "Version string for this version of Gnus.")
+
(defvar gnus-info-nodes
'((gnus-group-mode "(gnus)The Group Buffer")
(gnus-summary-mode "(gnus)The Summary Buffer")
(gnus-article-mode "(gnus)The Article Buffer"))
- "Assoc list of major modes and related Info nodes.")
+ "Alist of major modes and related Info nodes.")
(defvar gnus-group-buffer "*Group*")
(defvar gnus-summary-buffer "*Summary*")
gnus-newsgroup-scored gnus-newsgroup-kill-headers
gnus-newsgroup-async gnus-thread-expunge-below
gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
- (gnus-summary-mark-below . 0)
+ (gnus-summary-mark-below . global)
gnus-newsgroup-active gnus-scores-exclude-files
gnus-newsgroup-history gnus-newsgroup-ancient
gnus-newsgroup-sparse
("nnvirtual" nnvirtual-catchup-group)
("timezone" timezone-make-date-arpa-standard timezone-fix-time
timezone-make-sortable-date timezone-make-time-string)
- ("sendmail" mail-position-on-field mail-setup)
("rmailout" rmail-output)
- ("rnewspost" news-mail-other-window news-reply-yank-original
- news-caesar-buffer-body)
("rmail" rmail-insert-rmail-file-header rmail-count-new-messages
rmail-show-message)
("gnus-soup" :interactive t
("gnus-msg" :interactive t
gnus-group-post-news gnus-group-mail gnus-summary-post-news
gnus-summary-followup gnus-summary-followup-with-original
- gnus-summary-followup-and-reply
- gnus-summary-followup-and-reply-with-original
gnus-summary-cancel-article gnus-summary-supersede-article
gnus-post-news gnus-inews-news gnus-cancel-news
gnus-summary-reply gnus-summary-reply-with-original
gnus-grouplens-mode)
("gnus-vm" gnus-vm-mail-setup)
("gnus-vm" :interactive t gnus-summary-save-in-vm
- gnus-summary-save-article-vm gnus-yank-article))))
+ gnus-summary-save-article-vm))))
\f
(and gnus-group-buffer
(get-buffer gnus-group-buffer)))
+(defun gnus-delete-first (elt list)
+ "Delete by side effect the first occurrence of ELT as a member of LIST."
+ (if (equal (car list) elt)
+ (cdr list)
+ (let ((total list))
+ (while (and (cdr list)
+ (not (equal (cadr list) elt)))
+ (setq list (cdr list)))
+ (when (cdr list)
+ (setcdr list (cddr list)))
+ total)))
+
;; Delete the current line (and the next N lines.);
(defmacro gnus-delete-line (&optional n)
`(delete-region (progn (beginning-of-line) (point))
flist)
(cons 'progn (cddr fval)))))
+;; Find out whether the gnus-visual TYPE is wanted.
+(defun gnus-visual-p (&optional type class)
+ (and gnus-visual ; Has to be non-nil, at least.
+ (if (not type) ; We don't care about type.
+ gnus-visual
+ (if (listp gnus-visual) ; It's a list, so we check it.
+ (or (memq type gnus-visual)
+ (memq class gnus-visual))
+ t))))
+
;;; Load the compatability functions.
(require 'gnus-cus)
(setq prefixes (cons prefix prefixes))
(message "Descend hierarchy %s? ([y]nsq): "
(substring prefix 1 (1- (length prefix))))
- (setq ans (read-char))
+ (while (not (memq (setq ans (read-char)) '(?y ?\n ?n ?s ?q)))
+ (ding)
+ (message "Descend hierarchy %s? ([y]nsq): "
+ (substring prefix 1 (1- (length prefix)))))
(cond ((= ans ?n)
(while (and groups
(string-match prefix
(setq groups (cdr groups))))
(t nil)))
(message "Subscribe %s? ([n]yq)" (car groups))
- (setq ans (read-char))
+ (while (not (memq (setq ans (read-char)) '(?y ?\n ?q ?n)))
+ (ding)
+ (message "Subscribe %s? ([n]yq)" (car groups)))
(setq group (car groups))
(cond ((= ans ?y)
(gnus-subscribe-alphabetically (car groups))
(delete-windows-on (car bufs)))
(setq bufs (cdr bufs))))))
-(defun gnus-version ()
- "Version numbers of this version of Gnus."
- (interactive)
+(defun gnus-version (&optional arg)
+ "Version number of this version of Gnus.
+If ARG, insert string at point."
+ (interactive "P")
(let ((methods gnus-valid-select-methods)
(mess gnus-version)
meth)
(stringp (symbol-value meth))
(setq mess (concat mess "; " (symbol-value meth))))
(setq methods (cdr methods)))
- (gnus-message 2 mess)))
+ (if arg
+ (insert (message mess))
+ (message mess))))
(defun gnus-info-find-node ()
"Find Info documentation of Gnus."
"Hide text of TYPE between B and E."
(gnus-hide-text b e (cons 'gnus-type (cons type gnus-hidden-properties))))
-;; Find out whether the gnus-visual TYPE is wanted.
-(defun gnus-visual-p (&optional type class)
- (and gnus-visual ; Has to be non-nil, at least.
- (if (not type) ; We don't care about type.
- gnus-visual
- (if (listp gnus-visual) ; It's a list, so we check it.
- (or (memq type gnus-visual)
- (memq class gnus-visual))
- t))))
-
(defun gnus-parent-headers (headers &optional generation)
"Return the headers of the GENERATIONeth parent of HEADERS."
(unless generation
(setq truncate-lines t)
(setq buffer-read-only t)
(gnus-make-local-hook 'post-command-hook)
- (add-hook 'post-command-hook 'gnus-clear-inboxes-moved)
+ (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
(run-hooks 'gnus-group-mode-hook))
(defun gnus-clear-inboxes-moved ()
(goto-char loc)
(let ((gnus-group-indentation (gnus-group-group-indentation)))
(gnus-delete-line)
- (gnus-group-insert-group-line-info group))
+ (gnus-group-insert-group-line-info group)
+ (save-excursion
+ (forward-line -1)
+ (run-hooks 'gnus-group-update-group-hook)))
(setq loc (1+ loc)))
(unless (or found visible-only)
;; No such line in the buffer, find out where it's supposed to
(or entry (goto-char (point-max)))))
;; Finally insert the line.
(let ((gnus-group-indentation (gnus-group-group-indentation)))
- (gnus-group-insert-group-line-info group)))
+ (gnus-group-insert-group-line-info group)
+ (save-excursion
+ (forward-line -1)
+ (run-hooks 'gnus-group-update-group-hook))))
(gnus-group-set-mode-line)))))
(defun gnus-group-set-mode-line ()
The difference between N and actual number of newsgroups that were
caught up is returned."
(interactive "P")
+ (unless (gnus-group-group-name)
+ (error "No group on the current line"))
(if (not (or (not gnus-interactive-catchup) ;Without confirmation?
gnus-expert-user
(gnus-y-or-n-p
(interactive "P\nsList newsgroups matching: ")
;; First make sure active file has been read.
(when (and level
- (>= (prefix-numeric-value level) gnus-level-killed))
+ (> (prefix-numeric-value level) gnus-level-killed))
(gnus-get-killed-groups))
(gnus-group-prepare-flat (or level gnus-level-subscribed)
all (or lowest 1) regexp)
(gnus-visual-p 'summary-menu 'menu))
(gnus-summary-make-menu-bar))
(kill-all-local-variables)
- (let ((locals gnus-summary-local-variables))
- (while locals
- (if (consp (car locals))
- (progn
- (make-local-variable (caar locals))
- (set (caar locals) (eval (cdar locals))))
- (make-local-variable (car locals))
- (set (car locals) nil))
- (setq locals (cdr locals))))
+ (gnus-summary-make-local-variables)
(gnus-make-thread-indent-array)
(gnus-simplify-mode-line)
(setq major-mode 'gnus-summary-mode)
(make-local-variable 'gnus-summary-mark-positions)
(run-hooks 'gnus-summary-mode-hook))
+(defun gnus-summary-make-local-variables ()
+ "Make all the local summary buffer variables."
+ (let ((locals gnus-summary-local-variables)
+ global local)
+ (while (setq local (pop locals))
+ (if (consp local)
+ (progn
+ (if (eq (cdr local) 'global)
+ ;; Copy the global value of the variable.
+ (setq global (symbol-value (car local)))
+ ;; Use the value from the list.
+ (setq global (eval (cdr local))))
+ (make-local-variable (car local))
+ (set (car local) global))
+ ;; Simple nil-valued local variable.
+ (make-local-variable local)
+ (set local nil)))))
+
(defun gnus-summary-make-display-table ()
;; Change the display table. Odd characters have a tendency to mess
;; up nicely formatted displays - we make all possible glyphs
(delq number gnus-newsgroup-unselected)))
(push number gnus-newsgroup-ancient)))))))
-(defun gnus-summary-update-article (article &optional header)
+(defun gnus-summary-update-article (article &optional iheader)
"Update ARTICLE in the summary buffer."
(set-buffer gnus-summary-buffer)
- (let* ((header (or header (gnus-summary-article-header article)))
+ (let* ((header (or iheader (gnus-summary-article-header article)))
(id (mail-header-id header))
(data (gnus-data-find article))
(thread (gnus-id-to-thread id))
+ (references (mail-header-references header))
(parent
- (gnus-id-to-thread (or (gnus-parent-id
- (mail-header-references header))
- "tull")))
+ (gnus-id-to-thread
+ (or (gnus-parent-id
+ (if (and references
+ (not (equal "" references)))
+ references))
+ "none")))
(buffer-read-only nil)
(old (car thread))
(number (mail-header-number header))
pos)
(when thread
- (setcar thread nil)
+ ;; !!! Should this be in or not?
+ (unless iheader
+ (setcar thread nil))
(when parent
(delq thread parent))
- (if (gnus-summary-insert-subject id header)
+ (if (gnus-summary-insert-subject id header iheader)
;; Set the (possibly) new article number in the data structure.
(gnus-data-set-number data (gnus-id-to-article id))
(setcar thread old)
(defun gnus-thread-total-score (thread)
;; This function find the total score of THREAD.
- (if (consp thread)
- (if (stringp (car thread))
- (apply gnus-thread-score-function 0
- (mapcar 'gnus-thread-total-score-1 (cdr thread)))
- (gnus-thread-total-score-1 thread))
- (gnus-thread-total-score-1 (list thread))))
+ (cond ((null thread)
+ 0)
+ ((consp thread)
+ (if (stringp (car thread))
+ (apply gnus-thread-score-function 0
+ (mapcar 'gnus-thread-total-score-1 (cdr thread)))
+ (gnus-thread-total-score-1 thread)))
+ (t
+ (gnus-thread-total-score-1 (list thread)))))
(defun gnus-thread-total-score-1 (root)
;; This function find the total score of the thread below ROOT.
(unless gnus-single-article-buffer
(gnus-article-setup-buffer))
;; First and last article in this newsgroup.
- (and gnus-newsgroup-headers
- (setq gnus-newsgroup-begin
- (mail-header-number (car gnus-newsgroup-headers)))
- (setq gnus-newsgroup-end
- (mail-header-number
- (gnus-last-element gnus-newsgroup-headers))))
+ (when gnus-newsgroup-headers
+ (setq gnus-newsgroup-begin
+ (mail-header-number (car gnus-newsgroup-headers))
+ gnus-newsgroup-end
+ (mail-header-number
+ (gnus-last-element gnus-newsgroup-headers))))
(setq gnus-reffed-article-number -1)
;; GROUP is successfully selected.
(or gnus-newsgroup-headers t)))))
(setq header nil))
(setcar (symbol-value id-dep) header))
(set id-dep (list header))))
- (if header
- (progn
- (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
- (setcdr (symbol-value ref-dep)
- (nconc (cdr (symbol-value ref-dep))
- (list (symbol-value id-dep))))
- (set ref-dep (list nil (symbol-value id-dep))))))
+ (when header
+ (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
+ (setcdr (symbol-value ref-dep)
+ (nconc (cdr (symbol-value ref-dep))
+ (list (symbol-value id-dep))))
+ (set ref-dep (list nil (symbol-value id-dep)))))
header))
(defun gnus-article-get-xrefs ()
(progn (end-of-line) (point))))
(mail-header-set-xref headers xref))))))))
-(defun gnus-summary-insert-subject (id &optional old-header)
+(defun gnus-summary-insert-subject (id &optional old-header use-old-header)
"Find article ID and insert the summary line for that article."
- (let ((header (or old-header (gnus-read-header id)))
+ (let ((header (if (and old-header use-old-header)
+ old-header (gnus-read-header id)))
(number (and (numberp id) id))
pos)
(when header
;; Rebuild the thread that this article is part of and go to the
;; article we have fetched.
- (when old-header
+ (when (and (not gnus-show-threads)
+ old-header)
(when (setq pos (text-property-any
(point-min) (point-max) 'gnus-number
(mail-header-number old-header)))
;; We read in the article if we have to.
(and (not data)
force
- (gnus-summary-insert-subject article (and (vectorp force) force))
+ (gnus-summary-insert-subject article (and (vectorp force) force) t)
(setq data (gnus-data-find article)))
(goto-char b)
(if (not data)
gnus-article-buffer
(save-restriction
(widen)
- (let ((start (window-start)))
- (news-caesar-buffer-body arg)
+ (let ((start (window-start))
+ buffer-read-only)
+ (message-caesar-buffer-body arg)
(set-window-start (get-buffer-window (current-buffer)) start))))))
(defun gnus-summary-stop-page-breaking ()
(interactive "P")
(gnus-set-global-variables)
(let ((articles (gnus-summary-work-articles n))
+ (save-buffer (save-excursion
+ (nnheader-set-temp-buffer " *Gnus Save*")))
file header article)
(while articles
(setq header (gnus-summary-article-header
;; This is a real article.
(save-window-excursion
(gnus-summary-select-article t nil nil article))
+ (save-excursion
+ (set-buffer save-buffer)
+ (insert-buffer-substring gnus-original-article-buffer))
(unless gnus-save-all-headers
;; Remove headers accoring to `gnus-saved-headers'.
(let ((gnus-visible-headers
- (or gnus-saved-headers gnus-visible-headers)))
- (gnus-article-hide-headers nil t)))
- ;; Remove any X-Gnus lines.
- (save-excursion
- (set-buffer gnus-article-buffer)
- (save-restriction
- (let ((buffer-read-only nil))
- (nnheader-narrow-to-headers)
- (while (re-search-forward "^X-Gnus" nil t)
- (gnus-delete-line)))))
+ (or gnus-saved-headers gnus-visible-headers))
+ (gnus-article-buffer save-buffer))
+ (gnus-article-hide-headers 1 t)))
(save-window-excursion
(if (not gnus-default-article-saver)
(error "No default saver is defined.")
- (setq file (funcall
- gnus-default-article-saver
- (cond
- ((not gnus-prompt-before-saving)
- 'default)
- ((eq gnus-prompt-before-saving 'always)
- nil)
- (t file))))))
+ ;; !!! Magic! The saving functions all save
+ ;; `gnus-original-article-buffer' (or so they think),
+ ;; but we bind that variable to out save-buffer.
+ (let ((gnus-original-article-buffer save-buffer))
+ (setq file (funcall
+ gnus-default-article-saver
+ (cond
+ ((not gnus-prompt-before-saving)
+ 'default)
+ ((eq gnus-prompt-before-saving 'always)
+ nil)
+ (t file)))))))
(gnus-summary-remove-process-mark article)
(unless not-saved
(gnus-summary-set-saved-mark article))))
+ (gnus-kill-buffer save-buffer)
(gnus-summary-position-point)
n))
;; numbers for this article.
(mail-header-set-number header gnus-reffed-article-number))
(decf gnus-reffed-article-number)
+ (gnus-remove-header (mail-header-number header))
(push header gnus-newsgroup-headers)
(setq gnus-current-headers header)
(push (mail-header-number header) gnus-newsgroup-limit))
header)))))
+(defun gnus-remove-header (number)
+ "Remove header NUMBER from `gnus-newsgroup-headers'."
+ (if (and gnus-newsgroup-headers
+ (= number (mail-header-number (car gnus-newsgroup-headers))))
+ (pop gnus-newsgroup-headers)
+ (let ((headers gnus-newsgroup-headers))
+ (while (and (cdr headers)
+ (not (= number (mail-header-number (cadr headers)))))
+ (pop headers))
+ (when (cdr headers)
+ (setcdr headers (cddr headers))))))
+
(defun gnus-article-prepare (article &optional all-headers header)
"Prepare ARTICLE in article mode buffer.
ARTICLE should either be an article number or a Message-ID.
If given a negative prefix, always show; if given a positive prefix,
always hide."
(interactive "P")
- (unless (gnus-article-check-hidden-text 'headers arg)
+ (if (gnus-article-check-hidden-text 'headers arg)
+ ;; Show boring headers as well.
+ (gnus-article-show-hidden-text 'boring-headers)
;; This function might be inhibited.
(unless gnus-inhibit-hiding
(save-excursion
(while (looking-at "From ")
(forward-line 1))
(unless (bobp)
- (gnus-hide-text (point-min) (point) props))
+ (if delete
+ (delete-region (point-min) (point))
+ (gnus-hide-text (point-min) (point) props)))
;; Then treat the rest of the header lines.
(narrow-to-region
(point)
(while (search-forward "\b" nil t)
(let ((next (following-char))
(previous (char-after (- (point) 2))))
- (cond ((eq next previous)
- (gnus-put-text-property (- (point) 2) (point) 'invisible t)
- (gnus-put-text-property (point) (1+ (point)) 'face 'bold))
- ((eq next ?_)
- (gnus-put-text-property (1- (point)) (1+ (point)) 'invisible t)
- (gnus-put-text-property
- (- (point) 2) (1- (point)) 'face 'underline))
- ((eq previous ?_)
- (gnus-put-text-property (- (point) 2) (point) 'invisible t)
- (gnus-put-text-property
- (point) (1+ (point)) 'face 'underline))))))))
+ (cond
+ ((eq next previous)
+ (gnus-put-text-property (- (point) 2) (point) 'invisible t)
+ (gnus-put-text-property (point) (1+ (point)) 'face 'bold))
+ ((eq next ?_)
+ (gnus-put-text-property (1- (point)) (1+ (point)) 'invisible t)
+ (gnus-put-text-property
+ (- (point) 2) (1- (point)) 'face 'underline))
+ ((eq previous ?_)
+ (gnus-put-text-property (- (point) 2) (point) 'invisible t)
+ (gnus-put-text-property
+ (point) (1+ (point)) 'face 'underline))))))))
(defun gnus-article-word-wrap ()
"Format too long lines."
(process-send-region "gnus-x-face" beg end)
(process-send-eof "gnus-x-face")))))))))
-(defalias 'gnus-header-decode-quoted-printable 'gnus-decode-rfc1522)
+(defalias 'gnus-headers-decode-quoted-printable 'gnus-decode-rfc1522)
(defun gnus-decode-rfc1522 ()
"Hack to remove QP encoding from headers."
(let ((case-fold-search t)
(set-buffer gnus-article-buffer)
(let ((hide (gnus-article-hidden-text-p type)))
(cond ((or (and (null arg) (eq hide 'hidden))
- (and arg (< 0 (prefix-numeric-value arg))))
+ (and arg (< (prefix-numeric-value arg) 1)))
(gnus-article-show-hidden-text type))
+ ((and (numberp arg) (> (prefix-numeric-value arg) 0))
+ nil)
((eq hide 'shown)
(gnus-article-show-hidden-text type t))
(t nil)))))
(prog1
(concat (if prev ", " "") (int-to-string
(floor num))
- " " (symbol-name (car unit))
+ " " (symbol-name (car unit))
(if (> num 1) "s" ""))
(setq prev t))))
gnus-article-time-units "")
(if (gnus-visual-p 'article-highlight 'highlight)
(gnus-article-highlight-some)))
-;; Article savers.
+;;; Article savers.
(defun gnus-output-to-rmail (file-name)
"Append the current article to an Rmail file named FILE-NAME."
(unless (equal method gnus-message-archive-method)
(gnus-error 1 "Cannot read active file from %s server."
(car method)))
+ (gnus-message 5 mesg)
(gnus-active-to-gnus-format method gnus-active-hashtb)
;; We mark this active file as read.
(push method gnus-have-read-active-file)
(defun gnus-continuum-version (version)
"Return VERSION as a floating point number."
- (when (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
+ (when (or (string-match "^\\([^ ]+\\)? ?Gnus v?\\([0-9.]+\\)$" version)
+ (string-match "^\\(.?\\)gnus-\\([0-9.]+\\)$" version))
(let* ((alpha (and (match-beginning 1) (match-string 1 version)))
(number (match-string 2 version))
major minor least)
(if (zerop major)
(format "%s00%02d%02d"
(cond
- ((string= alpha "(ding)") "4.99")
- ((string= alpha "September") "5.01")
- ((string= alpha "Red") "5.03"))
+ ((member alpha '("(ding)" "d")) "4.99")
+ ((member alpha '("September" "s")) "5.01")
+ ((member alpha '("Red" "r")) "5.03"))
minor least)
- (format "%d.%02d%20d" major minor least))))))
+ (format "%d.%02d%02d" major minor least))))))
(defun gnus-convert-old-newsrc ()
"Convert old newsrc into the new format, if needed."
killed gnus-killed-assoc
marked gnus-marked-assoc)))
(setq gnus-newsrc-alist nil)
- (while (setq info (gnus-get-info (setq group (pop newsrc))))
- (if info
+ (while (setq group (pop newsrc))
+ (if (setq info (gnus-get-info (car group)))
(progn
(gnus-info-set-read info (cddr group))
(gnus-info-set-level