aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2015-10-08 22:25:38 -0400
committerStefan Monnier2015-10-08 22:25:38 -0400
commit111cebc0c7b86c1ce3507a32e19de5a32a9d2225 (patch)
tree52f7d147071c3622cd965e10394cb15215fab59f
parentb3154551bc501ba46983ce2cc943100cfb803f8c (diff)
downloademacs-111cebc0c7b86c1ce3507a32e19de5a32a9d2225.tar.gz
emacs-111cebc0c7b86c1ce3507a32e19de5a32a9d2225.zip
* lisp/calc/calc.el: Silence byte-compiler warnings
(calc-scan-for-dels): Use ignore-errors. (calc-dispatch, calc-do-dispatch): Make unused arg optional. (calc-read-key-sequence): Remove unused var `prompt2'. (calc-kill-stack-buffer): Remove unused var `buflist'. (calc): Remove unused var `oldbuf'. (calc-refresh): Use inhibit-read-only. (calc-can-abbrev-vectors): Declare. (calc-record): Remove unused var `mainbuf'. (math-sub-bignum): Remove unused var `sum'. (math-svo-c, math-svo-wid, math-svo-off): Declare.
-rw-r--r--lisp/calc/calc.el148
1 files changed, 74 insertions, 74 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 0709c619f3d..e44226d8702 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1105,20 +1105,18 @@ Used by `calc-user-invocation'.")
1105 "The key map for entering Calc digits.") 1105 "The key map for entering Calc digits.")
1106 1106
1107(mapc (lambda (x) 1107(mapc (lambda (x)
1108 (condition-case err 1108 (ignore-errors
1109 (progn 1109 (define-key calc-digit-map x 'calcDigit-backspace)
1110 (define-key calc-digit-map x 'calcDigit-backspace) 1110 (define-key calc-mode-map x 'calc-pop)
1111 (define-key calc-mode-map x 'calc-pop) 1111 (define-key calc-mode-map
1112 (define-key calc-mode-map 1112 (if (and (vectorp x) (featurep 'xemacs))
1113 (if (and (vectorp x) (featurep 'xemacs)) 1113 (if (= (length x) 1)
1114 (if (= (length x) 1) 1114 (vector (if (consp (aref x 0))
1115 (vector (if (consp (aref x 0)) 1115 (cons 'meta (aref x 0))
1116 (cons 'meta (aref x 0)) 1116 (list 'meta (aref x 0))))
1117 (list 'meta (aref x 0)))) 1117 "\e\C-d")
1118 "\e\C-d") 1118 (vconcat "\e" x))
1119 (vconcat "\e" x)) 1119 'calc-pop-above)))
1120 'calc-pop-above))
1121 (error nil)))
1122 (if calc-scan-for-dels 1120 (if calc-scan-for-dels
1123 (append (where-is-internal 'delete-backward-char global-map) 1121 (append (where-is-internal 'delete-backward-char global-map)
1124 (where-is-internal 'backward-delete-char global-map) 1122 (where-is-internal 'backward-delete-char global-map)
@@ -1189,25 +1187,24 @@ Used by `calc-user-invocation'.")
1189;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch) 1187;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch)
1190 1188
1191;;;###autoload 1189;;;###autoload
1192(defun calc-dispatch (&optional arg) 1190(defun calc-dispatch (&optional _arg)
1193 "Invoke the GNU Emacs Calculator. See \\[calc-dispatch-help] for details." 1191 "Invoke the GNU Emacs Calculator. See \\[calc-dispatch-help] for details."
1194 (interactive "P") 1192 (interactive)
1195; (sit-for echo-keystrokes) 1193; (sit-for echo-keystrokes)
1196 (condition-case err ; look for other keys bound to calc-dispatch 1194 (ignore-errors ; look for other keys bound to calc-dispatch
1197 (let ((keys (this-command-keys))) 1195 (let ((keys (this-command-keys)))
1198 (unless (or (not (stringp keys)) 1196 (unless (or (not (stringp keys))
1199 (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" keys) 1197 (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" keys)
1200 (eq (lookup-key calc-dispatch-map keys) 'calc-same-interface)) 1198 (eq (lookup-key calc-dispatch-map keys) 'calc-same-interface))
1201 (when (and (string-match "\\`[\C-@-\C-_]" keys) 1199 (when (and (string-match "\\`[\C-@-\C-_]" keys)
1202 (symbolp 1200 (symbolp
1203 (lookup-key calc-dispatch-map (substring keys 0 1)))) 1201 (lookup-key calc-dispatch-map (substring keys 0 1))))
1204 (define-key calc-dispatch-map (substring keys 0 1) nil)) 1202 (define-key calc-dispatch-map (substring keys 0 1) nil))
1205 (define-key calc-dispatch-map keys 'calc-same-interface))) 1203 (define-key calc-dispatch-map keys 'calc-same-interface))))
1206 (error nil)) 1204 (calc-do-dispatch))
1207 (calc-do-dispatch arg))
1208 1205
1209(defvar calc-dispatch-help nil) 1206(defvar calc-dispatch-help nil)
1210(defun calc-do-dispatch (arg) 1207(defun calc-do-dispatch (&optional _arg)
1211 "Start the Calculator." 1208 "Start the Calculator."
1212 (let ((key (calc-read-key-sequence 1209 (let ((key (calc-read-key-sequence
1213 (if calc-dispatch-help 1210 (if calc-dispatch-help
@@ -1225,8 +1222,7 @@ Used by `calc-user-invocation'.")
1225 1222
1226(defun calc-read-key-sequence (prompt map) 1223(defun calc-read-key-sequence (prompt map)
1227 "Read keys, with prompt PROMPT and keymap MAP." 1224 "Read keys, with prompt PROMPT and keymap MAP."
1228 (let ((prompt2 (format "%s " (key-description (this-command-keys)))) 1225 (let ((glob (current-global-map))
1229 (glob (current-global-map))
1230 (loc (current-local-map))) 1226 (loc (current-local-map)))
1231 (or (input-pending-p) (message "%s" prompt)) 1227 (or (input-pending-p) (message "%s" prompt))
1232 (let ((key (calc-read-key t)) 1228 (let ((key (calc-read-key t))
@@ -1254,7 +1250,6 @@ embedded information from the appropriate buffers and tidy up
1254the trail buffer." 1250the trail buffer."
1255 (let ((cb (current-buffer)) 1251 (let ((cb (current-buffer))
1256 (info-list nil) 1252 (info-list nil)
1257 (buflist)
1258; (plural nil) 1253; (plural nil)
1259 (cea calc-embedded-active)) 1254 (cea calc-embedded-active))
1260 ;; Get a list of all buffers using this buffer for 1255 ;; Get a list of all buffers using this buffer for
@@ -1448,42 +1443,41 @@ commands given here will actually operate on the *Calculator* stack."
1448 (set-buffer (window-buffer))) 1443 (set-buffer (window-buffer)))
1449 (if (derived-mode-p 'calc-mode) 1444 (if (derived-mode-p 'calc-mode)
1450 (calc-quit) 1445 (calc-quit)
1451 (let ((oldbuf (current-buffer))) 1446 (calc-create-buffer)
1452 (calc-create-buffer) 1447 (setq calc-was-keypad-mode nil)
1453 (setq calc-was-keypad-mode nil) 1448 (if (or (eq full-display t)
1454 (if (or (eq full-display t) 1449 (and (null full-display) calc-full-mode))
1455 (and (null full-display) calc-full-mode)) 1450 (switch-to-buffer (current-buffer) t)
1456 (switch-to-buffer (current-buffer) t) 1451 (if (get-buffer-window (current-buffer))
1457 (if (get-buffer-window (current-buffer)) 1452 (select-window (get-buffer-window (current-buffer)))
1458 (select-window (get-buffer-window (current-buffer))) 1453 (if calc-window-hook
1459 (if calc-window-hook 1454 (run-hooks 'calc-window-hook)
1460 (run-hooks 'calc-window-hook) 1455 (let ((w (get-largest-window)))
1461 (let ((w (get-largest-window))) 1456 (if (and pop-up-windows
1462 (if (and pop-up-windows 1457 (> (window-height w)
1463 (> (window-height w) 1458 (+ window-min-height calc-window-height 2)))
1464 (+ window-min-height calc-window-height 2))) 1459 (progn
1465 (progn 1460 (setq w (split-window w
1466 (setq w (split-window w 1461 (- (window-height w)
1467 (- (window-height w) 1462 calc-window-height 2)
1468 calc-window-height 2) 1463 nil))
1469 nil)) 1464 (set-window-buffer w (current-buffer))
1470 (set-window-buffer w (current-buffer)) 1465 (select-window w))
1471 (select-window w)) 1466 (pop-to-buffer (current-buffer)))))))
1472 (pop-to-buffer (current-buffer))))))) 1467 (with-current-buffer (calc-trail-buffer)
1473 (with-current-buffer (calc-trail-buffer) 1468 (and calc-display-trail
1474 (and calc-display-trail 1469 (= (window-width) (frame-width))
1475 (= (window-width) (frame-width)) 1470 (calc-trail-display 1 t)))
1476 (calc-trail-display 1 t))) 1471 (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit")
1477 (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") 1472 (run-hooks 'calc-start-hook)
1478 (run-hooks 'calc-start-hook) 1473 (and (windowp full-display)
1479 (and (windowp full-display) 1474 (window-point full-display)
1480 (window-point full-display) 1475 (select-window full-display))
1481 (select-window full-display)) 1476 (calc-check-defines)
1482 (calc-check-defines) 1477 (when (and calc-said-hello interactive)
1483 (when (and calc-said-hello interactive) 1478 (sit-for 2)
1484 (sit-for 2) 1479 (message ""))
1485 (message "")) 1480 (setq calc-said-hello t))))
1486 (setq calc-said-hello t)))))
1487 1481
1488;;;###autoload 1482;;;###autoload
1489(defun full-calc (&optional interactive) 1483(defun full-calc (&optional interactive)
@@ -1999,9 +1993,9 @@ See calc-keypad for details."
1999 (interactive) 1993 (interactive)
2000 (and (derived-mode-p 'calc-mode) 1994 (and (derived-mode-p 'calc-mode)
2001 (not calc-executing-macro) 1995 (not calc-executing-macro)
2002 (let* ((buffer-read-only nil) 1996 (let* ((inhibit-read-only t)
2003 (save-point (point)) 1997 (save-point (point))
2004 (save-mark (condition-case err (mark) (error nil))) 1998 (save-mark (ignore-errors (mark)))
2005 (save-aligned (looking-at "\\.$")) 1999 (save-aligned (looking-at "\\.$"))
2006 (thing calc-stack) 2000 (thing calc-stack)
2007 (calc-any-evaltos nil)) 2001 (calc-any-evaltos nil))
@@ -2102,11 +2096,12 @@ the United States."
2102 (setq calc-trail-pointer (point-marker)))) 2096 (setq calc-trail-pointer (point-marker))))
2103 calc-trail-buffer) 2097 calc-trail-buffer)
2104 2098
2099(defvar calc-can-abbrev-vectors)
2100
2105(defun calc-record (val &optional prefix) 2101(defun calc-record (val &optional prefix)
2106 (setq calc-aborted-prefix nil) 2102 (setq calc-aborted-prefix nil)
2107 (or calc-executing-macro 2103 (or calc-executing-macro
2108 (let* ((mainbuf (current-buffer)) 2104 (let* ((buf (calc-trail-buffer))
2109 (buf (calc-trail-buffer))
2110 (calc-display-raw nil) 2105 (calc-display-raw nil)
2111 (calc-can-abbrev-vectors t) 2106 (calc-can-abbrev-vectors t)
2112 (fval (if val 2107 (fval (if val
@@ -3052,7 +3047,7 @@ largest Emacs integer.")
3052(defun math-sub-bignum (a b) ; [l l l] 3047(defun math-sub-bignum (a b) ; [l l l]
3053 (if b 3048 (if b
3054 (if a 3049 (if a
3055 (let* ((a (copy-sequence a)) (aa a) (borrow nil) sum diff) 3050 (let* ((a (copy-sequence a)) (aa a) (borrow nil) diff)
3056 (while (and aa b) 3051 (while (and aa b)
3057 (if borrow 3052 (if borrow
3058 (if (>= (setq diff (- (car aa) (car b))) 1) 3053 (if (>= (setq diff (- (car aa) (car b))) 1)
@@ -3206,7 +3201,8 @@ largest Emacs integer.")
3206 aa a) 3201 aa a)
3207 (while (progn 3202 (while (progn
3208 (setcar ss (% (setq prod (+ (+ (car ss) (* (car aa) d)) 3203 (setcar ss (% (setq prod (+ (+ (car ss) (* (car aa) d))
3209 c)) math-bignum-digit-size)) 3204 c))
3205 math-bignum-digit-size))
3210 (setq aa (cdr aa))) 3206 (setq aa (cdr aa)))
3211 (setq c (/ prod math-bignum-digit-size) 3207 (setq c (/ prod math-bignum-digit-size)
3212 ss (or (cdr ss) (setcdr ss (list 0))))) 3208 ss (or (cdr ss) (setcdr ss (list 0)))))
@@ -3441,6 +3437,10 @@ largest Emacs integer.")
3441;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy 3437;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy
3442;; in calccomp.el. 3438;; in calccomp.el.
3443 3439
3440(defvar math-svo-c)
3441(defvar math-svo-wid)
3442(defvar math-svo-off)
3443
3444(defun math-stack-value-offset (math-svo-c) 3444(defun math-stack-value-offset (math-svo-c)
3445 (let* ((num (if calc-line-numbering 4 0)) 3445 (let* ((num (if calc-line-numbering 4 0))
3446 (math-svo-wid (calc-window-width)) 3446 (math-svo-wid (calc-window-width))