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: Xavier Maillard
Subject: Re: Quick math calc on any buffer
Date: Tue, 24 Feb 2009 16:25:07 +0100
User-agent: Rmail GNU emacs 23.0 on Slackware 12.2.0

Hi,

   > (defun my-calc-result (beg end)
   >   (interactive "r")
   >   (insert " = " (calc-eval (buffer-substring beg end))))

   Great! Much more elegant than my last attempt:

   (defun my-calc-result2 (beg end)
      (interactive "r")
      (insert " = " (number-to-string (apply 'eval (math-read-exprs 
   (buffer-substring beg end))))))

This works partially and insert the result in the wrong place if
you mark the region in the inverse order -i.e beg is end and end
is beg.

Regards,
        Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




reply via email to

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