Function: gnus-apply-kill-file-internal

gnus-apply-kill-file-internal is an autoloaded and byte-compiled function defined in gnus-kill.el.gz.

Signature

(gnus-apply-kill-file-internal)

Documentation

Apply a kill file to the current newsgroup.

Returns the number of articles marked as read.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-kill.el.gz
(defun gnus-apply-kill-file-internal ()
  "Apply a kill file to the current newsgroup.
Returns the number of articles marked as read."
  (let* ((kill-files (list (gnus-newsgroup-kill-file nil)
			   (gnus-newsgroup-kill-file gnus-newsgroup-name)))
	 (unreads (length gnus-newsgroup-unreads))
	 (gnus-summary-inhibit-highlight t)
	 ) ;; beg
    (setq gnus-newsgroup-kill-headers nil)
    ;; If there are any previously scored articles, we remove these
    ;; from the `gnus-newsgroup-headers' list that the score functions
    ;; will see.  This is probably pretty wasteful when it comes to
    ;; conses, but is, I think, faster than having to assq in every
    ;; single score function.
    (let ((files kill-files))
      (while files
	(if (file-exists-p (car files))
	    (let ((headers gnus-newsgroup-headers))
	      (if gnus-kill-killed
		  (setq gnus-newsgroup-kill-headers
			(mapcar #'mail-header-number headers))
		(while headers
		  (unless (gnus-member-of-range
			   (mail-header-number (car headers))
			   gnus-newsgroup-killed)
		    (push (mail-header-number (car headers))
			  gnus-newsgroup-kill-headers))
		  (setq headers (cdr headers))))
	      (setq files nil))
	  (setq files (cdr files)))))
    (if (not gnus-newsgroup-kill-headers)
	()
      (save-window-excursion
	(save-excursion
	  (while kill-files
	    (if (not (file-exists-p (car kill-files)))
		()
	      (gnus-message 6 "Processing kill file %s..." (car kill-files))
	      (find-file (car kill-files))
	      (goto-char (point-min))

	      (if (consp (ignore-errors (read (current-buffer))))
		  (gnus-kill-parse-gnus-kill-file)
		(gnus-kill-parse-rn-kill-file))

	      (gnus-message
	       6 "Processing kill file %s...done" (car kill-files)))
	    (setq kill-files (cdr kill-files)))))

      (gnus-set-mode-line 'summary)

      (if nil ;; beg
	  (let ((nunreads (- unreads (length gnus-newsgroup-unreads))))
	    (or (eq nunreads 0)
		(gnus-message 6 "Marked %d articles as read" nunreads))
	    nunreads)
	0))))