emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 111cebc: * lisp/calc/calc.el: Silence byte-compiler


From: Stefan Monnier
Subject: [Emacs-diffs] master 111cebc: * lisp/calc/calc.el: Silence byte-compiler warnings
Date: Fri, 09 Oct 2015 02:25:44 +0000

branch: master
commit 111cebc0c7b86c1ce3507a32e19de5a32a9d2225
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
---
 lisp/calc/calc.el |  148 ++++++++++++++++++++++++++--------------------------
 1 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 0709c61..e44226d 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1105,20 +1105,18 @@ Used by `calc-user-invocation'.")
   "The key map for entering Calc digits.")
 
 (mapc (lambda (x)
-       (condition-case err
-           (progn
-             (define-key calc-digit-map x 'calcDigit-backspace)
-             (define-key calc-mode-map x 'calc-pop)
-             (define-key calc-mode-map
-                (if (and (vectorp x) (featurep 'xemacs))
-                    (if (= (length x) 1)
-                        (vector (if (consp (aref x 0))
-                                    (cons 'meta (aref x 0))
-                                  (list 'meta (aref x 0))))
-                      "\e\C-d")
-                  (vconcat "\e" x))
-               'calc-pop-above))
-         (error nil)))
+       (ignore-errors
+          (define-key calc-digit-map x 'calcDigit-backspace)
+          (define-key calc-mode-map x 'calc-pop)
+          (define-key calc-mode-map
+            (if (and (vectorp x) (featurep 'xemacs))
+                (if (= (length x) 1)
+                    (vector (if (consp (aref x 0))
+                                (cons 'meta (aref x 0))
+                              (list 'meta (aref x 0))))
+                  "\e\C-d")
+              (vconcat "\e" x))
+            'calc-pop-above)))
       (if calc-scan-for-dels
          (append (where-is-internal 'delete-backward-char global-map)
                  (where-is-internal 'backward-delete-char global-map)
@@ -1189,25 +1187,24 @@ Used by `calc-user-invocation'.")
 ;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch)
 
 ;;;###autoload
-(defun calc-dispatch (&optional arg)
+(defun calc-dispatch (&optional _arg)
   "Invoke the GNU Emacs Calculator.  See \\[calc-dispatch-help] for details."
-  (interactive "P")
+  (interactive)
 ;  (sit-for echo-keystrokes)
-  (condition-case err   ; look for other keys bound to calc-dispatch
-      (let ((keys (this-command-keys)))
-       (unless (or (not (stringp keys))
-                   (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" 
keys)
-                   (eq (lookup-key calc-dispatch-map keys) 
'calc-same-interface))
-         (when (and (string-match "address@hidden" keys)
-                    (symbolp
-                     (lookup-key calc-dispatch-map (substring keys 0 1))))
-           (define-key calc-dispatch-map (substring keys 0 1) nil))
-         (define-key calc-dispatch-map keys 'calc-same-interface)))
-    (error nil))
-  (calc-do-dispatch arg))
+  (ignore-errors                   ; look for other keys bound to calc-dispatch
+    (let ((keys (this-command-keys)))
+      (unless (or (not (stringp keys))
+                  (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" 
keys)
+                  (eq (lookup-key calc-dispatch-map keys) 
'calc-same-interface))
+        (when (and (string-match "address@hidden" keys)
+                   (symbolp
+                    (lookup-key calc-dispatch-map (substring keys 0 1))))
+          (define-key calc-dispatch-map (substring keys 0 1) nil))
+        (define-key calc-dispatch-map keys 'calc-same-interface))))
+  (calc-do-dispatch))
 
 (defvar calc-dispatch-help nil)
-(defun calc-do-dispatch (arg)
+(defun calc-do-dispatch (&optional _arg)
   "Start the Calculator."
   (let ((key (calc-read-key-sequence
              (if calc-dispatch-help
@@ -1225,8 +1222,7 @@ Used by `calc-user-invocation'.")
 
 (defun calc-read-key-sequence (prompt map)
   "Read keys, with prompt PROMPT and keymap MAP."
-  (let ((prompt2 (format "%s " (key-description (this-command-keys))))
-       (glob (current-global-map))
+  (let ((glob (current-global-map))
        (loc (current-local-map)))
     (or (input-pending-p) (message "%s" prompt))
     (let ((key (calc-read-key t))
@@ -1254,7 +1250,6 @@ embedded information from the appropriate buffers and 
tidy up
 the trail buffer."
   (let ((cb (current-buffer))
         (info-list nil)
-        (buflist)
 ;        (plural nil)
         (cea calc-embedded-active))
     ;; Get a list of all buffers using this buffer for
@@ -1448,42 +1443,41 @@ commands given here will actually operate on the 
*Calculator* stack."
       (set-buffer (window-buffer)))
     (if (derived-mode-p 'calc-mode)
        (calc-quit)
-      (let ((oldbuf (current-buffer)))
-       (calc-create-buffer)
-       (setq calc-was-keypad-mode nil)
-       (if (or (eq full-display t)
-               (and (null full-display) calc-full-mode))
-           (switch-to-buffer (current-buffer) t)
-         (if (get-buffer-window (current-buffer))
-             (select-window (get-buffer-window (current-buffer)))
-            (if calc-window-hook
-                (run-hooks 'calc-window-hook)
-              (let ((w (get-largest-window)))
-                (if (and pop-up-windows
-                         (> (window-height w)
-                            (+ window-min-height calc-window-height 2)))
-                    (progn
-                      (setq w (split-window w
-                                            (- (window-height w)
-                                               calc-window-height 2)
-                                            nil))
-                      (set-window-buffer w (current-buffer))
-                      (select-window w))
-                  (pop-to-buffer (current-buffer)))))))
-       (with-current-buffer (calc-trail-buffer)
-         (and calc-display-trail
-              (= (window-width) (frame-width))
-              (calc-trail-display 1 t)))
-       (message "Welcome to the GNU Emacs Calculator!  Press `?' or `h' for 
help, `q' to quit")
-       (run-hooks 'calc-start-hook)
-       (and (windowp full-display)
-            (window-point full-display)
-            (select-window full-display))
-       (calc-check-defines)
-       (when (and calc-said-hello interactive)
-         (sit-for 2)
-         (message ""))
-       (setq calc-said-hello t)))))
+      (calc-create-buffer)
+      (setq calc-was-keypad-mode nil)
+      (if (or (eq full-display t)
+              (and (null full-display) calc-full-mode))
+          (switch-to-buffer (current-buffer) t)
+        (if (get-buffer-window (current-buffer))
+            (select-window (get-buffer-window (current-buffer)))
+          (if calc-window-hook
+              (run-hooks 'calc-window-hook)
+            (let ((w (get-largest-window)))
+              (if (and pop-up-windows
+                       (> (window-height w)
+                          (+ window-min-height calc-window-height 2)))
+                  (progn
+                    (setq w (split-window w
+                                          (- (window-height w)
+                                             calc-window-height 2)
+                                          nil))
+                    (set-window-buffer w (current-buffer))
+                    (select-window w))
+                (pop-to-buffer (current-buffer)))))))
+      (with-current-buffer (calc-trail-buffer)
+        (and calc-display-trail
+             (= (window-width) (frame-width))
+             (calc-trail-display 1 t)))
+      (message "Welcome to the GNU Emacs Calculator!  Press `?' or `h' for 
help, `q' to quit")
+      (run-hooks 'calc-start-hook)
+      (and (windowp full-display)
+           (window-point full-display)
+           (select-window full-display))
+      (calc-check-defines)
+      (when (and calc-said-hello interactive)
+        (sit-for 2)
+        (message ""))
+      (setq calc-said-hello t))))
 
 ;;;###autoload
 (defun full-calc (&optional interactive)
@@ -1999,9 +1993,9 @@ See calc-keypad for details."
   (interactive)
   (and (derived-mode-p 'calc-mode)
        (not calc-executing-macro)
-       (let* ((buffer-read-only nil)
+       (let* ((inhibit-read-only t)
              (save-point (point))
-             (save-mark (condition-case err (mark) (error nil)))
+             (save-mark (ignore-errors (mark)))
              (save-aligned (looking-at "\\.$"))
              (thing calc-stack)
              (calc-any-evaltos nil))
@@ -2102,11 +2096,12 @@ the United States."
        (setq calc-trail-pointer (point-marker))))
   calc-trail-buffer)
 
+(defvar calc-can-abbrev-vectors)
+
 (defun calc-record (val &optional prefix)
   (setq calc-aborted-prefix nil)
   (or calc-executing-macro
-      (let* ((mainbuf (current-buffer))
-            (buf (calc-trail-buffer))
+      (let* ((buf (calc-trail-buffer))
             (calc-display-raw nil)
             (calc-can-abbrev-vectors t)
             (fval (if val
@@ -3052,7 +3047,7 @@ largest Emacs integer.")
 (defun math-sub-bignum (a b)   ; [l l l]
   (if b
       (if a
-         (let* ((a (copy-sequence a)) (aa a) (borrow nil) sum diff)
+         (let* ((a (copy-sequence a)) (aa a) (borrow nil) diff)
            (while (and aa b)
              (if borrow
                  (if (>= (setq diff (- (car aa) (car b))) 1)
@@ -3206,7 +3201,8 @@ largest Emacs integer.")
                 aa a)
           (while (progn
                    (setcar ss (% (setq prod (+ (+ (car ss) (* (car aa) d))
-                                               c)) math-bignum-digit-size))
+                                               c))
+                                  math-bignum-digit-size))
                    (setq aa (cdr aa)))
             (setq c (/ prod math-bignum-digit-size)
                   ss (or (cdr ss) (setcdr ss (list 0)))))
@@ -3441,6 +3437,10 @@ largest Emacs integer.")
 ;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy
 ;; in calccomp.el.
 
+(defvar math-svo-c)
+(defvar math-svo-wid)
+(defvar math-svo-off)
+
 (defun math-stack-value-offset (math-svo-c)
   (let* ((num (if calc-line-numbering 4 0))
         (math-svo-wid (calc-window-width))



reply via email to

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