X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/9898bd0e5b0e51ce9040e11ae25c9a07ec08eb4f..cb5f690e4a383129895abf96256fd2c52feff618:/lisp/gnus/nndiary.el diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el index a798e22902..71229dd939 100644 --- a/lisp/gnus/nndiary.el +++ b/lisp/gnus/nndiary.el @@ -1,6 +1,6 @@ ;;; nndiary.el --- A diary back end for Gnus -;; Copyright (C) 1999-2011 Free Software Foundation, Inc. +;; Copyright (C) 1999-2016 Free Software Foundation, Inc. ;; Author: Didier Verna ;; Maintainer: Didier Verna @@ -55,7 +55,7 @@ ;; * nnoo. NNDiary is very similar to nnml. This makes the idea of using nnoo ;; (to derive nndiary from nnml) natural. However, my experience with nnoo -;; is that for reasonably complex back ends like this one, noo is a burden +;; is that for reasonably complex back ends like this one, nnoo is a burden ;; rather than an help. It's tricky to use, not everything can be inherited, ;; what can be inherited and when is not very clear, and you've got to be ;; very careful because a little mistake can fuck up your other back ends, @@ -71,7 +71,7 @@ ;; * nndiary-get-new-mail, nndiary-mail-source and nndiary-split-methods: ;; NNDiary has some experimental parts, in the sense Gnus normally uses only -;; one mail back ends for mail retreival and splitting. This back end is +;; one mail back ends for mail retrieval and splitting. This back end is ;; also an attempt to make it behave differently. For Gnus developers: as ;; you can see if you snarf into the code, that was not a very difficult ;; thing to do. Something should be done about the respooling breakage @@ -88,16 +88,6 @@ (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 @@ -151,15 +141,15 @@ maximum in the reminder is not that painful, I think. Although this 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" @@ -179,22 +169,28 @@ In order to make this clear, here are some examples: :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) @@ -224,7 +220,7 @@ The hooks will be called with the article in the current buffer." (defvoo nndiary-get-new-mail nil "Whether nndiary gets new mail and split it. Contrary to traditional mail back ends, this variable can be set to t -even if your primary mail back end also retreives mail. In such a case, +even if your primary mail back end also retrieves mail. In such a case, NDiary uses its own mail-sources and split-methods.") (defvoo nndiary-nov-is-evil nil @@ -353,7 +349,7 @@ all. This may very well take some time.") ;; List of NNDiary headers that specify the time spec. Each header name is ;; followed by either two integers (specifying a range of possible values ;; for this header) or one list (specifying all the possible values for this - ;; header). In the latter case, the list does NOT include the unspecifyed + ;; header). In the latter case, the list does NOT include the unspecified ;; spec (*). ;; For time zone values, we have symbolic time zone names associated with ;; the (relative) number of seconds ahead GMT. @@ -417,7 +413,7 @@ all. This may very well take some time.") (> 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) @@ -541,7 +537,7 @@ all. This may very well take some time.") (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)) @@ -633,7 +629,7 @@ all. This may very well take some time.") (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 @@ -804,7 +800,7 @@ all. This may very well take some time.") (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)) @@ -1151,21 +1147,21 @@ all. This may very well take some time.") ;; 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) ;; Parse the schedule string STR, or signal an error. - ;; Signals are caught by `nndary-schedule'. + ;; Signals are caught by `nndiary-schedule'. (if (string-match "[ \t]*\\*[ \t]*" str) - ;; unspecifyed + ;; unspecified nil - ;; specifyed + ;; specified (if (listp min-or-values) ;; min-or-values is values ;; #### NOTE: this is actually only a hack for time zones. @@ -1173,7 +1169,7 @@ all. This may very well take some time.") (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) @@ -1193,7 +1189,7 @@ all. This may very well take some time.") (t (cons end beg))))) (t - (nndiary-error "invalid syntax"))) + (error "Invalid syntax"))) )) (split-string str ","))) )) @@ -1204,11 +1200,11 @@ all. This may very well take some time.") ;; - Returns nil if `*' ;; - Otherwise returns a list of integers and/or ranges (BEG . END) ;; The exception is the Timze-Zone value which is always of the form (STR). - ;; Signals are caught by `nndary-schedule'. + ;; Signals are caught by `nndiary-schedule'. (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)) )) @@ -1308,6 +1304,8 @@ all. This may very well take some time.") 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. @@ -1320,7 +1318,7 @@ all. This may very well take some time.") (or minute (setq minute 59)) (or hour (setq hour 23)) ;; I'll just compute all possible values and test them by decreasing - ;; order until one succeeds. This is probably quide rude, but I got + ;; order until one succeeds. This is probably quite rude, but I got ;; bored in finding a good algorithm for doing that ;-) ;; ### FIXME: remove identical entries. (let ((dom-list (nth 2 sched)) @@ -1388,6 +1386,8 @@ all. This may very well take some time.") 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