From e6f0a80dd2bf0ee1101d6e6be2afc93966950cd0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 19 Sep 2012 23:44:57 -0400 Subject: [PATCH] * lisp/calc/calc.el: Remove redundant autoload shape check. (sel-mode): Don't defvar. (calc-get-stack-element): Add `sel-mode' arg instead. (calc-top, calc-top-list): Pass it this additional argument. * lisp/calc/calc-store.el (calc-store-map): * lisp/calc/calc-map.el (calc-apply, calc-reduce, calc-map) (calc-map-equation, calc-outer-product, calc-inner-product): * lisp/calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. --- lisp/ChangeLog | 9 +++++++++ lisp/calc/calc-aent.el | 3 +-- lisp/calc/calc-map.el | 20 +++++++------------- lisp/calc/calc-store.el | 3 +-- lisp/calc/calc.el | 19 +++++++++---------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9d9949c3999..c7a15e11f92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,14 @@ 2012-09-20 Stefan Monnier + * calc/calc.el: Remove redundant autoload shape check. + (sel-mode): Don't defvar. + (calc-get-stack-element): Add `sel-mode' arg instead. + (calc-top, calc-top-list): Pass it this additional argument. + * calc/calc-store.el (calc-store-map): + * calc/calc-map.el (calc-apply, calc-reduce, calc-map) + (calc-map-equation, calc-outer-product, calc-inner-product): + * calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. + * emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. 2012-09-19 Juri Linkov diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 4b91a8c2002..4cca7fb7e7f 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -286,8 +286,7 @@ The value t means abort and give an error message.") ;;;###autoload (defun calc-alg-entry (&optional initial prompt) - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-plain-entry t) diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el index 2519e960e0e..9276e1a7832 100644 --- a/lisp/calc/calc-map.el +++ b/lisp/calc/calc-map.el @@ -32,8 +32,7 @@ (defun calc-apply (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Apply" @@ -53,11 +52,10 @@ (defun calc-reduce (&optional oper accum) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (nest (calc-is-hyperbolic)) + (let* ((nest (calc-is-hyperbolic)) (rev (calc-is-inverse)) (nargs (if (and nest (not rev)) 2 1)) - (calc-dollar-values (mapcar 'calc-get-stack-element + (calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir (and (not accum) (not nest) "")) @@ -99,8 +97,7 @@ (defun calc-map (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir "") @@ -120,8 +117,7 @@ (defun calc-map-equation (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Map-equation"))) @@ -152,8 +148,7 @@ (defun calc-outer-product (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Outer" 2)))) @@ -170,8 +165,7 @@ (defun calc-inner-product (&optional mul-oper add-oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (mul-oper (or mul-oper (calc-get-operator "Inner (Mult)" 2))) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 80d355ed5fa..64df10a40ca 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -235,8 +235,7 @@ (defun calc-store-map (&optional oper var) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Store Mapping"))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 17f0998d30b..8e49693562d 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -914,8 +914,7 @@ Used by `calc-user-invocation'.") ;; Set up the autoloading linkage. (let ((name (and (fboundp 'calc-dispatch) - (autoloadp (symbol-function 'calc-dispatch)) - (nth 1 (symbol-function 'calc-dispatch)))) + (autoloadp (symbol-function 'calc-dispatch)))) (p load-path)) ;; If Calc files exist on the load-path, we're all set. @@ -1353,12 +1352,12 @@ Notations: 3.14e6 3.14 * 10^6 \\{calc-mode-map} " (interactive) - (mapc (function + (mapc (function ;FIXME: Why (set-default v (symbol-value v)) ?!?!? (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) (kill-all-local-variables) (use-local-map (if (eq calc-algebraic-mode 'total) (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) - (mapc (function (lambda (v) (make-local-variable v))) calc-local-var-list) + (mapc #'make-local-variable calc-local-var-list) (make-local-variable 'overlay-arrow-position) (make-local-variable 'overlay-arrow-string) (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) @@ -1395,7 +1394,7 @@ Notations: 3.14e6 3.14 * 10^6 (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack))) (add-to-list 'calc-buffer-list (current-buffer) t)) -(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks +(defvar calc-check-defines 'calc-check-defines) ; Suitable for run-hooks. (defun calc-check-defines () (if (symbol-plist 'calc-define) (let ((plist (copy-sequence (symbol-plist 'calc-define)))) @@ -1943,8 +1942,7 @@ See calc-keypad for details." (delete-region (point) (point-max)))) (calc-set-command-flag 'renum-stack)))))) -(defvar sel-mode) -(defun calc-get-stack-element (x) +(defun calc-get-stack-element (x &optional sel-mode) (cond ((eq sel-mode 'entry) x) ((eq sel-mode 'sel) @@ -1961,9 +1959,9 @@ See calc-keypad for details." (defun calc-top (&optional n sel-mode) (or n (setq n 1)) (calc-check-stack n) - (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack))) + (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack) sel-mode)) -(defun calc-top-n (&optional n sel-mode) ; in case precision has changed +(defun calc-top-n (&optional n sel-mode) ; In case precision has changed. (math-check-complete (calc-normalize (calc-top n sel-mode)))) (defun calc-top-list (&optional n m sel-mode) @@ -1974,7 +1972,8 @@ See calc-keypad for details." (let ((top (copy-sequence (nthcdr (+ m calc-stack-top -1) calc-stack)))) (setcdr (nthcdr (1- n) top) nil) - (nreverse (mapcar 'calc-get-stack-element top))))) + (nreverse + (mapcar (lambda (x) (calc-get-stack-element x sel-mode)) top))))) (defun calc-top-list-n (&optional n m sel-mode) (mapcar 'math-check-complete -- 2.39.2