projects
/
gnus
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Give a better error message in the "go offline" case.
[gnus]
/
lisp
/
nndiary.el
diff --git
a/lisp/nndiary.el
b/lisp/nndiary.el
index
c6821b0
..
7235e4b
100644
(file)
--- a/
lisp/nndiary.el
+++ b/
lisp/nndiary.el
@@
-1,7
+1,7
@@
;;; nndiary.el --- A diary back end for Gnus
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
;;; nndiary.el --- A diary back end for Gnus
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009 Free Software Foundation, Inc.
+;; 2008, 2009
, 2010
Free Software Foundation, Inc.
;; Author: Didier Verna <didier@xemacs.org>
;; Maintainer: Didier Verna <didier@xemacs.org>
;; Author: Didier Verna <didier@xemacs.org>
;; Maintainer: Didier Verna <didier@xemacs.org>
@@
-67,7
+67,7
@@
;; IMHO, nnoo is actually badly designed. A much simpler, and yet more
;; powerful one would be to make *real* functions and variables for a new
;; back end based on another. Lisp is a reflexive language so that's a very
;; IMHO, nnoo is actually badly designed. A much simpler, and yet more
;; powerful one would be to make *real* functions and variables for a new
;; back end based on another. Lisp is a reflexive language so that's a very
-;; easy thing to do: inspect the function's form, replace occurences of
+;; easy thing to do: inspect the function's form, replace occur
r
ences of
;; <nnfrom> (even in strings) with <nnto>, and you're done.
;; * nndiary-get-new-mail, nndiary-mail-source and nndiary-split-methods:
;; <nnfrom> (even in strings) with <nnto>, and you're done.
;; * nndiary-get-new-mail, nndiary-mail-source and nndiary-split-methods:
@@
-380,8
+380,7
@@
all. This may very well take some time.")
(deffoo nndiary-retrieve-headers (sequence &optional group server fetch-old)
(when (nndiary-possibly-change-directory group server)
(deffoo nndiary-retrieve-headers (sequence &optional group server fetch-old)
(when (nndiary-possibly-change-directory group server)
- (save-excursion
- (set-buffer nntp-server-buffer)
+ (with-current-buffer nntp-server-buffer
(erase-buffer)
(let* ((file nil)
(number (length sequence))
(erase-buffer)
(let* ((file nil)
(number (length sequence))
@@
-483,7
+482,7
@@
all. This may very well take some time.")
(cons (if group-num (car group-num) group)
(string-to-number (file-name-nondirectory path)))))))
(cons (if group-num (car group-num) group)
(string-to-number (file-name-nondirectory path)))))))
-(deffoo nndiary-request-group (group &optional server dont-check)
+(deffoo nndiary-request-group (group &optional server dont-check
info
)
(let ((file-name-coding-system nnmail-pathname-coding-system))
(cond
((not (nndiary-possibly-change-directory group server))
(let ((file-name-coding-system nnmail-pathname-coding-system))
(cond
((not (nndiary-possibly-change-directory group server))
@@
-615,8
+614,7
@@
all. This may very well take some time.")
(let (nndiary-current-directory
nndiary-current-group
nndiary-article-file-alist)
(let (nndiary-current-directory
nndiary-current-group
nndiary-article-file-alist)
- (save-excursion
- (set-buffer buf)
+ (with-current-buffer buf
(insert-buffer-substring nntp-server-buffer)
(setq result (eval accept-form))
(kill-buffer (current-buffer))
(insert-buffer-substring nntp-server-buffer)
(setq result (eval accept-form))
(kill-buffer (current-buffer))
@@
-672,8
+670,7
@@
all. This may very well take some time.")
(deffoo nndiary-request-replace-article (article group buffer)
(nndiary-possibly-change-directory group)
(deffoo nndiary-request-replace-article (article group buffer)
(nndiary-possibly-change-directory group)
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(nndiary-possibly-create-directory group)
(let ((chars (nnmail-insert-lines))
(art (concat (int-to-string article) "\t"))
(nndiary-possibly-create-directory group)
(let ((chars (nnmail-insert-lines))
(art (concat (int-to-string article) "\t"))
@@
-688,8
+685,7
@@
all. This may very well take some time.")
t)
(setq headers (nndiary-parse-head chars article))
;; Replace the NOV line in the NOV file.
t)
(setq headers (nndiary-parse-head chars article))
;; Replace the NOV line in the NOV file.
- (save-excursion
- (set-buffer (nndiary-open-nov group))
+ (with-current-buffer (nndiary-open-nov group)
(goto-char (point-min))
(if (or (looking-at art)
(search-forward (concat "\n" art) nil t))
(goto-char (point-min))
(if (or (looking-at art)
(search-forward (concat "\n" art) nil t))
@@
-842,8
+838,7
@@
all. This may very well take some time.")
;; Find an article number in the current group given the Message-ID.
(defun nndiary-find-group-number (id)
;; Find an article number in the current group given the Message-ID.
(defun nndiary-find-group-number (id)
- (save-excursion
- (set-buffer (get-buffer-create " *nndiary id*"))
+ (with-current-buffer (get-buffer-create " *nndiary id*")
(let ((alist nndiary-group-alist)
number)
;; We want to look through all .overview files, but we want to
(let ((alist nndiary-group-alist)
number)
;; We want to look through all .overview files, but we want to
@@
-888,8
+883,7
@@
all. This may very well take some time.")
(let ((nov (expand-file-name nndiary-nov-file-name
nndiary-current-directory)))
(when (file-exists-p nov)
(let ((nov (expand-file-name nndiary-nov-file-name
nndiary-current-directory)))
(when (file-exists-p nov)
- (save-excursion
- (set-buffer nntp-server-buffer)
+ (with-current-buffer nntp-server-buffer
(erase-buffer)
(nnheader-insert-file-contents nov)
(if (and fetch-old
(erase-buffer)
(nnheader-insert-file-contents nov)
(if (and fetch-old
@@
-989,8
+983,7
@@
all. This may very well take some time.")
(defun nndiary-add-nov (group article headers)
"Add a nov line for the GROUP base."
(defun nndiary-add-nov (group article headers)
"Add a nov line for the GROUP base."
- (save-excursion
- (set-buffer (nndiary-open-nov group))
+ (with-current-buffer (nndiary-open-nov group)
(goto-char (point-max))
(mail-header-set-number headers article)
(nnheader-insert-nov headers)))
(goto-char (point-max))
(mail-header-set-number headers article)
(nnheader-insert-nov headers)))
@@
-1015,8
+1008,7
@@
all. This may very well take some time.")
(or (cdr (assoc group nndiary-nov-buffer-alist))
(let ((buffer (get-buffer-create (format " *nndiary overview %s*"
group))))
(or (cdr (assoc group nndiary-nov-buffer-alist))
(let ((buffer (get-buffer-create (format " *nndiary overview %s*"
group))))
- (save-excursion
- (set-buffer buffer)
+ (with-current-buffer buffer
(set (make-local-variable 'nndiary-nov-buffer-file-name)
(expand-file-name
nndiary-nov-file-name
(set (make-local-variable 'nndiary-nov-buffer-file-name)
(expand-file-name
nndiary-nov-file-name
@@
-1103,9
+1095,8
@@
all. This may very well take some time.")
(nov (concat dir nndiary-nov-file-name))
(nov-buffer (get-buffer-create " *nov*"))
chars file headers)
(nov (concat dir nndiary-nov-file-name))
(nov-buffer (get-buffer-create " *nov*"))
chars file headers)
- (save-excursion
- ;; Init the nov buffer.
- (set-buffer nov-buffer)
+ ;; Init the nov buffer.
+ (with-current-buffer nov-buffer
(buffer-disable-undo)
(erase-buffer)
(set-buffer nntp-server-buffer)
(buffer-disable-undo)
(erase-buffer)
(set-buffer nntp-server-buffer)
@@
-1125,20
+1116,17
@@
all. This may very well take some time.")
(unless (zerop (buffer-size))
(goto-char (point-min))
(setq headers (nndiary-parse-head chars (caar files)))
(unless (zerop (buffer-size))
(goto-char (point-min))
(setq headers (nndiary-parse-head chars (caar files)))
- (save-excursion
- (set-buffer nov-buffer)
+ (with-current-buffer nov-buffer
(goto-char (point-max))
(nnheader-insert-nov headers)))
(widen))
(setq files (cdr files)))
(goto-char (point-max))
(nnheader-insert-nov headers)))
(widen))
(setq files (cdr files)))
- (save-excursion
- (set-buffer nov-buffer)
+ (with-current-buffer nov-buffer
(nnmail-write-region 1 (point-max) nov nil 'nomesg)
(kill-buffer (current-buffer))))))
(defun nndiary-nov-delete-article (group article)
(nnmail-write-region 1 (point-max) nov nil 'nomesg)
(kill-buffer (current-buffer))))))
(defun nndiary-nov-delete-article (group article)
- (save-excursion
- (set-buffer (nndiary-open-nov group))
+ (with-current-buffer (nndiary-open-nov group)
(when (nnheader-find-nov-line article)
(delete-region (point) (progn (forward-line 1) (point)))
(when (bobp)
(when (nnheader-find-nov-line article)
(delete-region (point) (progn (forward-line 1) (point)))
(when (bobp)
@@
-1322,7
+1310,7
@@
all. This may very well take some time.")
(sort res 'time-less-p)))
(defun nndiary-last-occurence (sched)
(sort res 'time-less-p)))
(defun nndiary-last-occurence (sched)
- ;; Returns the last occurence of schedule SCHED as an Emacs time struct, or
+ ;; Returns the last occur
r
ence of schedule SCHED as an Emacs time struct, or
;; nil for permanent schedule or errors.
(let ((minute (nndiary-max (nth 0 sched)))
(hour (nndiary-max (nth 1 sched)))
;; nil for permanent schedule or errors.
(let ((minute (nndiary-max (nth 0 sched)))
(hour (nndiary-max (nth 1 sched)))
@@
-1393,7
+1381,7
@@
all. This may very well take some time.")
(encode-time 0 minute hour
(car days) month year time-zone)))
)))))
(encode-time 0 minute hour
(car days) month year time-zone)))
)))))
- ;; There's an upper limit, but we didn't find any last occurence.
+ ;; There's an upper limit, but we didn't find any last occur
r
ence.
;; This means that the schedule is undecidable. This can happen if
;; you happen to say something like "each Feb 31 until 2038".
(progn
;; This means that the schedule is undecidable. This can happen if
;; you happen to say something like "each Feb 31 until 2038".
(progn
@@
-1402,8
+1390,8
@@
all. This may very well take some time.")
))))
(defun nndiary-next-occurence (sched now)
))))
(defun nndiary-next-occurence (sched now)
- ;; Returns the next occurence of schedule SCHED, starting from time NOW.
- ;; If there's no next occurence, returns the last one (if any) which is then
+ ;; Returns the next occur
r
ence of schedule SCHED, starting from time NOW.
+ ;; If there's no next occur
r
ence, returns the last one (if any) which is then
;; in the past.
(let* ((today (decode-time now))
(this-minute (nth 1 today))
;; in the past.
(let* ((today (decode-time now))
(this-minute (nth 1 today))
@@
-1557,12
+1545,12
@@
all. This may very well take some time.")
;; The article should be re-considered as unread if there's a reminder
;; between the group timestamp and the current time.
(when (and sched (setq sched (nndiary-next-occurence sched now)))
;; The article should be re-considered as unread if there's a reminder
;; between the group timestamp and the current time.
(when (and sched (setq sched (nndiary-next-occurence sched now)))
- (let ((reminders ;; add the next occurence itself at the end.
+ (let ((reminders ;; add the next occur
r
ence itself at the end.
(append (nndiary-compute-reminders sched) (list sched))))
(while (and reminders (time-less-p (car reminders) timestamp))
(pop reminders))
;; The reminders might be empty if the last date is in the past,
(append (nndiary-compute-reminders sched) (list sched))))
(while (and reminders (time-less-p (car reminders) timestamp))
(pop reminders))
;; The reminders might be empty if the last date is in the past,
- ;; or we've got at least the next occurence itself left. All past
+ ;; or we've got at least the next occur
r
ence itself left. All past
;; dates are renewed.
(or (not reminders)
(time-less-p (car reminders) now)))
;; dates are renewed.
(or (not reminders)
(time-less-p (car reminders) now)))
@@
-1584,6
+1572,4
@@
all. This may very well take some time.")
(provide 'nndiary)
(provide 'nndiary)
-
-;; arch-tag: 9c542b95-92e7-4ace-a038-330ab296e203
;;; nndiary.el ends here
;;; nndiary.el ends here