From: Glenn Morris <rgm@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: Trying to cope with Calendar's dynamic scoping
Date: Thu, 05 Sep 2013 00:58:35 -0400 [thread overview]
Message-ID: <xwbo47g8zo.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <jwvppt8ni1s.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 20 Aug 2013 18:07:45 -0400")
This looks really neat. Was there any particular aspect you thought
might not work? If not, I suggest moving to the traditional Emacs
testing phase of "install it and see what breaks".
Some minor comments follow.
> --- lisp/calendar/calendar.el 2013-08-07 00:06:43 +0000
> +++ lisp/calendar/calendar.el 2013-08-20 21:47:27 +0000
> +(defmacro calendar--eval (exp-exp env)
You've marked this as internal, but a third-party library might need to
use it. Eg if someone writes cal-foo.el for the foo calendar, it may
need to use this.
> + "Eval the value of EXP-EXP in the context ENV.
> +ENV is a let-style list of bindings."
Is there any value in making such a macro generally available?
It seems to recreate "evaluate a user-supplied expression with access to
certain dynamically bound variables" in a lexical environment.
I imagine calendar is not the only package doing that.
(Also, it seems to use the internal details of how closures are
implemented, which the lisp manual says is a no-no.)
> +(defmacro calendar--evalconcat (env exp-list sep)
> + "Concatenate the result of evaluating the expressions in EXP-LIST.
> +Each expression in the list returned by EXP-LIST is evaluated in the context
> +ENV, while is a let-style list of bindings. SEP is the string to place between
s/while/which
> Inserts STRING so that it ends at INDENT. STRING is either a
> literal string, or a sexp to evaluate to return such. Truncates
> STRING to length TRUNCATE, and ensures a trailing space."
> - (if (not (ignore-errors (stringp (setq string (eval string)))))
> + (if (not (ignore-errors (stringp string)))
It doesn't evaluate STRING any more, so the doc is wrong and the
ignore-errors is not needed.
calendar-string-spread does not evaluate its arg any more either.
You changed all the internal uses of both of these so that the eval
happens in the caller, so that's fine, but I think third-party libs
might be using these. So could they eval their arguments once more, with
day/month/year available?
> --- lisp/calendar/diary-lib.el 2013-08-05 14:26:57 +0000
> +++ lisp/calendar/diary-lib.el 2013-08-20 21:52:49 +0000
> (defun diary-list-entries-1 (months symbol absfunc)
> "List diary entries of a certain type.
> MONTHS is an array of month names. SYMBOL marks diary entries of the type
> in question. ABSFUNC is a function that converts absolute dates to dates
> of the appropriate type."
> + (defvar original-date)
> + (defvar number)
What's the significance of a defvar within a defun in this way?
> +Both ENTRY and DATE are available (as `entry' resp. `date') when the SEXP
"(as `entry' and `date', respectively)"?
otodo-mode.el still uses `date' and `entry' rather than `diary-date',
and may need updating.
Thanks again for doing this!
next prev parent reply other threads:[~2013-09-05 4:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 22:07 Trying to cope with Calendar's dynamic scoping Stefan Monnier
2013-08-21 0:19 ` Edward Reingold
2013-08-21 4:30 ` Stefan Monnier
2013-08-21 1:22 ` Leo Liu
2013-08-21 4:33 ` Stefan Monnier
2013-08-21 7:05 ` Glenn Morris
2013-09-05 4:58 ` Glenn Morris [this message]
2013-09-05 17:29 ` Stefan Monnier
2013-09-05 17:55 ` Glenn Morris
2013-09-05 18:59 ` Stefan Monnier
2013-09-06 1:20 ` Glenn Morris
2013-09-06 14:58 ` Stefan Monnier
2013-09-06 16:02 ` Glenn Morris
2013-09-06 17:16 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xwbo47g8zo.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.