diff options
| author | Glenn Morris | 2010-09-29 19:15:17 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-09-29 19:15:17 -0700 |
| commit | 3536dea896155643a797e872e4b80443153de1ce (patch) | |
| tree | aea9051a1f26de6a5036b5fc2b024217b9bd4d6e | |
| parent | e4b6db1206d6370ff25380e3d67e7ae39334a952 (diff) | |
| download | emacs-3536dea896155643a797e872e4b80443153de1ce.tar.gz emacs-3536dea896155643a797e872e4b80443153de1ce.zip | |
Remove some obsolete appt.el code.
* lisp/calendar/appt.el (appt-issue-message, appt-visible, appt-msg-window):
Remove options, obsolete since 22.1.
(appt-display-format, appt-display-message): Remove
backwards-compatibility code.
(appt-check): No longer check appt-issue-message.
(appt-make-list): No longer autoload it. Doc fix. No longer
activate the package.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/calendar/appt.el | 266 |
2 files changed, 108 insertions, 168 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3ca07c33e15..349c51a9cf9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2010-09-30 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * calendar/appt.el (appt-issue-message, appt-visible, appt-msg-window): | ||
| 4 | Remove options, obsolete since 22.1. | ||
| 5 | (appt-display-format, appt-display-message): Remove | ||
| 6 | backwards-compatibility code. | ||
| 7 | (appt-check): No longer check appt-issue-message. | ||
| 8 | (appt-make-list): No longer autoload it. Doc fix. No longer | ||
| 9 | activate the package. | ||
| 10 | |||
| 1 | 2010-09-29 Lars Magne Ingebrigtsen <larsi@gnus.org> | 11 | 2010-09-29 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 12 | ||
| 3 | * net/gnutls.el (starttls-negotiate): Loop a lot longer. | 13 | * net/gnutls.el (starttls-negotiate): Loop a lot longer. |
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index cd0f049027b..5e888c6c58c 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el | |||
| @@ -83,17 +83,6 @@ | |||
| 83 | :prefix "appt-" | 83 | :prefix "appt-" |
| 84 | :group 'calendar) | 84 | :group 'calendar) |
| 85 | 85 | ||
| 86 | (defcustom appt-issue-message t | ||
| 87 | "Non-nil means check for appointments in the diary buffer. | ||
| 88 | To be detected, the diary entry must have the format described in the | ||
| 89 | documentation of the function `appt-check'." | ||
| 90 | :type 'boolean | ||
| 91 | :group 'appt) | ||
| 92 | |||
| 93 | (make-obsolete-variable 'appt-issue-message | ||
| 94 | "use the function `appt-activate', and the \ | ||
| 95 | variable `appt-display-format' instead." "22.1") | ||
| 96 | |||
| 97 | (defcustom appt-message-warning-time 12 | 86 | (defcustom appt-message-warning-time 12 |
| 98 | "Time in minutes before an appointment that the warning begins." | 87 | "Time in minutes before an appointment that the warning begins." |
| 99 | :type 'integer | 88 | :type 'integer |
| @@ -104,41 +93,20 @@ variable `appt-display-format' instead." "22.1") | |||
| 104 | :type 'boolean | 93 | :type 'boolean |
| 105 | :group 'appt) | 94 | :group 'appt) |
| 106 | 95 | ||
| 107 | (defcustom appt-visible t | ||
| 108 | "Non-nil means display appointment message in echo area. | ||
| 109 | This variable is only relevant if `appt-msg-window' is nil." | ||
| 110 | :type 'boolean | ||
| 111 | :group 'appt) | ||
| 112 | |||
| 113 | (make-obsolete-variable 'appt-visible 'appt-display-format "22.1") | ||
| 114 | |||
| 115 | (defcustom appt-msg-window t | ||
| 116 | "Non-nil means display appointment message in another window. | ||
| 117 | If non-nil, this variable overrides `appt-visible'." | ||
| 118 | :type 'boolean | ||
| 119 | :group 'appt) | ||
| 120 | |||
| 121 | (make-obsolete-variable 'appt-msg-window 'appt-display-format "22.1") | ||
| 122 | |||
| 123 | ;; TODO - add popup. | 96 | ;; TODO - add popup. |
| 124 | (defcustom appt-display-format 'ignore | 97 | (defcustom appt-display-format 'window |
| 125 | "How appointment reminders should be displayed. | 98 | "How appointment reminders should be displayed. |
| 126 | The options are: | 99 | The options are: |
| 127 | window - use a separate window | 100 | window - use a separate window |
| 128 | echo - use the echo area | 101 | echo - use the echo area |
| 129 | nil - no visible reminder. | 102 | nil - no visible reminder. |
| 130 | See also `appt-audible' and `appt-display-mode-line'. | 103 | See also `appt-audible' and `appt-display-mode-line'." |
| 131 | |||
| 132 | The default value is 'ignore, which means to fall back on the value | ||
| 133 | of the (obsolete) variables `appt-msg-window' and `appt-visible'." | ||
| 134 | :type '(choice | 104 | :type '(choice |
| 135 | (const :tag "Separate window" window) | 105 | (const :tag "Separate window" window) |
| 136 | (const :tag "Echo-area" echo) | 106 | (const :tag "Echo-area" echo) |
| 137 | (const :tag "No visible display" nil) | 107 | (const :tag "No visible display" nil)) |
| 138 | (const :tag "Backwards compatibility setting - choose another value" | ||
| 139 | ignore)) | ||
| 140 | :group 'appt | 108 | :group 'appt |
| 141 | :version "22.1") | 109 | :version "24.1") ; no longer inherit from deleted obsolete variables |
| 142 | 110 | ||
| 143 | (defcustom appt-display-mode-line t | 111 | (defcustom appt-display-mode-line t |
| 144 | "Non-nil means display minutes to appointment and time on the mode line. | 112 | "Non-nil means display minutes to appointment and time on the mode line. |
| @@ -236,25 +204,18 @@ If this is non-nil, appointment checking is active.") | |||
| 236 | The string STRING describes the appointment, due in integer MINS minutes. | 204 | The string STRING describes the appointment, due in integer MINS minutes. |
| 237 | The format of the visible reminder is controlled by `appt-display-format'. | 205 | The format of the visible reminder is controlled by `appt-display-format'. |
| 238 | The variable `appt-audible' controls the audible reminder." | 206 | The variable `appt-audible' controls the audible reminder." |
| 239 | ;; Let-binding for backwards compatibility. Remove when obsolete | 207 | (if appt-audible (beep 1)) |
| 240 | ;; vars appt-msg-window and appt-visible are dropped. | 208 | (cond ((eq appt-display-format 'window) |
| 241 | (let ((appt-display-format | 209 | (funcall appt-disp-window-function |
| 242 | (if (eq appt-display-format 'ignore) | 210 | (number-to-string mins) |
| 243 | (cond (appt-msg-window 'window) | 211 | ;; TODO - use calendar-month-abbrev-array rather than %b? |
| 244 | (appt-visible 'echo)) | 212 | (format-time-string "%a %b %e " (current-time)) |
| 245 | appt-display-format))) | 213 | string) |
| 246 | (if appt-audible (beep 1)) | 214 | (run-at-time (format "%d sec" appt-display-duration) |
| 247 | (cond ((eq appt-display-format 'window) | 215 | nil |
| 248 | (funcall appt-disp-window-function | 216 | appt-delete-window-function)) |
| 249 | (number-to-string mins) | 217 | ((eq appt-display-format 'echo) |
| 250 | ;; TODO - use calendar-month-abbrev-array rather than %b? | 218 | (message "%s" string)))) |
| 251 | (format-time-string "%a %b %e " (current-time)) | ||
| 252 | string) | ||
| 253 | (run-at-time (format "%d sec" appt-display-duration) | ||
| 254 | nil | ||
| 255 | appt-delete-window-function)) | ||
| 256 | ((eq appt-display-format 'echo) | ||
| 257 | (message "%s" string))))) | ||
| 258 | 219 | ||
| 259 | 220 | ||
| 260 | (defun appt-check (&optional force) | 221 | (defun appt-check (&optional force) |
| @@ -348,7 +309,7 @@ displayed in a window: | |||
| 348 | ;; If there are entries in the list, and the user wants a | 309 | ;; If there are entries in the list, and the user wants a |
| 349 | ;; message issued, get the first time off of the list and | 310 | ;; message issued, get the first time off of the list and |
| 350 | ;; calculate the number of minutes until the appointment. | 311 | ;; calculate the number of minutes until the appointment. |
| 351 | (when (and appt-issue-message appt-time-msg-list) | 312 | (when appt-time-msg-list |
| 352 | (setq appt-comp-time (caar (car appt-time-msg-list)) | 313 | (setq appt-comp-time (caar (car appt-time-msg-list)) |
| 353 | appt-warn-time (or (nth 3 (car appt-time-msg-list)) | 314 | appt-warn-time (or (nth 3 (car appt-time-msg-list)) |
| 354 | appt-message-warning-time) | 315 | appt-message-warning-time) |
| @@ -515,8 +476,7 @@ sMinutes before the appointment to start warning: ") | |||
| 515 | (defvar number) | 476 | (defvar number) |
| 516 | (defvar original-date) | 477 | (defvar original-date) |
| 517 | (defvar diary-entries-list) | 478 | (defvar diary-entries-list) |
| 518 | ;; Autoload for the old way of using this package. Can be removed sometime. | 479 | |
| 519 | ;;;###autoload | ||
| 520 | (defun appt-make-list () | 480 | (defun appt-make-list () |
| 521 | "Update the appointments list from today's diary buffer. | 481 | "Update the appointments list from today's diary buffer. |
| 522 | The time must be at the beginning of a line for it to be | 482 | The time must be at the beginning of a line for it to be |
| @@ -525,92 +485,86 @@ the function `appt-check'). We assume that the variables DATE and | |||
| 525 | NUMBER hold the arguments that `diary-list-entries' received. | 485 | NUMBER hold the arguments that `diary-list-entries' received. |
| 526 | They specify the range of dates that the diary is being processed for. | 486 | They specify the range of dates that the diary is being processed for. |
| 527 | 487 | ||
| 528 | Any appointments made with `appt-add' are not affected by this function. | 488 | Any appointments made with `appt-add' are not affected by this function." |
| 529 | 489 | ;; We have something to do if the range of dates that the diary is | |
| 530 | For backwards compatibility, this function activates the | 490 | ;; considering includes the current date. |
| 531 | appointment package (if it is not already active)." | 491 | (if (and (not (calendar-date-compare |
| 532 | ;; See comments above appt-activate defun. | 492 | (list (calendar-current-date)) |
| 533 | (if (not appt-timer) | 493 | (list original-date))) |
| 534 | (appt-activate 1) | 494 | (calendar-date-compare |
| 535 | ;; We have something to do if the range of dates that the diary is | 495 | (list (calendar-current-date)) |
| 536 | ;; considering includes the current date. | 496 | (list (calendar-gregorian-from-absolute |
| 537 | (if (and (not (calendar-date-compare | 497 | (+ (calendar-absolute-from-gregorian original-date) |
| 538 | (list (calendar-current-date)) | 498 | number))))) |
| 539 | (list original-date))) | 499 | (save-excursion |
| 540 | (calendar-date-compare | 500 | ;; Clear the appointments list, then fill it in from the diary. |
| 541 | (list (calendar-current-date)) | 501 | (dolist (elt appt-time-msg-list) |
| 542 | (list (calendar-gregorian-from-absolute | 502 | ;; Delete any entries that were not made with appt-add. |
| 543 | (+ (calendar-absolute-from-gregorian original-date) | 503 | (unless (nth 2 elt) |
| 544 | number))))) | 504 | (setq appt-time-msg-list |
| 545 | (save-excursion | 505 | (delq elt appt-time-msg-list)))) |
| 546 | ;; Clear the appointments list, then fill it in from the diary. | 506 | (if diary-entries-list |
| 547 | (dolist (elt appt-time-msg-list) | 507 | ;; Cycle through the entry-list (diary-entries-list) |
| 548 | ;; Delete any entries that were not made with appt-add. | 508 | ;; looking for entries beginning with a time. If the |
| 549 | (unless (nth 2 elt) | 509 | ;; entry begins with a time, add it to the |
| 550 | (setq appt-time-msg-list | 510 | ;; appt-time-msg-list. Then sort the list. |
| 551 | (delq elt appt-time-msg-list)))) | 511 | (let ((entry-list diary-entries-list) |
| 552 | (if diary-entries-list | 512 | (new-time-string "") |
| 553 | ;; Cycle through the entry-list (diary-entries-list) | 513 | time-string) |
| 554 | ;; looking for entries beginning with a time. If the | 514 | ;; Below, we assume diary-entries-list was in date |
| 555 | ;; entry begins with a time, add it to the | 515 | ;; order. It is, unless something on |
| 556 | ;; appt-time-msg-list. Then sort the list. | 516 | ;; diary-list-entries-hook has changed it, eg |
| 557 | (let ((entry-list diary-entries-list) | 517 | ;; diary-include-other-files (bug#7019). It must be |
| 558 | (new-time-string "") | 518 | ;; in date order if number = 1. |
| 559 | time-string) | 519 | (and diary-list-entries-hook |
| 560 | ;; Below, we assume diary-entries-list was in date | 520 | appt-display-diary |
| 561 | ;; order. It is, unless something on | 521 | (not (eq diary-number-of-entries 1)) |
| 562 | ;; diary-list-entries-hook has changed it, eg | 522 | (not (memq (car (last diary-list-entries-hook)) |
| 563 | ;; diary-include-other-files (bug#7019). It must be | 523 | '(diary-sort-entries sort-diary-entries))) |
| 564 | ;; in date order if number = 1. | 524 | (setq entry-list (sort entry-list 'diary-entry-compare))) |
| 565 | (and diary-list-entries-hook | 525 | ;; Skip diary entries for dates before today. |
| 566 | appt-display-diary | 526 | (while (and entry-list |
| 567 | (not (eq diary-number-of-entries 1)) | 527 | (calendar-date-compare |
| 568 | (not (memq (car (last diary-list-entries-hook)) | 528 | (car entry-list) (list (calendar-current-date)))) |
| 569 | '(diary-sort-entries sort-diary-entries))) | 529 | (setq entry-list (cdr entry-list))) |
| 570 | (setq entry-list (sort entry-list 'diary-entry-compare))) | 530 | ;; Parse the entries for today. |
| 571 | ;; Skip diary entries for dates before today. | 531 | (while (and entry-list |
| 572 | (while (and entry-list | 532 | (calendar-date-equal |
| 573 | (calendar-date-compare | 533 | (calendar-current-date) (caar entry-list))) |
| 574 | (car entry-list) (list (calendar-current-date)))) | 534 | (setq time-string (cadr (car entry-list))) |
| 575 | (setq entry-list (cdr entry-list))) | 535 | (while (string-match appt-time-regexp time-string) |
| 576 | ;; Parse the entries for today. | 536 | (let* ((beg (match-beginning 0)) |
| 577 | (while (and entry-list | 537 | ;; Get just the time for this appointment. |
| 578 | (calendar-date-equal | 538 | (only-time (match-string 0 time-string)) |
| 579 | (calendar-current-date) (caar entry-list))) | 539 | ;; Find the end of this appointment |
| 580 | (setq time-string (cadr (car entry-list))) | 540 | ;; (the start of the next). |
| 581 | (while (string-match appt-time-regexp time-string) | 541 | (end (string-match |
| 582 | (let* ((beg (match-beginning 0)) | 542 | (concat "\n[ \t]*" appt-time-regexp) |
| 583 | ;; Get just the time for this appointment. | 543 | time-string |
| 584 | (only-time (match-string 0 time-string)) | 544 | (match-end 0))) |
| 585 | ;; Find the end of this appointment | 545 | ;; Get the whole string for this appointment. |
| 586 | ;; (the start of the next). | 546 | (appt-time-string |
| 587 | (end (string-match | 547 | (substring time-string beg end)) |
| 588 | (concat "\n[ \t]*" appt-time-regexp) | 548 | (appt-time (list (appt-convert-time only-time))) |
| 589 | time-string | 549 | (time-msg (list appt-time appt-time-string))) |
| 590 | (match-end 0))) | 550 | ;; Add this appointment to appt-time-msg-list. |
| 591 | ;; Get the whole string for this appointment. | 551 | (setq appt-time-msg-list |
| 592 | (appt-time-string | 552 | (nconc appt-time-msg-list (list time-msg)) |
| 593 | (substring time-string beg end)) | 553 | ;; Discard this appointment from the string. |
| 594 | (appt-time (list (appt-convert-time only-time))) | 554 | time-string |
| 595 | (time-msg (list appt-time appt-time-string))) | 555 | (if end (substring time-string end) "")))) |
| 596 | ;; Add this appointment to appt-time-msg-list. | 556 | (setq entry-list (cdr entry-list))))) |
| 597 | (setq appt-time-msg-list | 557 | (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)) |
| 598 | (nconc appt-time-msg-list (list time-msg)) | 558 | ;; Convert current time to minutes after midnight (12:01am = 1), |
| 599 | ;; Discard this appointment from the string. | 559 | ;; so that elements in the list that are earlier than the |
| 600 | time-string | 560 | ;; present time can be removed. |
| 601 | (if end (substring time-string end) "")))) | 561 | (let* ((now (decode-time)) |
| 602 | (setq entry-list (cdr entry-list))))) | 562 | (cur-comp-time (+ (* 60 (nth 2 now)) (nth 1 now))) |
| 603 | (setq appt-time-msg-list (appt-sort-list appt-time-msg-list)) | 563 | (appt-comp-time (caar (car appt-time-msg-list)))) |
| 604 | ;; Convert current time to minutes after midnight (12:01am = 1), | 564 | (while (and appt-time-msg-list (< appt-comp-time cur-comp-time)) |
| 605 | ;; so that elements in the list that are earlier than the | 565 | (setq appt-time-msg-list (cdr appt-time-msg-list)) |
| 606 | ;; present time can be removed. | 566 | (if appt-time-msg-list |
| 607 | (let* ((now (decode-time)) | 567 | (setq appt-comp-time (caar (car appt-time-msg-list))))))))) |
| 608 | (cur-comp-time (+ (* 60 (nth 2 now)) (nth 1 now))) | ||
| 609 | (appt-comp-time (caar (car appt-time-msg-list)))) | ||
| 610 | (while (and appt-time-msg-list (< appt-comp-time cur-comp-time)) | ||
| 611 | (setq appt-time-msg-list (cdr appt-time-msg-list)) | ||
| 612 | (if appt-time-msg-list | ||
| 613 | (setq appt-comp-time (caar (car appt-time-msg-list)))))))))) | ||
| 614 | 568 | ||
| 615 | 569 | ||
| 616 | (defun appt-sort-list (appt-list) | 570 | (defun appt-sort-list (appt-list) |
| @@ -650,30 +604,6 @@ It is intended for use with `write-file-functions'." | |||
| 650 | (appt-check t))) | 604 | (appt-check t))) |
| 651 | nil) | 605 | nil) |
| 652 | 606 | ||
| 653 | ;; In Emacs-21.3, the manual documented the following procedure to | ||
| 654 | ;; activate this package: | ||
| 655 | ;; (display-time) | ||
| 656 | ;; (add-hook 'diary-hook 'appt-make-list) | ||
| 657 | ;; (diary 0) | ||
| 658 | ;; The display-time call was not necessary, AFAICS. | ||
| 659 | ;; What was really needed was to add the hook and load this file. | ||
| 660 | ;; Calling (diary 0) once the hook had been added was in some sense a | ||
| 661 | ;; roundabout way of loading this file. This file used to have code at | ||
| 662 | ;; the top-level that set up the appt-timer and global-mode-string. | ||
| 663 | ;; One way to maintain backwards compatibility would be to call | ||
| 664 | ;; (appt-activate 1) at top-level. However, this goes against the | ||
| 665 | ;; convention that just loading an Emacs package should not activate | ||
| 666 | ;; it. Instead, we make appt-make-list activate the package (after a | ||
| 667 | ;; suggestion from rms). This means that one has to call diary in | ||
| 668 | ;; order to get it to work, but that is in line with the old (weird, | ||
| 669 | ;; IMO) documented behavior for activating the package. | ||
| 670 | ;; Actually, since (diary 0) does not run diary-hook, I don't think | ||
| 671 | ;; the documented behavior in Emacs-21.3 would ever have worked. | ||
| 672 | ;; Oh well, at least with the changes to appt-make-list it will now | ||
| 673 | ;; work as well as it ever did. | ||
| 674 | ;; The new method is just to use (appt-activate 1). | ||
| 675 | ;; -- gmorris | ||
| 676 | |||
| 677 | ;;;###autoload | 607 | ;;;###autoload |
| 678 | (defun appt-activate (&optional arg) | 608 | (defun appt-activate (&optional arg) |
| 679 | "Toggle checking of appointments. | 609 | "Toggle checking of appointments. |