Revision: miles@gnu.org--gnu-2005/gnus--devo--0--patch-151
[gnus] / lisp / gnus-diary.el
index 60df29c..6af72cb 100644 (file)
@@ -1,30 +1,29 @@
 ;;; gnus-diary.el --- Wrapper around the NNDiary Gnus backend
 
-;; Copyright (C) 1999-2001 Didier Verna.
-
-;; PRCS: $Id: gnus-diary.el,v 1.2 2001/09/12 14:17:15 didier Exp $
+;; Copyright (c) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001 Didier Verna.
 
 ;; Author:        Didier Verna <didier@xemacs.org>
 ;; Maintainer:    Didier Verna <didier@xemacs.org>
-;; Created:       Tue Jul 20 10:42:55 1999 under XEmacs 21.2 (beta 18)
-;; Last Revision: Wed Sep 12 12:31:09 2001
+;; Created:       Tue Jul 20 10:42:55 1999
 ;; Keywords:      calendar mail news
 
-;; This file is part of NNDiary.
+;; This file is part of GNU Emacs.
 
-;; NNDiary is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2 of the License, or
-;; (at your option) any later version.
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 2 of the License,
+;; or (at your option) any later version.
 
-;; NNDiary is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program; if not, write to the Free Software
-;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301, USA.
 
 
 ;;; Commentary:
 (require 'gnus-art)
 
 (defgroup gnus-diary nil
-  "Utilities on top of the nndiary backend for Gnus.")
+  "Utilities on top of the nndiary backend for Gnus."
+  :version "22.1"
+  :group 'gnus)
 
 (defcustom gnus-diary-summary-line-format "%U%R%z %uD: %(%s%) (%ud)\n"
   "*Summary line format for nndiary groups."
@@ -138,13 +139,24 @@ There are currently two built-in format functions:
   "Current Diary backend version.")
 
 
+;; Compatibility functions ==================================================
+
+(eval-and-compile
+  (if (fboundp 'kill-entire-line)
+      (defalias 'gnus-diary-kill-entire-line 'kill-entire-line)
+    (defun gnus-diary-kill-entire-line ()
+      (beginning-of-line)
+      (let ((kill-whole-line t))
+       (kill-line)))))
+
+
 ;; Summary line format ======================================================
 
 (defun gnus-diary-delay-format-french (past delay)
   (if (null delay)
       "maintenant!"
     ;; Keep only a precision of two degrees
-    (and (> (length delay) 1) (setf (nthcdr 2 delay) nil))
+    (and (> (length delay) 1) (setcdr (cdr delay) nil))
     (concat (if past "il y a " "dans ")
            (let ((str "")
                  del)
@@ -174,7 +186,7 @@ There are currently two built-in format functions:
   (if (null delay)
       "now!"
     ;; Keep only a precision of two degrees
-    (and (> (length delay) 1) (setf (nthcdr 2 delay) nil))
+    (and (> (length delay) 1) (setcdr (cdr delay) nil))
     (concat (unless past "in ")
            (let ((str "")
                  del)
@@ -195,7 +207,7 @@ There are currently two built-in format functions:
      (let ((head (cdr (assoc (intern (format "X-Diary-%s" (car elt)))
                             headers))))
        (when head
-        (nndiary-parse-schedule-value head (cadr elt) (caddr elt)))))
+        (nndiary-parse-schedule-value head (cadr elt) (car (cddr elt))))))
    nndiary-headers))
 
 ;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any
@@ -256,7 +268,7 @@ There are currently two built-in format functions:
         (o1 (nndiary-next-occurence s1 now))
         (o2 (nndiary-next-occurence s2 now)))
     (if (and (= (car o1) (car o2)) (= (cadr o1) (cadr o2)))
-        (< (mail-header-number h1) (mail-header-number h2))
+       (< (mail-header-number h1) (mail-header-number h2))
       (time-less-p o1 o2))))
 
 
@@ -270,8 +282,7 @@ Optional prefix (or REVERSE argument) means sort in reverse order."
   (interactive "P")
   (gnus-summary-sort 'schedule reverse))
 
-(defvar gnus-summary-misc-menu)
-
+(defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
 (add-hook 'gnus-summary-menu-hook
          (lambda ()
            (easy-menu-add-item gnus-summary-misc-menu
@@ -339,14 +350,6 @@ Optional prefix (or REVERSE argument) means sort in reverse order."
 
 ;; Diary Message Checking ===================================================
 
-(eval-and-compile
-  (if (fboundp 'kill-entire-line)
-      (defalias 'gnus-diary-kill-entire-line 'kill-entire-line)
-    (defun gnus-diary-kill-entire-line ()
-      (beginning-of-line)
-      (let ((kill-whole-line t))
-       (kill-line)))))
-
 (defvar gnus-diary-header-value-history nil
   ;; History variable for header value prompting
   )
@@ -397,7 +400,7 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
           (when (re-search-forward (concat "^" header ":") nil t)
             (unless (eq (char-after) ? )
               (insert " "))
-            (setq value (buffer-substring (point) (gnus-point-at-eol)))
+            (setq value (buffer-substring (point) (point-at-eol)))
             (and (string-match "[ \t]*\\([^ \t]+\\)[ \t]*" value)
                  (setq value (match-string 1 value)))
             (condition-case ()
@@ -417,16 +420,14 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
           (let ((prompt (concat (and invalid
                                      (prog1 "(current value invalid) "
                                        (beep)))
-                                header
-                                (and (not value) " (defaults to `*')")
-                                ": ")))
+                                header ": ")))
             (setq value
                   (if (listp (nth 1 head))
                       (completing-read prompt (cons '("*" nil) (nth 1 head))
                                        nil t value
-                                       gnus-diary-header-value-history "*")
+                                       gnus-diary-header-value-history)
                     (read-string prompt value
-                                 gnus-diary-header-value-history "*"))))
+                                 gnus-diary-header-value-history))))
           (setq ask nil)
           (setq invalid nil)
           (condition-case ()
@@ -459,4 +460,5 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
 
 (provide 'gnus-diary)
 
+;;; arch-tag: 98467e70-337e-4ddc-b92d-45d403ff1b4b
 ;;; gnus-diary.el ends here