comparison lisp/calc/calc-alg.el @ 41271:fcd507927105

Change all toplevel `setq' forms to `defvar' forms, and move them before their first use. Use `when', `unless'. Remove trailing periods from error forms. Add description and headers suggested by Emacs Lisp coding conventions.
author Colin Walters <walters@gnu.org>
date Mon, 19 Nov 2001 07:43:43 +0000
parents 3e8874c2e70c
children 2406cf2da1d4
comparison
equal deleted inserted replaced
41270:711f18abaf57 41271:fcd507927105
1 ;; Calculator for GNU Emacs, part II [calc-alg.el] 1 ;;; calc-alg.el --- algebraic functions for Calc
2
2 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc. 3 ;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
3 ;; Written by Dave Gillespie, daveg@synaptics.com. 4
5 ;; Author: David Gillespie <daveg@synaptics.com>
6 ;; Maintainer: Colin Walters <walters@debian.org>
4 7
5 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
6 9
7 ;; GNU Emacs is distributed in the hope that it will be useful, 10 ;; GNU Emacs is distributed in the hope that it will be useful,
8 ;; but WITHOUT ANY WARRANTY. No author or distributor 11 ;; but WITHOUT ANY WARRANTY. No author or distributor
17 ;; supposed to have been given to you along with GNU Emacs so you 20 ;; supposed to have been given to you along with GNU Emacs so you
18 ;; can know your rights and responsibilities. It should be in a 21 ;; can know your rights and responsibilities. It should be in a
19 ;; file named COPYING. Among other things, the copyright notice 22 ;; file named COPYING. Among other things, the copyright notice
20 ;; and this notice must be preserved on all copies. 23 ;; and this notice must be preserved on all copies.
21 24
22 25 ;;; Commentary:
26
27 ;;; Code:
23 28
24 ;; This file is autoloaded from calc-ext.el. 29 ;; This file is autoloaded from calc-ext.el.
25 (require 'calc-ext) 30 (require 'calc-ext)
26 31
27 (require 'calc-macs) 32 (require 'calc-macs)
28 33
29 (defun calc-Need-calc-alg () nil) 34 (defun calc-Need-calc-alg () nil)
30
31 35
32 ;;; Algebra commands. 36 ;;; Algebra commands.
33 37
34 (defun calc-alg-evaluate (arg) 38 (defun calc-alg-evaluate (arg)
35 (interactive "p") 39 (interactive "p")
167 (setq expr (calc-top-n 1))) 171 (setq expr (calc-top-n 1)))
168 (setq old (if (stringp oldname) (math-read-expr oldname) oldname)) 172 (setq old (if (stringp oldname) (math-read-expr oldname) oldname))
169 (if (eq (car-safe old) 'error) 173 (if (eq (car-safe old) 'error)
170 (error "Bad format in expression: %s" (nth 1 old))) 174 (error "Bad format in expression: %s" (nth 1 old)))
171 (or (math-expr-contains expr old) 175 (or (math-expr-contains expr old)
172 (error "No occurrences found."))) 176 (error "No occurrences found")))
173 (calc-enter-result num "sbst" (math-expr-subst expr old new))))) 177 (calc-enter-result num "sbst" (math-expr-subst expr old new)))))
174 178
175 179
176 (defun calc-has-rules (name) 180 (defun calc-has-rules (name)
177 (setq name (calc-var-value name)) 181 (setq name (calc-var-value name))