diff options
| author | Glenn Morris | 2011-05-09 19:22:55 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-05-09 19:22:55 -0700 |
| commit | 4f99f44b34c11935e00eb7acd3d464abd903ab53 (patch) | |
| tree | cc9404abf69650649de3495f50fbdb358e19d571 | |
| parent | 84f29e6bd8cb51953a260e8d0ad901f7d1ac23c5 (diff) | |
| download | emacs-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/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 129 |
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 @@ | |||
| 1 | 2011-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 | |||
| 1 | 2011-05-09 Juanma Barranquero <lekktu@gmail.com> | 9 | 2011-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 | |||
| 212 | in your `.emacs' file to cause the fancy diary buffer to be displayed with | 212 | in your `.emacs' file to cause the fancy diary buffer to be displayed with |
| 213 | diary entries from various included files, each day's entries sorted into | 213 | diary entries from various included files, each day's entries sorted into |
| 214 | lexicographic order. Note how the sort function is placed last, | 214 | lexicographic order. Note how the sort function is placed last, |
| 215 | so that it can sort the entries included from other files." | 215 | so that it can sort the entries included from other files. |
| 216 | |||
| 217 | This hook runs after `diary-nongregorian-listing-hook'. These two hooks | ||
| 218 | differ 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. | ||
| 221 | So for example, to sort the complete list of diary entries you would | ||
| 222 | use the list-entries hook, whereas to process e.g. Islamic entries in | ||
| 223 | the 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. |
| 225 | You might wish to add `diary-mark-included-diary-files', in which case | 233 | You might wish to add `diary-mark-included-diary-files', in which case |
| 226 | you will probably also want to add `diary-include-other-diary-files' to | 234 | you will probably also want to add `diary-include-other-diary-files' to |
| 227 | `diary-list-entries-hook'." | 235 | `diary-list-entries-hook'. |
| 236 | |||
| 237 | This hook runs after `diary-nongregorian-marking-hook'. These two hooks | ||
| 238 | differ 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 | |||
| 238 | to cull relevant entries. You can use any or all of | 251 | to 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 |
| 241 | describes the style of such diary entries." | 254 | describes the style of such diary entries. |
| 255 | |||
| 256 | You can use this hook for other functions as well, if you want them to | ||
| 257 | be run on the main diary file and any included diary files. Otherwise, | ||
| 258 | use `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 | |||
| 254 | to cull relevant entries. You can use any or all of | 271 | to 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 |
| 257 | describes the style of such diary entries." | 274 | describes the style of such diary entries. |
| 275 | |||
| 276 | You can use this hook for other functions as well, if you want them to | ||
| 277 | be run on the main diary file and any included diary files. Otherwise, | ||
| 278 | use `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'. |
| 763 | The arguments are DATE and NUMBER; the entries selected are those | 783 | Selects entries for NUMBER days starting with date DATE. Hides any |
| 764 | for NUMBER days starting with date DATE. The other entries are hidden | 784 | other entries using overlays. If NUMBER is less than 1, this function |
| 765 | using overlays. If NUMBER is less than 1, this function does nothing. | 785 | does nothing. |
| 766 | 786 | ||
| 767 | Returns a list of all relevant diary entries found. | 787 | Returns a list of all relevant diary entries found. |
| 768 | The list entries have the form ((MONTH DAY YEAR) STRING SPECIFIER) where | 788 | The 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' | |||
| 771 | is non-nil, this list includes a dummy diary entry consisting of the empty | 791 | is non-nil, this list includes a dummy diary entry consisting of the empty |
| 772 | string for a date with no diary entries. | 792 | string for a date with no diary entries. |
| 773 | 793 | ||
| 774 | If entries are being produced for multiple dates (i.e., NUMBER > 1), | 794 | If producing entries for multiple dates (i.e., NUMBER > 1), then |
| 775 | then this function normally returns the entries from any given | 795 | this function normally returns the entries from any given diary |
| 776 | diary file in date order. The entries for any given day are in | 796 | file in date order. The entries for any given day are in the |
| 777 | the order in which they were found in the file, not necessarily | 797 | order in which they were found in the file, not necessarily in |
| 778 | in time-of-day order. Note that any functions present on the | 798 | time-of-day order. Note that any functions present on the |
| 779 | hooks (see below) may add entries, or change the order. For | 799 | hooks (see below) may add entries, or change the order. For |
| 780 | example, `diary-include-other-diary-files' adds entries from any | 800 | example, `diary-include-other-diary-files' adds entries from any |
| 781 | include files that it finds to the end of the original list. The | 801 | include files that it finds to the end of the original list. The |
| 782 | entries from each file will be in date order, but the overall | 802 | entries from each file will be in date order, but the overall |
| 783 | list will not be. If you want the entire list to be in time order, | 803 | list will not be. If you want the entire list to be in time |
| 784 | add `diary-sort-entries' to the end of `diary-list-entries-hook'. | 804 | order, add `diary-sort-entries' to the end of `diary-list-entries-hook'. |
| 785 | 805 | ||
| 786 | After the initial list is prepared, the following hooks are run: | 806 | After 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 | ||
| 800 | Functions called by these hooks may use the variables ORIGINAL-DATE | 820 | Functions 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'. |
| 897 | This function is suitable for use with `diary-list-entries-hook'; | 926 | For example, this enables you to share common diary files. |
| 898 | it enables you to use shared diary files together with your own. | 927 | To use, add this function to `diary-list-entries-hook'. |
| 899 | The files included are specified in the `diary-file' by lines of this form: | 928 | Specify include files using lines matching `diary-include-string', e.g. |
| 900 | #include \"filename\" | 929 | #include \"filename\" |
| 901 | This is recursive; that is, #include directives in diary files thus included | 930 | This is recursive; that is, included files may include other files. |
| 902 | are obeyed. You can change the `#include' to some other string by changing | 931 | See also `diary-mark-included-diary-files'." |
| 903 | the 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. |
| 1353 | Each entry in the diary file visible in the calendar window is | 1381 | Marks each entry in the diary that is visible in the calendar window. |
| 1354 | marked. After the entries are marked, the hooks | 1382 | |
| 1355 | `diary-nongregorian-marking-hook' and `diary-mark-entries-hook' | 1383 | After marking the entries, runs `diary-nongregorian-marking-hook' |
| 1356 | are run. If the optional argument REDRAW is non-nil (which is | 1384 | for the main diary file, and each included file. For example, |
| 1357 | the case interactively, for example) then any existing diary | 1385 | this is the appropriate hook to process Islamic entries in all |
| 1358 | marks are first removed. This is intended to deal with deleted | 1386 | diary files. Next `diary-mark-entries-hook' runs, for the main diary |
| 1359 | diary entries." | 1387 | file only. If not using include files, there is no difference between |
| 1388 | these two hooks. | ||
| 1389 | |||
| 1390 | If the optional argument REDRAW is non-nil (which is the case | ||
| 1391 | interactively, for example) then this first removes any existing diary | ||
| 1392 | marks. 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. |
| 1467 | This function is suitable for use with `diary-mark-entries-hook'; it enables | 1503 | For example, this enables you to share common diary files. |
| 1468 | you to use shared diary files together with your own. The files included are | 1504 | To use, add this function to `diary-mark-entries-hook'. |
| 1469 | specified in the `diary-file' by lines of this form: | 1505 | Specify include files using lines matching `diary-include-string', e.g. |
| 1470 | #include \"filename\" | 1506 | #include \"filename\" |
| 1471 | This is recursive; that is, #include directives in diary files thus included | 1507 | This is recursive; that is, included files may include other files. |
| 1472 | are obeyed. You can change the `#include' to some other string by changing | 1508 | See also `diary-include-other-diary-files'." |
| 1473 | the 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)) |