Mercurial > emacs
changeset 40911:df97a382ad43
(toplevel): Require calc-macs.
(calc-minibuffer-size): New.
(calcDigit-nondigit): Use it instead of `buffer-size'.
(calcDigit-backspace): Likewise.
(calcDigit-nondigit): Use `minibuffer-contents' instead of `buffer-string'.
(calc-minibuffer-contains): Use `minibuffer-prompt-end' instead of `point-min'.
(calcDigit-key): Use `calc-minibuffer-contains' instead of a `save-excursion'.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sun, 11 Nov 2001 10:28:55 +0000 |
parents | c07c0f7a2c8e |
children | 689a6f179313 |
files | lisp/calc/calc.el |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/calc/calc.el Sun Nov 11 10:27:32 2001 +0000 +++ b/lisp/calc/calc.el Sun Nov 11 10:28:55 2001 +0000 @@ -67,11 +67,10 @@ (provide 'calc) - +(require 'calc-macs) (defun calc-record-compilation-date () - (calc-record-compilation-date-macro) -) + (calc-record-compilation-date-macro)) (calc-record-compilation-date) @@ -2046,16 +2045,19 @@ (calc-dots)))))) ) +(defsubst calc-minibuffer-size () + (- (point-max) (minibuffer-prompt-end))) + (defun calcDigit-nondigit () (interactive) ;; Exercise for the reader: Figure out why this is a good precaution! (or (boundp 'calc-buffer) (use-local-map minibuffer-local-map)) - (let ((str (buffer-string))) + (let ((str (minibuffer-contents))) (setq calc-digit-value (save-excursion (set-buffer calc-buffer) (math-read-number str)))) - (if (and (null calc-digit-value) (> (buffer-size) 0)) + (if (and (null calc-digit-value) (> (calc-minibuffer-size) 0)) (progn (beep) (calc-temp-minibuffer-message " [Bad format]")) @@ -2071,7 +2073,7 @@ (defun calc-minibuffer-contains (rex) (save-excursion - (goto-char (point-min)) + (goto-char (minibuffer-prompt-end)) (looking-at rex)) ) @@ -2158,10 +2160,8 @@ (upcase last-command-char)))) (and dig (< dig radix))))))) - (save-excursion - (goto-char (point-min)) - (looking-at - "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9]+\\.?0*[@oh] *\\)?\\([0-9]+\\.?0*['m] *\\)?[0-9]*\\(\\.?[0-9]*\\(e[-+]?[0-3]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\\)?\\|[0-9]:\\([0-9]+:\\)?[0-9]*\\)?[\"s]?\\'"))) + (calc-minibuffer-contains + "[-+]?\\(.*\\+/- *\\|.*mod *\\)?\\([0-9]+\\.?0*[@oh] *\\)?\\([0-9]+\\.?0*['m] *\\)?[0-9]*\\(\\.?[0-9]*\\(e[-+]?[0-3]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?\\)?\\|[0-9]:\\([0-9]+:\\)?[0-9]*\\)?[\"s]?\\'")) (if (and (memq last-command-char '(?@ ?o ?h ?\' ?m)) (string-match " " calc-hms-format)) (insert " ")) @@ -2190,7 +2190,7 @@ ((eq last-command 'calcDigit-start) (erase-buffer)) (t (backward-delete-char 1))) - (if (= (buffer-size) 0) + (if (= (calc-minibuffer-size) 0) (progn (setq last-command-char 13) (calcDigit-nondigit)))