[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: void variable error in function diary-anniversary
From: |
stardiviner |
Subject: |
Re: void variable error in function diary-anniversary |
Date: |
Thu, 21 Dec 2017 13:51:13 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
I'm using latest Emacs version from `master` branch.
Current version: GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+
Version 3.22.26) of 2017-12-16
And here is the edebug backtrace (check out the FIXME):
#+begin_src emacs-lisp
(defun diary-anniversary (month day &optional year mark)
"Anniversary diary entry.
Entry applies if date is the anniversary of MONTH, DAY, YEAR.
The order of the input parameters changes according to
`calendar-date-style' (e.g. to DAY MONTH YEAR in the European style).
The diary entry can contain `%d' or `%d%s'; the %d will be replaced
by the number of years since the MONTH, DAY, YEAR, and the %s will
be replaced by the ordinal ending of that number (that is, `st',
`nd', `rd' or `th', as appropriate). The anniversary of February 29
is considered to be March 1 in non-leap years.
An optional parameter MARK specifies a face or single-character
string to use when highlighting the day in the calendar."
(with-no-warnings (defvar date) (defvar entry))
(let* ((ddate (diary-make-date month day year))
(dd (calendar-extract-day ddate))
(mm (calendar-extract-month ddate))
(yy (calendar-extract-year ddate))
(y (calendar-extract-year date)) ; FIXME: here date is void.
(diff (if yy (- y yy) 100)))
(and (= mm 2) (= dd 29) (not (calendar-leap-year-p y))
(setq mm 3
dd 1))
(and (> diff 0) (calendar-date-equal (list mm dd y) date)
(cons mark (format entry diff (diary-ordinal-suffix diff))))))
#+end_src
On 12/21/2017 12:09 AM, Stefan Monnier wrote:
I have:
```org
* test anniversary
%%(diary-anniversary 12 8 2007)
```
When I execute [M-: (diary-anniversary 12 8 2007) RET], I got error:
Symbol's value as variable is vodi: date
Which Emacs version?
Could you set "Options => Enter Debugger on Error", then reproduce
the problem, then send us the backtrace that you (hopefully) get?
Stefan