all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* void variable error in function diary-anniversary
@ 2017-12-20  3:19 stardiviner
  2017-12-20 16:09 ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: stardiviner @ 2017-12-20  3:19 UTC (permalink / raw
  To: emacs-help

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-20  3:19 void variable error in function diary-anniversary stardiviner
@ 2017-12-20 16:09 ` Stefan Monnier
  2017-12-21  5:51   ` stardiviner
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-12-20 16:09 UTC (permalink / raw
  To: help-gnu-emacs

> 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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-20 16:09 ` Stefan Monnier
@ 2017-12-21  5:51   ` stardiviner
  2017-12-21  7:50     ` Nick Dokos
  2017-12-21 13:58     ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: stardiviner @ 2017-12-21  5:51 UTC (permalink / raw
  To: help-gnu-emacs

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
>
>
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-21  5:51   ` stardiviner
@ 2017-12-21  7:50     ` Nick Dokos
  2017-12-21 10:27       ` numbchild
  2017-12-21 13:58     ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2017-12-21  7:50 UTC (permalink / raw
  To: help-gnu-emacs

stardiviner <numbchild@gmail.com> writes:

> 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

The calendar and diary modules assume that the symbol 'date' is
(dynamically) bound to today's date.  So if you want to evaluate a
function like diary-anniversary by hand (so to speak), you have to do
something like this (N.B. the (month day year) format for the date):

(setq date '(12 21 2017))
(12 21 2017)
(setq entry "foo %d")
"Test anniversary %d"
(org-anniversary 2015 12 21)
(nil . "Test anniversary 2")

-- 
Nick




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-21  7:50     ` Nick Dokos
@ 2017-12-21 10:27       ` numbchild
  0 siblings, 0 replies; 7+ messages in thread
From: numbchild @ 2017-12-21 10:27 UTC (permalink / raw
  To: Nick Dokos; +Cc: emacs-help

I see, thanks. @Nick.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Dec 21, 2017 at 3:50 PM, Nick Dokos <ndokos@gmail.com> wrote:

> stardiviner <numbchild@gmail.com> writes:
>
> > 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
>
> The calendar and diary modules assume that the symbol 'date' is
> (dynamically) bound to today's date.  So if you want to evaluate a
> function like diary-anniversary by hand (so to speak), you have to do
> something like this (N.B. the (month day year) format for the date):
>
> (setq date '(12 21 2017))
> (12 21 2017)
> (setq entry "foo %d")
> "Test anniversary %d"
> (org-anniversary 2015 12 21)
> (nil . "Test anniversary 2")
>
> --
> Nick
>
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-21  5:51   ` stardiviner
  2017-12-21  7:50     ` Nick Dokos
@ 2017-12-21 13:58     ` Stefan Monnier
  2017-12-21 15:08       ` numbchild
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2017-12-21 13:58 UTC (permalink / raw
  To: help-gnu-emacs

> And here is the edebug backtrace (check out the FIXME):

This is not a backtrace :-(

But to get back to the original problem:
> 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 void: date

Do you only get this error in your M-: use case (which is normal), or do
you also see it when you use that in your diary file?

> I'm using latest Emacs version from `master` branch.

If it's a new problem that was not present in earlier versions of Emacs,
then please, please, pretty please, `M-x report-emacs-bug`.


        Stefan




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: void variable error in function diary-anniversary
  2017-12-21 13:58     ` Stefan Monnier
@ 2017-12-21 15:08       ` numbchild
  0 siblings, 0 replies; 7+ messages in thread
From: numbchild @ 2017-12-21 15:08 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-help

Sorry for this. I only have this error in when in [M-:]. I also asked
Org-mode mailing list. I can include diary anniversary now. So it is not
Emacs bug.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/

On Thu, Dec 21, 2017 at 9:58 PM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > And here is the edebug backtrace (check out the FIXME):
>
> This is not a backtrace :-(
>
> But to get back to the original problem:
> > 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 void: date
>
> Do you only get this error in your M-: use case (which is normal), or do
> you also see it when you use that in your diary file?
>
> > I'm using latest Emacs version from `master` branch.
>
> If it's a new problem that was not present in earlier versions of Emacs,
> then please, please, pretty please, `M-x report-emacs-bug`.
>
>
>         Stefan
>
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-21 15:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20  3:19 void variable error in function diary-anniversary stardiviner
2017-12-20 16:09 ` Stefan Monnier
2017-12-21  5:51   ` stardiviner
2017-12-21  7:50     ` Nick Dokos
2017-12-21 10:27       ` numbchild
2017-12-21 13:58     ` Stefan Monnier
2017-12-21 15:08       ` numbchild

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.