* net/ldap.el (ldap-search-internal): Tweak URL regexp.
[bpt/emacs.git] / lisp / calc / calc.el
index 5ff4f9a..4b16209 100644 (file)
@@ -1033,7 +1033,10 @@ Used by `calc-user-invocation'.")
           "lOW")
     (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key))
           (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz"
-                  ":\\|!()[]<>{},;=~`\C-k\M-k\C-w\M-w\C-_"))
+                  ":\\|!()[]<>{},;=~`\C-k\C-w\C-_"))
+    (define-key map "\M-w" 'calc-missing-key)
+    (define-key map "\M-k" 'calc-missing-key)
+    (define-key map "\M-\C-w" 'calc-missing-key)
     (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-start))
           "_0123456789.#@")
     map)
@@ -3452,7 +3455,7 @@ largest Emacs integer.")
 
 
 ;;; Parse a simple number in string form.   [N X] [Public]
-(defun math-read-number (s)
+(defun math-read-number (s &optional decimal)
   "Convert the string S into a Calc number."
   (math-normalize
    (cond
@@ -3460,9 +3463,10 @@ largest Emacs integer.")
     ;; Integers (most common case)
     ((string-match "\\` *\\([0-9]+\\) *\\'" s)
      (let ((digs (math-match-substring s 1)))
-       (if (and (eq calc-language 'c)
+       (if (and (memq calc-language calc-lang-c-type-hex)
                (> (length digs) 1)
-               (eq (aref digs 0) ?0))
+               (eq (aref digs 0) ?0)
+                (null decimal))
           (math-read-number (concat "8#" digs))
         (if (<= (length digs) (* 2 math-bignum-digit-length))
             (string-to-number digs)
@@ -3489,8 +3493,8 @@ largest Emacs integer.")
           (frac (math-match-substring s 2)))
        (let ((ilen (length int))
             (flen (length frac)))
-        (let ((int (if (> ilen 0) (math-read-number int) 0))
-              (frac (if (> flen 0) (math-read-number frac) 0)))
+        (let ((int (if (> ilen 0) (math-read-number int t) 0))
+              (frac (if (> flen 0) (math-read-number frac t) 0)))
           (and int frac (or (> ilen 0) (> flen 0))
                (list 'float
                      (math-add (math-scale-int int flen) frac)
@@ -3500,7 +3504,7 @@ largest Emacs integer.")
     ((string-match "^\\(.*\\)[eE]\\([-+]?[0-9]+\\)$" s)
      (let ((mant (math-match-substring s 1))
           (exp (math-match-substring s 2)))
-       (let ((mant (if (> (length mant) 0) (math-read-number mant) 1))
+       (let ((mant (if (> (length mant) 0) (math-read-number mant t) 1))
             (exp (if (<= (length exp) (if (memq (aref exp 0) '(?+ ?-)) 8 7))
                      (string-to-number exp))))
         (and mant exp (Math-realp mant) (> exp -4000000) (< exp 4000000)
@@ -3660,6 +3664,17 @@ Also looks for the equivalent TeX words, \\gets and \\evalto."
 
 ;;;###autoload
 (defmacro defmath (func args &rest body)   ;  [Public]
+  "Define Calc function.
+
+Like `defun' except that code in the body of the definition can
+make use of the full range of Calc data types and the usual
+arithmetic operations are converted to their Calc equivalents.
+
+The prefix `calcFunc-' is added to the specified name to get the
+actual Lisp function name.
+
+See Info node `(calc)Defining Functions'."
+  (declare (doc-string 3))
   (require 'calc-ext)
   (math-do-defmath func args body))