From 993ce732149d539a6698fe4062f50c8467fb7ce3 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Wed, 29 Dec 2004 04:04:09 +0000 Subject: [PATCH] (calc-user-define-permanent, calc-user-define-composition) (calc-user-define-formula): Remove the need for "calcFunc-" in the default input of algebraic functions. --- lisp/calc/calc-prog.el | 61 ++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index f0a86b6f07a..d7d0a03c182 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -214,19 +214,25 @@ (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) @@ -359,8 +365,15 @@ (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) @@ -951,11 +964,25 @@ (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))) -- 2.39.2