]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calcsel2.el
restore 2008-07-30T14:50:08Z!dann@ics.uci.edu
[gnu-emacs] / lisp / calc / calcsel2.el
index d1e92ab6806d435324695b052b4eba1ddc7b5503..4c141afc2d291fbaebb65f13d4d25309b8c11106 100644 (file)
@@ -1,33 +1,41 @@
-;; Calculator for GNU Emacs, part II [calc-sel-2.el]
-;; Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
-;; Written by Dave Gillespie, daveg@synaptics.com.
+;;; calcsel2.el --- selection functions for Calc
+
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+;; Author: David Gillespie <daveg@synaptics.com>
+;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
 ;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY.  No author or distributor
-;; accepts responsibility to anyone for the consequences of using it
-;; or for whether it serves any particular purpose or works at all,
-;; unless he says so in writing.  Refer to the GNU Emacs General Public
-;; License for full details.
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
-;; Everyone is granted permission to copy, modify and redistribute
-;; GNU Emacs, but only under the conditions described in the
-;; GNU Emacs General Public License.   A copy of this license is
-;; supposed to have been given to you along with GNU Emacs so you
-;; can know your rights and responsibilities.  It should be in a
-;; file named COPYING.  Among other things, the copyright notice
-;; and this notice must be preserved on all copies.
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
+;;; Commentary:
 
+;;; Code:
 
 ;; This file is autoloaded from calc-ext.el.
-(require 'calc-ext)
 
+(require 'calc-ext)
 (require 'calc-macs)
 
-(defun calc-Need-calc-sel-2 () nil)
+;; The variable calc-keep-selection is declared and set in calc-sel.el.
+(defvar calc-keep-selection)
 
+;; The variable calc-sel-reselect is local to the methods below,
+;; but is used by some functions in calc-sel.el which are called
+;; by the functions below.
 
 (defun calc-commute-left (arg)
   (interactive "p")
@@ -36,7 +44,7 @@
     (calc-wrapper
      (calc-preserve-point)
      (let ((num (max 1 (calc-locate-cursor-element (point))))
-          (reselect calc-keep-selection))
+          (calc-sel-reselect calc-keep-selection))
        (if (= arg 0) (setq arg nil))
        (while (or (null arg) (>= (setq arg (1- arg)) 0))
         (let* ((entry (calc-top num 'entry))
           (if (null new)
               (if arg
                   (error "Term is already leftmost")
-                (or reselect
+                (or calc-sel-reselect
                     (calc-pop-push-list 1 (list expr) num '(nil)))
                 (setq arg 0))
             (calc-pop-push-record-list
              1 "left"
              (list (calc-replace-sub-formula expr parent new))
              num
-             (list (and (or (not (eq arg 0)) reselect)
-                        sel)))))))))
-)
+             (list (and (or (not (eq arg 0)) calc-sel-reselect)
+                        sel))))))))))
 
 (defun calc-commute-right (arg)
   (interactive "p")
     (calc-wrapper
      (calc-preserve-point)
      (let ((num (max 1 (calc-locate-cursor-element (point))))
-          (reselect calc-keep-selection))
+          (calc-sel-reselect calc-keep-selection))
        (if (= arg 0) (setq arg nil))
        (while (or (null arg) (>= (setq arg (1- arg)) 0))
         (let* ((entry (calc-top num 'entry))
           (if (null new)
               (if arg
                   (error "Term is already rightmost")
-                (or reselect
+                (or calc-sel-reselect
                     (calc-pop-push-list 1 (list expr) num '(nil)))
                 (setq arg 0))
             (calc-pop-push-record-list
              1 "rght"
              (list (calc-replace-sub-formula expr parent new))
              num
-             (list (and (or (not (eq arg 0)) reselect)
-                        sel)))))))))
-)
+             (list (and (or (not (eq arg 0)) calc-sel-reselect)
+                        sel))))))))))
 
 (defun calc-build-assoc-term (op lhs rhs)
   (cond ((and (eq op '+) (or (math-looks-negp rhs)
                              (or (math-equal-int (nth 1 rhs) 1)
                                  (equal (nth 1 rhs) '(cplx 1 0)))))
         (list '/ lhs (nth 2 rhs)))
-       (t (list op lhs rhs)))
-)
+       (t (list op lhs rhs))))
 
 (defun calc-sel-unpack ()
   (interactive)
   (calc-wrapper
    (calc-preserve-point)
    (let* ((num (max 1 (calc-locate-cursor-element (point))))
-         (reselect calc-keep-selection)
+         (calc-sel-reselect calc-keep-selection)
          (entry (calc-top num 'entry))
          (expr (car entry))
          (sel (or (calc-auto-selection entry) expr)))
                                (list (calc-replace-sub-formula
                                       expr sel (nth 1 sel)))
                                num
-                               (list (and reselect (nth 1 sel))))))
-)
+                               (list (and calc-sel-reselect (nth 1 sel)))))))
 
 (defun calc-sel-isolate ()
   (interactive)
   (calc-slow-wrapper
    (calc-preserve-point)
    (let* ((num (max 1 (calc-locate-cursor-element (point))))
-         (reselect calc-keep-selection)
+         (calc-sel-reselect calc-keep-selection)
          (entry (calc-top num 'entry))
          (expr (car entry))
          (sel (or (calc-auto-selection entry) (error "No selection")))
                                (list (calc-replace-sub-formula
                                       expr eqn soln))
                                num
-                               (list (and reselect sel)))
-     (calc-handle-whys)))
-)
+                               (list (and calc-sel-reselect sel)))
+     (calc-handle-whys))))
 
 (defun calc-sel-commute (many)
   (interactive "P")
   (let ((calc-assoc-selections nil))
     (calc-rewrite-selection "CommuteRules" many "cmut"))
-  (calc-set-mode-line)
-)
+  (calc-set-mode-line))
 
 (defun calc-sel-jump-equals (many)
   (interactive "P")
-  (calc-rewrite-selection "JumpRules" many "jump")
-)
+  (calc-rewrite-selection "JumpRules" many "jump"))
 
 (defun calc-sel-distribute (many)
   (interactive "P")
-  (calc-rewrite-selection "DistribRules" many "dist")
-)
+  (calc-rewrite-selection "DistribRules" many "dist"))
 
 (defun calc-sel-merge (many)
   (interactive "P")
-  (calc-rewrite-selection "MergeRules" many "merg")
-)
+  (calc-rewrite-selection "MergeRules" many "merg"))
 
 (defun calc-sel-negate (many)
   (interactive "P")
-  (calc-rewrite-selection "NegateRules" many "jneg")
-)
+  (calc-rewrite-selection "NegateRules" many "jneg"))
 
 (defun calc-sel-invert (many)
   (interactive "P")
-  (calc-rewrite-selection "InvertRules" many "jinv")
-)
+  (calc-rewrite-selection "InvertRules" many "jinv"))
+
+(provide 'calcsel2)
 
+;; arch-tag: 7c5b8d65-b8f0-45d9-820d-9930f8ee114b
+;;; calcsel2.el ends here