;;; nndiary.el --- A diary back end for Gnus
-;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2016 Free Software Foundation, Inc.
;; Author: Didier Verna <didier@xemacs.org>
;; Maintainer: Didier Verna <didier@xemacs.org>
(require 'gnus-start)
(require 'gnus-sum)
-;; Compatibility Functions =================================================
-
-(eval-and-compile
- (if (fboundp 'signal-error)
- (defun nndiary-error (&rest args)
- (apply #'signal-error 'nndiary args))
- (defun nndiary-error (&rest args)
- (apply #'error args))))
-
-
;; Back End behavior customization ===========================================
(defgroup nndiary nil
scheme might appear somewhat weird at a first glance, it is very powerful.
In order to make this clear, here are some examples:
-- '(0 . day): this is the default value of `nndiary-reminders'. It means
+- (0 . day): this is the default value of `nndiary-reminders'. It means
pop up the appointments of the day each morning at 00:00.
-- '(1 . day): this means pop up the appointments the day before, at 00:00.
+- (1 . day): this means pop up the appointments the day before, at 00:00.
-- '(6 . hour): for an appointment at 18:30, this would pop up the
+- (6 . hour): for an appointment at 18:30, this would pop up the
appointment message at 12:00.
-- '(360 . minute): for an appointment at 18:30 and 15 seconds, this would
+- (360 . minute): for an appointment at 18:30 and 15 seconds, this would
pop up the appointment message at 12:30."
:group 'nndiary
:type '(repeat (cons :format "%v\n"
:group 'nndiary)
-(defcustom nndiary-request-create-group-hooks nil
- "*Hooks to run after `nndiary-request-create-group' is executed.
-The hooks will be called with the full group name as argument."
+(define-obsolete-variable-alias 'nndiary-request-create-group-hooks
+ 'nndiary-request-create-group-functions "24.3")
+(defcustom nndiary-request-create-group-functions nil
+ "*Hook run after `nndiary-request-create-group' is executed.
+The hook functions will be called with the full group name as argument."
:group 'nndiary
:type 'hook)
-(defcustom nndiary-request-update-info-hooks nil
- "*Hooks to run after `nndiary-request-update-info-group' is executed.
-The hooks will be called with the full group name as argument."
+(define-obsolete-variable-alias 'nndiary-request-update-info-hooks
+ 'nndiary-request-update-info-functions "24.3")
+(defcustom nndiary-request-update-info-functions nil
+ "*Hook run after `nndiary-request-update-info-group' is executed.
+The hook functions will be called with the full group name as argument."
:group 'nndiary
:type 'hook)
-(defcustom nndiary-request-accept-article-hooks nil
- "*Hooks to run before accepting an article.
+(define-obsolete-variable-alias 'nndiary-request-accept-article-hooks
+ 'nndiary-request-accept-article-functions "24.3")
+(defcustom nndiary-request-accept-article-functions nil
+ "*Hook run before accepting an article.
Executed near the beginning of `nndiary-request-accept-article'.
-The hooks will be called with the article in the current buffer."
+The hook functions will be called with the article in the current buffer."
:group 'nndiary
:type 'hook)
(> number nnmail-large-newsgroup)
(zerop (% count 20))
(nnheader-message 6 "nndiary: Receiving headers... %d%%"
- (/ (* count 100) number))))
+ (floor (* count 100.0) number))))
(and (numberp nnmail-large-newsgroup)
(> number nnmail-large-newsgroup)
(setcar active (apply 'min articles))
(setcdr active (apply 'max articles))))
(nnmail-save-active nndiary-group-alist nndiary-active-file)
- (run-hook-with-args 'nndiary-request-create-group-hooks
+ (run-hook-with-args 'nndiary-request-create-group-functions
(gnus-group-prefixed-name group
(list "nndiary" server)))
t))
(deffoo nndiary-request-accept-article (group &optional server last)
(nndiary-possibly-change-directory group server)
(nnmail-check-syntax)
- (run-hooks 'nndiary-request-accept-article-hooks)
+ (run-hooks 'nndiary-request-accept-article-functions)
(when (nndiary-schedule)
(let (result)
(when nnmail-cache-accepted-message-ids
(gnus-info-set-read info (gnus-update-read-articles
(gnus-info-group info) unread t)))
))
- (run-hook-with-args 'nndiary-request-update-info-hooks
+ (run-hook-with-args 'nndiary-request-update-info-functions
(gnus-info-group info))
t))
;; within the specified bounds.
;; Signals are caught by `nndiary-schedule'.
(if (not (string-match "^[ \t]*[0-9]+[ \t]*$" str))
- (nndiary-error "not an integer value")
+ (error "Not an integer value")
;; else
(let ((val (string-to-number str)))
(and (or (< val min)
(and max (> val max)))
- (nndiary-error "value out of range"))
+ (error "Value out of range"))
val)))
(defun nndiary-parse-schedule-value (str min-or-values max)
(match-string 1 str))))
(if (and val (setq val (assoc val min-or-values)))
(list (cadr val))
- (nndiary-error "invalid syntax")))
+ (error "Invalid syntax")))
;; min-or-values is min
(mapcar
(lambda (val)
(t
(cons end beg)))))
(t
- (nndiary-error "invalid syntax")))
+ (error "Invalid syntax")))
))
(split-string str ",")))
))
(let ((header (format "^X-Diary-%s: \\(.*\\)$" head)))
(goto-char (point-min))
(if (not (re-search-forward header nil t))
- (nndiary-error "header missing")
+ (error "Header missing")
;; else
(nndiary-parse-schedule-value (match-string 1) min-or-values max))
))
res))
(sort res 'time-less-p)))
+;; FIXME: "occurrence" is misspelled in this function name.
+
(defun nndiary-last-occurence (sched)
;; Returns the last occurrence of schedule SCHED as an Emacs time struct, or
;; nil for permanent schedule or errors.
nil))
))))
+;; FIXME: "occurrence" is misspelled in this function name.
+
(defun nndiary-next-occurence (sched now)
;; Returns the next occurrence of schedule SCHED, starting from time NOW.
;; If there's no next occurrence, returns the last one (if any) which is then