.emacs-my
changeset 517 6889ad2dbd35
parent 516 efa00a6ef34e
child 519 bdc19bd3820f
child 523 1c216ab8a926
equal deleted inserted replaced
516:efa00a6ef34e 517:6889ad2dbd35
   656 ;;; ----------------------------------------------------------------
   656 ;;; ----------------------------------------------------------------
   657 ;;; cacl, calculator.
   657 ;;; cacl, calculator.
   658 
   658 
   659 (setq-default calc-group-digits t)
   659 (setq-default calc-group-digits t)
   660 (setq-default calc-group-char "'")
   660 (setq-default calc-group-char "'")
       
   661 
       
   662 (defun my-calc-eval-region (arg beg end)
       
   663   "Calculate the region and display the result in the echo area.
       
   664 With prefix ARG non-nil, insert the result at the end of region."
       
   665   (interactive "P\nr")
       
   666   (require 'calc)
       
   667   (let* ((expr (buffer-substring-no-properties beg end))
       
   668          (result (calc-eval expr)))
       
   669     (if (null arg)
       
   670         (message "%s = %s" expr result)
       
   671       (goto-char end)
       
   672       (save-excursion
       
   673         (insert result)))))
   661 
   674 
   662 ;;; ----------------------------------------------------------------
   675 ;;; ----------------------------------------------------------------
   663 ;;; TeX, LaTeX.
   676 ;;; TeX, LaTeX.
   664 
   677 
   665 (setq tex-run-command "initex")
   678 (setq tex-run-command "initex")