From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chetan Newsgroups: gmane.emacs.help Subject: Re: Quick math calc on any buffer Date: Tue, 24 Feb 2009 15:20:06 -0800 Organization: Noname Inc. Message-ID: References: <866ac838-c9b2-4507-acca-08df9ddf5b94@l1g2000yqj.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1235518916 7602 80.91.229.12 (24 Feb 2009 23:41:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2009 23:41:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 25 00:43:12 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lc6vO-0001Lc-CM for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Feb 2009 00:42:54 +0100 Original-Received: from localhost ([127.0.0.1]:36053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lc6u3-0003DK-DC for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Feb 2009 18:41:31 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!newshub.sdsu.edu!flph200.ffdc.sbc.com!prodigy.net!flph199.ffdc.sbc.com!prodigy.com!flpi107.ffdc.sbc.com!nlpi067.nbdc.sbc.com.POSTED!8e1d8614!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Emacs Gnus Cancel-Lock: sha1:LcoL6tHi7OgyASqUupWQH3HuJ/I= Original-Lines: 24 Original-NNTP-Posting-Host: 76.200.183.58 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: nlpi067.nbdc.sbc.com 1235517607 ST000 76.200.183.58 (Tue, 24 Feb 2009 18:20:07 EST) Original-NNTP-Posting-Date: Tue, 24 Feb 2009 18:20:07 EST X-UserInfo1: FKPO@MC@@S@SSVPXJJMF_W@BFJT@QDDMEPWXODMMHXMTWA]EPMS[AACY@TZZXQ[KS^ESKCJLOF_J_NGAWNTG^_XGTNTAHULK[X[NRTC@G\P^PLT_OCBRHUO@@TBQZDZMHD[YZ@NLXQXIWMOSXT_KOLK^^CXFF\WHMI^C@EGA_[FXAQ@E^TGNMUXGYNS[QQVL Original-Xref: news.stanford.edu gnu.emacs.help:167039 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62339 Archived-At: Scott Frazer writes: > On Feb 21, 11:42 am, Rodrigo Lazo wrote: >> Hi all, >> >> Is there a way to compute a math expression on any buffer? I mean, if I >> have a buffer with the following expression >> >> 2 + 3 >> >> I want to mark the region and compute the result >> >> 2 + 3 = 5 >> >> It doesn't seems too hard to do, I've looked on calculator.el for a >> "computing" function I can call but I didn't find it. >> > > (defun my-calc-result (beg end) > (interactive "r") > (insert " = " (calc-eval (buffer-substring beg end)))) This makes me wonder, is there a rewriter of math expressions, something like a macro that can rewrite the arithmetic expression as regular lisp function calls?