From: Eli Zaretskii Date: Sun, 11 Nov 2001 10:33:50 +0000 (+0000) Subject: (toplevel): Require calc-macs. X-Git-Tag: ttn-vms-21-2-B4~18675 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=91e51f9a78a97e8d1a4d5d293ec675798e93b66e;p=emacs.git (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'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 68aaedb3882..2a395e7876e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,34 @@ +2001-11-11 Colin Walters + + The following changes are based on patches from + Eli Zaretskii , Kai Gro,A_(Bjohann + , and others. + + * calc/calc.el (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'. + + * calc/calc-macs.el (calc-record-compilation-date-macro): Return a + simple `setq' form. + + * calc/calc-ext.el: (toplevel): Require calc. + (calc-fancy-prefix-map): New. + (calc-fancy-prefix): Use it. + (calc-fancy-prefix-other-key): New. + + * calc/calc-aent.el (toplevel): Require calc-macs during compilation. + (calc-do-quick-calc): Use `frame-width' instead of `screen-width'. + (calcAlg-edit): Use `minibuffer-contents' instead of `buffer-string'. + (calcAlg-enter): Likewise. + (calcAlg-enter): Use `minibuffer-prompt-end' instead of `point-min'. + 2001-11-10 Richard M. Stallman * progmodes/compile.el (compile-goto-error): Fix previous change diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 9e09ff8e977..ba098fb1659 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -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 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." (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 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." (defun calc-minibuffer-contains (rex) (save-excursion - (goto-char (point-min)) + (goto-char (minibuffer-prompt-end)) (looking-at rex)) ) @@ -2158,10 +2160,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." (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 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack." ((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)))