]> git.eshelyaron.com Git - emacs.git/commitdiff
(calc-user-define-permanent, calc-user-define-composition)
authorJay Belanger <jay.p.belanger@gmail.com>
Wed, 29 Dec 2004 04:04:09 +0000 (04:04 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Wed, 29 Dec 2004 04:04:09 +0000 (04:04 +0000)
(calc-user-define-formula): Remove the need for "calcFunc-" in the
default input of algebraic functions.

lisp/calc/calc-prog.el

index f0a86b6f07a785e57810bd514e775955d669e5f1..d7d0a03c1825225cf6e152ab9ed90628cec7cfb7 100644 (file)
         (setq cmd (intern (concat "calc-User-" keyname))))
      (while
         (progn
-          (setq func (completing-read "Define algebraic function name: "
-                                      obarray 'fboundp nil
-                                      (concat "calcFunc-"
-                                              (if cmd-base
-                                                  (if (string-match
-                                                       "\\`User-.+" cmd-base)
-                                                      (concat
-                                                       "User"
-                                                       (substring cmd-base 5))
-                                                    cmd-base)
-                                                "")))
-                func (and (not (or (string-equal func "")
-                                   (string-equal func "calcFunc-")))
+          (setq func 
+                 (concat "calcFunc-"
+                         (completing-read "Define algebraic function name: "
+                                          (mapcar (lambda (x) (substring x 9))
+                                                  (all-completions "calcFunc-"
+                                                                   obarray))
+                                          (lambda (x) 
+                                            (fboundp 
+                                             (intern (concat "calcFunc-" x))))
+                                          nil
+                                          (if cmd-base
+                                              (if (string-match
+                                                   "\\`User-.+" cmd-base)
+                                                  (concat
+                                                   "User"
+                                                   (substring cmd-base 5))
+                                                cmd-base)
+                                            "")))
+                 func (and (not (string-equal func "calcFunc-"))
                           (intern func)))
           (and func
                (fboundp func)
    (if (eq calc-language 'unform)
        (error "Can't define formats for unformatted mode"))
    (let* ((comp (calc-top 1))
-         (func (intern (completing-read "Define format for which function: "
-                                        obarray 'fboundp nil "calcFunc-")))
+         (func (intern 
+                 (concat "calcFunc-"
+                         (completing-read "Define format for which function: "
+                                          (mapcar (lambda (x) (substring x 9))
+                                                  (all-completions "calcFunc-"
+                                                                   obarray))
+                                          (lambda (x) 
+                                            (fboundp 
+                                             (intern (concat "calcFunc-" x))))))))
          (comps (get func 'math-compose-forms))
          entry entry2
          (arglist nil)
                   (assq (upcase key) (calc-user-key-map))
                   (assq (downcase key) (calc-user-key-map))
                   (and (eq key ?\')
+                       (cons nil
+                              (intern
+                               (concat "calcFunc-"
+                                       (completing-read
+                                        (format "Record in %s the algebraic function: "
+                                                calc-settings-file)
+                                        (mapcar (lambda (x) (substring x 9))
+                                                (all-completions "calcFunc-"
+                                                                 obarray))
+                                        (lambda (x) 
+                                          (fboundp 
+                                           (intern (concat "calcFunc-" x))))
+                                        t)))))
+                   (and (eq key ?\M-x)
                        (cons nil
                              (intern (completing-read
-                                      (format "Record in %s the function: "
+                                      (format "Record in %s the command: "
                                               calc-settings-file)
-                                      obarray 'fboundp nil "calcFunc-"))))
+                                      obarray 'fboundp nil "calc-"))))
                   (error "No command defined for that key"))))
      (set-buffer (find-file-noselect (substitute-in-file-name
                                      calc-settings-file)))