summaryrefslogtreecommitdiff
path: root/lisp/gnus/nnheader.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus/nnheader.el')
-rw-r--r--lisp/gnus/nnheader.el65
1 files changed, 43 insertions, 22 deletions
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index aa19967b412..031d2c3d0fb 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -115,7 +115,6 @@ on your system, you could say something like:
(autoload 'nnmail-message-id "nnmail")
(autoload 'mail-position-on-field "sendmail")
(autoload 'message-remove-header "message")
- (autoload 'gnus-point-at-eol "gnus-util")
(autoload 'gnus-buffer-live-p "gnus-util"))
;;; Header access macros.
@@ -209,9 +208,9 @@ on your system, you could say something like:
"Return the extra headers in HEADER."
`(aref ,header 9))
-(defmacro mail-header-set-extra (header extra)
+(defun mail-header-set-extra (header extra)
"Set the extra headers in HEADER to EXTRA."
- `(aset ,header 9 ',extra))
+ (aset header 9 extra))
(defsubst make-mail-header (&optional init)
"Create a new mail header structure initialized with INIT."
@@ -227,12 +226,16 @@ on your system, you could say something like:
(defvar nnheader-fake-message-id 1)
-(defsubst nnheader-generate-fake-message-id ()
- (concat "fake+none+" (int-to-string (incf nnheader-fake-message-id))))
+(defsubst nnheader-generate-fake-message-id (&optional number)
+ (if (numberp number)
+ (format "fake+none+%s+%d" gnus-newsgroup-name number)
+ (format "fake+none+%s+%s"
+ gnus-newsgroup-name
+ (int-to-string (incf nnheader-fake-message-id)))))
(defsubst nnheader-fake-message-id-p (id)
(save-match-data ; regular message-id's are <.*>
- (string-match "\\`fake\\+none\\+[0-9]+\\'" id)))
+ (string-match "\\`fake\\+none\\+.*\\+[0-9]+\\'" id)))
;; Parsing headers and NOV lines.
@@ -243,7 +246,7 @@ on your system, you could say something like:
(defsubst nnheader-header-value ()
(skip-chars-forward " \t")
- (buffer-substring (point) (gnus-point-at-eol)))
+ (buffer-substring (point) (point-at-eol)))
(defun nnheader-parse-naked-head (&optional number)
;; This function unfolds continuation lines in this buffer
@@ -289,12 +292,12 @@ on your system, you could say something like:
(goto-char p)
(if (search-forward "\nmessage-id:" nil t)
(buffer-substring
- (1- (or (search-forward "<" (gnus-point-at-eol) t)
+ (1- (or (search-forward "<" (point-at-eol) t)
(point)))
- (or (search-forward ">" (gnus-point-at-eol) t) (point)))
+ (or (search-forward ">" (point-at-eol) t) (point)))
;; If there was no message-id, we just fake one to make
;; subsequent routines simpler.
- (nnheader-generate-fake-message-id)))
+ (nnheader-generate-fake-message-id number)))
;; References.
(progn
(goto-char p)
@@ -392,20 +395,29 @@ on your system, you could say something like:
out)))
out))
-(defmacro nnheader-nov-read-message-id ()
- '(let ((id (nnheader-nov-field)))
+(eval-and-compile
+ (defvar nnheader-uniquify-message-id nil))
+
+(defmacro nnheader-nov-read-message-id (&optional number)
+ `(let ((id (nnheader-nov-field)))
(if (string-match "^<[^>]+>$" id)
- id
- (nnheader-generate-fake-message-id))))
+ ,(if nnheader-uniquify-message-id
+ `(if (string-match "__[^@]+@" id)
+ (concat (substring id 0 (match-beginning 0))
+ (substring id (1- (match-end 0))))
+ id)
+ 'id)
+ (nnheader-generate-fake-message-id ,number))))
(defun nnheader-parse-nov ()
- (let ((eol (gnus-point-at-eol)))
+ (let ((eol (point-at-eol))
+ (number (nnheader-nov-read-integer)))
(vector
- (nnheader-nov-read-integer) ; number
+ number ; number
(nnheader-nov-field) ; subject
(nnheader-nov-field) ; from
(nnheader-nov-field) ; date
- (nnheader-nov-read-message-id) ; id
+ (nnheader-nov-read-message-id number) ; id
(nnheader-nov-field) ; refs
(nnheader-nov-read-integer) ; chars
(nnheader-nov-read-integer) ; lines
@@ -628,7 +640,7 @@ the line could be found."
;; This is invalid, but not all articles have Message-IDs.
()
(mail-position-on-field "References")
- (let ((begin (gnus-point-at-bol))
+ (let ((begin (point-at-bol))
(fill-column 78)
(fill-prefix "\t"))
(when references
@@ -662,6 +674,14 @@ the line could be found."
(point-max)))
(goto-char (point-min)))
+(defun nnheader-get-lines-and-char ()
+ "Return the number of lines and chars in the article body."
+ (goto-char (point-min))
+ (if (not (re-search-forward "\n\r?\n" nil t))
+ (list 0 0)
+ (list (count-lines (point) (point-max))
+ (- (point-max) (point)))))
+
(defun nnheader-remove-body ()
"Remove the body from an article in this current buffer."
(goto-char (point-min))
@@ -701,8 +721,7 @@ the line could be found."
(defvar nnheader-directory-files-is-safe
(or (eq system-type 'windows-nt)
- (and (not (featurep 'xemacs))
- (> emacs-major-version 20)))
+ (not (featurep 'xemacs)))
"If non-nil, Gnus believes `directory-files' is safe.
It has been reported numerous times that `directory-files' fails with
an alarming frequency on NFS mounted file systems. If it is nil,
@@ -848,7 +867,9 @@ without formatting."
"Message if the Gnus backends are talkative."
(if (or (not (numberp gnus-verbose-backends))
(<= level gnus-verbose-backends))
- (apply 'message args)
+ (if gnus-add-timestamp-to-message
+ (apply 'gnus-message-with-timestamp args)
+ (apply 'message args))
(apply 'format args)))
(defun nnheader-be-verbose (level)
@@ -972,6 +993,7 @@ See `find-file-noselect' for the arguments."
(after-insert-file-functions nil)
(enable-local-eval nil)
(coding-system-for-read nnheader-file-coding-system)
+ (version-control 'never)
(ffh (if (boundp 'find-file-hook)
'find-file-hook
'find-file-hooks))
@@ -1033,7 +1055,6 @@ See `find-file-noselect' for the arguments."
"Strip all \r's from the current buffer."
(nnheader-skeleton-replace "\r"))
-(defalias 'nnheader-run-at-time 'run-at-time)
(defalias 'nnheader-cancel-timer 'cancel-timer)
(defalias 'nnheader-cancel-function-timers 'cancel-function-timers)
(defalias 'nnheader-string-as-multibyte 'string-as-multibyte)