aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2001-11-11 10:33:50 +0000
committerEli Zaretskii2001-11-11 10:33:50 +0000
commit91e51f9a78a97e8d1a4d5d293ec675798e93b66e (patch)
tree9c4ab5e2213e60d05ad5d4cc70f2f10ad073d0d5
parentcb765059d7378e8d6b6904c0a73f49fc3f11ff66 (diff)
downloademacs-91e51f9a78a97e8d1a4d5d293ec675798e93b66e.tar.gz
emacs-91e51f9a78a97e8d1a4d5d293ec675798e93b66e.zip
(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'.
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/calc/calc.el22
2 files changed, 42 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 68aaedb3882..2a395e7876e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,34 @@
12001-11-11 Colin Walters <walters@verbum.org>
2
3 The following changes are based on patches from
4 Eli Zaretskii <eliz@is.elta.co.il>, Kai Gro,A_(Bjohann
5 <Kai.Grossjohann@CS.Uni-Dortmund.DE>, and others.
6
7 * calc/calc.el (toplevel): Require calc-macs.
8 (calc-minibuffer-size): New.
9 (calcDigit-nondigit): Use it instead of `buffer-size'.
10 (calcDigit-backspace): Likewise.
11 (calcDigit-nondigit): Use `minibuffer-contents' instead of
12 `buffer-string'.
13 (calc-minibuffer-contains): Use `minibuffer-prompt-end' instead of
14 `point-min'.
15 (calcDigit-key): Use `calc-minibuffer-contains' instead of a
16 `save-excursion'.
17
18 * calc/calc-macs.el (calc-record-compilation-date-macro): Return a
19 simple `setq' form.
20
21 * calc/calc-ext.el: (toplevel): Require calc.
22 (calc-fancy-prefix-map): New.
23 (calc-fancy-prefix): Use it.
24 (calc-fancy-prefix-other-key): New.
25
26 * calc/calc-aent.el (toplevel): Require calc-macs during compilation.
27 (calc-do-quick-calc): Use `frame-width' instead of `screen-width'.
28 (calcAlg-edit): Use `minibuffer-contents' instead of `buffer-string'.
29 (calcAlg-enter): Likewise.
30 (calcAlg-enter): Use `minibuffer-prompt-end' instead of `point-min'.
31
12001-11-10 Richard M. Stallman <rms@gnu.org> 322001-11-10 Richard M. Stallman <rms@gnu.org>
2 33
3 * progmodes/compile.el (compile-goto-error): Fix previous change 34 * 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 @@
67 67
68 68
69(provide 'calc) 69(provide 'calc)
70 70(require 'calc-macs)
71 71
72(defun calc-record-compilation-date () 72(defun calc-record-compilation-date ()
73 (calc-record-compilation-date-macro) 73 (calc-record-compilation-date-macro))
74)
75(calc-record-compilation-date) 74(calc-record-compilation-date)
76 75
77 76
@@ -2046,16 +2045,19 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2046 (calc-dots)))))) 2045 (calc-dots))))))
2047) 2046)
2048 2047
2048(defsubst calc-minibuffer-size ()
2049 (- (point-max) (minibuffer-prompt-end)))
2050
2049(defun calcDigit-nondigit () 2051(defun calcDigit-nondigit ()
2050 (interactive) 2052 (interactive)
2051 ;; Exercise for the reader: Figure out why this is a good precaution! 2053 ;; Exercise for the reader: Figure out why this is a good precaution!
2052 (or (boundp 'calc-buffer) 2054 (or (boundp 'calc-buffer)
2053 (use-local-map minibuffer-local-map)) 2055 (use-local-map minibuffer-local-map))
2054 (let ((str (buffer-string))) 2056 (let ((str (minibuffer-contents)))
2055 (setq calc-digit-value (save-excursion 2057 (setq calc-digit-value (save-excursion
2056 (set-buffer calc-buffer) 2058 (set-buffer calc-buffer)
2057 (math-read-number str)))) 2059 (math-read-number str))))
2058 (if (and (null calc-digit-value) (> (buffer-size) 0)) 2060 (if (and (null calc-digit-value) (> (calc-minibuffer-size) 0))
2059 (progn 2061 (progn
2060 (beep) 2062 (beep)
2061 (calc-temp-minibuffer-message " [Bad format]")) 2063 (calc-temp-minibuffer-message " [Bad format]"))
@@ -2071,7 +2073,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2071 2073
2072(defun calc-minibuffer-contains (rex) 2074(defun calc-minibuffer-contains (rex)
2073 (save-excursion 2075 (save-excursion
2074 (goto-char (point-min)) 2076 (goto-char (minibuffer-prompt-end))
2075 (looking-at rex)) 2077 (looking-at rex))
2076) 2078)
2077 2079
@@ -2158,10 +2160,8 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2158 (upcase last-command-char)))) 2160 (upcase last-command-char))))
2159 (and dig 2161 (and dig
2160 (< dig radix))))))) 2162 (< dig radix)))))))
2161 (save-excursion 2163 (calc-minibuffer-contains
2162 (goto-char (point-min)) 2164 "[-+]?\\(.*\\+/- *\\|.*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]?\\'"))
2163 (looking-at
2164 "[-+]?\\(.*\\+/- *\\|.*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]?\\'")))
2165 (if (and (memq last-command-char '(?@ ?o ?h ?\' ?m)) 2165 (if (and (memq last-command-char '(?@ ?o ?h ?\' ?m))
2166 (string-match " " calc-hms-format)) 2166 (string-match " " calc-hms-format))
2167 (insert " ")) 2167 (insert " "))
@@ -2190,7 +2190,7 @@ If mouse is pressed in Calc window, push cut buffer contents onto the stack."
2190 ((eq last-command 'calcDigit-start) 2190 ((eq last-command 'calcDigit-start)
2191 (erase-buffer)) 2191 (erase-buffer))
2192 (t (backward-delete-char 1))) 2192 (t (backward-delete-char 1)))
2193 (if (= (buffer-size) 0) 2193 (if (= (calc-minibuffer-size) 0)
2194 (progn 2194 (progn
2195 (setq last-command-char 13) 2195 (setq last-command-char 13)
2196 (calcDigit-nondigit))) 2196 (calcDigit-nondigit)))