help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick math calc on any buffer


From: Rodrigo Lazo
Subject: Re: Quick math calc on any buffer
Date: Sun, 22 Feb 2009 09:30:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Scott Frazer <address@hidden> writes:

> On Feb 21, 11:42 am, Rodrigo Lazo <address@hidden> 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))))
>

Excellent! that is exactly what I was looking for.

Thanks a lot
-- 

Rodrigo Lazo (rlazo)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]