67 |
|
|
68 |
|
|
69 |
(provide 'calc) |
(provide 'calc) |
70 |
|
(require 'calc-macs) |
71 |
|
|
72 |
(defun calc-record-compilation-date () |
(defun calc-record-compilation-date () |
73 |
(calc-record-compilation-date-macro) |
(calc-record-compilation-date-macro)) |
|
) |
|
74 |
(calc-record-compilation-date) |
(calc-record-compilation-date) |
75 |
|
|
76 |
|
|
2045 |
(calc-dots)))))) |
(calc-dots)))))) |
2046 |
) |
) |
2047 |
|
|
2048 |
|
(defsubst calc-minibuffer-size () |
2049 |
|
(- (point-max) (minibuffer-prompt-end))) |
2050 |
|
|
2051 |
(defun calcDigit-nondigit () |
(defun calcDigit-nondigit () |
2052 |
(interactive) |
(interactive) |
2053 |
;; Exercise for the reader: Figure out why this is a good precaution! |
;; Exercise for the reader: Figure out why this is a good precaution! |
2054 |
(or (boundp 'calc-buffer) |
(or (boundp 'calc-buffer) |
2055 |
(use-local-map minibuffer-local-map)) |
(use-local-map minibuffer-local-map)) |
2056 |
(let ((str (buffer-string))) |
(let ((str (minibuffer-contents))) |
2057 |
(setq calc-digit-value (save-excursion |
(setq calc-digit-value (save-excursion |
2058 |
(set-buffer calc-buffer) |
(set-buffer calc-buffer) |
2059 |
(math-read-number str)))) |
(math-read-number str)))) |
2060 |
(if (and (null calc-digit-value) (> (buffer-size) 0)) |
(if (and (null calc-digit-value) (> (calc-minibuffer-size) 0)) |
2061 |
(progn |
(progn |
2062 |
(beep) |
(beep) |
2063 |
(calc-temp-minibuffer-message " [Bad format]")) |
(calc-temp-minibuffer-message " [Bad format]")) |
2073 |
|
|
2074 |
(defun calc-minibuffer-contains (rex) |
(defun calc-minibuffer-contains (rex) |
2075 |
(save-excursion |
(save-excursion |
2076 |
(goto-char (point-min)) |
(goto-char (minibuffer-prompt-end)) |
2077 |
(looking-at rex)) |
(looking-at rex)) |
2078 |
) |
) |
2079 |
|
|
2160 |
(upcase last-command-char)))) |
(upcase last-command-char)))) |
2161 |
(and dig |
(and dig |
2162 |
(< dig radix))))))) |
(< dig radix))))))) |
2163 |
(save-excursion |
(calc-minibuffer-contains |
2164 |
(goto-char (point-min)) |
"[-+]?\\(.*\\+/- *\\|.*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]?\\'")) |
|
(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]?\\'"))) |
|
2165 |
(if (and (memq last-command-char '(?@ ?o ?h ?\' ?m)) |
(if (and (memq last-command-char '(?@ ?o ?h ?\' ?m)) |
2166 |
(string-match " " calc-hms-format)) |
(string-match " " calc-hms-format)) |
2167 |
(insert " ")) |
(insert " ")) |
2190 |
((eq last-command 'calcDigit-start) |
((eq last-command 'calcDigit-start) |
2191 |
(erase-buffer)) |
(erase-buffer)) |
2192 |
(t (backward-delete-char 1))) |
(t (backward-delete-char 1))) |
2193 |
(if (= (buffer-size) 0) |
(if (= (calc-minibuffer-size) 0) |
2194 |
(progn |
(progn |
2195 |
(setq last-command-char 13) |
(setq last-command-char 13) |
2196 |
(calcDigit-nondigit))) |
(calcDigit-nondigit))) |