summaryrefslogtreecommitdiff
path: root/lisp/calculator.el
diff options
context:
space:
mode:
authorJuanma Barranquero <lekktu@gmail.com>2013-08-10 17:17:29 +0200
committerJuanma Barranquero <lekktu@gmail.com>2013-08-10 17:17:29 +0200
commit45fdb48240996f7ad9c8c03f438ecf7f5b925d8e (patch)
tree63d1b157c6391428d8641dd4bf25cceab50e7e84 /lisp/calculator.el
parentc880af52a62dda0900b8737b9e592700466e45ec (diff)
downloademacs-45fdb48240996f7ad9c8c03f438ecf7f5b925d8e.tar.gz
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument. (calculator-paste, calculator-quit, calculator-integer-p): Use ignore-errors. (calculator-string-to-number, calculator-decimal, calculator-exp) (calculator-op-or-exp): Use string-match-p. * dired-aux.el (dired-compress): Use ignore-errors. (dired-do-chxxx, dired-do-chmod, dired-trample-file-versions) (dired-do-async-shell-command, dired-do-shell-command) (dired-shell-stuff-it, dired-compress-file, dired-insert-subdir) (dired-insert-subdir-validate): Use string-match-p. (dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p. (dired-add-entry): Use string-match-p, looking-at-p. (dired-insert-subdir-newpos): Remove unused local variable. * dired.el (dired-buffer-more-recently-used-p): Declare. (dired-insert-set-properties, dired-insert-old-subdirs): Use ignore-errors. * filenotify.el (file-notify-callback): Remove unused local variable. * filesets.el (filesets-error): Mark unused argument. (filesets-which-command-p, filesets-filter-dir-names) (filesets-directory-files, filesets-get-external-viewer) (filesets-ingroup-get-data): Use string-match-p. * find-file.el (ff-other-file-name, ff-other-file-name) (ff-find-the-other-file, ff-cc-hh-converter): Remove unused local variables. (ff-get-file-name): Use string-match-p. (ff-all-dirs-under): Use ignore-errors. * follow.el (follow-comint-scroll-to-bottom): Mark unused argument. (follow-select-if-visible): Remove unused local variable. * forms.el (read-file-filter): Move declaration. (forms--make-format, forms--make-parser, forms-insert-record): Quote function with #'. (forms--update): Use string-match-p. Quote function with #'. * help-mode.el (help-dir-local-var-def): Mark unused argument. (help-make-xrefs): Use looking-at-p. (help-xref-on-pp): Use looking-at-p, ignore-errors. * ibuffer.el (ibuffer-ext-visible-p): Declare. (ibuffer-confirm-operation-on): Use string-match-p. * msb.el (msb-item-handler, msb-dired-item-handler): Mark unused arguments. * ses.el (ses-decode-cell-symbol) (ses-kill-override): Remove unused local variable. (ses-create-cell-variable, ses-relocate-formula): Use string-match-p. (ses-load): Use ignore-errors, looking-at-p. (ses-jump-safe): Use ignore-errors. (ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments. * tabify.el (untabify, tabify): Mark unused arguments. * thingatpt.el (thing-at-point--bounds-of-well-formed-url): Mark unused argument. (bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point) (thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
Diffstat (limited to 'lisp/calculator.el')
-rw-r--r--lisp/calculator.el36
1 files changed, 15 insertions, 21 deletions
diff --git a/lisp/calculator.el b/lisp/calculator.el
index 8b253b810f5..c9a73054712 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -708,7 +708,7 @@ See the documentation for `calculator-mode' for more information."
;; can't use 'noprompt, bug in electric.el
(lambda () 'noprompt)
nil
- (lambda (x y) (calculator-update-display))))
+ (lambda (_x _y) (calculator-update-display))))
(and calculator-buffer
(catch 'calculator-done (calculator-quit)))
(use-local-map old-l-map)
@@ -905,9 +905,9 @@ The string is set not to exceed the screen width."
value)
(car (read-from-string
(cond ((equal "." str) "0.0")
- ((string-match "[eE][+-]?$" str) (concat str "0"))
- ((string-match "\\.[0-9]\\|[eE]" str) str)
- ((string-match "\\." str)
+ ((string-match-p "[eE][+-]?$" str) (concat str "0"))
+ ((string-match-p "\\.[0-9]\\|[eE]" str) str)
+ ((string-match-p "\\." str)
;; do this because Emacs reads "23." as an integer
(concat str "0"))
((stringp str) (concat str ".0"))
@@ -1366,7 +1366,7 @@ OP is the operator (if any) that caused this call."
(or calculator-display-fragile
(not (numberp (car calculator-stack))))
(not (and calculator-curnum
- (string-match "[.eE]" calculator-curnum))))
+ (string-match-p "[.eE]" calculator-curnum))))
;; enter the period on the same condition as a digit, only if no
;; period or exponent entered yet
(progn
@@ -1382,7 +1382,7 @@ OP is the operator (if any) that caused this call."
(if (and (or calculator-display-fragile
(not (numberp (car calculator-stack))))
(not (and calculator-curnum
- (string-match "[eE]" calculator-curnum))))
+ (string-match-p "[eE]" calculator-curnum))))
;; same condition as above, also no E so far
(progn
(calculator-clear-fragile)
@@ -1452,7 +1452,7 @@ no need for negative numbers since these are handled by unary operators)."
(interactive)
(if (and (not calculator-display-fragile)
calculator-curnum
- (string-match "[eE]$" calculator-curnum))
+ (string-match-p "[eE]$" calculator-curnum))
(calculator-digit)
(calculator-op)))
@@ -1661,8 +1661,7 @@ Used by `calculator-paste' and `get-register'."
(setq str (concat (or (match-string 1 str) "0")
(or (match-string 2 str) ".0")
(or (match-string 3 str) ""))))
- (condition-case nil (calculator-string-to-number str)
- (error nil)))))
+ (ignore-errors (calculator-string-to-number str)))))
(defun calculator-get-register (reg)
"Get a value from a register REG."
@@ -1728,13 +1727,11 @@ Used by `calculator-paste' and `get-register'."
(interactive)
(set-buffer calculator-buffer)
(let ((inhibit-read-only t)) (erase-buffer))
- (if (not calculator-electric-mode)
- (progn
- (condition-case nil
- (while (get-buffer-window calculator-buffer)
- (delete-window (get-buffer-window calculator-buffer)))
- (error nil))
- (kill-buffer calculator-buffer)))
+ (unless calculator-electric-mode
+ (ignore-errors
+ (while (get-buffer-window calculator-buffer)
+ (delete-window (get-buffer-window calculator-buffer))))
+ (kill-buffer calculator-buffer))
(setq calculator-buffer nil)
(message "Calculator done.")
(if calculator-electric-mode (throw 'calculator-done nil)))
@@ -1768,14 +1765,11 @@ To use this, apply a binary operator (evaluate it), then call this."
(defun calculator-integer-p (x)
"Non-nil if X is equal to an integer."
- (condition-case nil
- (= x (ftruncate x))
- (error nil)))
+ (ignore-errors (= x (ftruncate x))))
(defun calculator-expt (x y)
"Compute X^Y, dealing with errors appropriately."
- (condition-case
- nil
+ (condition-case nil
(expt x y)
(domain-error 0.0e+NaN)
(range-error