aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-03-29 21:47:07 +0000
committerDave Love2000-03-29 21:47:07 +0000
commitd073fa5ba6738dd9f9c2097d6e013d5987e6faee (patch)
tree98350c227a474f23c5da7255cf7c667660d00cf6
parentc5aa0fc2898b84f67038c063aeb8d44c1df9d85c (diff)
downloademacs-d073fa5ba6738dd9f9c2097d6e013d5987e6faee.tar.gz
emacs-d073fa5ba6738dd9f9c2097d6e013d5987e6faee.zip
Doc fixes.
(appt-check): Convert min-to-app to a string before passing to appt-disp-window-function or concat. (appt-delete-window): Remove test for frame-root-window. (appt-select-lowest-window, appt-convert-time): Simplify.
-rw-r--r--lisp/calendar/appt.el80
1 files changed, 36 insertions, 44 deletions
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 0f669d55f48..9b93db96c27 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -30,7 +30,7 @@
30;; appointments from ~/diary file. 30;; appointments from ~/diary file.
31;; 31;;
32;;; 32;;;
33;;; Thanks to Edward M. Reingold for much help and many suggestions, 33;;; Thanks to Edward M. Reingold for much help and many suggestions,
34;;; And to many others for bug fixes and suggestions. 34;;; And to many others for bug fixes and suggestions.
35;;; 35;;;
36;;; 36;;;
@@ -75,7 +75,7 @@
75;;; at 12:01am for those who do not logout every day or are programming 75;;; at 12:01am for those who do not logout every day or are programming
76;;; late. 76;;; late.
77;;; 77;;;
78;;; Brief internal description - Skip this if your not interested! 78;;; Brief internal description - Skip this if you are not interested!
79;;; 79;;;
80;;; The function appt-make-list creates the appointments list which appt-check 80;;; The function appt-make-list creates the appointments list which appt-check
81;;; reads. This is all done automatically. 81;;; reads. This is all done automatically.
@@ -327,7 +327,7 @@ The following variables control appointment notification:
327 (current-time))) 327 (current-time)))
328 (funcall 328 (funcall
329 appt-disp-window-function 329 appt-disp-window-function
330 min-to-app new-time 330 (number-to-string min-to-app) new-time
331 (car (cdr (car appt-time-msg-list)))) 331 (car (cdr (car appt-time-msg-list))))
332 332
333 (run-at-time 333 (run-at-time
@@ -345,7 +345,9 @@ The following variables control appointment notification:
345 345
346 (when appt-display-mode-line 346 (when appt-display-mode-line
347 (setq appt-mode-string 347 (setq appt-mode-string
348 (concat " App't in " min-to-app " min. "))) 348 (concat " App't in "
349 (number-to-string min-to-app)
350 " min. ")))
349 351
350 ;; When an appointment is reached, 352 ;; When an appointment is reached,
351 ;; delete it from the list. 353 ;; delete it from the list.
@@ -369,8 +371,8 @@ The following variables control appointment notification:
369 (sit-for 0))))))))) 371 (sit-for 0)))))))))
370 372
371 373
372;; Display appointment message in a separate buffer.
373(defun appt-disp-window (min-to-app new-time appt-msg) 374(defun appt-disp-window (min-to-app new-time appt-msg)
375 "Display appointment message APPT-MSG in a separate buffer."
374 (require 'electric) 376 (require 'electric)
375 377
376 ;; Make sure we're not in the minibuffer 378 ;; Make sure we're not in the minibuffer
@@ -412,23 +414,21 @@ The following variables control appointment notification:
412Usually just deletes the appointment buffer." 414Usually just deletes the appointment buffer."
413 (let ((window (get-buffer-window appt-buffer-name t))) 415 (let ((window (get-buffer-window appt-buffer-name t)))
414 (and window 416 (and window
415 (or (and (fboundp 'frame-root-window) 417 (or (eq window (frame-root-window (window-frame window)))
416 (eq window (frame-root-window (window-frame window))))
417 (delete-window window)))) 418 (delete-window window))))
418 (kill-buffer appt-buffer-name) 419 (kill-buffer appt-buffer-name)
419 (if appt-audible 420 (if appt-audible
420 (beep 1))) 421 (beep 1)))
421 422
422;; Select the lowest window on the frame.
423(defun appt-select-lowest-window () 423(defun appt-select-lowest-window ()
424"Select the lowest window on the frame."
424 (let* ((lowest-window (selected-window)) 425 (let* ((lowest-window (selected-window))
425 (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) 426 (bottom-edge (nth 3 (window-edges)))
426 (last-window (previous-window)) 427 (last-window (previous-window))
427 (window-search t)) 428 (window-search t))
428 (while window-search 429 (while window-search
429 (let* ((this-window (next-window)) 430 (let* ((this-window (next-window))
430 (next-bottom-edge (car (cdr (cdr (cdr 431 (next-bottom-edge (nth 3 (window-edges this-window))))
431 (window-edges this-window)))))))
432 (if (< bottom-edge next-bottom-edge) 432 (if (< bottom-edge next-bottom-edge)
433 (progn 433 (progn
434 (setq bottom-edge next-bottom-edge) 434 (setq bottom-edge next-bottom-edge)
@@ -443,7 +443,7 @@ Usually just deletes the appointment buffer."
443 443
444;;;###autoload 444;;;###autoload
445(defun appt-add (new-appt-time new-appt-msg) 445(defun appt-add (new-appt-time new-appt-msg)
446 "Add an appointment for the day at TIME and issue MESSAGE. 446 "Add an appointment for the day at NEW-APPT-TIME and issue message NEW-APPT-MSG.
447The time should be in either 24 hour format or am/pm format." 447The time should be in either 24 hour format or am/pm format."
448 448
449 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ") 449 (interactive "sTime (hh:mm[am/pm]): \nsMessage: ")
@@ -454,8 +454,7 @@ The time should be in either 24 hour format or am/pm format."
454 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg)) 454 (let* ((appt-time-string (concat new-appt-time " " new-appt-msg))
455 (appt-time (list (appt-convert-time new-appt-time))) 455 (appt-time (list (appt-convert-time new-appt-time)))
456 (time-msg (cons appt-time (list appt-time-string)))) 456 (time-msg (cons appt-time (list appt-time-string))))
457 (setq appt-time-msg-list (append appt-time-msg-list 457 (setq appt-time-msg-list (nconc appt-time-msg-list (list time-msg)))
458 (list time-msg)))
459 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)))) 458 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))))
460 459
461;;;###autoload 460;;;###autoload
@@ -476,22 +475,22 @@ The time should be in either 24 hour format or am/pm format."
476 (message ""))) 475 (message "")))
477 476
478 477
479;; Create the appointments list from todays diary buffer.
480;; The time must be at the beginning of a line for it to be
481;; put in the appointments list.
482;; 02/23/89
483;; 12:00pm lunch
484;; Wednesday
485;; 10:00am group meeting
486;; We assume that the variables DATE and NUMBER
487;; hold the arguments that list-diary-entries received.
488;; They specify the range of dates that the diary is being processed for.
489
490(eval-when-compile (defvar number) 478(eval-when-compile (defvar number)
491 (defvar original-date) 479 (defvar original-date)
492 (defvar diary-entries-list)) 480 (defvar diary-entries-list))
493;;;###autoload 481;;;###autoload
494(defun appt-make-list () 482(defun appt-make-list ()
483 "Create the appointments list from todays diary buffer.
484The time must be at the beginning of a line for it to be
485put in the appointments list.
486 02/23/89
487 12:00pm lunch
488 Wednesday
489 10:00am group meeting
490We assume that the variables DATE and NUMBER
491hold the arguments that `list-diary-entries' received.
492They specify the range of dates that the diary is being processed for."
493
495 ;; We have something to do if the range of dates that the diary is 494 ;; We have something to do if the range of dates that the diary is
496 ;; considering includes the current date. 495 ;; considering includes the current date.
497 (if (and (not (calendar-date-compare 496 (if (and (not (calendar-date-compare
@@ -529,9 +528,7 @@ The time should be in either 24 hour format or am/pm format."
529 (while (string-match 528 (while (string-match
530 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?.*" 529 "[0-9]?[0-9]:[0-9][0-9]\\(am\\|pm\\)?.*"
531 time-string) 530 time-string)
532 (let* ((appt-time-string (substring time-string 531 (let* ((appt-time-string (match-string 0 time-string)))
533 (match-beginning 0)
534 (match-end 0))))
535 532
536 (if (< (match-end 0) (length time-string)) 533 (if (< (match-end 0) (length time-string))
537 (setq new-time-string (substring time-string 534 (setq new-time-string (substring time-string
@@ -543,14 +540,12 @@ The time should be in either 24 hour format or am/pm format."
543 time-string) 540 time-string)
544 541
545 (let* ((appt-time (list (appt-convert-time 542 (let* ((appt-time (list (appt-convert-time
546 (substring time-string 543 (match-string 0 time-string))))
547 (match-beginning 0)
548 (match-end 0)))))
549 (time-msg (cons appt-time 544 (time-msg (cons appt-time
550 (list appt-time-string)))) 545 (list appt-time-string))))
551 (setq time-string new-time-string) 546 (setq time-string new-time-string)
552 (setq appt-time-msg-list (append appt-time-msg-list 547 (setq appt-time-msg-list (nconc appt-time-msg-list
553 (list time-msg))))))) 548 (list time-msg)))))))
554 (setq entry-list (cdr entry-list))))) 549 (setq entry-list (cdr entry-list)))))
555 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)) 550 (setq appt-time-msg-list (appt-sort-list appt-time-msg-list))
556 551
@@ -572,11 +567,11 @@ The time should be in either 24 hour format or am/pm format."
572 (setq appt-comp-time (car (car (car appt-time-msg-list)))))))))) 567 (setq appt-comp-time (car (car (car appt-time-msg-list))))))))))
573 568
574 569
575;;Simple sort to put the appointments list in order.
576;;Scan the list for the smallest element left in the list.
577;;Append the smallest element left into the new list, and remove
578;;it from the original list.
579(defun appt-sort-list (appt-list) 570(defun appt-sort-list (appt-list)
571 "Simple sort to put the appointments list APPT-LIST in order.
572Scan the list for the smallest element left in the list.
573Append the smallest element left into the new list, and remove
574it from the original list."
580 (let ((order-list nil)) 575 (let ((order-list nil))
581 (while appt-list 576 (while appt-list
582 (let* ((element (car appt-list)) 577 (let* ((element (car appt-list))
@@ -588,7 +583,7 @@ The time should be in either 24 hour format or am/pm format."
588 (setq element (car tmp-list)) 583 (setq element (car tmp-list))
589 (setq element-time (car (car element)))) 584 (setq element-time (car (car element))))
590 (setq tmp-list (cdr tmp-list))) 585 (setq tmp-list (cdr tmp-list)))
591 (setq order-list (append order-list (list element))) 586 (setq order-list (nconc order-list (list element)))
592 (setq appt-list (delq element appt-list)))) 587 (setq appt-list (delq element appt-list))))
593 order-list)) 588 order-list))
594 589
@@ -600,16 +595,13 @@ The time should be in either 24 hour format or am/pm format."
600 (hr 0) 595 (hr 0)
601 (min 0)) 596 (min 0))
602 597
603 (string-match ":[0-9][0-9]" time2conv) 598 (string-match ":\\([0-9][0-9]\\)" time2conv)
604 (setq min (string-to-int 599 (setq min (string-to-int
605 (substring time2conv 600 (match-string 1 time2conv)))
606 (+ (match-beginning 0) 1) (match-end 0))))
607 601
608 (string-match "[0-9]?[0-9]:" time2conv) 602 (string-match "[0-9]?[0-9]:" time2conv)
609 (setq hr (string-to-int 603 (setq hr (string-to-int
610 (substring time2conv 604 (match-string 0 time2conv)))
611 (match-beginning 0)
612 (match-end 0))))
613 605
614 ;; convert the time appointment time into 24 hour time 606 ;; convert the time appointment time into 24 hour time
615 607