1997-04-16 22:13:18 +00:00
|
|
|
|
;;; nnspool.el --- spool access for GNU Emacs
|
2000-09-19 13:37:09 +00:00
|
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
|
;; Copyright (C) 1988-1990, 1993-1998, 2000-2020 Free Software
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Foundation, Inc.
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
|
2004-09-04 13:13:48 +00:00
|
|
|
|
;; Lars Magne Ingebrigtsen <larsi@gnus.org>
|
1997-04-16 22:13:18 +00:00
|
|
|
|
;; Keywords: news
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 03:56:49 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1997-04-16 22:13:18 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 03:56:49 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'nnheader)
|
|
|
|
|
(require 'nntp)
|
|
|
|
|
(require 'nnoo)
|
gnus: replace cl with cl-lib
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-demon.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-icalendar.el, lisp/gnus/gnus-logic.el:
* lisp/gnus/gnus-msg.el, lisp/gnus/gnus-picon.el:
* lisp/gnus/gnus-registry.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-spec.el:
* lisp/gnus/gnus-srvr.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/mail-source.el, lisp/gnus/mm-decode.el:
* lisp/gnus/mm-encode.el, lisp/gnus/mm-url.el, lisp/gnus/mm-view.el:
* lisp/gnus/mml-smime.el, lisp/gnus/mml.el, lisp/gnus/mml2015.el:
* lisp/gnus/nnbabyl.el, lisp/gnus/nndoc.el, lisp/gnus/nneething.el:
* lisp/gnus/nnheader.el, lisp/gnus/nnimap.el, lisp/gnus/nnmail.el:
* lisp/gnus/nnmaildir.el, lisp/gnus/nnoo.el, lisp/gnus/nnrss.el:
* lisp/gnus/nnspool.el, lisp/gnus/nntp.el, lisp/gnus/nnvirtual.el:
* lisp/gnus/nnweb.el, lisp/gnus/spam.el: Replace cl with cl-lib.
* lisp/gnus/canlock.el, lisp/gnus/gnus-bcklg.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-cloud.el:
* lisp/gnus/gnus-draft.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-html.el:
* lisp/gnus/gnus-int.el, lisp/gnus/gnus-kill.el, lisp/gnus/gnus-ml.el:
* lisp/gnus/gnus-mlspl.el, lisp/gnus/gnus-range.el:
* lisp/gnus/gnus-undo.el, lisp/gnus/gnus-vm.el:
* lisp/gnus/mm-partial.el, lisp/gnus/mm-uu.el, lisp/gnus/mml1991.el:
* lisp/gnus/nnagent.el, lisp/gnus/nndiary.el, lisp/gnus/nndir.el:
* lisp/gnus/nndraft.el, lisp/gnus/nnfolder.el, lisp/gnus/nngateway.el:
* lisp/gnus/nnmairix.el, lisp/gnus/nnmbox.el, lisp/gnus/nnmh.el:
* lisp/gnus/nnml.el, lisp/gnus/score-mode.el, lisp/gnus/smiley.el:
No need for cl.
2018-03-23 16:13:09 -04:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
2012-05-24 00:27:24 -07:00
|
|
|
|
;; Probably this entire thing should be obsolete.
|
|
|
|
|
;; It's only used to init nnspool-spool-directory, so why not just
|
|
|
|
|
;; set that variable's default directly?
|
2012-05-25 06:43:29 +00:00
|
|
|
|
(eval-and-compile
|
2018-04-20 18:34:39 -04:00
|
|
|
|
(defvaralias 'news-path 'news-directory)
|
2012-05-25 06:43:29 +00:00
|
|
|
|
(defvar news-directory (if (file-exists-p "/usr/spool/news/")
|
|
|
|
|
"/usr/spool/news/"
|
|
|
|
|
"/var/spool/news/")
|
2018-04-20 18:34:39 -04:00
|
|
|
|
"The root directory below which all news files are stored."))
|
2012-05-24 00:27:24 -07:00
|
|
|
|
|
2012-05-24 00:31:45 -07:00
|
|
|
|
;; Ditto re obsolescence.
|
|
|
|
|
(defvar news-inews-program
|
|
|
|
|
(cond ((file-exists-p "/usr/bin/inews") "/usr/bin/inews")
|
|
|
|
|
((file-exists-p "/usr/local/inews") "/usr/local/inews")
|
|
|
|
|
((file-exists-p "/usr/local/bin/inews") "/usr/local/bin/inews")
|
|
|
|
|
((file-exists-p "/usr/contrib/lib/news/inews") "/usr/contrib/lib/news/inews")
|
|
|
|
|
((file-exists-p "/usr/lib/news/inews") "/usr/lib/news/inews")
|
|
|
|
|
(t "inews"))
|
|
|
|
|
"Program to post news.")
|
|
|
|
|
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(nnoo-declare nnspool)
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-inews-program news-inews-program
|
|
|
|
|
"Program to post news.
|
|
|
|
|
This is most commonly `inews' or `injnews'.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-inews-switches '("-h" "-S")
|
|
|
|
|
"Switches for nnspool-request-post to pass to `inews' for posting news.
|
|
|
|
|
If you are using Cnews, you probably should set this variable to nil.")
|
|
|
|
|
|
2004-10-29 02:23:24 +00:00
|
|
|
|
(defvoo nnspool-spool-directory
|
|
|
|
|
(file-name-as-directory (if (boundp 'news-directory)
|
|
|
|
|
(symbol-value 'news-directory)
|
|
|
|
|
news-path))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
"Local news spool directory.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-nov-directory (concat nnspool-spool-directory "over.view/")
|
|
|
|
|
"Local news nov directory.")
|
|
|
|
|
|
2004-09-04 13:13:48 +00:00
|
|
|
|
(defvoo nnspool-lib-dir
|
|
|
|
|
(if (file-exists-p "/usr/lib/news/active")
|
|
|
|
|
"/usr/lib/news/"
|
|
|
|
|
"/var/lib/news/")
|
1997-04-16 22:13:18 +00:00
|
|
|
|
"Where the local news library files are stored.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-active-file (concat nnspool-lib-dir "active")
|
|
|
|
|
"Local news active file.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-newsgroups-file (concat nnspool-lib-dir "newsgroups")
|
|
|
|
|
"Local news newsgroups file.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-distributions-file (concat nnspool-lib-dir "distribs.pat")
|
|
|
|
|
"Local news distributions file.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-history-file (concat nnspool-lib-dir "history")
|
|
|
|
|
"Local news history file.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-active-times-file (concat nnspool-lib-dir "active.times")
|
|
|
|
|
"Local news active date file.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-large-newsgroup 50
|
2004-09-04 13:13:48 +00:00
|
|
|
|
"The number of articles which indicates a large newsgroup.
|
|
|
|
|
If the number of articles is greater than the value, verbose
|
1997-04-16 22:13:18 +00:00
|
|
|
|
messages will be shown to indicate the current status.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-nov-is-evil nil
|
|
|
|
|
"Non-nil means that nnspool will never return NOV lines instead of headers.")
|
|
|
|
|
|
|
|
|
|
(defconst nnspool-sift-nov-with-sed nil
|
|
|
|
|
"If non-nil, use sed to get the relevant portion from the overview file.
|
|
|
|
|
If nil, nnspool will load the entire file into a buffer and process it
|
|
|
|
|
there.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-rejected-article-hook nil
|
2018-04-13 19:54:22 +02:00
|
|
|
|
"A hook that will be run when an article has been rejected by the server.")
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
1999-02-20 14:05:57 +00:00
|
|
|
|
(defvoo nnspool-file-coding-system nnheader-file-coding-system
|
|
|
|
|
"Coding system for nnspool.")
|
|
|
|
|
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defconst nnspool-version "nnspool 2.0"
|
|
|
|
|
"Version numbers of this version of NNSPOOL.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-current-directory nil
|
|
|
|
|
"Current news group directory.")
|
|
|
|
|
|
|
|
|
|
(defvoo nnspool-current-group nil)
|
|
|
|
|
(defvoo nnspool-status-string "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Interface functions.
|
|
|
|
|
|
|
|
|
|
(nnoo-define-basics nnspool)
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-retrieve-headers (articles &optional group server fetch-old)
|
|
|
|
|
"Retrieve the headers of ARTICLES."
|
2010-09-18 10:02:19 +00:00
|
|
|
|
(with-current-buffer nntp-server-buffer
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(when (nnspool-possibly-change-directory group)
|
|
|
|
|
(let* ((number (length articles))
|
|
|
|
|
(count 0)
|
|
|
|
|
(default-directory nnspool-current-directory)
|
|
|
|
|
(do-message (and (numberp nnspool-large-newsgroup)
|
|
|
|
|
(> number nnspool-large-newsgroup)))
|
1997-08-28 04:51:02 +00:00
|
|
|
|
(nnheader-file-coding-system nnspool-file-coding-system)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
file beg article ag)
|
|
|
|
|
(if (and (numberp (car articles))
|
|
|
|
|
(nnspool-retrieve-headers-with-nov articles fetch-old))
|
|
|
|
|
;; We successfully retrieved the NOV headers.
|
|
|
|
|
'nov
|
|
|
|
|
;; No NOV headers here, so we do it the hard way.
|
|
|
|
|
(while (setq article (pop articles))
|
|
|
|
|
(if (stringp article)
|
|
|
|
|
;; This is a Message-ID.
|
|
|
|
|
(setq ag (nnspool-find-id article)
|
|
|
|
|
file (and ag (nnspool-article-pathname
|
|
|
|
|
(car ag) (cdr ag)))
|
|
|
|
|
article (cdr ag))
|
|
|
|
|
;; This is an article in the current group.
|
|
|
|
|
(setq file (int-to-string article)))
|
|
|
|
|
;; Insert the head of the article.
|
|
|
|
|
(when (and file
|
|
|
|
|
(file-exists-p file))
|
|
|
|
|
(insert "221 ")
|
|
|
|
|
(princ article (current-buffer))
|
|
|
|
|
(insert " Article retrieved.\n")
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(inline (nnheader-insert-head file))
|
|
|
|
|
(goto-char beg)
|
2000-09-19 13:37:09 +00:00
|
|
|
|
(if (search-forward "\n\n" nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char -1)
|
|
|
|
|
(insert ".\n"))
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(if (bolp)
|
|
|
|
|
(insert ".\n")
|
|
|
|
|
(insert "\n.\n")))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(delete-region (point) (point-max)))
|
|
|
|
|
|
|
|
|
|
(and do-message
|
gnus: replace cl with cl-lib
* lisp/gnus/gnus-agent.el, lisp/gnus/gnus-art.el:
* lisp/gnus/gnus-async.el, lisp/gnus/gnus-cache.el:
* lisp/gnus/gnus-demon.el, lisp/gnus/gnus-group.el:
* lisp/gnus/gnus-icalendar.el, lisp/gnus/gnus-logic.el:
* lisp/gnus/gnus-msg.el, lisp/gnus/gnus-picon.el:
* lisp/gnus/gnus-registry.el, lisp/gnus/gnus-salt.el:
* lisp/gnus/gnus-score.el, lisp/gnus/gnus-spec.el:
* lisp/gnus/gnus-srvr.el, lisp/gnus/gnus-start.el:
* lisp/gnus/gnus-sum.el, lisp/gnus/gnus-topic.el:
* lisp/gnus/gnus-util.el, lisp/gnus/gnus-uu.el, lisp/gnus/gnus-win.el:
* lisp/gnus/mail-source.el, lisp/gnus/mm-decode.el:
* lisp/gnus/mm-encode.el, lisp/gnus/mm-url.el, lisp/gnus/mm-view.el:
* lisp/gnus/mml-smime.el, lisp/gnus/mml.el, lisp/gnus/mml2015.el:
* lisp/gnus/nnbabyl.el, lisp/gnus/nndoc.el, lisp/gnus/nneething.el:
* lisp/gnus/nnheader.el, lisp/gnus/nnimap.el, lisp/gnus/nnmail.el:
* lisp/gnus/nnmaildir.el, lisp/gnus/nnoo.el, lisp/gnus/nnrss.el:
* lisp/gnus/nnspool.el, lisp/gnus/nntp.el, lisp/gnus/nnvirtual.el:
* lisp/gnus/nnweb.el, lisp/gnus/spam.el: Replace cl with cl-lib.
* lisp/gnus/canlock.el, lisp/gnus/gnus-bcklg.el:
* lisp/gnus/gnus-cite.el, lisp/gnus/gnus-cloud.el:
* lisp/gnus/gnus-draft.el, lisp/gnus/gnus-dup.el:
* lisp/gnus/gnus-fun.el, lisp/gnus/gnus-html.el:
* lisp/gnus/gnus-int.el, lisp/gnus/gnus-kill.el, lisp/gnus/gnus-ml.el:
* lisp/gnus/gnus-mlspl.el, lisp/gnus/gnus-range.el:
* lisp/gnus/gnus-undo.el, lisp/gnus/gnus-vm.el:
* lisp/gnus/mm-partial.el, lisp/gnus/mm-uu.el, lisp/gnus/mml1991.el:
* lisp/gnus/nnagent.el, lisp/gnus/nndiary.el, lisp/gnus/nndir.el:
* lisp/gnus/nndraft.el, lisp/gnus/nnfolder.el, lisp/gnus/nngateway.el:
* lisp/gnus/nnmairix.el, lisp/gnus/nnmbox.el, lisp/gnus/nnmh.el:
* lisp/gnus/nnml.el, lisp/gnus/score-mode.el, lisp/gnus/smiley.el:
No need for cl.
2018-03-23 16:13:09 -04:00
|
|
|
|
(zerop (% (cl-incf count) 20))
|
1999-02-20 14:05:57 +00:00
|
|
|
|
(nnheader-message 5 "nnspool: Receiving headers... %d%%"
|
2015-07-31 10:12:37 -07:00
|
|
|
|
(floor (* count 100.0) number))))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
(when do-message
|
1999-02-20 14:05:57 +00:00
|
|
|
|
(nnheader-message 5 "nnspool: Receiving headers...done"))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
;; Fold continuation lines.
|
|
|
|
|
(nnheader-fold-continuation-lines)
|
|
|
|
|
'headers)))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-open-server (server &optional defs)
|
|
|
|
|
(nnoo-change-server 'nnspool server defs)
|
|
|
|
|
(cond
|
|
|
|
|
((not (file-exists-p nnspool-spool-directory))
|
|
|
|
|
(nnspool-close-server)
|
|
|
|
|
(nnheader-report 'nnspool "Spool directory doesn't exist: %s"
|
|
|
|
|
nnspool-spool-directory))
|
|
|
|
|
((not (file-directory-p
|
|
|
|
|
(directory-file-name
|
|
|
|
|
(file-truename nnspool-spool-directory))))
|
|
|
|
|
(nnspool-close-server)
|
|
|
|
|
(nnheader-report 'nnspool "Not a directory: %s" nnspool-spool-directory))
|
|
|
|
|
((not (file-exists-p nnspool-active-file))
|
|
|
|
|
(nnheader-report 'nnspool "The active file doesn't exist: %s"
|
|
|
|
|
nnspool-active-file))
|
|
|
|
|
(t
|
|
|
|
|
(nnheader-report 'nnspool "Opened server %s using directory %s"
|
|
|
|
|
server nnspool-spool-directory)
|
|
|
|
|
t)))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-article (id &optional group server buffer)
|
|
|
|
|
"Select article by message ID (or number)."
|
|
|
|
|
(nnspool-possibly-change-directory group)
|
|
|
|
|
(let ((nntp-server-buffer (or buffer nntp-server-buffer))
|
|
|
|
|
file ag)
|
|
|
|
|
(if (stringp id)
|
|
|
|
|
;; This is a Message-ID.
|
|
|
|
|
(when (setq ag (nnspool-find-id id))
|
|
|
|
|
(setq file (nnspool-article-pathname (car ag) (cdr ag))))
|
|
|
|
|
(setq file (nnspool-article-pathname nnspool-current-group id)))
|
|
|
|
|
(and file
|
|
|
|
|
(file-exists-p file)
|
|
|
|
|
(not (file-directory-p file))
|
|
|
|
|
(save-excursion (nnspool-find-file file))
|
|
|
|
|
;; We return the article number and group name.
|
|
|
|
|
(if (numberp id)
|
|
|
|
|
(cons nnspool-current-group id)
|
|
|
|
|
ag))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-body (id &optional group server)
|
|
|
|
|
"Select article body by message ID (or number)."
|
|
|
|
|
(nnspool-possibly-change-directory group)
|
|
|
|
|
(let ((res (nnspool-request-article id)))
|
|
|
|
|
(when res
|
2010-09-18 10:02:19 +00:00
|
|
|
|
(with-current-buffer nntp-server-buffer
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (search-forward "\n\n" nil t)
|
|
|
|
|
(delete-region (point-min) (point)))
|
|
|
|
|
res))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-head (id &optional group server)
|
|
|
|
|
"Select article head by message ID (or number)."
|
|
|
|
|
(nnspool-possibly-change-directory group)
|
|
|
|
|
(let ((res (nnspool-request-article id)))
|
|
|
|
|
(when res
|
2010-09-18 10:02:19 +00:00
|
|
|
|
(with-current-buffer nntp-server-buffer
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (search-forward "\n\n" nil t)
|
|
|
|
|
(delete-region (1- (point)) (point-max)))
|
|
|
|
|
(nnheader-fold-continuation-lines)))
|
|
|
|
|
res))
|
|
|
|
|
|
2010-09-18 23:36:29 +00:00
|
|
|
|
(deffoo nnspool-request-group (group &optional server dont-check info)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
"Select news GROUP."
|
|
|
|
|
(let ((pathname (nnspool-article-pathname group))
|
|
|
|
|
dir)
|
|
|
|
|
(if (not (file-directory-p pathname))
|
|
|
|
|
(nnheader-report
|
|
|
|
|
'nnspool "Invalid group name (no such directory): %s" group)
|
|
|
|
|
(setq nnspool-current-directory pathname)
|
|
|
|
|
(nnheader-report 'nnspool "Selected group %s" group)
|
|
|
|
|
(if dont-check
|
|
|
|
|
(progn
|
|
|
|
|
(nnheader-report 'nnspool "Selected group %s" group)
|
|
|
|
|
t)
|
|
|
|
|
;; Yes, completely empty spool directories *are* possible.
|
|
|
|
|
;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
|
Fix edge case errors in filename-matching regexps
These changes fix actual or latent bugs in regexps that match
file names, such as PATTERN arguments to 'directory-files'. See
https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00265.html
* admin/authors.el (authors-obsolete-files-regexps)
(authors-renamed-files-regexps):
* lisp/auth-source-pass.el (auth-source-pass-entries):
* lisp/calendar/todo-mode.el (todo-show, todo-find-filtered-items-file)
(todo-filter-items, todo-reset-nondiary-marker, todo-reset-done-string)
(todo-reset-comment-string, todo-reset-highlight-item):
* lisp/cedet/semantic/db-ebrowse.el (semanticdb-load-ebrowse-caches):
* lisp/cedet/semantic/texi.el (semantic-texi-associated-files):
* lisp/cedet/srecode/map.el (srecode-map-update-map):
* lisp/dired.el (dired-re-no-dot):
* lisp/emacs-lisp/autoload.el (update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-find):
* lisp/files.el (auto-mode-alist, directory-files-no-dot-files-regexp):
* lisp/finder.el (finder-compile-keywords):
* lisp/generic-x.el (inetd-conf-generic-mode, named-boot-generic-mode)
(resolve-conf-generic-mode, etc-modules-conf-generic-mode):
* lisp/gnus/gnus-agent.el (gnus-agent-read-agentview)
(gnus-agent-regenerate-group, gnus-agent-update-files-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-articles-in-group):
* lisp/gnus/gnus-score.el (gnus-score-search-global-directories):
* lisp/gnus/gnus-util.el (gnus-delete-directory):
* lisp/gnus/gnus-uu.el (gnus-uu-dir-files):
* lisp/gnus/nndraft.el (nndraft-request-group):
* lisp/gnus/nnmh.el (nnmh-request-group, nnmh-request-create-group):
(nnmh-request-delete-group, nnmh-active-number, nnmh-update-gnus-unreads):
* lisp/gnus/nnspool.el (nnspool-request-group):
* lisp/gnus/spam-stat.el (spam-stat-process-directory)
(spam-stat-test-directory):
* lisp/help-fns.el (help-fns--first-release):
* lisp/help.el (view-emacs-news):
* lisp/international/quail.el (quail-update-leim-list-file):
* lisp/international/titdic-cnv.el (batch-titdic-convert):
* lisp/mail/mspools.el (mspools-set-vm-spool-files)
(mspools-get-spool-files):
* lisp/mail/rmail.el (rmail-secondary-file-regexp)
(rmail-speedbar-match-folder-regexp):
* lisp/net/ange-ftp.el (ange-ftp-delete-directory):
* lisp/net/tramp.el (tramp-use-absolute-autoload-file-names):
* lisp/obsolete/gulp.el (gulp-send-requests):
* lisp/obsolete/vc-arch.el (vc-arch-trim-revlib):
* lisp/org/ob-core.el (org-babel-remove-temporary-directory):
* lisp/progmodes/ebnf2ps.el (ebnf-file-suffix-regexp, ebnf-style-database):
* lisp/progmodes/executable.el (executable-command-find-posix-p):
* lisp/startup.el (command-line):
* lisp/textmodes/refer.el (refer-get-bib-files):
* lisp/url/url-about.el (url-probe-protocols):
* lisp/vc/vc-rcs.el (vc-rcs-register, vc-rcs-unregister):
* test/lisp/net/tramp-archive-tests.el
(tramp-archive-test19-directory-files-and-attributes):
* test/lisp/net/tramp-tests.el (tramp-test19-directory-files-and-attributes):
Replace ^ and $ with \` and \', respectively.
Use (rx (or (not ".") "...")), translated into "[^.]\\|\\.\\.\\.",
to match anything but "." and "..", instead of several incorrect
regexps.
2020-04-14 12:17:40 +02:00
|
|
|
|
(when (setq dir (directory-files pathname nil "\\`[0-9]+\\'" t))
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(setq dir (sort (mapcar 'string-to-number dir) '<)))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(if dir
|
|
|
|
|
(nnheader-insert
|
|
|
|
|
"211 %d %d %d %s\n" (length dir) (car dir)
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(car (last dir)) group)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(nnheader-report 'nnspool "Empty group %s" group)
|
|
|
|
|
(nnheader-insert "211 0 0 0 %s\n" group))))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-type (group &optional article)
|
|
|
|
|
'news)
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-close-group (group &optional server)
|
|
|
|
|
t)
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-list (&optional server)
|
|
|
|
|
"List active newsgroups."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(or (nnspool-find-file nnspool-active-file)
|
|
|
|
|
(nnheader-report 'nnspool (nnheader-file-error nnspool-active-file)))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-list-newsgroups (&optional server)
|
|
|
|
|
"List newsgroups (defined in NNTP2)."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(or (nnspool-find-file nnspool-newsgroups-file)
|
|
|
|
|
(nnheader-report 'nnspool (nnheader-file-error
|
|
|
|
|
nnspool-newsgroups-file)))))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-list-distributions (&optional server)
|
|
|
|
|
"List distributions (defined in NNTP2)."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(or (nnspool-find-file nnspool-distributions-file)
|
|
|
|
|
(nnheader-report 'nnspool (nnheader-file-error
|
|
|
|
|
nnspool-distributions-file)))))
|
|
|
|
|
|
|
|
|
|
;; Suggested by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
|
|
|
|
|
(deffoo nnspool-request-newgroups (date &optional server)
|
|
|
|
|
"List groups created after DATE."
|
|
|
|
|
(if (nnspool-find-file nnspool-active-times-file)
|
|
|
|
|
(save-excursion
|
|
|
|
|
;; Find the last valid line.
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(while (and (not (looking-at
|
|
|
|
|
"\\([^ ]+\\) +\\([0-9]+\\)[0-9][0-9][0-9] "))
|
|
|
|
|
(zerop (forward-line -1))))
|
New function time-convert
This replaces the awkward reuse of encode-time to both convert
calendrical timestamps to Lisp timestamps, and to convert Lisp
timestamps to other forms. Now, encode-time does just the
former and the new function does just the latter.
The new function builds on a suggestion by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00801.html
and refined by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00803.html
* doc/lispref/os.texi (Time of Day, Time Conversion):
* doc/misc/emacs-mime.texi (time-date):
* etc/NEWS: Update documentation.
* lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
* lisp/calendar/time-date.el (seconds-to-time, days-to-time):
* lisp/calendar/timeclock.el (timeclock-seconds-to-time):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-add-item):
* lisp/emacs-lisp/cl-extra.el (cl--random-time):
* lisp/emacs-lisp/timer.el (timer--time-setter)
(timer-next-integral-multiple-of-time):
* lisp/find-lisp.el (find-lisp-format-time):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/gnus-group.el (gnus-group-set-timestamp):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda):
* lisp/gnus/nnrss.el (nnrss-normalize-date):
* lisp/gnus/nnspool.el (nnspool-request-newgroups):
* lisp/net/ntlm.el (ntlm-compute-timestamp):
* lisp/net/pop3.el (pop3-uidl-dele):
* lisp/obsolete/vc-arch.el (vc-arch-add-tagline):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-clock-in)
(org-clock-out, org-clock-sum):
* lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/flymake.el (flymake--schedule-timer-maybe):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
* lisp/tar-mode.el (tar-octal-time):
* lisp/time.el (emacs-uptime):
* lisp/url/url-auth.el (url-digest-auth-make-cnonce):
* lisp/url/url-util.el (url-lazy-message):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg-state-fast):
* lisp/xt-mouse.el (xterm-mouse-event):
* test/lisp/emacs-lisp/timer-tests.el:
(timer-next-integral-multiple-of-time-2):
Use time-convert, not encode-time.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Don’t use now-removed FORM argument for encode-time.
It wasn’t crucial anyway.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert.
* lisp/emacs-lisp/elint.el (elint-unknown-builtin-args):
Update encode-time signature to match current arg set.
* lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time):
Use timer-convert with t rather than doing it by hand.
* src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp):
Remove; no longer needed.
(decode_lisp_time): Rturn the form instead of having a *PFORM arg.
All uses changed.
(time_arith): Just return TICKS if HZ is 1.
(Fencode_time): Remove argument FORM. All callers changed.
Do not attempt to encode time values; just encode
decoded (calendrical) times.
Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1.
(Ftime_convert): New function, which does the time value
conversion that bleeding-edge encode-time formerly did.
Return TIME if it is easy to see that it is already
of the correct form.
(Fcurrent_time): Mention in doc that the form is planned to change.
* test/src/timefns-tests.el (decode-then-encode-time):
Don’t use (encode-time nil).
2019-08-05 17:38:52 -07:00
|
|
|
|
(let ((seconds (time-convert (date-to-time date) 'integer))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
groups)
|
|
|
|
|
;; Go through lines and add the latest groups to a list.
|
|
|
|
|
(while (and (looking-at "\\([^ ]+\\) +[0-9]+ ")
|
|
|
|
|
(progn
|
2019-02-12 18:24:59 -08:00
|
|
|
|
(goto-char (match-end 1))
|
|
|
|
|
(< seconds (read (current-buffer))))
|
|
|
|
|
(progn
|
|
|
|
|
(push (buffer-substring
|
|
|
|
|
(match-beginning 1) (match-end 1))
|
|
|
|
|
groups)
|
|
|
|
|
(zerop (forward-line -1)))))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(erase-buffer)
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(dolist (group groups)
|
|
|
|
|
(insert group " 0 0 y\n")))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
t)
|
|
|
|
|
nil))
|
|
|
|
|
|
|
|
|
|
(deffoo nnspool-request-post (&optional server)
|
|
|
|
|
"Post a new news in current buffer."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let* ((process-connection-type nil) ; t bugs out on Solaris
|
|
|
|
|
(inews-buffer (generate-new-buffer " *nnspool post*"))
|
2016-02-12 16:03:22 +11:00
|
|
|
|
(buf (current-buffer))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(proc
|
|
|
|
|
(condition-case err
|
|
|
|
|
(apply 'start-process "*nnspool inews*" inews-buffer
|
|
|
|
|
nnspool-inews-program nnspool-inews-switches)
|
|
|
|
|
(error
|
|
|
|
|
(nnheader-report 'nnspool "inews error: %S" err)))))
|
|
|
|
|
(if (not proc)
|
|
|
|
|
;; The inews program failed.
|
|
|
|
|
()
|
|
|
|
|
(nnheader-report 'nnspool "")
|
|
|
|
|
(set-process-sentinel proc 'nnspool-inews-sentinel)
|
2016-02-12 16:03:22 +11:00
|
|
|
|
(with-temp-buffer
|
|
|
|
|
(set-buffer-multibyte nil)
|
|
|
|
|
(insert-buffer-substring buf)
|
|
|
|
|
(encode-coding-region (point-min) (point-max)
|
|
|
|
|
nnspool-file-coding-system)
|
2002-01-04 14:34:43 +00:00
|
|
|
|
(process-send-region proc (point-min) (point-max)))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
;; We slap a condition-case around this, because the process may
|
|
|
|
|
;; have exited already...
|
|
|
|
|
(ignore-errors
|
|
|
|
|
(process-send-eof proc))
|
|
|
|
|
t))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Internal functions.
|
|
|
|
|
|
|
|
|
|
(defun nnspool-inews-sentinel (proc status)
|
2010-09-18 10:02:19 +00:00
|
|
|
|
(with-current-buffer (process-buffer proc)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (or (zerop (buffer-size))
|
|
|
|
|
(search-forward "spooled" nil t))
|
|
|
|
|
(kill-buffer (current-buffer))
|
|
|
|
|
;; Make status message by folding lines.
|
|
|
|
|
(while (re-search-forward "[ \t\n]+" nil t)
|
|
|
|
|
(replace-match " " t t))
|
|
|
|
|
(nnheader-report 'nnspool "%s" (buffer-string))
|
1999-02-20 14:05:57 +00:00
|
|
|
|
(nnheader-message 5 "nnspool: %s" nnspool-status-string)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(ding)
|
|
|
|
|
(run-hooks 'nnspool-rejected-article-hook))))
|
|
|
|
|
|
|
|
|
|
(defun nnspool-retrieve-headers-with-nov (articles &optional fetch-old)
|
|
|
|
|
(if (or gnus-nov-is-evil nnspool-nov-is-evil)
|
|
|
|
|
nil
|
|
|
|
|
(let ((nov (nnheader-group-pathname
|
|
|
|
|
nnspool-current-group nnspool-nov-directory ".overview"))
|
|
|
|
|
(arts articles)
|
2004-09-04 13:13:48 +00:00
|
|
|
|
(nnheader-file-coding-system nnspool-file-coding-system)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
last)
|
|
|
|
|
(if (not (file-exists-p nov))
|
|
|
|
|
()
|
2010-09-18 10:02:19 +00:00
|
|
|
|
(with-current-buffer nntp-server-buffer
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(if nnspool-sift-nov-with-sed
|
|
|
|
|
(nnspool-sift-nov-with-sed articles nov)
|
|
|
|
|
(nnheader-insert-file-contents nov)
|
|
|
|
|
(if (and fetch-old
|
|
|
|
|
(not (numberp fetch-old)))
|
|
|
|
|
t ; We want all the headers.
|
|
|
|
|
(ignore-errors
|
|
|
|
|
;; Delete unwanted NOV lines.
|
|
|
|
|
(nnheader-nov-delete-outside-range
|
|
|
|
|
(if fetch-old (max 1 (- (car articles) fetch-old))
|
|
|
|
|
(car articles))
|
|
|
|
|
(car (last articles)))
|
|
|
|
|
;; If the buffer is empty, this wasn't very successful.
|
|
|
|
|
(unless (zerop (buffer-size))
|
|
|
|
|
;; We check what the last article number was.
|
|
|
|
|
;; The NOV file may be out of sync with the articles
|
|
|
|
|
;; in the group.
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(setq last (read (current-buffer)))
|
|
|
|
|
(if (= last (car articles))
|
|
|
|
|
;; Yup, it's all there.
|
|
|
|
|
t
|
|
|
|
|
;; Perhaps not. We try to find the missing articles.
|
|
|
|
|
(while (and arts
|
|
|
|
|
(<= last (car arts)))
|
|
|
|
|
(pop arts))
|
|
|
|
|
;; The articles in `arts' are missing from the buffer.
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(mapc 'nnspool-insert-nov-head arts)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
t))))))))))
|
|
|
|
|
|
|
|
|
|
(defun nnspool-insert-nov-head (article)
|
|
|
|
|
"Read the head of ARTICLE, convert to NOV headers, and insert."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(let ((cur (current-buffer))
|
2010-11-23 22:24:15 +00:00
|
|
|
|
buf)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(setq buf (nnheader-set-temp-buffer " *nnspool head*"))
|
|
|
|
|
(when (nnheader-insert-head
|
2010-11-23 22:24:15 +00:00
|
|
|
|
(nnspool-article-pathname nnspool-current-group article))
|
|
|
|
|
(nnheader-insert-article-line article)
|
|
|
|
|
(goto-char (point-min))
|
2020-09-05 08:46:43 +08:00
|
|
|
|
(let ((headers (nnheader-parse-head nil t)))
|
2010-11-23 22:24:15 +00:00
|
|
|
|
(set-buffer cur)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(nnheader-insert-nov headers)))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(kill-buffer buf))))
|
|
|
|
|
|
|
|
|
|
(defun nnspool-sift-nov-with-sed (articles file)
|
|
|
|
|
(let ((first (car articles))
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(last (car (last articles))))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(call-process "awk" nil t nil
|
|
|
|
|
(format "BEGIN {firstmsg=%d; lastmsg=%d;}\n $1 >= firstmsg && $1 <= lastmsg {print;}"
|
|
|
|
|
(1- first) (1+ last))
|
|
|
|
|
file)))
|
|
|
|
|
|
|
|
|
|
;; Fixed by fdc@cliwe.ping.de (Frank D. Cringle).
|
|
|
|
|
;; Find out what group an article identified by a Message-ID is in.
|
|
|
|
|
(defun nnspool-find-id (id)
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(with-temp-buffer
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(ignore-errors
|
|
|
|
|
(call-process "grep" nil t nil (regexp-quote id) nnspool-history-file))
|
|
|
|
|
(goto-char (point-min))
|
2007-10-28 09:18:39 +00:00
|
|
|
|
(when (looking-at "<[^>]+>[ \t]+[-0-9~]+[ \t]+\\([^ /\t\n]+\\)/\\([0-9]+\\)[ \t\n]")
|
|
|
|
|
(cons (match-string 1) (string-to-number (match-string 2))))))
|
1997-04-16 22:13:18 +00:00
|
|
|
|
|
|
|
|
|
(defun nnspool-find-file (file)
|
|
|
|
|
"Insert FILE in server buffer safely."
|
|
|
|
|
(set-buffer nntp-server-buffer)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(condition-case ()
|
2000-09-19 13:37:09 +00:00
|
|
|
|
(let ((coding-system-for-read nnspool-file-coding-system))
|
|
|
|
|
(mm-insert-file-contents file)
|
1997-08-28 04:51:02 +00:00
|
|
|
|
t)
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(file-error nil)))
|
|
|
|
|
|
|
|
|
|
(defun nnspool-possibly-change-directory (group)
|
|
|
|
|
(if (not group)
|
|
|
|
|
t
|
|
|
|
|
(let ((pathname (nnspool-article-pathname group)))
|
|
|
|
|
(if (file-directory-p pathname)
|
|
|
|
|
(setq nnspool-current-directory pathname
|
|
|
|
|
nnspool-current-group group)
|
|
|
|
|
(nnheader-report 'nnspool "No such newsgroup: %s" group)))))
|
|
|
|
|
|
|
|
|
|
(defun nnspool-article-pathname (group &optional article)
|
2003-01-16 01:19:03 +00:00
|
|
|
|
"Find the file name for GROUP."
|
1997-04-16 22:13:18 +00:00
|
|
|
|
(nnheader-group-pathname group nnspool-spool-directory article))
|
|
|
|
|
|
|
|
|
|
(provide 'nnspool)
|
|
|
|
|
|
|
|
|
|
;;; nnspool.el ends here
|