(paragraph-start, paragraph-separate): Default values no longer start
[bpt/emacs.git] / lisp / diary-lib.el
index 2a7b8ed..ccf80d4 100644 (file)
@@ -67,16 +67,28 @@ in the displayed three-month calendar."
     (if (and d-file (file-exists-p d-file))
         (if (file-readable-p d-file)
             (list-diary-entries (calendar-cursor-to-date t) arg)
-          (error "Your diary file is not readable!"))
+          (error "Diary file is not readable!"))
       (error "You don't have a diary file!"))))
 
+(defun view-other-diary-entries (arg diary-file)
+  "Prepare and display buffer of diary entries from an alternative diary file.
+Prompts for a file name and searches that file for entries that match ARG
+days starting with the date indicated by the cursor position in the displayed
+three-month calendar."
+  (interactive
+   (list (cond ((null current-prefix-arg) 1)
+               ((listp current-prefix-arg) (car current-prefix-arg))
+               (t current-prefix-arg))
+         (setq diary-file (read-file-name "Enter diary file name: "
+                                          default-directory nil t))))
+  (view-diary-entries arg))
+
 (autoload 'check-calendar-holidays "holidays"
   "Check the list of holidays for any that occur on DATE.
 The value returned is a list of strings of relevant holiday descriptions.
 The holidays are those in the list `calendar-holidays'."
   t)
 
-
 (autoload 'calendar-holiday-list "holidays"
   "Form the list of holidays that occur on dates in the calendar window.
 The holidays are those in the list `calendar-holidays'."
@@ -761,12 +773,12 @@ For example, returns 1325 for 1:25pm.  Returns -9999 if no time is recognized.
 The recognized forms are XXXX or X:XX or XX:XX (military time), XXam or XXpm,
 and XX:XXam or XX:XXpm."
   (cond ((string-match;; Military time  
-          "^ *\\([0-9]?[0-9]\\):?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" s)
+          "^[ \t]*\\([0-9]?[0-9]\\):?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" s)
          (+ (* 100 (string-to-int
                     (substring s (match-beginning 1) (match-end 1))))
             (string-to-int (substring s (match-beginning 2) (match-end 2)))))
         ((string-match;; Hour only  XXam or XXpm
-          "^ *\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s)
+          "^[ \t]*\\([0-9]?[0-9]\\)\\([ap]\\)m\\>" s)
          (+ (* 100 (% (string-to-int
                          (substring s (match-beginning 1) (match-end 1)))
                         12))
@@ -774,7 +786,7 @@ and XX:XXam or XX:XXpm."
                               (substring s (match-beginning 2) (match-end 2)))
                 0 1200)))
         ((string-match;; Hour and minute  XX:XXam or XX:XXpm
-          "^ *\\([0-9]?[0-9]\\):\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
+          "^[ \t]*\\([0-9]?[0-9]\\):\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
          (+ (* 100 (% (string-to-int
                          (substring s (match-beginning 1) (match-end 1)))
                         12))
@@ -1322,7 +1334,7 @@ ending of that number (that is, `st', `nd', `rd' or `th', as appropriate."
 (defun diary-ordinal-suffix (n)
   "Ordinal suffix for N. (That is, `st', `nd', `rd', or `th', as appropriate.)"
   (if (or (memq (% n 100) '(11 12 13))
-         (< 3 (% n 10)))
+          (< 3 (% n 10)))
       "th"
     (aref ["th" "st" "nd" "rd"] (% n 10))))
 
@@ -1893,6 +1905,6 @@ A value of 0 in any position is a wildcard."
                  (mark-visible-calendar-date
                   (calendar-gregorian-from-absolute date)))))))))
 
-(provide 'diary)
+(provide 'diary-lib)
 
-;;; diary.el ends here
+;;; diary-lib.el ends here