comparison lisp/gnus/nnspool.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 0d8b17d428b5
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; nnspool.el --- spool access for GNU Emacs 1 ;;; nnspool.el --- spool access for GNU Emacs
2 2
3 ;; Copyright (C) 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998, 3 ;; Copyright (C) 1988, 1989, 1990, 1993, 1994, 1995, 1996, 1997, 1998,
4 ;; 2000, 2002 4 ;; 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5 ;; Free Software Foundation, Inc.
6 5
7 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 6 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
8 ;; Lars Magne Ingebrigtsen <larsi@gnus.org> 7 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; Keywords: news 8 ;; Keywords: news
10 9
11 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
12 11
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details. 20 ;; GNU General Public License for more details.
22 21
23 ;; You should have received a copy of the GNU General Public License 22 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02111-1307, USA. 25 ;; Boston, MA 02110-1301, USA.
27 26
28 ;;; Commentary: 27 ;;; Commentary:
29 28
30 ;;; Code: 29 ;;; Code:
31 30
42 41
43 (defvoo nnspool-inews-switches '("-h" "-S") 42 (defvoo nnspool-inews-switches '("-h" "-S")
44 "Switches for nnspool-request-post to pass to `inews' for posting news. 43 "Switches for nnspool-request-post to pass to `inews' for posting news.
45 If you are using Cnews, you probably should set this variable to nil.") 44 If you are using Cnews, you probably should set this variable to nil.")
46 45
47 (defvoo nnspool-spool-directory (file-name-as-directory news-path) 46 (defvoo nnspool-spool-directory
47 (file-name-as-directory (if (boundp 'news-directory)
48 (symbol-value 'news-directory)
49 news-path))
48 "Local news spool directory.") 50 "Local news spool directory.")
49 51
50 (defvoo nnspool-nov-directory (concat nnspool-spool-directory "over.view/") 52 (defvoo nnspool-nov-directory (concat nnspool-spool-directory "over.view/")
51 "Local news nov directory.") 53 "Local news nov directory.")
52 54
53 (defvoo nnspool-lib-dir "/usr/lib/news/" 55 (defvoo nnspool-lib-dir
56 (if (file-exists-p "/usr/lib/news/active")
57 "/usr/lib/news/"
58 "/var/lib/news/")
54 "Where the local news library files are stored.") 59 "Where the local news library files are stored.")
55 60
56 (defvoo nnspool-active-file (concat nnspool-lib-dir "active") 61 (defvoo nnspool-active-file (concat nnspool-lib-dir "active")
57 "Local news active file.") 62 "Local news active file.")
58 63
67 72
68 (defvoo nnspool-active-times-file (concat nnspool-lib-dir "active.times") 73 (defvoo nnspool-active-times-file (concat nnspool-lib-dir "active.times")
69 "Local news active date file.") 74 "Local news active date file.")
70 75
71 (defvoo nnspool-large-newsgroup 50 76 (defvoo nnspool-large-newsgroup 50
72 "The number of the articles which indicates a large newsgroup. 77 "The number of articles which indicates a large newsgroup.
73 If the number of the articles is greater than the value, verbose 78 If the number of articles is greater than the value, verbose
74 messages will be shown to indicate the current status.") 79 messages will be shown to indicate the current status.")
75 80
76 (defvoo nnspool-nov-is-evil nil 81 (defvoo nnspool-nov-is-evil nil
77 "Non-nil means that nnspool will never return NOV lines instead of headers.") 82 "Non-nil means that nnspool will never return NOV lines instead of headers.")
78 83
240 t) 245 t)
241 ;; Yes, completely empty spool directories *are* possible. 246 ;; Yes, completely empty spool directories *are* possible.
242 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu> 247 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
243 (when (setq dir (directory-files pathname nil "^[0-9]+$" t)) 248 (when (setq dir (directory-files pathname nil "^[0-9]+$" t))
244 (setq dir 249 (setq dir
245 (sort (mapcar (lambda (name) (string-to-int name)) dir) '<))) 250 (sort (mapcar (lambda (name) (string-to-number name)) dir) '<)))
246 (if dir 251 (if dir
247 (nnheader-insert 252 (nnheader-insert
248 "211 %d %d %d %s\n" (length dir) (car dir) 253 "211 %d %d %d %s\n" (length dir) (car dir)
249 (progn (while (cdr dir) (setq dir (cdr dir))) (car dir)) 254 (progn (while (cdr dir) (setq dir (cdr dir))) (car dir))
250 group) 255 group)
359 (if (or gnus-nov-is-evil nnspool-nov-is-evil) 364 (if (or gnus-nov-is-evil nnspool-nov-is-evil)
360 nil 365 nil
361 (let ((nov (nnheader-group-pathname 366 (let ((nov (nnheader-group-pathname
362 nnspool-current-group nnspool-nov-directory ".overview")) 367 nnspool-current-group nnspool-nov-directory ".overview"))
363 (arts articles) 368 (arts articles)
364 (nnheader-file-coding-system nnspool-file-coding-system) 369 (nnheader-file-coding-system nnspool-file-coding-system)
365 last) 370 last)
366 (if (not (file-exists-p nov)) 371 (if (not (file-exists-p nov))
367 () 372 ()
368 (save-excursion 373 (save-excursion
369 (set-buffer nntp-server-buffer) 374 (set-buffer nntp-server-buffer)
432 (ignore-errors 437 (ignore-errors
433 (call-process "grep" nil t nil (regexp-quote id) nnspool-history-file)) 438 (call-process "grep" nil t nil (regexp-quote id) nnspool-history-file))
434 (goto-char (point-min)) 439 (goto-char (point-min))
435 (prog1 440 (prog1
436 (when (looking-at "<[^>]+>[ \t]+[-0-9~]+[ \t]+\\([^ /\t\n]+\\)/\\([0-9]+\\)[ \t\n]") 441 (when (looking-at "<[^>]+>[ \t]+[-0-9~]+[ \t]+\\([^ /\t\n]+\\)/\\([0-9]+\\)[ \t\n]")
437 (cons (match-string 1) (string-to-int (match-string 2)))) 442 (cons (match-string 1) (string-to-number (match-string 2))))
438 (kill-buffer (current-buffer))))) 443 (kill-buffer (current-buffer)))))
439 444
440 (defun nnspool-find-file (file) 445 (defun nnspool-find-file (file)
441 "Insert FILE in server buffer safely." 446 "Insert FILE in server buffer safely."
442 (set-buffer nntp-server-buffer) 447 (set-buffer nntp-server-buffer)
460 "Find the file name for GROUP." 465 "Find the file name for GROUP."
461 (nnheader-group-pathname group nnspool-spool-directory article)) 466 (nnheader-group-pathname group nnspool-spool-directory article))
462 467
463 (provide 'nnspool) 468 (provide 'nnspool)
464 469
470 ;;; arch-tag: bdac8d27-2934-4eee-bad0-49e6b90c0d05
465 ;;; nnspool.el ends here 471 ;;; nnspool.el ends here