umerin@photon.stars.flab.Fujitsu.JUNET (Masanobu UMEDA) (07/05/88)
This is the second official patch to GNUS. Please apply the patch to GNUS after applying patch#1. This patch includes: (1) Bug fixes of gnus-auto-select-next. Many parts of gnus are broken by patch#1. (2) Performance improvement by use of oblist. Masanobu UMEDA --------------------------------------------------------------------------- *** /tmp/,RCSt1a00829 Tue Jul 5 12:52:12 1988 --- gnus.el Tue Jul 5 11:21:55 1988 *************** *** 1,7 **** ;;; GNUS: NNTP-based News Reader for GNU Emacs ;; Copyright (C) 1987, 1988 Fujitsu Laboratoris LTD. ;; Copyright (C) 1987, 1988 Masanobu UMEDA (umerin@flab.flab.Fujitsu.JUNET) ! ;; $Header: gnus.el,v 3.5 88/06/28 13:36:38 umerin Exp $ ;; This file is part of GNU Emacs. --- 1,7 ---- ;;; GNUS: NNTP-based News Reader for GNU Emacs ;; Copyright (C) 1987, 1988 Fujitsu Laboratoris LTD. ;; Copyright (C) 1987, 1988 Masanobu UMEDA (umerin@flab.flab.Fujitsu.JUNET) ! ;; $Header: gnus.el,v 3.6 88/07/05 11:20:43 umerin Exp $ ;; This file is part of GNU Emacs. *************** *** 83,88 **** --- 83,91 ---- "*Hooks for saving the newsrc file. This hook is called before writing to .newsrc file.") + (defvar gnus-Exit-gnus-hook nil + "*Hooks called when exiting gnus.") + ;; Site dependent variables. You have to define these variables in ;; site-init.el, default.el or your .emacs. *************** *** 109,122 **** (defvar gnus-newsrc-assoc nil "Assoc list of read articles.") ! (defvar gnus-unread-assoc nil ! "Assoc list of unread articles.") ! (defvar gnus-active-assoc nil ! "Assoc list of active articles.") ! (defvar gnus-octive-assoc nil ! "Assoc list of OLD active articles.") (defvar gnus-Group-display-buffer "*Newsgroup*") (defvar gnus-Subject-display-buffer "*Subject*") --- 112,125 ---- (defvar gnus-newsrc-assoc nil "Assoc list of read articles.") ! (defvar gnus-unread-hashtb nil ! "Hashtable of unread articles.") ! (defvar gnus-active-hashtb nil ! "Hashtable of active articles.") ! (defvar gnus-octive-hashtb nil ! "Hashtable of OLD active articles.") (defvar gnus-Group-display-buffer "*Newsgroup*") (defvar gnus-Subject-display-buffer "*Subject*") *************** *** 167,172 **** --- 170,188 ---- (,@ forms)) (select-window StartBufferWindow))))) + (defmacro gnus-make-hashtable () + '(make-abbrev-table)) + + (defmacro gnus-gethash (string hashtable) + "Get hash value of STRING in HASHTABLE." + ;;(` (symbol-value (abbrev-symbol (, string) (, hashtable)))) + (` (abbrev-expansion (, string) (, hashtable)))) + + (defmacro gnus-sethash (string value hashtable) + "Set hash value. Arguments are STRING, VALUE, and HASHTABLE." + ;; We cannot use define-abbrev since it only accepts string as value. + (` (set (intern (, string) (, hashtable)) (, value)))) + ;;; ;;; GNUS Group display mode *************** *** 259,266 **** variable `gnus-auto-select-next' is T (default). You don't have to exit subject selection mode explicitly. ! Entry to this mode calls the value of gnus-Group-mode-hook with no arguments, ! if that value is non-nil." (interactive) (kill-all-local-variables) (setq major-mode 'gnus-Group-mode) --- 275,284 ---- variable `gnus-auto-select-next' is T (default). You don't have to exit subject selection mode explicitly. ! Entry to this mode calls the value of gnus-Group-mode-hook with no ! arguments, if that value is non-nil. And the value of ! gnus-Exit-gnus-hook will be called with no arguments when exiting ! GNUS, if that value is non-nil." (interactive) (kill-all-local-variables) (setq major-mode 'gnus-Group-mode) *************** *** 288,294 **** (defun gnus-Group-startup-message () (insert "\n\n\n\n ! GNUS Version 3.5 NNTP-based News Reader for GNU Emacs --- 306,312 ---- (defun gnus-Group-startup-message () (insert "\n\n\n\n ! GNUS Version 3.6 NNTP-based News Reader for GNU Emacs *************** *** 318,349 **** If optional argument ALL is non-nil, unsubscribed groups are also listed." (save-excursion (let ((buffer-read-only nil) ! (unread gnus-unread-assoc) ! (group nil) (group-name nil) ;; This specifies format of Group display buffer. (cntl "%s %5s: %s\n")) (erase-buffer) (goto-char (point-min)) ;; List news groups. ! (while unread ! (setq group (car unread)) ! (setq group-name (car group)) (if (or all ! (and (> (nth 1 group) 0) ;There are unread articles. ! (nth 1 (assoc group-name gnus-newsrc-assoc)))) (progn (insert (format cntl ;; Subscribed or not. ! (if (nth 1 (assoc group-name gnus-newsrc-assoc)) ! " " "U") ;; Number of unread articles. ! (nth 1 group) ;; News group name. group-name)) )) ! (setq unread (cdr unread)) )) )) --- 336,368 ---- If optional argument ALL is non-nil, unsubscribed groups are also listed." (save-excursion (let ((buffer-read-only nil) ! (newsrc gnus-newsrc-assoc) ! (group-info nil) (group-name nil) + (how-many 0) ;; This specifies format of Group display buffer. (cntl "%s %5s: %s\n")) (erase-buffer) (goto-char (point-min)) ;; List news groups. ! (while newsrc ! (setq group-info (car newsrc)) ! (setq group-name (car group-info)) ! (setq how-many (nth 1 (gnus-gethash group-name gnus-unread-hashtb))) (if (or all ! (and (nth 1 group-info) ;Subscribed. ! (> how-many 0))) ;There are unread articles. (progn (insert (format cntl ;; Subscribed or not. ! (if (nth 1 group-info) " " "U") ;; Number of unread articles. ! how-many ;; News group name. group-name)) )) ! (setq newsrc (cdr newsrc)) )) )) *************** *** 357,363 **** (set-buffer (get-buffer gnus-Group-display-buffer)) (let ((buffer-read-only nil) (visible nil) - (unread (assoc group gnus-unread-assoc)) ;; This specifies format of Group display buffer. (cntl "%s %5s: %s\n")) ;; Search point to modify. --- 376,381 ---- *************** *** 374,383 **** (insert (format cntl ;; Subscribed or not. ! (if (nth 1 (assoc group gnus-newsrc-assoc)) ! " " "U") ;; Number of unread articles. ! (nth 1 unread) ;; News group name. group)) )) --- 392,400 ---- (insert (format cntl ;; Subscribed or not. ! (if (nth 1 (assoc group gnus-newsrc-assoc)) " " "U") ;; Number of unread articles. ! (nth 1 (gnus-gethash group gnus-unread-hashtb)) ;; News group name. group)) )) *************** *** 403,411 **** (if group (gnus-Subject-read-group group ! (or all ! (not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed ! (zerop (nth 1 (assoc group gnus-unread-assoc)))) ;No unread no-article )) )) --- 420,429 ---- (if group (gnus-Subject-read-group group ! (or ! all ! (not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed ! (zerop (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread no-article )) )) *************** *** 420,432 **** (defun gnus-Group-read-group (group &optional all) "Start reading news in news GROUP. If argument ALL is non-nil, already read articles become readable." ! (interactive (list (completing-read "News group: " gnus-unread-assoc) current-prefix-arg)) (gnus-Subject-read-group group (or all (not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed ! (zerop (nth 1 (assoc group gnus-unread-assoc)))) ;No unread article )) (defun gnus-Group-search-forward (backward any-group) --- 438,450 ---- (defun gnus-Group-read-group (group &optional all) "Start reading news in news GROUP. If argument ALL is non-nil, already read articles become readable." ! (interactive (list (completing-read "News group: " gnus-newsrc-assoc) current-prefix-arg)) (gnus-Subject-read-group group (or all (not (nth 1 (assoc group gnus-newsrc-assoc))) ;Unsubscribed ! (zerop (nth 1 (gnus-gethash group gnus-unread-hashtb)))) ;No unread )) (defun gnus-Group-search-forward (backward any-group) *************** *** 539,554 **** (progn (gnus-save-newsrc-file) (gnus-clear-system) ! (nntp-close-server)) )) (defun gnus-Group-quit () "Quit reading news without updating .newsrc." (interactive) ! (if (yes-or-no-p "Quit reading news without saving .newsrc? ") (progn (gnus-clear-system) ! (nntp-close-server)) )) --- 557,576 ---- (progn (gnus-save-newsrc-file) (gnus-clear-system) ! (nntp-close-server) ! (run-hooks 'gnus-Exit-gnus-hook)) )) (defun gnus-Group-quit () "Quit reading news without updating .newsrc." (interactive) ! (if (yes-or-no-p ! (format "Quit reading news without saving %s? " ! (file-name-nondirectory gnus-current-startup-file))) (progn (gnus-clear-system) ! (nntp-close-server) ! (run-hooks 'gnus-Exit-gnus-hook)) )) *************** *** 695,702 **** ;; Kill article display buffer because I sometime get ;; confused by old article buffer. (if (get-buffer gnus-Article-display-buffer) ! (kill-buffer gnus-Article-display-buffer) ! )) ;; Adjust cursor point. (beginning-of-line) (search-forward ":" nil t) --- 717,723 ---- ;; Kill article display buffer because I sometime get ;; confused by old article buffer. (if (get-buffer gnus-Article-display-buffer) ! (kill-buffer gnus-Article-display-buffer))) ;; Adjust cursor point. (beginning-of-line) (search-forward ":" nil t) *************** *** 804,811 **** (if (funcall func regexp nil t) (setq article (string-to-int (buffer-substring (match-beginning 1) ! (match-end 1)))) ! ) ;; Adjust cursor point. (beginning-of-line) (search-forward ":" nil t) --- 825,831 ---- (if (funcall func regexp nil t) (setq article (string-to-int (buffer-substring (match-beginning 1) ! (match-end 1))))) ;; Adjust cursor point. (beginning-of-line) (search-forward ":" nil t) *************** *** 908,914 **** (defun gnus-Subject-configure-window () "Use two window mode. One is for reading subjects and the other is article." ! (if (one-window-p t) (progn ;; We have to prepare article buffer first to prevent ;; displaying subject buffer twice. --- 928,936 ---- (defun gnus-Subject-configure-window () "Use two window mode. One is for reading subjects and the other is article." ! (if (or (one-window-p t) ! (null (get-buffer-window gnus-Article-display-buffer)) ! (null (get-buffer-window gnus-Subject-display-buffer))) (progn ;; We have to prepare article buffer first to prevent ;; displaying subject buffer twice. *************** *** 915,920 **** --- 937,943 ---- ;; Suggested by Juha Heinanen <jh@tut.fi> (gnus-Article-setup-buffer) (switch-to-buffer gnus-Subject-display-buffer) + (delete-other-windows) (split-window-vertically (1+ gnus-subject-lines-height)) (other-window 1) (switch-to-buffer gnus-Article-display-buffer) *************** *** 923,936 **** (defun gnus-Subject-display-article (article &optional all-header) "Display ARTICLE in article display buffer." ! (if article ! (progn ! (gnus-Subject-configure-window) ! (let ((window (selected-window))) ! (gnus-Article-prepare article all-header) ! (pop-to-buffer gnus-Article-display-buffer) ! (select-window window) ! (gnus-Subject-set-mode-line))) )) (defun gnus-Subject-select-article (&optional all-headers force) --- 946,958 ---- (defun gnus-Subject-display-article (article &optional all-header) "Display ARTICLE in article display buffer." ! (if (null article) ! nil ! (gnus-Subject-configure-window) ! (gnus-Article-prepare article all-header) ! (gnus-Subject-set-mode-line) ! ;; Successfully display article. ! t )) (defun gnus-Subject-select-article (&optional all-headers force) *************** *** 943,951 **** (/= article gnus-current-article)) ;; Selected subject is different from current article's. (gnus-Subject-display-article article all-headers) ! (or (get-buffer-window gnus-Article-display-buffer) ! (gnus-Subject-configure-window)) ! ) )) ;;(defun gnus-Subject-next-article (unread &optional subject) --- 965,971 ---- (/= article gnus-current-article)) ;; Selected subject is different from current article's. (gnus-Subject-display-article article all-headers) ! (gnus-Subject-configure-window)) )) ;;(defun gnus-Subject-next-article (unread &optional subject) *************** *** 978,983 **** --- 998,1005 ---- '(gnus-Subject-next-unread-article gnus-Subject-next-article gnus-Subject-next-page)) + ;; Ignore characters typed ahead. + (not (input-pending-p)) ))) (message "No more%s articles%s" (if unread " unread" "") *************** *** 987,993 **** (if (string-equal keyseq " ") "SPACE" keyseq) group ! (nth 1 (assoc group gnus-unread-assoc))) (format " (Type %s to exit %s)" (if (string-equal keyseq " ") "SPACE" keyseq) --- 1009,1015 ---- (if (string-equal keyseq " ") "SPACE" keyseq) group ! (nth 1 (gnus-gethash group gnus-unread-hashtb))) (format " (Type %s to exit %s)" (if (string-equal keyseq " ") "SPACE" keyseq) *************** *** 1001,1008 **** (message "") (if (eq char cmd) (if (null group) ! (call-interactively 'gnus-Subject-exit) ! (gnus-Subject-exit) (gnus-Subject-read-group group nil nil)) (setq unread-command-char char)) )) --- 1023,1030 ---- (message "") (if (eq char cmd) (if (null group) ! (gnus-Subject-exit) ! (gnus-Subject-exit t) ;Exit temporary. (gnus-Subject-read-group group nil nil)) (setq unread-command-char char)) )) *************** *** 1349,1355 **** (read-string "Shell command on article: ") nil) )) ! (defun gnus-Subject-exit () "Exit reading current news group, and then return to group selection mode." (interactive) (let ((updated nil)) --- 1371,1377 ---- (read-string "Shell command on article: ") nil) )) ! (defun gnus-Subject-exit (&optional temporary) "Exit reading current news group, and then return to group selection mode." (interactive) (let ((updated nil)) *************** *** 1364,1375 **** (bury-buffer gnus-Subject-display-buffer)) (if (get-buffer gnus-Article-display-buffer) (bury-buffer gnus-Article-display-buffer)) ! (if (interactive-p) ! (progn ! (switch-to-buffer gnus-Group-display-buffer) ! (delete-other-windows)) ! ;; Do not update windows but change buffer to work. ! (set-buffer gnus-Group-display-buffer)) ;; Update cross referenced group info. (while updated (gnus-Group-update-group (car updated) t) ;Ignore non-visible group. --- 1386,1396 ---- (bury-buffer gnus-Subject-display-buffer)) (if (get-buffer gnus-Article-display-buffer) (bury-buffer gnus-Article-display-buffer)) ! (if temporary ! ;; Do not update windows but change buffer to work. ! (set-buffer gnus-Group-display-buffer) ! (switch-to-buffer gnus-Group-display-buffer) ! (delete-other-windows)) ;; Update cross referenced group info. (while updated (gnus-Group-update-group (car updated) t) ;Ignore non-visible group. *************** *** 1441,1447 **** "Prepare ARTICLE in article display buffer. If optional argument ALL-HEADERS is non-nil, all headers are inserted." (save-excursion - (gnus-Article-setup-buffer) (set-buffer gnus-Article-display-buffer) (let ((buffer-read-only nil)) (erase-buffer) --- 1462,1467 ---- *************** *** 1457,1470 **** (gnus-Subject-mark-read gnus-current-article)) ;; Next function must be called after setting ;; `gnus-current-article' variable. ! (gnus-Article-set-mode-line) ! ) (gnus-Subject-mark-read article) ! (error "No such article (may be canceled).")) ))) (defun gnus-Article-show-all-headers () "Show all article headers in article display buffer." (gnus-Article-prepare gnus-current-article t)) (defun gnus-Article-set-mode-line () --- 1477,1490 ---- (gnus-Subject-mark-read gnus-current-article)) ;; Next function must be called after setting ;; `gnus-current-article' variable. ! (gnus-Article-set-mode-line)) (gnus-Subject-mark-read article) ! (message "No such article (may be canceled).")) ))) (defun gnus-Article-show-all-headers () "Show all article headers in article display buffer." + (gnus-Article-setup-buffer) (gnus-Article-prepare gnus-current-article t)) (defun gnus-Article-set-mode-line () *************** *** 1588,1595 **** (defun gnus-Article-show-subjects () "Reconfigure windows in order to show subjects." (interactive) ! (pop-to-buffer gnus-Subject-display-buffer) ! (delete-other-windows) (gnus-Subject-configure-window)) --- 1608,1614 ---- (defun gnus-Article-show-subjects () "Reconfigure windows in order to show subjects." (interactive) ! (delete-other-windows) ;Force re-configure windows. (gnus-Subject-configure-window)) *************** *** 1625,1635 **** If optional argument SHOW-ALL is non-nil, all of articles in the group are selected." (if (nntp-request-group group) ! (let ((unread (assoc group gnus-unread-assoc))) (setq gnus-current-news-group group) (if show-all ;; Select all active articles. ! (let ((active (assoc group gnus-active-assoc))) (setq gnus-current-group-begin (car (nth 2 active))) (setq gnus-current-group-end (cdr (nth 2 active))) (setq gnus-current-group-articles --- 1644,1654 ---- If optional argument SHOW-ALL is non-nil, all of articles in the group are selected." (if (nntp-request-group group) ! (let ((unread (gnus-gethash group gnus-unread-hashtb))) (setq gnus-current-news-group group) (if show-all ;; Select all active articles. ! (let ((active (gnus-gethash group gnus-active-hashtb))) (setq gnus-current-group-begin (car (nth 2 active))) (setq gnus-current-group-end (cdr (nth 2 active))) (setq gnus-current-group-articles *************** *** 1656,1665 **** (defun gnus-clear-system () "Clear all variables and buffer." ;; Clear variables. ! (setq gnus-active-assoc nil) (setq gnus-newsrc-assoc nil) ! (setq gnus-unread-assoc nil) ;; Kill buffers (if (get-buffer gnus-Article-display-buffer) (kill-buffer gnus-Article-display-buffer)) (if (get-buffer gnus-Subject-display-buffer) --- 1675,1686 ---- (defun gnus-clear-system () "Clear all variables and buffer." ;; Clear variables. ! (setq gnus-active-hashtb nil) (setq gnus-newsrc-assoc nil) ! (setq gnus-unread-hashtb nil) ;; Kill buffers + (if (get-file-buffer gnus-current-startup-file) + (kill-buffer (get-file-buffer gnus-current-startup-file))) (if (get-buffer gnus-Article-display-buffer) (kill-buffer gnus-Article-display-buffer)) (if (get-buffer gnus-Subject-display-buffer) *************** *** 1712,1722 **** ;; (("general" t (1 . 1)) ;; ("misc" t (1 . 10) (12 . 15)) ;; ("test" nil (1 . 99)) ...) ! ;; GNUS internal format of gnus-active-assoc: ;; (("general" t (1 . 1)) ;; ("misc" t (1 . 10)) ;; ("test" nil (1 . 99)) ...) ! ;; GNUS internal format of gnus-unread-assoc: ;; (("general" 1 (1 . 1)) ;; ("misc" 14 (1 . 10) (12 . 15)) ;; ("test" 99 (1 . 99)) ...) --- 1733,1743 ---- ;; (("general" t (1 . 1)) ;; ("misc" t (1 . 10) (12 . 15)) ;; ("test" nil (1 . 99)) ...) ! ;; GNUS internal format of gnus-active-hashtb: ;; (("general" t (1 . 1)) ;; ("misc" t (1 . 10)) ;; ("test" nil (1 . 99)) ...) ! ;; GNUS internal format of gnus-unread-hashtb: ;; (("general" 1 (1 . 1)) ;; ("misc" 14 (1 . 10) (12 . 15)) ;; ("test" 99 (1 . 99)) ...) *************** *** 1724,1732 **** (defun gnus-setup-news-info (&optional force) "Setup news information. If optional argument FORCE is non-nil, initialize completely." ! (if (and gnus-active-assoc gnus-newsrc-assoc ! gnus-unread-assoc (not force)) (progn ;; Re-read active file only. --- 1745,1753 ---- (defun gnus-setup-news-info (&optional force) "Setup news information. If optional argument FORCE is non-nil, initialize completely." ! (if (and gnus-active-hashtb gnus-newsrc-assoc ! gnus-unread-hashtb (not force)) (progn ;; Re-read active file only. *************** *** 1751,1780 **** (defun gnus-get-unread-articles () "Compute diffs between active and read articles." (let ((read gnus-newsrc-assoc) ! (group nil) (group-name nil) (active nil) ! (range nil) ! (unread nil)) (message "Checking new news...") (while read ! (setq group (car read)) ;About one news group ! (setq group-name (car group)) ! (setq active (nth 2 (assoc group-name gnus-active-assoc))) ! (if (and (not (null gnus-octive-assoc)) ! (equal active (nth 2 (assoc group-name gnus-octive-assoc)))) ! ;; There are no changes in this news group, so use old info. ! (setq unread (cons (assoc group-name gnus-unread-assoc) unread)) ! (setq range (gnus-difference-of-range active (nthcdr 2 group))) ! (setq unread ! (cons (cons group-name ;Group name ! (cons (gnus-number-of-articles range) ! range)) ;Range of unread articles ! unread)) ) (setq read (cdr read)) ) - (setq gnus-unread-assoc (nreverse unread)) (message "Checking new news... Done.") )) --- 1772,1801 ---- (defun gnus-get-unread-articles () "Compute diffs between active and read articles." (let ((read gnus-newsrc-assoc) ! (group-info nil) (group-name nil) (active nil) ! (range nil)) (message "Checking new news...") + (or gnus-unread-hashtb + (setq gnus-unread-hashtb (gnus-make-hashtable))) (while read ! (setq group-info (car read)) ;About one news group ! (setq group-name (car group-info)) ! (setq active (nth 2 (gnus-gethash group-name gnus-active-hashtb))) ! (if (and gnus-octive-hashtb ! (equal active ! (nth 2 (gnus-gethash group-name gnus-octive-hashtb)))) ! nil ;Nothing changed. ! (setq range (gnus-difference-of-range active (nthcdr 2 group-info))) ! (gnus-sethash group-name ! (cons group-name ;Group name ! (cons (gnus-number-of-articles range) ! range)) ;Range of unread articles ! gnus-unread-hashtb) ) (setq read (cdr read)) ) (message "Checking new news... Done.") )) *************** *** 1853,1859 **** (setq group (car (car xrefs))) (setq idlist (cdr (car xrefs))) (setq unread (gnus-uncompress-sequence ! (nthcdr 2 (assoc group gnus-unread-assoc)))) (while idlist (setq unread (delq (car idlist) unread)) (setq idlist (cdr idlist))) --- 1874,1880 ---- (setq group (car (car xrefs))) (setq idlist (cdr (car xrefs))) (setq unread (gnus-uncompress-sequence ! (nthcdr 2 (gnus-gethash group gnus-unread-hashtb)))) (while idlist (setq unread (delq (car idlist) unread)) (setq idlist (cdr idlist))) *************** *** 1863,1871 **** (defun gnus-update-unread-articles (group unread-list) "Update unread article information of news GROUP using UNREAD-LIST." ! (let ((active (nth 2 (assoc group gnus-active-assoc))) ! (unread (assoc group gnus-unread-assoc))) ! ;; Update gnus-unread-assoc. (if unread-list (setcdr (cdr unread) (gnus-compress-sequence unread-list)) --- 1884,1892 ---- (defun gnus-update-unread-articles (group unread-list) "Update unread article information of news GROUP using UNREAD-LIST." ! (let ((active (nth 2 (gnus-gethash group gnus-active-hashtb))) ! (unread (gnus-gethash group gnus-unread-hashtb))) ! ;; Update gnus-unread-hashtb. (if unread-list (setcdr (cdr unread) (gnus-compress-sequence unread-list)) *************** *** 1964,2003 **** (defun gnus-add-new-news-group () "Add new news group to gnus-newsrc-assoc." ! (let ((active (reverse gnus-active-assoc)) ! (group nil)) ! (while active ! (setq group (car (car active))) ! (if (null (assoc group gnus-newsrc-assoc)) ! ;; Found new news group. ! (let ((subscribe (not (or (string-equal group "control") ! (string-equal group "junk"))))) ! (setq gnus-newsrc-assoc ! (cons (list group subscribe) gnus-newsrc-assoc)) ! (gnus-update-newsrc-buffer group) ! (if subscribe ! (message "New news group: %s is subscribed." group)) ! )) ! (setq active (cdr active)) ! ))) - ;;(defun gnus-clean-up-newsrc () - ;; "Mark as read expired articles." - ;; (let ((newsrc gnus-newsrc-assoc) - ;; (group nil)) - ;; (message "Checking expired articles...") - ;; (while newsrc - ;; (setq group (car (car newsrc))) ;News group name - ;; (setq newsrc (cdr newsrc)) - ;; (if (assoc group gnus-active-assoc) ;Must be active group - ;; (gnus-update-unread-articles - ;; group (gnus-uncompress-sequence - ;; (nthcdr 2 (assoc group gnus-unread-assoc))))) - ;; ) - ;; (gnus-make-newsrc-buffer) - ;; (message "Checking expired articles... Done.") - ;; )) - (defun gnus-delete-bogus-news-group (&optional confirm) "Delete bogus news group. If optional argument CONFIRM is non-nil, confirm deletion of news groups." --- 1985,2008 ---- (defun gnus-add-new-news-group () "Add new news group to gnus-newsrc-assoc." ! (let ((group nil)) ! (mapatoms ! (function ! (lambda (sym) ! (setq group (symbol-name sym)) ! (if (null (assoc group gnus-newsrc-assoc)) ! ;; Found new news group. ! (let ((subscribe (not (or (string-equal group "control") ! (string-equal group "junk"))))) ! (setq gnus-newsrc-assoc ! (cons (list group subscribe) gnus-newsrc-assoc)) ! (gnus-update-newsrc-buffer group) ! (if subscribe ! (message "New news group: %s is subscribed." group)) ! )))) ! gnus-active-hashtb) ! )) (defun gnus-delete-bogus-news-group (&optional confirm) "Delete bogus news group. If optional argument CONFIRM is non-nil, confirm deletion of news groups." *************** *** 2005,2014 **** (newsrc nil)) (message "Checking bogus news groups...") (while oldrc ! (if (or (assoc (car (car oldrc)) gnus-active-assoc) (and confirm ! (not (y-or-n-p (format "Delete bogus news group: %s " ! (car (car oldrc))))))) ;; Active news group. (setq newsrc (cons (car oldrc) newsrc)) ;; Found bogus news group. --- 2010,2020 ---- (newsrc nil)) (message "Checking bogus news groups...") (while oldrc ! (if (or (gnus-gethash (car (car oldrc)) gnus-active-hashtb) (and confirm ! (not (y-or-n-p ! (format "Delete bogus news group: %s " ! (car (car oldrc))))))) ;; Active news group. (setq newsrc (cons (car oldrc) newsrc)) ;; Found bogus news group. *************** *** 2026,2039 **** (message "Reading active file...") (if (nntp-request-list) ;Get active file from server (progn - ;; Save OLD active info. - (setq gnus-octive-assoc gnus-active-assoc) ;; Take care of unexpected situations. (gnus-copy-to-buffer " *GNUS-active*") ! (goto-char (point-min)) (gnus-active-to-gnus-format) - ;; Define variable gnus-active-assoc. - (eval-current-buffer) (kill-buffer (current-buffer)) (message "Reading active file... Done.") ) --- 2032,2043 ---- (message "Reading active file...") (if (nntp-request-list) ;Get active file from server (progn ;; Take care of unexpected situations. (gnus-copy-to-buffer " *GNUS-active*") ! ;; Save OLD active info. ! (setq gnus-octive-hashtb gnus-active-hashtb) ! (setq gnus-active-hashtb (gnus-make-hashtable)) (gnus-active-to-gnus-format) (kill-buffer (current-buffer)) (message "Reading active file... Done.") ) *************** *** 2041,2069 **** )) (defun gnus-active-to-gnus-format () ! "Convert NNTP active file format to internal format. ! Buffer becomes evaluable as lisp expression." ;; Delete unnecessary lines. (goto-char (point-min)) (delete-matching-lines "^to\\..*$") ! ;; Process each lines. (goto-char (point-min)) ! (while (not (eobp)) ! (if (re-search-forward "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([ymn]\\).*$" nil t) ! (replace-match ! (concat "(\"\\1\"" ! (if (string-equal "y" (buffer-substring (match-beginning 4) ! (match-end 4))) ! " t " " nil ") ! "(\\3 . \\2))")) ! (error "Active format error.")) ! (forward-line 1)) ! ;; Make the buffer evaluable. ! (goto-char (point-min)) ! (insert "(setq gnus-active-assoc '(\n") ! (goto-char (point-max)) ! (insert "))\n") ! ) (defun gnus-read-newsrc-file () "Read in .newsrc FILE." --- 2045,2071 ---- )) (defun gnus-active-to-gnus-format () ! "Convert active file format to internal format." ;; Delete unnecessary lines. (goto-char (point-min)) (delete-matching-lines "^to\\..*$") ! ;; Store active file in hashtable. (goto-char (point-min)) ! (while ! (re-search-forward ! "^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\([ymn]\\).*$" ! nil t) ! (gnus-sethash ! (buffer-substring (match-beginning 1) (match-end 1)) ! (list (buffer-substring (match-beginning 1) (match-end 1)) ! (string-equal ! "y" (buffer-substring (match-beginning 4) (match-end 4))) ! (cons (string-to-int ! (buffer-substring (match-beginning 3) (match-end 3))) ! (string-to-int ! (buffer-substring (match-beginning 2) (match-end 2))))) ! gnus-active-hashtb) ! )) (defun gnus-read-newsrc-file () "Read in .newsrc FILE." -- Masanobu UMEDA umerin@flab.flab.Fujitsu.JUNET umerin%flab.flab.Fujitsu.JUNET@uunet.uu.NET
umerin@photon.stars.flab.Fujitsu.JUNET (Masanobu UMEDA) (07/07/88)
I was reported that gnus.el could not be byte-compiled successfully after upgrading to the latest version. (I could not reach the reporter, I'm posting here. Sorry.) I'd like to explain how to byte-compile GNUS files successfully. The order of files to be byte-compiled is very important since lisp macros are defined in nntp.el on which gnus.el depends. You have to byte-compile them in this order: nntp.el -> nnspool.el -> gnus.el To obtain the best performance, you'd better byte-compile GNUS. Thank you. -- Masanobu UMEDA umerin@flab.flab.Fujitsu.JUNET umerin%flab.flab.Fujitsu.JUNET@uunet.uu.NET