comparison lisp/calc/calc-aent.el @ 40909:09249b7679f6

(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'.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 11 Nov 2001 10:26:44 +0000
parents 2fb9d407ae73
children e29926a2ef59
comparison
equal deleted inserted replaced
40908:d277eddc41c4 40909:09249b7679f6
23 23
24 ;; This file is autoloaded from calc.el. 24 ;; This file is autoloaded from calc.el.
25 (require 'calc) 25 (require 'calc)
26 26
27 (require 'calc-macs) 27 (require 'calc-macs)
28 (eval-when-compile '(require calc-macs))
28 29
29 (defun calc-Need-calc-aent () nil) 30 (defun calc-Need-calc-aent () nil)
30 31
31 32
32 (defun calc-do-quick-calc () 33 (defun calc-do-quick-calc ()
83 (> (car alg-exp) 0) 84 (> (car alg-exp) 0)
84 (< (car alg-exp) 127)) 85 (< (car alg-exp) 127))
85 (format ", \"%c\"" (car alg-exp)) 86 (format ", \"%c\"" (car alg-exp))
86 "") 87 "")
87 ")"))) 88 ")")))
88 (if (and (< (length buf) (screen-width)) (= (length entry) 1) 89 (if (and (< (length buf) (frame-width)) (= (length entry) 1)
89 calc-extensions-loaded) 90 calc-extensions-loaded)
90 (let ((long (concat (math-format-value (car entry) 1000) 91 (let ((long (concat (math-format-value (car entry) 1000)
91 " => " buf))) 92 " => " buf)))
92 (if (<= (length long) (- (screen-width) 8)) 93 (if (<= (length long) (- (frame-width) 8))
93 (setq buf long)))) 94 (setq buf long))))
94 (calc-handle-whys) 95 (calc-handle-whys)
95 (message "Result: %s" buf))) 96 (message "Result: %s" buf)))
96 (if (eq last-command-char 10) 97 (if (eq last-command-char 10)
97 (insert shortbuf) 98 (insert shortbuf)
383 (interactive) 384 (interactive)
384 (if (or (not calc-plain-entry) 385 (if (or (not calc-plain-entry)
385 (calc-minibuffer-contains 386 (calc-minibuffer-contains
386 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'")) 387 "\\`\\([^\"]*\"[^\"]*\"\\)*[^\"]*\"[^\"]*\\'"))
387 (insert "`") 388 (insert "`")
388 (setq alg-exp (buffer-string)) 389 (setq alg-exp (minibuffer-contents))
389 (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp)) 390 (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp))
390 (exit-minibuffer)) 391 (exit-minibuffer))
391 ) 392 )
392 (setq calc-plain-entry nil) 393 (setq calc-plain-entry nil)
393 394
394 (defun calcAlg-enter () 395 (defun calcAlg-enter ()
395 (interactive) 396 (interactive)
396 (let* ((str (buffer-string)) 397 (let* ((str (minibuffer-contents))
397 (exp (and (> (length str) 0) 398 (exp (and (> (length str) 0)
398 (save-excursion 399 (save-excursion
399 (set-buffer calc-buffer) 400 (set-buffer calc-buffer)
400 (math-read-exprs str))))) 401 (math-read-exprs str)))))
401 (if (eq (car-safe exp) 'error) 402 (if (eq (car-safe exp) 'error)
402 (progn 403 (progn
403 (goto-char (point-min)) 404 (goto-char (minibuffer-prompt-end))
404 (forward-char (nth 1 exp)) 405 (forward-char (nth 1 exp))
405 (beep) 406 (beep)
406 (calc-temp-minibuffer-message 407 (calc-temp-minibuffer-message
407 (concat " [" (or (nth 2 exp) "Error") "]")) 408 (concat " [" (or (nth 2 exp) "Error") "]"))
408 (calc-clear-unread-commands)) 409 (calc-clear-unread-commands))
453 454
454 (defun calcDigit-algebraic () 455 (defun calcDigit-algebraic ()
455 (interactive) 456 (interactive)
456 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") 457 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'")
457 (calcDigit-key) 458 (calcDigit-key)
458 (setq calc-digit-value (buffer-string)) 459 (setq calc-digit-value (minibuffer-contents))
459 (exit-minibuffer)) 460 (exit-minibuffer))
460 ) 461 )
461 462
462 (defun calcDigit-edit () 463 (defun calcDigit-edit ()
463 (interactive) 464 (interactive)
464 (calc-unread-command) 465 (calc-unread-command)
465 (setq calc-digit-value (buffer-string)) 466 (setq calc-digit-value (minibuffer-contents))
466 (exit-minibuffer) 467 (exit-minibuffer)
467 ) 468 )
468 469
469 470
470 ;;; Algebraic expression parsing. [Public] 471 ;;; Algebraic expression parsing. [Public]