unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "D. Goel" <deego@gnufans.org>
Subject: Re: appt: allowing hh.mm for time
Date: Mon, 08 Dec 2003 10:35:05 -0500	[thread overview]
Message-ID: <87he0b5nme.fsf@gnufans.net> (raw)
In-Reply-To: <xgekvha9yc.fsf@xpc14.ast.cam.ac.uk> (Glenn Morris's message of "Sat, 06 Dec 2003 21:54:35 +0000")

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

Glenn Morris <gmorris+emacs@ast.cam.ac.uk> writes:

>
> Please by all means make this change. 

Glenn, 

 Andreas hinted it could be done with a much simper regexp: [:.].

Attached are all the changes and the ChangeLog. I went through all the
files in lisp/calendar/ and these are the only changes I think need to
be made. 



DG                                 http://gnufans.net/~deego/
--

[-- Attachment #2: patches.el-diff --]
[-- Type: application/octet-stream, Size: 1773 bytes --]

--- appt-original.el	Mon Dec  8 10:17:51 2003
+++ appt.el	Mon Dec  8 10:17:26 2003
@@ -437,7 +437,8 @@
 The time should be in either 24 hour format or am/pm format."
 
   (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
-  (if (string-match "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?" new-appt-time)
+  (if (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?" 
+		    new-appt-time)
       nil
     (error "Unacceptable time-string"))
 
@@ -519,7 +520,7 @@
 			   (calendar-current-date) (car (car entry-list))))
 		(let ((time-string (cadr (car entry-list))))
 		  (while (string-match
-			  "\\([0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?\\).*"
+			  "\\([0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?\\).*"
 			  time-string)
 		    (let* ((beg (match-beginning 0))
 			   ;; Get just the time for this appointment.
@@ -527,7 +528,7 @@
 			   ;; Find the end of this appointment
 			   ;; (the start of the next).
 			   (end (string-match
-				 "^[ \t]*[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?"
+				 "^[ \t]*[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?"
 				 time-string
 				 (match-end 0)))
 			   ;; Get the whole string for this appointment.
@@ -586,17 +587,17 @@
 
 
 (defun appt-convert-time (time2conv)
-  "Convert hour:min[am/pm] format to minutes from midnight."
-
+  "Convert hour:min[am/pm] format to minutes from midnight.
+Also try to accpe the hour.min[am/pm] format."
   (let ((conv-time 0)
         (hr 0)
         (min 0))
 
-    (string-match ":\\([0-9][0-9]\\)" time2conv)
+    (string-match "[:.]\\([0-9][0-9]\\)" time2conv)
     (setq min (string-to-int
                (match-string 1 time2conv)))
 
-    (string-match "[0-9]?[0-9]:" time2conv)
+    (string-match "[0-9]?[0-9][:.]" time2conv)
     (setq hr (string-to-int
               (match-string 0 time2conv)))
 

[-- Attachment #3: diary-lib.el-diff --]
[-- Type: application/octet-stream, Size: 2669 bytes --]

--- diary-lib-original.el	Mon Dec  8 10:18:06 2003
+++ diary-lib.el	Mon Dec  8 10:17:01 2003
@@ -1099,12 +1099,15 @@
 (defun diary-entry-time (s)
   "Return time at the beginning of the string S as a military-style integer.
 For example, returns 1325 for 1:25pm.
-Returns `diary-unknown-time' (default value -9999) if no time is recognized.  The recognized forms are XXXX, X:XX, or
-XX:XX (military time), and XXam, XXAM, XXpm, XXPM, XX:XXam, XX:XXAM XX:XXpm,
-or XX:XXPM."
+
+Returns `diary-unknown-time' (default value -9999) if no time is
+recognized.  The recognized forms are XXXX, X:XX, or
+XX:XX (military time), and XXam, XXAM, XXpm, XXPM, XX:XXam,
+XX:XXAM XX:XXpm, or XX:XXPM. We also try to accept time in the
+form XX[.XX][am/pm/AM/PM]]."
   (let ((case-fold-search nil))
     (cond ((string-match        ; Military time
-	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\):?\\([0-9][0-9]\\)\\(\\>\\|[^ap]\\)" s)
+	    "\\`[ \t\n\\^M]*\\([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)))))
@@ -1116,7 +1119,7 @@
 	      (if (equal ?a (downcase (aref s (match-beginning 2))))
 		  0 1200)))
 	  ((string-match        ; Hour and minute  XX:XXam or XX:XXpm
-	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\):\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
+	    "\\`[ \t\n\\^M]*\\([0-9]?[0-9]\\)[:.][\\([0-9][0-9]\\)\\([ap]\\)m\\>" s)
 	   (+ (* 100 (% (string-to-int
 			   (substring s (match-beginning 1) (match-end 1)))
 			  12))
@@ -1764,7 +1767,7 @@
    '("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
    '("^Day.*omer.*$" . font-lock-builtin-face)
    '("^Parashat.*$" . font-lock-comment-face)
-   '("^[ \t]*[0-9]?[0-9]\\(:?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\(-[0-9]?[0-9]\\(:?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\)?"
+   '("^[ \t]*[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)?\\)?"
      . font-lock-variable-name-face))
   "Keywords to highlight in fancy diary display")
 
@@ -1855,7 +1858,7 @@
                  "?\\(" (regexp-quote islamic-diary-entry-symbol) "\\)")
          '(1 font-lock-reference-face))
         '(font-lock-diary-sexps . font-lock-keyword-face)
-        '("[0-9]?[0-9]\\(:?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\(:?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?"
+        '("[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\(-[0-9]?[0-9]\\([:.]?[0-9][0-9]\\)?\\(am\\|pm\\|AM\\|PM\\)\\)?"
           . font-lock-function-name-face)))
       "Forms to highlight in diary-mode")
 

[-- Attachment #4: changelog --]
[-- Type: application/octet-stream, Size: 295 bytes --]

2003-12-08  D Goel  <deego@gnufans.org>


	* diary-lib.el (diary-entry-time): Also accept time in the form
	XX[.XX][am/pm/AM/PM]. 
	(fancy-diary-font-lock-keywords): ditto.
	(diary-font-lock-keywords): ditto.
	* appt.el (appt-add): ditto.
	(appt-make-list): ditto.
	(appt-convert-time): ditto.


[-- Attachment #5: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel

      reply	other threads:[~2003-12-08 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-04 15:00 appt: allowing hh.mm for time D Goel
2003-12-05 20:44 ` Glenn Morris
2003-12-05 21:18   ` D Goel
2003-12-05 23:05     ` Andreas Schwab
2003-12-06  0:58     ` Thien-Thi Nguyen
2003-12-06 21:54     ` Glenn Morris
2003-12-08 15:35       ` D. Goel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87he0b5nme.fsf@gnufans.net \
    --to=deego@gnufans.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).