summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-ext.el
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-08-07 18:12:20 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2012-08-07 18:12:20 +0200
commit651eaf36f227ac6067263fe1fb9a7c56984a9b6d (patch)
tree63f5f8839f74c768b85cbfc204cf8d15c45045fa /lisp/calc/calc-ext.el
parentc644523bd8a23e518c91b61a1b8520e866b715b9 (diff)
downloademacs-651eaf36f227ac6067263fe1fb9a7c56984a9b6d.tar.gz
emacs-651eaf36f227ac6067263fe1fb9a7c56984a9b6d.tar.bz2
emacs-651eaf36f227ac6067263fe1fb9a7c56984a9b6d.zip
* calc/calc-prog.el (math-do-defmath): Use backquote forms. Fix
handling of interactive spec when the body uses return. (math-do-arg-check, math-define-function-body): Use backquote forms. * calc/calc-ext.el (math-defcache): Likewise. * calc/calc-rewr.el (math-rwfail, math-rweval): Likewise. * allout.el (allout-new-exposure): Likewise. * calc/calcalg2.el (math-tracing-integral): Likewise. * info.el (Info-last-menu-item): Likewise. * emulation/vip.el (vip-loop): Likewise. * textmodes/artist.el (artist-funcall): Likewise. * menu-bar.el (menu-bar-make-mm-toggle, menu-bar-make-toggle): Construct menu-item directly. * cedet/ede/base.el (ede-with-projectfile): Use backquote forms.
Diffstat (limited to 'lisp/calc/calc-ext.el')
-rw-r--r--lisp/calc/calc-ext.el75
1 files changed, 30 insertions, 45 deletions
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 338330a793b..7089070df59 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1997,51 +1997,36 @@ calc-kill calc-kill-region calc-yank))))
(cache-val (intern (concat (symbol-name name) "-cache")))
(last-prec (intern (concat (symbol-name name) "-last-prec")))
(last-val (intern (concat (symbol-name name) "-last"))))
- (list 'progn
-; (list 'defvar cache-prec (if init (math-numdigs (nth 1 init)) -100))
- (list 'defvar cache-prec
- `(cond
- ((consp ,init) (math-numdigs (nth 1 ,init)))
- (,init
- (nth 1 (math-numdigs (eval ,init))))
- (t
- -100)))
- (list 'defvar cache-val
- `(cond
- ((consp ,init) ,init)
- (,init (eval ,init))
- (t ,init)))
- (list 'defvar last-prec -100)
- (list 'defvar last-val nil)
- (list 'setq 'math-cache-list
- (list 'cons
- (list 'quote cache-prec)
- (list 'cons
- (list 'quote last-prec)
- 'math-cache-list)))
- (list 'defun
- name ()
- (list 'or
- (list '= last-prec 'calc-internal-prec)
- (list 'setq
- last-val
- (list 'math-normalize
- (list 'progn
- (list 'or
- (list '>= cache-prec
- 'calc-internal-prec)
- (list 'setq
- cache-val
- (list 'let
- '((calc-internal-prec
- (+ calc-internal-prec
- 4)))
- form)
- cache-prec
- '(+ calc-internal-prec 2)))
- cache-val))
- last-prec 'calc-internal-prec))
- last-val))))
+ `(progn
+; (defvar ,cache-prec ,(if init (math-numdigs (nth 1 init)) -100))
+ (defvar ,cache-prec (cond
+ ((consp ,init) (math-numdigs (nth 1 ,init)))
+ (,init
+ (nth 1 (math-numdigs (eval ,init))))
+ (t
+ -100)))
+ (defvar ,cache-val (cond ((consp ,init) ,init)
+ (,init (eval ,init))
+ (t ,init)))
+ (defvar ,last-prec -100)
+ (defvar ,last-val nil)
+ (setq math-cache-list
+ (cons ',cache-prec
+ (cons ',last-prec
+ math-cache-list)))
+ (defun ,name ()
+ (or (= ,last-prec calc-internal-prec)
+ (setq ,last-val
+ (math-normalize
+ (progn (or (>= ,cache-prec calc-internal-prec)
+ (setq ,cache-val
+ (let ((calc-internal-prec
+ (+ calc-internal-prec 4)))
+ ,form)
+ ,cache-prec (+ calc-internal-prec 2)))
+ ,cache-val))
+ ,last-prec calc-internal-prec))
+ ,last-val))))
(put 'math-defcache 'lisp-indent-hook 2)
;;; Betcha didn't know that pi = 16 atan(1/5) - 4 atan(1/239). [F] [Public]