]> git.eshelyaron.com Git - emacs.git/commitdiff
(toplevel): Require calc-macs.
authorEli Zaretskii <eliz@gnu.org>
Sun, 11 Nov 2001 10:33:50 +0000 (10:33 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sun, 11 Nov 2001 10:33:50 +0000 (10:33 +0000)
(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'.

lisp/ChangeLog
lisp/calc/calc.el

index 68aaedb38823b949e662ea1693607a46e4570ef4..2a395e7876ec50bec2964705c1dc67a5c36b27ad 100644 (file)
@@ -1,3 +1,34 @@
+2001-11-11  Colin Walters  <walters@verbum.org>
+
+       The following changes are based on patches from
+       Eli Zaretskii <eliz@is.elta.co.il>, Kai Gro\e,A_\e(Bjohann
+       <Kai.Grossjohann@CS.Uni-Dortmund.DE>, 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  <rms@gnu.org>
 
        * progmodes/compile.el (compile-goto-error): Fix previous change
index 9e09ff8e97764284fecfe60dc3582d4220f4cb5b..ba098fb16591a7f34908548af9ebae5eb26945aa 100644 (file)
 
 
 (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)))