aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2005-10-04 20:51:16 +0000
committerStefan Monnier2005-10-04 20:51:16 +0000
commit0cb7f2c026948b6e093921b5bc6027f1daddddf0 (patch)
treeb92bba2c716eefa65dddd5a98a05ff0b9c7d8df7
parent3307a4fa17926898746713c7cb470cd4abdff8b8 (diff)
downloademacs-0cb7f2c026948b6e093921b5bc6027f1daddddf0.tar.gz
emacs-0cb7f2c026948b6e093921b5bc6027f1daddddf0.zip
(appt-time-regexp): New var.
(appt-add, appt-make-list): Use it. (appt-convert-time): Clean up.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/calendar/appt.el46
2 files changed, 31 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1137e1dac54..fc438fe7663 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12005-10-04 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * calendar/appt.el (appt-time-regexp): New var.
4 (appt-add, appt-make-list): Use it.
5 (appt-convert-time): Clean up.
6
7 * textmodes/tex-mode.el (tex-font-lock-syntactic-face-function):
8 Don't set any syntax-table property here.
9 (tex-font-lock-verb): New function. Do it here.
10 (tex-font-lock-syntactic-keywords): Use it.
11
12005-10-04 Richard M. Stallman <rms@gnu.org> 122005-10-04 Richard M. Stallman <rms@gnu.org>
2 13
3 * wid-edit.el (widget-file-complete): Get the widget start point 14 * wid-edit.el (widget-file-complete): Get the widget start point
@@ -12,7 +23,7 @@
12 Call ispell-maybe-find-aspell-dictionaries. 23 Call ispell-maybe-find-aspell-dictionaries.
13 (ispell-accept-buffer-local-defs): 24 (ispell-accept-buffer-local-defs):
14 Don't call ispell-maybe-find-aspell-dictionaries 25 Don't call ispell-maybe-find-aspell-dictionaries
15 26
162005-10-04 Richard M. Stallman <rms@gnu.org> 272005-10-04 Richard M. Stallman <rms@gnu.org>
17 28
18 * iswitchb.el (iswitchb-buffer-ignore): Label it risky. 29 * iswitchb.el (iswitchb-buffer-ignore): Label it risky.
@@ -74,7 +85,6 @@
74 85
75 * ido.el (ido-mode): Use custom-initialize-set. 86 * ido.el (ido-mode): Use custom-initialize-set.
76 87
77>>>>>>> 1.8276
782005-10-02 Richard M. Stallman <rms@gnu.org> 882005-10-02 Richard M. Stallman <rms@gnu.org>
79 89
80 * progmodes/ebnf2ps.el (ebnf-eps-production-list): 90 * progmodes/ebnf2ps.el (ebnf-eps-production-list):
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 06b83872449..ccced635976 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -195,7 +195,7 @@ STRING is the description of the appointment.
195FLAG, if non-nil, says that the element was made with `appt-add' 195FLAG, if non-nil, says that the element was made with `appt-add'
196so calling `appt-make-list' again should preserve it.") 196so calling `appt-make-list' again should preserve it.")
197 197
198(defconst appt-max-time 1439 198(defconst appt-max-time (1- (* 24 60))
199 "11:59pm in minutes - number of minutes in a day minus 1.") 199 "11:59pm in minutes - number of minutes in a day minus 1.")
200 200
201(defvar appt-mode-string nil 201(defvar appt-mode-string nil
@@ -484,13 +484,15 @@ Usually just deletes the appointment buffer."
484 lowest-window w))))) 484 lowest-window w)))))
485 (select-window lowest-window))) 485 (select-window lowest-window)))
486 486
487(defconst appt-time-regexp
488 "[0-9]?[0-9]\\(h\\([0-9][0-9]\\)?\\|[:.][0-9][0-9]\\)\\(am\\|pm\\)?")
489
487;;;###autoload 490;;;###autoload
488(defun appt-add (new-appt-time new-appt-msg) 491(defun appt-add (new-appt-time new-appt-msg)
489 "Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG. 492 "Add an appointment for today at NEW-APPT-TIME with message NEW-APPT-MSG.
490The time should be in either 24 hour format or am/pm format." 493The time should be in either 24 hour format or am/pm format."
491 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ") 494 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
492 (unless (string-match "[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?" 495 (unless (string-match appt-time-regexp new-appt-time)
493 new-appt-time)
494 (error "Unacceptable time-string")) 496 (error "Unacceptable time-string"))
495 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg)) 497 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
496 (appt-time (list (appt-convert-time new-appt-time))) 498 (appt-time (list (appt-convert-time new-appt-time)))
@@ -577,16 +579,14 @@ appointment package (if it is not already active)."
577 (calendar-date-equal 579 (calendar-date-equal
578 (calendar-current-date) (car (car entry-list)))) 580 (calendar-current-date) (car (car entry-list))))
579 (let ((time-string (cadr (car entry-list)))) 581 (let ((time-string (cadr (car entry-list))))
580 (while (string-match 582 (while (string-match appt-time-regexp time-string)
581 "\\([0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?\\).*"
582 time-string)
583 (let* ((beg (match-beginning 0)) 583 (let* ((beg (match-beginning 0))
584 ;; Get just the time for this appointment. 584 ;; Get just the time for this appointment.
585 (only-time (match-string 1 time-string)) 585 (only-time (match-string 0 time-string))
586 ;; Find the end of this appointment 586 ;; Find the end of this appointment
587 ;; (the start of the next). 587 ;; (the start of the next).
588 (end (string-match 588 (end (string-match
589 "^[ \t]*[0-9]?[0-9][:.][0-9][0-9]\\(am\\|pm\\)?" 589 (concat "\n[ \t]*" appt-time-regexp)
590 time-string 590 time-string
591 (match-end 0))) 591 (match-end 0)))
592 ;; Get the whole string for this appointment. 592 ;; Get the whole string for this appointment.
@@ -633,31 +633,23 @@ APPT-LIST is a list of the same format as `appt-time-msg-list'."
633 "Convert hour:min[am/pm] format to minutes from midnight. 633 "Convert hour:min[am/pm] format to minutes from midnight.
634A period (.) can be used instead of a colon (:) to separate the 634A period (.) can be used instead of a colon (:) to separate the
635hour and minute parts." 635hour and minute parts."
636 (let ((conv-time 0) 636 ;; Formats that should be accepted:
637 (hr 0) 637 ;; 10:00 10.00 10h00 10h 10am 10:00am 10.00am
638 (min 0)) 638 (let ((min (if (string-match "[h:.]\\([0-9][0-9]\\)" time2conv)
639 639 (string-to-number (match-string 1 time2conv))
640 (string-match "[:.]\\([0-9][0-9]\\)" time2conv) 640 0))
641 (setq min (string-to-number 641 (hr (if (string-match "[0-9]*[0-9]" time2conv)
642 (match-string 1 time2conv))) 642 (string-to-number (match-string 0 time2conv))
643 643 0)))
644 (string-match "[0-9]?[0-9][:.]" time2conv)
645 (setq hr (string-to-number
646 (match-string 0 time2conv)))
647 644
648 ;; convert the time appointment time into 24 hour time 645 ;; convert the time appointment time into 24 hour time
649
650 (cond ((and (string-match "pm" time2conv) (< hr 12)) 646 (cond ((and (string-match "pm" time2conv) (< hr 12))
651 (setq hr (+ 12 hr))) 647 (setq hr (+ 12 hr)))
652 ((and (string-match "am" time2conv) (= hr 12)) 648 ((and (string-match "am" time2conv) (= hr 12))
653 (setq hr 0))) 649 (setq hr 0)))
654 650
655 ;; convert the actual time 651 ;; convert the actual time into minutes.
656 ;; into minutes for comparison 652 (+ (* hr 60) min)))
657 ;; against the actual time.
658
659 (setq conv-time (+ (* hr 60) min))
660 conv-time))
661 653
662 654
663(defun appt-update-list () 655(defun appt-update-list ()
@@ -719,5 +711,5 @@ ARG is positive, otherwise off."
719 711
720(provide 'appt) 712(provide 'appt)
721 713
722;;; arch-tag: bf5791c4-8921-499e-a26f-772b1788d347 714;; arch-tag: bf5791c4-8921-499e-a26f-772b1788d347
723;;; appt.el ends here 715;;; appt.el ends here