From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Re: Trying to cope with Calendar's dynamic scoping Date: Thu, 05 Sep 2013 00:58:35 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1378357119 27748 80.91.229.3 (5 Sep 2013 04:58:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Sep 2013 04:58:39 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 05 06:58:42 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VHReU-00009X-8b for ged-emacs-devel@m.gmane.org; Thu, 05 Sep 2013 06:58:42 +0200 Original-Received: from localhost ([::1]:56911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHReT-000556-Sa for ged-emacs-devel@m.gmane.org; Thu, 05 Sep 2013 00:58:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHReQ-00054y-BD for emacs-devel@gnu.org; Thu, 05 Sep 2013 00:58:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VHReP-0003kb-Cf for emacs-devel@gnu.org; Thu, 05 Sep 2013 00:58:38 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39564) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VHReP-0003kX-8x for emacs-devel@gnu.org; Thu, 05 Sep 2013 00:58:37 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VHReN-0003Mc-Mo; Thu, 05 Sep 2013 00:58:35 -0400 X-Spook: airframe Vince Foster Watergate Syria explosion Chobetsu X-Ran: K(iW)!"z7uj'0-X*SL.?YO_*F4O7k/THIExn%.g[9@*Fy;mVWn`$zJIquJiuF2sLd{y+1Y X-Hue: black X-Attribution: GM In-Reply-To: (Stefan Monnier's message of "Tue, 20 Aug 2013 18:07:45 -0400") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:163198 Archived-At: 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!