summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-frac.el
diff options
context:
space:
mode:
authorColin Walters <walters@gnu.org>2001-11-19 07:34:00 +0000
committerColin Walters <walters@gnu.org>2001-11-19 07:34:00 +0000
commit12f1951a27a8c671d74d68540398a0adf674946f (patch)
treeb086f9622b7ee1250a872b45501c512c3694c818 /lisp/calc/calc-frac.el
parent10c8c918b28e0aabd3142bf27ec9edeb9d79a1dc (diff)
downloademacs-12f1951a27a8c671d74d68540398a0adf674946f.tar.gz
(calc-over-notation): Use `completing-read'.
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.
Diffstat (limited to 'lisp/calc/calc-frac.el')
-rw-r--r--lisp/calc/calc-frac.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el
index b1a391fe1ad..80b70433210 100644
--- a/lisp/calc/calc-frac.el
+++ b/lisp/calc/calc-frac.el
@@ -1,8 +1,9 @@
-;; Calculator for GNU Emacs, part II [calc-frac.el]
+;;; calc-frac.el --- fraction functions for Calc
+
;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
-;; Written by Dave Gillespie, daveg@synaptics.com.
-;; This file is part of GNU Emacs.
+;; Author: David Gillespie <daveg@synaptics.com>
+;; Maintainer: Colin Walters <walters@debian.org>
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY. No author or distributor
@@ -19,7 +20,9 @@
;; file named COPYING. Among other things, the copyright notice
;; and this notice must be preserved on all copies.
+;;; Commentary:
+;;; Code:
;; This file is autoloaded from calc-ext.el.
(require 'calc-ext)
@@ -28,7 +31,6 @@
(defun calc-Need-calc-frac () nil)
-
(defun calc-fdiv (arg)
(interactive "P")
(calc-slow-wrapper
@@ -49,7 +51,12 @@
(defun calc-over-notation (fmt)
- (interactive "sFraction separator (:, ::, /, //, :/): ")
+ (interactive
+ (list
+ (completing-read "Fraction separator: " (mapcar (lambda (s)
+ (cons s 0))
+ '(":" "::" "/" "//" ":/"))
+ nil t)))
(calc-wrapper
(if (string-match "\\`\\([^ 0-9][^ 0-9]?\\)[0-9]*\\'" fmt)
(let ((n nil))
@@ -58,7 +65,7 @@
fmt (math-match-substring fmt 1)))
(if (eq n 0) (error "Bad denominator"))
(calc-change-mode 'calc-frac-format (list fmt n) t))
- (error "Bad fraction separator format."))))
+ (error "Bad fraction separator format"))))
(defun calc-slash-notation (n)
(interactive "P")
@@ -71,11 +78,8 @@
(calc-wrapper
(calc-change-mode 'calc-prefer-frac n nil t)
(message (if calc-prefer-frac
- "Integer division will now generate fractions."
- "Integer division will now generate floating-point results."))))
-
-
-
+ "Integer division will now generate fractions"
+ "Integer division will now generate floating-point results"))))
;;;; Fractions.
@@ -130,8 +134,6 @@
(nth 1 b))))
-
-
;;; Convert a real value to fractional form. [T R I; T R F] [Public]
(defun calcFunc-frac (a &optional tol)
(or tol (setq tol 0))