aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2011-05-09 19:22:55 -0700
committerGlenn Morris2011-05-09 19:22:55 -0700
commit4f99f44b34c11935e00eb7acd3d464abd903ab53 (patch)
treecc9404abf69650649de3495f50fbdb358e19d571
parent84f29e6bd8cb51953a260e8d0ad901f7d1ac23c5 (diff)
downloademacs-4f99f44b34c11935e00eb7acd3d464abd903ab53.tar.gz
emacs-4f99f44b34c11935e00eb7acd3d464abd903ab53.zip
diary-lib.el doc fixes.
* lisp/calendar/diary-lib.el (diary-list-entries-hook) (diary-mark-entries-hook, diary-nongregorian-listing-hook) (diary-nongregorian-marking-hook, diary-list-entries) (diary-include-other-diary-files, diary-mark-entries) (diary-mark-included-diary-files): Doc fixes.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calendar/diary-lib.el129
2 files changed, 90 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2b61509fb30..cbb03baa3bf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12011-05-10 Glenn Morris <rgm@gnu.org>
2
3 * calendar/diary-lib.el (diary-list-entries-hook)
4 (diary-mark-entries-hook, diary-nongregorian-listing-hook)
5 (diary-nongregorian-marking-hook, diary-list-entries)
6 (diary-include-other-diary-files, diary-mark-entries)
7 (diary-mark-included-diary-files): Doc fixes.
8
12011-05-09 Juanma Barranquero <lekktu@gmail.com> 92011-05-09 Juanma Barranquero <lekktu@gmail.com>
2 10
3 * misc.el: Require tabulated-list.el during compilation. 11 * misc.el: Require tabulated-list.el during compilation.
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 1e1066028ac..62da7579d50 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -212,7 +212,15 @@ you will probably also want to add `diary-mark-included-diary-files' to
212in your `.emacs' file to cause the fancy diary buffer to be displayed with 212in your `.emacs' file to cause the fancy diary buffer to be displayed with
213diary entries from various included files, each day's entries sorted into 213diary entries from various included files, each day's entries sorted into
214lexicographic order. Note how the sort function is placed last, 214lexicographic order. Note how the sort function is placed last,
215so that it can sort the entries included from other files." 215so that it can sort the entries included from other files.
216
217This hook runs after `diary-nongregorian-listing-hook'. These two hooks
218differ only if you are using included diary files. In that case,
219`diary-nongregorian-listing-hook' runs for each file, whereas
220`diary-list-entries-hook' only runs once, for the main diary file.
221So for example, to sort the complete list of diary entries you would
222use the list-entries hook, whereas to process e.g. Islamic entries in
223the main file and all included files, you would use the nongregorian hook."
216 :type 'hook 224 :type 'hook
217 :options '(diary-include-other-diary-files diary-sort-entries) 225 :options '(diary-include-other-diary-files diary-sort-entries)
218 :group 'diary) 226 :group 'diary)
@@ -224,7 +232,12 @@ so that it can sort the entries included from other files."
224 "List of functions called after marking diary entries in the calendar. 232 "List of functions called after marking diary entries in the calendar.
225You might wish to add `diary-mark-included-diary-files', in which case 233You might wish to add `diary-mark-included-diary-files', in which case
226you will probably also want to add `diary-include-other-diary-files' to 234you will probably also want to add `diary-include-other-diary-files' to
227`diary-list-entries-hook'." 235`diary-list-entries-hook'.
236
237This hook runs after `diary-nongregorian-marking-hook'. These two hooks
238differ only if you are using included diary files. In that case,
239`diary-nongregorian-marking-hook' runs for each file, whereas
240`diary-mark-entries-hook' only runs once, for the main diary file."
228 :type 'hook 241 :type 'hook
229 :options '(diary-mark-included-diary-files) 242 :options '(diary-mark-included-diary-files)
230 :group 'diary) 243 :group 'diary)
@@ -238,7 +251,11 @@ As the files are processed for diary entries, these functions are used
238to cull relevant entries. You can use any or all of 251to cull relevant entries. You can use any or all of
239`diary-bahai-list-entries', `diary-hebrew-list-entries', and 252`diary-bahai-list-entries', `diary-hebrew-list-entries', and
240`diary-islamic-list-entries'. The documentation for these functions 253`diary-islamic-list-entries'. The documentation for these functions
241describes the style of such diary entries." 254describes the style of such diary entries.
255
256You can use this hook for other functions as well, if you want them to
257be run on the main diary file and any included diary files. Otherwise,
258use `diary-list-entries-hook', which runs only for the main diary file."
242 :type 'hook 259 :type 'hook
243 :options '(diary-bahai-list-entries 260 :options '(diary-bahai-list-entries
244 diary-hebrew-list-entries 261 diary-hebrew-list-entries
@@ -254,7 +271,11 @@ As the files are processed for diary entries, these functions are used
254to cull relevant entries. You can use any or all of 271to cull relevant entries. You can use any or all of
255`diary-bahai-mark-entries', `diary-hebrew-mark-entries' and 272`diary-bahai-mark-entries', `diary-hebrew-mark-entries' and
256`diary-islamic-mark-entries'. The documentation for these functions 273`diary-islamic-mark-entries'. The documentation for these functions
257describes the style of such diary entries." 274describes the style of such diary entries.
275
276You can use this hook for other functions as well, if you want them to
277be run on the main diary file and any included diary files. Otherwise,
278use `diary-mark-entries-hook', which runs only for the main diary file."
258 :type 'hook 279 :type 'hook
259 :options '(diary-bahai-mark-entries 280 :options '(diary-bahai-mark-entries
260 diary-hebrew-mark-entries 281 diary-hebrew-mark-entries
@@ -757,12 +778,11 @@ of the appropriate type."
757(defvar diary-included-files nil 778(defvar diary-included-files nil
758 "List of any diary files included in the last call to `diary-list-entries'.") 779 "List of any diary files included in the last call to `diary-list-entries'.")
759 780
760;; FIXME non-greg and list hooks run same number of times?
761(defun diary-list-entries (date number &optional list-only) 781(defun diary-list-entries (date number &optional list-only)
762 "Create and display a buffer containing the relevant lines in `diary-file'. 782 "Create and display a buffer containing the relevant lines in `diary-file'.
763The arguments are DATE and NUMBER; the entries selected are those 783Selects entries for NUMBER days starting with date DATE. Hides any
764for NUMBER days starting with date DATE. The other entries are hidden 784other entries using overlays. If NUMBER is less than 1, this function
765using overlays. If NUMBER is less than 1, this function does nothing. 785does nothing.
766 786
767Returns a list of all relevant diary entries found. 787Returns a list of all relevant diary entries found.
768The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where 788The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where
@@ -771,30 +791,30 @@ SPECIFIER is the applicability. If the variable `diary-list-include-blanks'
771is non-nil, this list includes a dummy diary entry consisting of the empty 791is non-nil, this list includes a dummy diary entry consisting of the empty
772string for a date with no diary entries. 792string for a date with no diary entries.
773 793
774If entries are being produced for multiple dates (i.e., NUMBER > 1), 794If producing entries for multiple dates (i.e., NUMBER > 1), then
775then this function normally returns the entries from any given 795this function normally returns the entries from any given diary
776diary file in date order. The entries for any given day are in 796file in date order. The entries for any given day are in the
777the order in which they were found in the file, not necessarily 797order in which they were found in the file, not necessarily in
778in time-of-day order. Note that any functions present on the 798time-of-day order. Note that any functions present on the
779hooks (see below) may add entries, or change the order. For 799hooks (see below) may add entries, or change the order. For
780example, `diary-include-other-diary-files' adds entries from any 800example, `diary-include-other-diary-files' adds entries from any
781include files that it finds to the end of the original list. The 801include files that it finds to the end of the original list. The
782entries from each file will be in date order, but the overall 802entries from each file will be in date order, but the overall
783list will not be. If you want the entire list to be in time order, 803list will not be. If you want the entire list to be in time
784add `diary-sort-entries' to the end of `diary-list-entries-hook'. 804order, add `diary-sort-entries' to the end of `diary-list-entries-hook'.
785 805
786After the initial list is prepared, the following hooks are run: 806After preparing the initial list, hooks run in this order:
787 807
788 `diary-nongregorian-listing-hook' can cull dates from the diary 808 `diary-nongregorian-listing-hook' runs for the main diary file,
789 and each included file, for example to process Islamic diary 809 and each included file. For example, this is the appropriate hook
790 entries. Applied to *each* file. 810 to process Islamic entries in all diary files.
791 811
792 `diary-list-entries-hook' adds or manipulates diary entries from 812 `diary-list-entries-hook' runs once only, for the main diary file.
793 external sources. Used, for example, to include diary entries 813 For example, this is appropriate for sorting all the entries.
794 from other files or to sort the diary entries. Invoked *once* 814 If not using include files, there is no difference from the previous
795 only, before the display hook is run. 815 hook.
796 816
797 `diary-hook' is run last, after the diary is displayed. 817 `diary-hook' runs last, after the diary is displayed.
798 This is used e.g. by `appt-check'. 818 This is used e.g. by `appt-check'.
799 819
800Functions called by these hooks may use the variables ORIGINAL-DATE 820Functions called by these hooks may use the variables ORIGINAL-DATE
@@ -867,8 +887,17 @@ LIST-ONLY is non-nil, in which case it just returns the list."
867 (calendar-gregorian-from-absolute 887 (calendar-gregorian-from-absolute
868 (1+ (calendar-absolute-from-gregorian date))))))) 888 (1+ (calendar-absolute-from-gregorian date)))))))
869 (goto-char (point-min)) 889 (goto-char (point-min))
890 ;; Although it looks like list-entries-hook runs
891 ;; every time, diary-include-other-diary-files
892 ;; binds it to nil (essentially) when it runs
893 ;; in included files.
870 (run-hooks 'diary-nongregorian-listing-hook 894 (run-hooks 'diary-nongregorian-listing-hook
871 'diary-list-entries-hook) 895 'diary-list-entries-hook)
896 ;; We could make this explicit:
897 ;;; (run-hooks 'diary-nongregorian-listing-hook)
898 ;;; (if d-incp
899 ;;; (diary-include-other-diary-files) ; recurse
900 ;;; (run-hooks 'diary-list-entries-hook))
872 (unless list-only 901 (unless list-only
873 (if (and diary-display-function 902 (if (and diary-display-function
874 (listp diary-display-function)) 903 (listp diary-display-function))
@@ -893,14 +922,13 @@ LIST-ONLY is non-nil, in which case it just returns the list."
893;(defvar number) ; already declared above 922;(defvar number) ; already declared above
894 923
895(defun diary-include-other-diary-files () 924(defun diary-include-other-diary-files ()
896 "Include the diary entries from other diary files with those of `diary-file'. 925 "Add diary entries from included diary files to `diary-entries-list'.
897This function is suitable for use with `diary-list-entries-hook'; 926For example, this enables you to share common diary files.
898it enables you to use shared diary files together with your own. 927To use, add this function to `diary-list-entries-hook'.
899The files included are specified in the `diary-file' by lines of this form: 928Specify include files using lines matching `diary-include-string', e.g.
900 #include \"filename\" 929 #include \"filename\"
901This is recursive; that is, #include directives in diary files thus included 930This is recursive; that is, included files may include other files.
902are obeyed. You can change the `#include' to some other string by changing 931See also `diary-mark-included-diary-files'."
903the variable `diary-include-string'."
904 (goto-char (point-min)) 932 (goto-char (point-min))
905 (while (re-search-forward 933 (while (re-search-forward
906 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string)) 934 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string))
@@ -1350,13 +1378,18 @@ function that converts absolute dates to dates of the appropriate type. "
1350;;;###cal-autoload 1378;;;###cal-autoload
1351(defun diary-mark-entries (&optional redraw) 1379(defun diary-mark-entries (&optional redraw)
1352 "Mark days in the calendar window that have diary entries. 1380 "Mark days in the calendar window that have diary entries.
1353Each entry in the diary file visible in the calendar window is 1381Marks each entry in the diary that is visible in the calendar window.
1354marked. After the entries are marked, the hooks 1382
1355`diary-nongregorian-marking-hook' and `diary-mark-entries-hook' 1383After marking the entries, runs `diary-nongregorian-marking-hook'
1356are run. If the optional argument REDRAW is non-nil (which is 1384for the main diary file, and each included file. For example,
1357the case interactively, for example) then any existing diary 1385this is the appropriate hook to process Islamic entries in all
1358marks are first removed. This is intended to deal with deleted 1386diary files. Next `diary-mark-entries-hook' runs, for the main diary
1359diary entries." 1387file only. If not using include files, there is no difference between
1388these two hooks.
1389
1390If the optional argument REDRAW is non-nil (which is the case
1391interactively, for example) then this first removes any existing diary
1392marks. This is intended to deal with deleted diary entries."
1360 (interactive "p") 1393 (interactive "p")
1361 ;; To remove any deleted diary entries. Do not redraw when: 1394 ;; To remove any deleted diary entries. Do not redraw when:
1362 ;; i) processing #include diary files (else only get the marks from 1395 ;; i) processing #include diary files (else only get the marks from
@@ -1378,6 +1411,9 @@ diary entries."
1378 (with-syntax-table diary-syntax-table 1411 (with-syntax-table diary-syntax-table
1379 (diary-mark-entries-1 'calendar-mark-date-pattern) 1412 (diary-mark-entries-1 'calendar-mark-date-pattern)
1380 (diary-mark-sexp-entries) 1413 (diary-mark-sexp-entries)
1414 ;; Although it looks like mark-entries-hook runs every time,
1415 ;; diary-mark-included-diary-files binds it to nil
1416 ;; (essentially) when it runs in included files.
1381 (run-hooks 'diary-nongregorian-marking-hook 1417 (run-hooks 'diary-nongregorian-marking-hook
1382 'diary-mark-entries-hook)) 1418 'diary-mark-entries-hook))
1383 (message "Marking diary entries...done"))))) 1419 (message "Marking diary entries...done")))))
@@ -1463,14 +1499,13 @@ is marked. See the documentation for the function `diary-list-sexp-entries'."
1463 'diary-mark-sexp-entries "23.1") 1499 'diary-mark-sexp-entries "23.1")
1464 1500
1465(defun diary-mark-included-diary-files () 1501(defun diary-mark-included-diary-files ()
1466 "Mark the diary entries from other diary files with those of the diary file. 1502 "Mark diary entries from included diary files.
1467This function is suitable for use with `diary-mark-entries-hook'; it enables 1503For example, this enables you to share common diary files.
1468you to use shared diary files together with your own. The files included are 1504To use, add this function to `diary-mark-entries-hook'.
1469specified in the `diary-file' by lines of this form: 1505Specify include files using lines matching `diary-include-string', e.g.
1470 #include \"filename\" 1506 #include \"filename\"
1471This is recursive; that is, #include directives in diary files thus included 1507This is recursive; that is, included files may include other files.
1472are obeyed. You can change the `#include' to some other string by changing 1508See also `diary-include-other-diary-files'."
1473the variable `diary-include-string'."
1474 (goto-char (point-min)) 1509 (goto-char (point-min))
1475 (while (re-search-forward 1510 (while (re-search-forward
1476 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string)) 1511 (format "^%s \"\\([^\"]*\\)\"" (regexp-quote diary-include-string))