/[emacs]/emacs/lisp/calc/calc-aent.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-aent.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by walters, Wed Nov 14 08:59:18 2001 UTC revision 1.5 by walters, Mon Nov 19 07:30:57 2001 UTC
# Line 1  Line 1 
1  ;; Calculator for GNU Emacs, part I [calc-aent.el]  ;;; calc-aent.el --- algebraic entry functions for Calc
2    
3  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.  ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
4  ;; Written by Dave Gillespie, daveg@synaptics.com.  
5    ;; Author: Dave Gillespie <daveg@synaptics.com>
6    ;; Maintainer: Colin Walters <walters@debian.org>
7    
8  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
9    
# Line 19  Line 22 
22  ;; file named COPYING.  Among other things, the copyright notice  ;; file named COPYING.  Among other things, the copyright notice
23  ;; and this notice must be preserved on all copies.  ;; and this notice must be preserved on all copies.
24    
25    ;;; Commentary:
26    
27    ;;; Code:
28    
29  ;; This file is autoloaded from calc.el.  ;; This file is autoloaded from calc.el.
30  (require 'calc)  (require 'calc)
# Line 55  Line 60 
60                                       (calc-extensions)                                       (calc-extensions)
61                                       (math-evaluate-expr x))))                                       (math-evaluate-expr x))))
62                                  entry)))                                  entry)))
63            (if (and (= (length alg-exp) 1)            (when (and (= (length alg-exp) 1)
64                     (eq (car-safe (car alg-exp)) 'calcFunc-assign)                       (eq (car-safe (car alg-exp)) 'calcFunc-assign)
65                     (= (length (car alg-exp)) 3)                       (= (length (car alg-exp)) 3)
66                     (eq (car-safe (nth 1 (car alg-exp))) 'var))                       (eq (car-safe (nth 1 (car alg-exp))) 'var))
67                (progn              (calc-extensions)
68                  (calc-extensions)              (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))
69                  (set (nth 2 (nth 1 (car alg-exp))) (nth 2 (car alg-exp)))              (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))
70                  (calc-refresh-evaltos (nth 2 (nth 1 (car alg-exp))))              (setq alg-exp (list (nth 2 (car alg-exp)))))
                 (setq alg-exp (list (nth 2 (car alg-exp))))))  
71            (setq calc-quick-prev-results alg-exp            (setq calc-quick-prev-results alg-exp
72                  buf (mapconcat (function (lambda (x)                  buf (mapconcat (function (lambda (x)
73                                             (math-format-value x 1000)))                                             (math-format-value x 1000)))
# Line 97  Line 101 
101        (if (eq last-command-char 10)        (if (eq last-command-char 10)
102            (insert shortbuf)            (insert shortbuf)
103          (setq kill-ring (cons shortbuf kill-ring))          (setq kill-ring (cons shortbuf kill-ring))
104          (if (> (length kill-ring) kill-ring-max)          (when (> (length kill-ring) kill-ring-max)
105              (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))            (setcdr (nthcdr (1- kill-ring-max) kill-ring) nil))
106          (setq kill-ring-yank-pointer kill-ring)))))          (setq kill-ring-yank-pointer kill-ring)))))
107    
108  (defun calc-do-calc-eval (str separator args)  (defun calc-do-calc-eval (str separator args)
# Line 294  Line 298 
298    (let* ((calc-buffer (current-buffer))    (let* ((calc-buffer (current-buffer))
299           (blink-paren-function 'calcAlg-blink-matching-open)           (blink-paren-function 'calcAlg-blink-matching-open)
300           (alg-exp 'error))           (alg-exp 'error))
301      (if (boundp 'calc-alg-ent-map)      (unless (boundp 'calc-alg-ent-map)
         ()  
302        (setq calc-alg-ent-map (copy-keymap minibuffer-local-map))        (setq calc-alg-ent-map (copy-keymap minibuffer-local-map))
303        (define-key calc-alg-ent-map "'" 'calcAlg-previous)        (define-key calc-alg-ent-map "'" 'calcAlg-previous)
304        (define-key calc-alg-ent-map "`" 'calcAlg-edit)        (define-key calc-alg-ent-map "`" 'calcAlg-edit)
# Line 307  Line 310 
310              (while (< i 127)              (while (< i 127)
311                (aset calc-alg-ent-esc-map i 'calcAlg-escape)                (aset calc-alg-ent-esc-map i 'calcAlg-escape)
312                (setq i (1+ i))))))                (setq i (1+ i))))))
313      (or calc-emacs-type-19      (unless calc-emacs-type-19
314          (define-key calc-alg-ent-map "\e" nil))        (define-key calc-alg-ent-map "\e" nil))
315      (if (eq calc-algebraic-mode 'total)      (if (eq calc-algebraic-mode 'total)
316          (define-key calc-alg-ent-map "\e" calc-alg-ent-esc-map)          (define-key calc-alg-ent-map "\e" calc-alg-ent-esc-map)
317        (define-key calc-alg-ent-map "\ep" 'calcAlg-plus-minus)        (define-key calc-alg-ent-map "\ep" 'calcAlg-plus-minus)
# Line 320  Line 323 
323      (let ((buf (read-from-minibuffer (or prompt "Algebraic: ")      (let ((buf (read-from-minibuffer (or prompt "Algebraic: ")
324                                       (or initial "")                                       (or initial "")
325                                       calc-alg-ent-map nil)))                                       calc-alg-ent-map nil)))
326        (if (eq alg-exp 'error)        (when (eq alg-exp 'error)
327            (if (eq (car-safe (setq alg-exp (math-read-exprs buf))) 'error)          (when (eq (car-safe (setq alg-exp (math-read-exprs buf))) 'error)
328                (setq alg-exp nil)))            (setq alg-exp nil)))
329        (setq calc-aborted-prefix "alg'")        (setq calc-aborted-prefix "alg'")
330        (or no-normalize        (or no-normalize
331            (and alg-exp (setq alg-exp (mapcar 'calc-normalize alg-exp))))            (and alg-exp (setq alg-exp (mapcar 'calc-normalize alg-exp))))
# Line 368  Line 371 
371      (use-local-map calc-mode-map))      (use-local-map calc-mode-map))
372    (calcAlg-enter))    (calcAlg-enter))
373    
374    (defvar calc-plain-entry nil)
375  (defun calcAlg-edit ()  (defun calcAlg-edit ()
376    (interactive)    (interactive)
377    (if (or (not calc-plain-entry)    (if (or (not calc-plain-entry)
# Line 377  Line 381 
381      (setq alg-exp (minibuffer-contents))      (setq alg-exp (minibuffer-contents))
382      (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp))      (and (> (length alg-exp) 0) (setq calc-previous-alg-entry alg-exp))
383      (exit-minibuffer)))      (exit-minibuffer)))
 (setq calc-plain-entry nil)  
384    
385  (defun calcAlg-enter ()  (defun calcAlg-enter ()
386    (interactive)    (interactive)
# Line 482  Line 485 
485          (setq last rest)))          (setq last rest)))
486      val))      val))
487    
488  (setq calc-user-parse-table nil)  (defvar calc-user-parse-table nil)
489  (setq calc-last-main-parse-table nil)  (defvar calc-last-main-parse-table nil)
490  (setq calc-last-lang-parse-table nil)  (defvar calc-last-lang-parse-table nil)
491  (setq calc-user-tokens nil)  (defvar calc-user-tokens nil)
492  (setq calc-user-token-chars nil)  (defvar calc-user-token-chars nil)
493    
494  (defun math-build-parse-table ()  (defun math-build-parse-table ()
495    (let ((mtab (cdr (assq nil calc-user-parse-tables)))    (let ((mtab (cdr (assq nil calc-user-parse-tables)))

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26