diff options
| author | Stefan Monnier | 2018-01-10 11:40:21 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2018-01-10 11:40:21 -0500 |
| commit | feea2b5b0df946e2ec9519220b9e1707064274ab (patch) | |
| tree | f05697d963a22dc76724dbd09d695e4052fe78ea | |
| parent | 27b754d6b3ade7446b139177e324145f2683e089 (diff) | |
| download | emacs-feea2b5b0df946e2ec9519220b9e1707064274ab.tar.gz emacs-feea2b5b0df946e2ec9519220b9e1707064274ab.zip | |
* lisp/calendar/diary-lib.el: Fix bug#30051
(diary-list-entries): Dynamically bind 'number' and 'original-date' around
diary-hook as documented in the docstring.
| -rw-r--r-- | lisp/calendar/diary-lib.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 159dd9ba3d1..c327717c8a6 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el | |||
| @@ -151,8 +151,10 @@ See also `diary-comment-start'." | |||
| 151 | :group 'diary) | 151 | :group 'diary) |
| 152 | 152 | ||
| 153 | (defcustom diary-hook nil | 153 | (defcustom diary-hook nil |
| 154 | "List of functions called after the display of the diary. | 154 | "Hook run after displaying the diary. |
| 155 | Used for example by the appointment package - see `appt-activate'." | 155 | Used for example by the appointment package - see `appt-activate'. |
| 156 | The variables `number' and `original-date' are dynamically bound around | ||
| 157 | the call." | ||
| 156 | :type 'hook | 158 | :type 'hook |
| 157 | :group 'diary) | 159 | :group 'diary) |
| 158 | 160 | ||
| @@ -779,10 +781,10 @@ After preparing the initial list, hooks run in this order: | |||
| 779 | `diary-hook' runs last, after the diary is displayed. | 781 | `diary-hook' runs last, after the diary is displayed. |
| 780 | This is used e.g. by `appt-check'. | 782 | This is used e.g. by `appt-check'. |
| 781 | 783 | ||
| 782 | Functions called by these hooks may use the variables ORIGINAL-DATE | 784 | Functions called by these hooks may use the variables `original-date' |
| 783 | and NUMBER, which are the arguments with which this function was called. | 785 | and `number', which are the arguments with which this function was called. |
| 784 | Note that hook functions should _not_ use DATE, but ORIGINAL-DATE. | 786 | Note that hook functions should _not_ use `date', but `original-date'. |
| 785 | \(Sexp diary entries may use DATE - see `diary-list-sexp-entries'.) | 787 | \(Sexp diary entries may use `date' - see `diary-list-sexp-entries'.) |
| 786 | 788 | ||
| 787 | This function displays the list using `diary-display-function', unless | 789 | This function displays the list using `diary-display-function', unless |
| 788 | LIST-ONLY is non-nil, in which case it just returns the list." | 790 | LIST-ONLY is non-nil, in which case it just returns the list." |
| @@ -872,7 +874,9 @@ LIST-ONLY is non-nil, in which case it just returns the list." | |||
| 872 | (copy-sequence | 874 | (copy-sequence |
| 873 | (car display-buffer-fallback-action)))))) | 875 | (car display-buffer-fallback-action)))))) |
| 874 | (funcall diary-display-function))) | 876 | (funcall diary-display-function))) |
| 875 | (run-hooks 'diary-hook))))) | 877 | (calendar-dlet* ((number number) |
| 878 | (original-date original-date)) | ||
| 879 | (run-hooks 'diary-hook)))))) | ||
| 876 | (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) | 880 | (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) |
| 877 | (or d-incp (message "Preparing diary...done")) | 881 | (or d-incp (message "Preparing diary...done")) |
| 878 | diary-entries-list))) | 882 | diary-entries-list))) |