comparison lisp/gnus/nnfolder.el @ 19969:5f1ab3dd344d

*** empty log message ***
author Lars Magne Ingebrigtsen <larsi@gnus.org>
date Wed, 24 Sep 1997 01:50:24 +0000
parents 1dfca0cdcb91
children 1438b35b320b
comparison
equal deleted inserted replaced
19968:88dd57f50303 19969:5f1ab3dd344d
274 (nnfolder-possibly-change-group nil server) 274 (nnfolder-possibly-change-group nil server)
275 (nnmail-activate 'nnfolder) 275 (nnmail-activate 'nnfolder)
276 (when group 276 (when group
277 (unless (assoc group nnfolder-group-alist) 277 (unless (assoc group nnfolder-group-alist)
278 (push (list group (cons 1 0)) nnfolder-group-alist) 278 (push (list group (cons 1 0)) nnfolder-group-alist)
279 (nnmail-save-active nnfolder-group-alist nnfolder-active-file))) 279 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
280 (nnfolder-read-folder group)))
280 t) 281 t)
281 282
282 (deffoo nnfolder-request-list (&optional server) 283 (deffoo nnfolder-request-list (&optional server)
283 (nnfolder-possibly-change-group nil server) 284 (nnfolder-possibly-change-group nil server)
284 (save-excursion 285 (save-excursion
449 (nnmail-save-active nnfolder-group-alist nnfolder-active-file) 450 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
450 ;; We kill the buffer instead of renaming it and stuff. 451 ;; We kill the buffer instead of renaming it and stuff.
451 (kill-buffer (current-buffer)) 452 (kill-buffer (current-buffer))
452 t)))) 453 t))))
453 454
455 (defun nnfolder-request-regenerate (server)
456 (nnfolder-possibly-change-group nil server)
457 (nnfolder-generate-active-file)
458 t)
459
454 460
455 ;;; Internal functions. 461 ;;; Internal functions.
456 462
457 (defun nnfolder-adjust-min-active (group) 463 (defun nnfolder-adjust-min-active (group)
458 ;; Find the lowest active article in this group. 464 ;; Find the lowest active article in this group.
501 (setq nnfolder-current-buffer nil 507 (setq nnfolder-current-buffer nil
502 nnfolder-current-group nil)) 508 nnfolder-current-group nil))
503 ;; Change group. 509 ;; Change group.
504 (when (and group 510 (when (and group
505 (not (equal group nnfolder-current-group))) 511 (not (equal group nnfolder-current-group)))
506 ;; 1997/8/14 by MORIOKA Tomohiko
507 ;; for XEmacs/mule.
508 (let ((pathname-coding-system 'binary)) 512 (let ((pathname-coding-system 'binary))
509 (nnmail-activate 'nnfolder) 513 (nnmail-activate 'nnfolder)
510 (when (and (not (assoc group nnfolder-group-alist)) 514 (when (and (not (assoc group nnfolder-group-alist))
511 (not (file-exists-p 515 (not (file-exists-p
512 (nnfolder-group-pathname group)))) 516 (nnfolder-group-pathname group))))
513 ;; The group doesn't exist, so we create a new entry for it. 517 ;; The group doesn't exist, so we create a new entry for it.
514 (push (list group (cons 1 0)) nnfolder-group-alist) 518 (push (list group (cons 1 0)) nnfolder-group-alist)
515 (nnmail-save-active nnfolder-group-alist nnfolder-active-file)) 519 (nnmail-save-active nnfolder-group-alist nnfolder-active-file))
516 520
517 (if dont-check 521 (if dont-check
518 (setq nnfolder-current-group group) 522 (setq nnfolder-current-group group
523 nnfolder-current-buffer nil)
519 (let (inf file) 524 (let (inf file)
520 ;; If we have to change groups, see if we don't already have the 525 ;; If we have to change groups, see if we don't already have the
521 ;; folder in memory. If we do, verify the modtime and destroy 526 ;; folder in memory. If we do, verify the modtime and destroy
522 ;; the folder if needed so we can rescan it. 527 ;; the folder if needed so we can rescan it.
523 (when (setq inf (assoc group nnfolder-buffer-alist)) 528 (setq nnfolder-current-buffer
524 (setq nnfolder-current-buffer (nth 1 inf))) 529 (nth 1 (assoc group nnfolder-buffer-alist)))
525 530
526 ;; If the buffer is not live, make sure it isn't in the alist. If it 531 ;; If the buffer is not live, make sure it isn't in the alist. If it
527 ;; is live, verify that nobody else has touched the file since last 532 ;; is live, verify that nobody else has touched the file since last
528 ;; time. 533 ;; time.
529 (when (and nnfolder-current-buffer 534 (when (and nnfolder-current-buffer
530 (not (gnus-buffer-live-p nnfolder-current-buffer))) 535 (not (gnus-buffer-live-p nnfolder-current-buffer)))
531 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist) 536 (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist)
532 nnfolder-current-buffer nil)) 537 nnfolder-current-buffer nil))
533 538
534 (setq nnfolder-current-group group) 539 (setq nnfolder-current-group group)
535 540
536 (when (or (not nnfolder-current-buffer) 541 (when (or (not nnfolder-current-buffer)
537 (not (verify-visited-file-modtime nnfolder-current-buffer))) 542 (not (verify-visited-file-modtime nnfolder-current-buffer)))
538 (save-excursion 543 (save-excursion
539 (setq file (nnfolder-group-pathname group)) 544 (setq file (nnfolder-group-pathname group))
540 ;; See whether we need to create the new file. 545 ;; See whether we need to create the new file.
756 (nnfolder-close-group file)))) 761 (nnfolder-close-group file))))
757 (message ""))) 762 (message "")))
758 763
759 (defun nnfolder-group-pathname (group) 764 (defun nnfolder-group-pathname (group)
760 "Make pathname for GROUP." 765 "Make pathname for GROUP."
761 ;; 1997/8/14 by MORIOKA Tomohiko 766 (setq group (gnus-encode-coding-string group nnmail-pathname-coding-system))
762 ;; encode file name for Emacs 20.
763 (setq group (encode-coding-string group nnmail-pathname-coding-system))
764 (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory)))) 767 (let ((dir (file-name-as-directory (expand-file-name nnfolder-directory))))
765 ;; If this file exists, we use it directly. 768 ;; If this file exists, we use it directly.
766 (if (or nnmail-use-long-file-names 769 (if (or nnmail-use-long-file-names
767 (file-exists-p (concat dir group))) 770 (file-exists-p (concat dir group)))
768 (concat dir group) 771 (concat dir group)
771 774
772 (defun nnfolder-save-buffer () 775 (defun nnfolder-save-buffer ()
773 "Save the buffer." 776 "Save the buffer."
774 (when (buffer-modified-p) 777 (when (buffer-modified-p)
775 (run-hooks 'nnfolder-save-buffer-hook) 778 (run-hooks 'nnfolder-save-buffer-hook)
779 (gnus-make-directory (file-name-directory (buffer-file-name)))
776 (save-buffer))) 780 (save-buffer)))
777 781
778 (provide 'nnfolder) 782 (provide 'nnfolder)
779 783
780 ;;; nnfolder.el ends here 784 ;;; nnfolder.el ends here