From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] getting calc-units working in table formulas Date: Sat, 20 Dec 2014 17:33:11 +0100 Message-ID: <87r3vuz3g8.fsf@nicolasgoaziou.fr> References: <87oar4ql5t.fsf@ericabrahamsen.net> <87egrznl9e.fsf@ericabrahamsen.net> <87d27ioj1j.fsf@ericabrahamsen.net> <87vbl9qnin.fsf_-_@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2Mx9-0008Ri-Oc for emacs-orgmode@gnu.org; Sat, 20 Dec 2014 11:32:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2Mwy-0005zI-8n for emacs-orgmode@gnu.org; Sat, 20 Dec 2014 11:32:27 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:60807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2Mwy-0005z4-3T for emacs-orgmode@gnu.org; Sat, 20 Dec 2014 11:32:16 -0500 In-Reply-To: <87vbl9qnin.fsf_-_@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 18 Dec 2014 18:07:44 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > Here's the doc patch, hope all is in order. Thanks. Some comments follow. > +Calc also comes with support for unit calculations, via the @code{calc-units} > +package. For a complete list of recognized units, call > +@code{calc-view-units-table}. Units can be specified with or without a space > +between the number and the unit name, eg @samp{2 ft} is the same as "eg" -> "e.g.," > +@samp{2ft}. Rates are handled automatically: multiplying @samp{3 m/s} by two > +will give @samp{6 m / s}. By default, @code{calc-units} only defines one > +units-related function for use in tables, @code{usimplify}, which can take an > +expression such as @samp{42 km / 2.5 h} and return @samp{16.8 km / hr}. > +Another useful function to define might be @code{math-convert-units}, > eg: Ditto. > +@example > +(defmath uconv (expr target-units &optional pure) > + (math-convert-units expr target-units pure)) > +@end example I think you should use @lisp instead of @example here. > +Which would allow you to use @samp{uconv($1, ft)} to, for example, convert a > +distance specified in the cell @samp{$1} into feet. The optional > 'pure @code{pure} instead of 'pure Regards, -- Nicolas Goaziou