+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
(provide 'calc)
-
+(require 'calc-macs)
(defun calc-record-compilation-date ()
- (calc-record-compilation-date-macro)
-)
+ (calc-record-compilation-date-macro))
(calc-record-compilation-date)
(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]"))
(defun calc-minibuffer-contains (rex)
(save-excursion
- (goto-char (point-min))
+ (goto-char (minibuffer-prompt-end))
(looking-at rex))
)
(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 " "))
((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)))