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.el38
1 files changed, 15 insertions, 23 deletions
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index dec32361cae..090b8420842 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -26,7 +26,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
(defvar nnmail-extra-headers)
(defvar gnus-newsgroup-name)
@@ -237,7 +237,7 @@ on your system, you could say something like:
(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)))))
+ (int-to-string (cl-incf nnheader-fake-message-id)))))
(defsubst nnheader-fake-message-id-p (id)
(save-match-data ; regular message-id's are <.*>
@@ -408,7 +408,7 @@ on your system, you could say something like:
`(let ((id (nnheader-nov-field)))
(if (string-match "^<[^>]+>$" id)
,(if nnheader-uniquify-message-id
- `(if (string-match "__[^@]+@" id)
+ '(if (string-match "__[^@]+@" id)
(concat (substring id 0 (match-beginning 0))
(substring id (1- (match-end 0))))
id)
@@ -612,7 +612,7 @@ the line could be found."
(while (and (eq nnheader-head-chop-length
(nth 1 (mm-insert-file-contents
file nil beg
- (incf beg nnheader-head-chop-length))))
+ (cl-incf beg nnheader-head-chop-length))))
;; CRLF or CR might be used for the line-break code.
(prog1 (not (re-search-forward "\n\r?\n\\|\r\r" nil t))
(goto-char (point-max)))
@@ -784,7 +784,7 @@ If FULL, translate everything."
(when (setq trans (cdr (assq (aref leaf i)
nnheader-file-name-translation-alist)))
(aset leaf i trans))
- (incf i))
+ (cl-incf i))
(concat path leaf))))
(defun nnheader-report (backend &rest args)
@@ -896,7 +896,7 @@ without formatting."
(defun nnheader-file-size (file)
"Return the file size of FILE or 0."
- (or (nth 7 (file-attributes file)) 0))
+ (or (file-attribute-size (file-attributes file)) 0))
(defun nnheader-find-etc-directory (package &optional file first)
"Go through `load-path' and find the \"../etc/PACKAGE\" directory.
@@ -951,7 +951,7 @@ find-file-hook, etc.
(mm-insert-file-contents filename visit beg end replace)))
(defun nnheader-insert-nov-file (file first)
- (let ((size (nth 7 (file-attributes file)))
+ (let ((size (file-attribute-size (file-attributes file)))
(cutoff (* 32 1024)))
(when size
(if (< size cutoff)
@@ -973,7 +973,7 @@ find-file-hook, etc.
(defun nnheader-find-file-noselect (&rest args)
"Open a file with some variables bound.
See `find-file-noselect' for the arguments."
- (letf* ((format-alist nil)
+ (cl-letf* ((format-alist nil)
(auto-mode-alist (mm-auto-mode-alist))
((default-value 'major-mode) 'fundamental-mode)
(enable-local-variables nil)
@@ -1042,12 +1042,7 @@ See `find-file-noselect' for the arguments."
;; When changing this function, consider changing `pop3-accept-process-output'
;; as well.
(defun nnheader-accept-process-output (process)
- (accept-process-output
- process
- (truncate nnheader-read-timeout)
- (truncate (* (- nnheader-read-timeout
- (truncate nnheader-read-timeout))
- 1000))))
+ (accept-process-output process nnheader-read-timeout))
(defun nnheader-update-marks-actions (backend-marks actions)
(dolist (action actions)
@@ -1071,19 +1066,16 @@ See `find-file-noselect' for the arguments."
(defmacro nnheader-insert-buffer-substring (buffer &optional start end)
"Copy string from unibyte buffer to multibyte current buffer."
- `(if enable-multibyte-characters
- (insert (with-current-buffer ,buffer
- (string-to-multibyte
- ,(if (or start end)
- `(buffer-substring (or ,start (point-min))
- (or ,end (point-max)))
- '(buffer-string)))))
- (insert-buffer-substring ,buffer ,start ,end)))
+ `(insert (with-current-buffer ,buffer
+ ,(if (or start end)
+ `(buffer-substring (or ,start (point-min))
+ (or ,end (point-max)))
+ '(buffer-string)))))
(defvar nnheader-last-message-time '(0 0))
(defun nnheader-message-maybe (&rest args)
(let ((now (current-time)))
- (when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
+ (when (time-less-p 1 (time-subtract now nnheader-last-message-time))
(setq nnheader-last-message-time now)
(apply 'nnheader-message args))))