• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:directory +defs:file +defs:name

11 ;; This file is part of GNU Emacs.
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
47 (defvoo nnml-directory message-directory
48 "Spool directory for the nnml mail backend.")
50 (defvoo nnml-active-file
51 (expand-file-name "active" nnml-directory)
52 "Mail active file.")
54 (defvoo nnml-newsgroups-file
55 (expand-file-name "newsgroups" nnml-directory)
56 "Mail newsgroups description file.")
59 "If non-nil, nnml will check the incoming mail file and split the mail.")
71 "If non-nil, Gnus will never generate and use marks file for mail spools.
75 corresponding marks file (usually named `.marks' in the nnml group
76 directory, but see `nnml-marks-file-name') for the group. Then the
77 marks file will be regenerated properly by Gnus.")
94 (defvoo nnml-nov-file-name ".overview")
95 (defvoo nnml-marks-file-name ".marks")
97 (defvoo nnml-current-directory nil)
103 (defvoo nnml-article-file-alist nil)
107 (defvar nnml-nov-buffer-file-name nil)
109 (defvoo nnml-file-coding-system nnmail-file-coding-system)
122 (when (nnml-possibly-change-directory group server)
126 (let* ((file nil)
129 (file-name-coding-system nnmail-pathname-coding-system)
137 (setq file (nnml-article-to-file article))
138 (when (and file
139 (file-exists-p file)
140 (not (file-directory-p file)))
143 (nnheader-insert-head file)
168 (when (not (file-exists-p nnml-directory))
169 (ignore-errors (make-directory nnml-directory t)))
171 ((not (file-exists-p nnml-directory))
173 (nnheader-report 'nnml "Couldn't create directory: %s" nnml-directory))
174 ((not (file-directory-p (file-truename nnml-directory)))
176 (nnheader-report 'nnml "Not a directory: %s" nnml-directory))
178 (nnheader-report 'nnml "Opened server %s using directory %s"
179 server nnml-directory)
183 (nnml-possibly-change-directory nil server)
188 (nnml-possibly-change-directory group server)
190 (file-name-coding-system nnmail-pathname-coding-system)
196 (nnheader-article-to-file-alist
200 nnml-directory))))))
202 (setq path (nnml-article-to-file id)))
206 ((not (file-exists-p path))
207 (nnheader-report 'nnml "No such file: %s" path))
208 ((file-directory-p path)
209 (nnheader-report 'nnml "File is a directory: %s" path))
210 ((not (save-excursion (let ((nnmail-file-coding-system
211 nnml-file-coding-system))
212 (nnmail-find-file path))))
213 (nnheader-report 'nnml "Couldn't read file: %s" path))
218 (string-to-number (file-name-nondirectory path)))))))
221 (let ((file-name-coding-system nnmail-pathname-coding-system))
223 ((not (nnml-possibly-change-directory group server))
224 (nnheader-report 'nnml "Invalid group (no such directory)"))
225 ((not (file-exists-p nnml-current-directory))
227 nnml-current-directory))
228 ((not (file-directory-p nnml-current-directory))
229 (nnheader-report 'nnml "%s is not a directory" nnml-current-directory))
234 (nnheader-re-read-dir nnml-current-directory)
245 (setq nnml-article-file-alist nil)
246 (nnml-possibly-change-directory group server)
247 (nnmail-get-new-mail 'nnml 'nnml-save-nov nnml-directory group))
250 (setq nnml-article-file-alist nil)
254 (nnml-possibly-change-directory nil server)
259 ((and (file-exists-p (nnmail-group-pathname group nnml-directory))
260 (not (file-directory-p (nnmail-group-pathname group nnml-directory))))
261 (nnheader-report 'nnml "%s is a file"
262 (nnmail-group-pathname group nnml-directory)))
267 (nnml-possibly-create-directory group)
268 (nnml-possibly-change-directory group server)
269 (let ((articles (nnml-directory-articles nnml-current-directory)))
273 (nnmail-save-active nnml-group-alist nnml-active-file)
278 (let ((nnmail-file-coding-system nnmail-active-file-coding-system)
279 (file-name-coding-system nnmail-pathname-coding-system))
280 (nnmail-find-file nnml-active-file))
289 (nnmail-find-file nnml-newsgroups-file)))
292 (nnml-possibly-change-directory group server)
294 (nnml-directory-articles nnml-current-directory))
305 (if (and (setq article (nnml-article-to-file
307 (setq mod-time (nth 5 (file-attributes article)))
316 (let (nnml-current-directory
318 nnml-article-file-alist)
320 ;; Maybe directory is changed during nnmail-expiry-target-group.
321 (nnml-possibly-change-directory group server))
325 (funcall nnmail-delete-file-function article)
326 (file-error
336 (nnmail-save-active nnml-group-alist nnml-active-file))
344 (nnml-possibly-change-directory group server)
345 (nnml-update-file-alist)
349 (let (nnml-current-directory
351 nnml-article-file-alist)
359 (nnml-possibly-change-directory group server)
361 (funcall nnmail-delete-file-function
362 (nnml-article-to-file article))
363 (file-error nil))
367 (nnmail-save-active nnml-group-alist nnml-active-file))))
371 (nnml-possibly-change-directory group server)
385 (nnmail-save-active nnml-group-alist nnml-active-file)
394 (nnmail-save-active nnml-group-alist nnml-active-file)
404 (nnml-possibly-change-directory group)
407 (nnml-possibly-create-directory group)
414 (or (nnml-article-to-file article)
415 (expand-file-name (int-to-string article)
416 nnml-current-directory))
420 ;; Replace the NOV line in the NOV file.
443 (nnml-possibly-change-directory group server)
447 (directory-files
448 nnml-current-directory t
450 "\\|" (regexp-quote nnml-nov-file-name) "$"
451 "\\|" (regexp-quote nnml-marks-file-name) "$")))
455 (when (file-writable-p article)
457 (funcall nnmail-delete-file-function article))))
458 ;; Try to delete the directory itself.
459 (ignore-errors (delete-directory nnml-current-directory)))
464 nnml-current-directory nil)
465 ;; Save the active file.
466 (nnmail-save-active nnml-group-alist nnml-active-file)
469 (deffoo nnml-request-rename-group (group new-name &optional server)
470 (nnml-possibly-change-directory group server)
471 (let ((new-dir (nnmail-group-pathname new-name nnml-directory))
472 (old-dir (nnmail-group-pathname group nnml-directory)))
474 (make-directory new-dir t)
476 ;; We move the articles file by file instead of renaming
477 ;; the directory -- there may be subgroups in this group.
479 (let ((files (nnheader-article-to-file-alist old-dir)))
481 (rename-file
485 ;; Move .overview file.
486 (let ((overview (concat old-dir nnml-nov-file-name)))
487 (when (file-exists-p overview)
488 (rename-file overview (concat new-dir nnml-nov-file-name))))
489 ;; Move .marks file.
490 (let ((marks (concat old-dir nnml-marks-file-name)))
491 (when (file-exists-p marks)
492 (rename-file marks (concat new-dir nnml-marks-file-name))))
493 (when (<= (length (directory-files old-dir)) 2)
494 (ignore-errors (delete-directory old-dir)))
498 (setcar entry new-name))
499 (setq nnml-current-directory nil
502 (nnmail-save-active nnml-group-alist nnml-active-file)
505 (deffoo nnml-set-status (article name value &optional group server)
506 (nnml-possibly-change-directory group server)
507 (let ((file (nnml-article-to-file article)))
509 ((not (file-exists-p file))
510 (nnheader-report 'nnml "File %s does not exist" file))
512 (with-temp-file file
513 (nnheader-insert-file-contents file)
514 (nnmail-replace-status name value))
521 (defun nnml-article-to-file (article)
522 (nnml-update-file-alist)
523 (let (file)
524 (if (setq file
526 (cdr (assq article nnml-article-file-alist))
528 (expand-file-name file nnml-current-directory)
529 (when (not nnheader-directory-files-is-safe)
532 (when (file-exists-p
533 (setq file (expand-file-name (number-to-string article)
534 nnml-current-directory)))
535 (nnml-update-file-alist t)
536 file)))))
541 (when (setq path (nnml-article-to-file article))
542 (when (file-writable-p path)
554 ;; start with the one in the current directory. It seems most
570 (let ((nov (expand-file-name nnml-nov-file-name
571 (nnmail-group-pathname group nnml-directory)))
573 (when (file-exists-p nov)
574 (nnheader-insert-file-contents nov)
591 (let ((nov (expand-file-name nnml-nov-file-name nnml-current-directory)))
592 (when (file-exists-p nov)
596 (nnheader-insert-file-contents nov)
606 (defun nnml-possibly-change-directory (group &optional server)
612 (let ((pathname (nnmail-group-pathname group nnml-directory))
613 (file-name-coding-system nnmail-pathname-coding-system))
614 (when (not (equal pathname nnml-current-directory))
615 (setq nnml-current-directory pathname
617 nnml-article-file-alist nil))
618 (file-exists-p nnml-current-directory))))
620 (defun nnml-possibly-create-directory (group)
621 (let ((dir (nnmail-group-pathname group nnml-directory)))
622 (unless (file-exists-p dir)
623 (make-directory (directory-file-name dir) t)
624 (nnheader-message 5 "Creating mail directory %s" dir))))
645 (nnml-possibly-create-directory (caar ga))
646 (let ((file (concat (nnmail-group-pathname
647 (caar ga) nnml-directory)
652 (funcall nnmail-crosspost-link-function first file t)
654 (nnmail-write-region (point-min) (point-max) file nil
656 (setq first file)))
675 ;; Perhaps the active file was corrupt? See whether
677 (nnml-possibly-create-directory group)
678 (nnml-possibly-change-directory group)
679 (unless nnml-article-file-alist
680 (setq nnml-article-file-alist
682 (nnml-current-group-article-to-file-alist)
685 (if nnml-article-file-alist
686 (cons (caar nnml-article-file-alist)
687 (caar (last nnml-article-file-alist)))
691 (while (file-exists-p
692 (expand-file-name (int-to-string (cdr active))
693 (nnmail-group-pathname group nnml-directory)))
727 (set (make-local-variable 'nnml-nov-buffer-file-name)
728 (expand-file-name
729 nnml-nov-file-name
730 (nnmail-group-pathname group nnml-directory)))
732 (when (file-exists-p nnml-nov-buffer-file-name)
733 (nnheader-insert-file-contents nnml-nov-buffer-file-name)))
745 (when (buffer-name (cdar nnml-nov-buffer-alist))
749 nnml-nov-buffer-file-name nil 'nomesg))
758 ;; Read the active file to make sure we don't re-use articles
763 (setq nnml-directory (expand-file-name nnml-directory))
765 (nnml-generate-nov-databases-1 nnml-directory nil t)
766 ;; Save the active file.
767 (nnmail-save-active nnml-group-alist nnml-active-file))
772 (setq dir (file-name-as-directory dir))
774 (unless (member (file-truename dir) seen)
775 (push (file-truename dir) seen)
777 (let ((dirs (directory-files dir t nil t))
780 (when (and (not (string-match "^\\." (file-name-nondirectory dir)))
781 (file-directory-p dir))
783 ;; Do this directory.
784 (let ((files (sort (nnheader-article-to-file-alist dir)
787 (let* ((group (nnheader-file-to-group
788 (directory-file-name dir) nnml-directory))
793 ;; Generate the nov file.
794 (nnml-generate-nov-file dir files)
796 (nnmail-save-active nnml-group-alist nnml-active-file))))))
801 (let* ((group (nnheader-file-to-group
802 (directory-file-name dir) nnml-directory))
815 (defun nnml-generate-nov-file (dir files)
816 (let* ((dir (file-name-as-directory dir))
817 (nov (concat dir nnml-nov-file-name))
819 chars file headers)
826 ;; Delete the old NOV file.
827 (when (file-exists-p nov)
828 (funcall nnmail-delete-file-function nov))
830 (unless (file-directory-p (setq file (concat dir (cdar files))))
832 (nnheader-insert-file-contents file)
869 (defun nnml-update-file-alist (&optional force)
871 (when (or (not nnml-article-file-alist)
873 (setq nnml-article-file-alist
874 (nnml-current-group-article-to-file-alist)))))
876 (defun nnml-directory-articles (dir)
877 "Return a list of all article files in a directory.
878 Use the nov database for that directory if available."
880 (not (file-exists-p
881 (expand-file-name nnml-nov-file-name dir))))
882 (nnheader-directory-articles dir)
898 (defun nnml-current-group-article-to-file-alist ()
899 "Return an alist of article/file pairs in the current group.
904 (not (file-exists-p
905 (expand-file-name nnml-nov-file-name
906 nnml-current-directory))))
907 (nnheader-article-to-file-alist nnml-current-directory)
917 ;; assume file name is unadorned (ie. not compressed etc)
923 (nnml-possibly-change-directory group server)
943 (nnml-possibly-change-directory group server)
968 (let ((file (expand-file-name nnml-marks-file-name
969 (nnmail-group-pathname group nnml-directory))))
970 (if (null (gnus-gethash file nnml-marks-modtime))
971 t ;; never looked at marks file, assume it has changed
972 (not (equal (gnus-gethash file nnml-marks-modtime)
973 (nth 5 (file-attributes file)))))))
976 (let ((file-name-coding-system nnmail-pathname-coding-system)
977 (file (expand-file-name nnml-marks-file-name
978 (nnmail-group-pathname group nnml-directory))))
981 (nnml-possibly-create-directory group)
982 (with-temp-file file
986 (gnus-sethash file
987 (nth 5 (file-attributes file))
990 (format "Could not write to %s (%s). Continue? " file err))
991 (error "Cannot write to %s (%s)" file err))))))
994 (let ((file (expand-file-name
995 nnml-marks-file-name
996 (nnmail-group-pathname group nnml-directory))))
997 (if (file-exists-p file)
1000 (gnus-sethash file (nth 5 (file-attributes file))
1002 (nnheader-insert-file-contents file)
1007 (format "Error reading nnml marks file %s (%s). Continuing will use marks from .newsrc.eld. Continue? " file err))
1008 (error "Cannot read nnml marks file %s (%s)" file err))))
1009 ;; User didn't have a .marks file. Probably first time
1012 (gnus-group-prefixed-name