Output alists with dotted pair notation in .dir-locals.el
[emacs.git] / lisp / gnus / nndir.el
blob6dc6c3380826bda02ed9830749c4e2caa8d20d7a
1 ;;; nndir.el --- single directory newsgroup access for Gnus
3 ;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 (require 'nnheader)
28 (require 'nnmh)
29 (require 'nnml)
30 (require 'nnoo)
32 (nnoo-declare nndir
33 nnml nnmh)
35 (defvoo nndir-directory nil
36 "Where nndir will look for groups."
37 nnml-current-directory nnmh-current-directory)
39 (defvoo nndir-nov-is-evil nil
40 "Non-nil means that nndir will never retrieve NOV headers."
41 nnml-nov-is-evil)
45 (defvoo nndir-current-group "" nil nnml-current-group nnmh-current-group)
46 (defvoo nndir-top-directory nil nil nnml-directory nnmh-directory)
47 (defvoo nndir-get-new-mail nil nil nnml-get-new-mail nnmh-get-new-mail)
49 (defvoo nndir-status-string "" nil nnmh-status-string)
50 (defconst nndir-version "nndir 1.0")
54 ;;; Interface functions.
56 (nnoo-define-basics nndir)
58 (deffoo nndir-open-server (server &optional defs)
59 (setq nndir-directory
60 (or (cadr (assq 'nndir-directory defs))
61 server))
62 (unless (assq 'nndir-directory defs)
63 (push `(nndir-directory ,server) defs))
64 (push `(nndir-current-group
65 ,(file-name-nondirectory (directory-file-name nndir-directory)))
66 defs)
67 (push `(nndir-top-directory
68 ,(file-name-directory (directory-file-name nndir-directory)))
69 defs)
70 (nnoo-change-server 'nndir server defs)
71 (let (err)
72 (cond
73 ((not (condition-case arg
74 (file-exists-p nndir-directory)
75 (ftp-error (setq err (format "%s" arg)))))
76 (nndir-close-server)
77 (nnheader-report
78 'nndir (or err "No such file or directory: %s" nndir-directory)))
79 ((not (file-directory-p (file-truename nndir-directory)))
80 (nndir-close-server)
81 (nnheader-report 'nndir "Not a directory: %s" nndir-directory))
83 (nnheader-report 'nndir "Opened server %s using directory %s"
84 server nndir-directory)
85 t))))
87 (nnoo-map-functions nndir
88 (nnml-retrieve-headers 0 nndir-current-group 0 0)
89 (nnml-request-article 0 nndir-current-group 0 0)
90 (nnmh-request-group nndir-current-group 0 0)
91 (nnml-close-group nndir-current-group 0)
92 (nnml-request-list (nnoo-current-server 'nndir)))
94 (provide 'nndir)
96 ;;; nndir.el ends here