aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-05-30 02:57:27 +0000
committerGlenn Morris2008-05-30 02:57:27 +0000
commitf8c8f32b3d40f5405505aae82f46d76a670ab8c0 (patch)
treec461228f41352665e62362b3f483fda893b6319a
parent9d7316f071c48eb302580977e15ee32641203ef1 (diff)
downloademacs-f8c8f32b3d40f5405505aae82f46d76a670ab8c0.tar.gz
emacs-f8c8f32b3d40f5405505aae82f46d76a670ab8c0.zip
(diary-display-function): New name for diary-display-hook. Keep old
name as obsolete alias. Doc fix. Change custom type and version. (diary-list-entries-hook, diary-list-entries, diary-simple-display) (diary-fancy-display): Doc fixes. (diary-list-entries, diary-include-other-diary-files, diary-mail-entries): Use diary-display-function rather than diary-display-hook.
-rw-r--r--lisp/calendar/diary-lib.el85
1 files changed, 46 insertions, 39 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 618c06db624..9ece770f324 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -148,33 +148,33 @@ Used for example by the appointment package - see `appt-activate'."
148 :type 'hook 148 :type 'hook
149 :group 'diary) 149 :group 'diary)
150 150
151(defcustom diary-display-hook nil 151(define-obsolete-variable-alias 'diary-display-hook 'diary-display-function
152 "List of functions that handle the display of the diary. 152 "23.1")
153If nil (the default), `diary-simple-display' is used. Use 153
154`ignore' for no diary display. 154(defcustom diary-display-function 'diary-simple-display
155 155 "Function used to display the diary.
156Ordinarily, this just displays the diary buffer (with holidays 156The default is `diary-simple-display'; `diary-fancy-display' is
157indicated in the mode line), if there are any relevant entries. 157an alternative.
158At the time these functions are called, the variable 158
159`diary-entries-list' is a list, in order by date, of all relevant 159For historical reasons, `nil' is the same as `diary-simple-display'
160diary entries in the form of ((MONTH DAY YEAR) STRING), where 160\(so you must use `ignore' for no display). Also for historical
161string is the diary entry for the given date. This can be used, 161reasons, this variable can be a list of functions to run. These
162for example, a different buffer for display (perhaps combined 162uses are not recommended and may be removed at some point.
163with holidays), or produce hard copy output. 163
164 164When this function is called, the variable `diary-entries-list'
165A function `diary-fancy-display' is provided for use with this 165is a list, in order by date, of all relevant diary entries in the
166hook; this function prepares a special noneditable diary buffer 166form of ((MONTH DAY YEAR) STRING), where string is the diary
167with the relevant diary entries that has neat day-by-day 167entry for the given date. This can be used, for example, to
168arrangement with headings. The fancy diary buffer will show the 168produce a different buffer for display (perhaps combined with
169holidays unless the variable `diary-show-holidays-flag' is set to 169holidays), or hard copy output."
170nil. Ordinarily, the fancy diary buffer will not show days for 170 :type '(choice (const diary-simple-display :tag "Basic display")
171which there are no diary entries, even if that day is a holiday; 171 (const diary-fancy-display :tag "Fancy display")
172if you want such days to be shown in the fancy diary buffer, set 172 (const ignore :tag "No display")
173the variable `diary-list-include-blanks' non-nil." 173 (const nil :tag "Obsolete way to choose basic display")
174 :type 'hook 174 (hook :tag "Obsolete form with list of display functions"))
175 :options '(diary-fancy-display)
176 :initialize 'custom-initialize-default 175 :initialize 'custom-initialize-default
177 :set 'diary-set-maybe-redraw 176 :set 'diary-set-maybe-redraw
177 :version "23.1"
178 :group 'diary) 178 :group 'diary)
179 179
180(define-obsolete-variable-alias 'list-diary-entries-hook 180(define-obsolete-variable-alias 'list-diary-entries-hook
@@ -186,9 +186,9 @@ You might wish to add `diary-include-other-diary-files', in which case
186you will probably also want to add `diary-mark-included-diary-files' to 186you will probably also want to add `diary-mark-included-diary-files' to
187`diary-mark-entries-hook'. For example, you could use 187`diary-mark-entries-hook'. For example, you could use
188 188
189 (setq diary-display-function 'diary-fancy-display)
189 (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) 190 (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
190 (add-hook 'diary-list-entries-hook 'diary-sort-entries) 191 (add-hook 'diary-list-entries-hook 'diary-sort-entries)
191 (add-hook 'diary-display-hook 'diary-fancy-display)
192 192
193in your `.emacs' file to cause the fancy diary buffer to be displayed with 193in your `.emacs' file to cause the fancy diary buffer to be displayed with
194diary entries from various included files, each day's entries sorted into 194diary entries from various included files, each day's entries sorted into
@@ -728,18 +728,16 @@ After the list is prepared, the following hooks are run:
728 from other files or to sort the diary entries. Invoked *once* 728 from other files or to sort the diary entries. Invoked *once*
729 only, before the display hook is run. 729 only, before the display hook is run.
730 730
731 `diary-display-hook' does the actual display of information. If nil, 731 `diary-hook' is run last, after the diary is displayed.
732 `diary-simple-display' is used. Use `add-hook' to use 732 This is used e.g. by `appt-check'.
733 `diary-fancy-display', if desired, or `ignore' for no display.
734
735 `diary-hook' is run last. This is used e.g. by `appt-check'.
736 733
737Functions called by these hooks may use the variables ORIGINAL-DATE 734Functions called by these hooks may use the variables ORIGINAL-DATE
738and NUMBER, which are the arguments with which this function was called. 735and NUMBER, which are the arguments with which this function was called.
739Note that hook functions should _not_ use DATE, but ORIGINAL-DATE. 736Note that hook functions should _not_ use DATE, but ORIGINAL-DATE.
740\(Sexp diary entries may use DATE - see `diary-list-sexp-entries'.) 737\(Sexp diary entries may use DATE - see `diary-list-sexp-entries'.)
741 738
742If LIST-ONLY is non-nil don't modify or display the buffer, only return a list." 739This function displays the list using `diary-display-function', unless
740LIST-ONLY is non-nil, in which case it just returns the list."
743 (unless number 741 (unless number
744 (setq number (if (vectorp diary-number-of-entries) 742 (setq number (if (vectorp diary-number-of-entries)
745 (aref diary-number-of-entries (calendar-day-of-week date)) 743 (aref diary-number-of-entries (calendar-day-of-week date))
@@ -795,9 +793,12 @@ If LIST-ONLY is non-nil don't modify or display the buffer, only return a list."
795 (run-hooks 'diary-nongregorian-listing-hook 793 (run-hooks 'diary-nongregorian-listing-hook
796 'diary-list-entries-hook) 794 'diary-list-entries-hook)
797 (unless list-only 795 (unless list-only
798 (if diary-display-hook 796 (if (and diary-display-function
799 (run-hooks 'diary-display-hook) 797 (listp diary-display-function))
800 (diary-simple-display))) 798 ;; Backwards compatability.
799 (run-hooks 'diary-display-function)
800 (funcall (or diary-display-function
801 'diary-simple-display))))
801 (run-hooks 'diary-hook) 802 (run-hooks 'diary-hook)
802 diary-entries-list)))))) 803 diary-entries-list))))))
803 804
@@ -829,7 +830,7 @@ changing the variable `diary-include-string'."
829 (match-string-no-properties 1))) 830 (match-string-no-properties 1)))
830 (diary-list-include-blanks nil) 831 (diary-list-include-blanks nil)
831 (diary-list-entries-hook 'diary-include-other-diary-files) 832 (diary-list-entries-hook 'diary-include-other-diary-files)
832 (diary-display-hook 'ignore) 833 (diary-display-function 'ignore)
833 (diary-hook nil)) 834 (diary-hook nil))
834 (if (file-exists-p diary-file) 835 (if (file-exists-p diary-file)
835 (if (file-readable-p diary-file) 836 (if (file-readable-p diary-file)
@@ -886,7 +887,9 @@ Returns a cons (NOENTRIES . HOLIDAY-STRING)."
886(defvar diary-saved-point) ; bound in diary-list-entries 887(defvar diary-saved-point) ; bound in diary-list-entries
887 888
888(defun diary-simple-display () 889(defun diary-simple-display ()
889 "Display the diary buffer if there are any relevant entries or holidays." 890 "Display the diary buffer if there are any relevant entries or holidays.
891Entries that do not apply are made invisible. Holidays are shown
892in the mode line. This is an option for `diary-display-function'."
890 ;; If selected window is dedicated (to the calendar), need a new one 893 ;; If selected window is dedicated (to the calendar), need a new one
891 ;; to display the diary. 894 ;; to display the diary.
892 (let* ((pop-up-frames (or pop-up-frames 895 (let* ((pop-up-frames (or pop-up-frames
@@ -941,7 +944,11 @@ Returns a cons (NOENTRIES . HOLIDAY-STRING)."
941 944
942(defun diary-fancy-display () 945(defun diary-fancy-display ()
943 "Prepare a diary buffer with relevant entries in a fancy, noneditable form. 946 "Prepare a diary buffer with relevant entries in a fancy, noneditable form.
944To use this function, add it to `diary-display-hook'." 947Holidays are shown unless `diary-show-holidays-flag' is nil.
948Days with no diary entries are not shown (even if that day is a
949holiday), unless `diary-list-include-blanks' is non-nil.
950
951This is an option for `diary-display-function'."
945 ;; Turn off selective-display in the diary file's buffer. 952 ;; Turn off selective-display in the diary file's buffer.
946 (with-current-buffer 953 (with-current-buffer
947 (find-buffer-visiting (substitute-in-file-name diary-file)) 954 (find-buffer-visiting (substitute-in-file-name diary-file))
@@ -1117,7 +1124,7 @@ should ensure that all relevant variables are set.
1117 (interactive "P") 1124 (interactive "P")
1118 (if (string-equal diary-mail-addr "") 1125 (if (string-equal diary-mail-addr "")
1119 (error "You must set `diary-mail-addr' to use this command") 1126 (error "You must set `diary-mail-addr' to use this command")
1120 (let ((diary-display-hook 'diary-fancy-display)) 1127 (let ((diary-display-function 'diary-fancy-display))
1121 (diary-list-entries (calendar-current-date) (or ndays diary-mail-days))) 1128 (diary-list-entries (calendar-current-date) (or ndays diary-mail-days)))
1122 (compose-mail diary-mail-addr 1129 (compose-mail diary-mail-addr
1123 (concat "Diary entries generated " 1130 (concat "Diary entries generated "