aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2004-10-12 15:47:32 +0000
committerJay Belanger2004-10-12 15:47:32 +0000
commit6fb690e298b9e1bbf6a767c5e7e830030ae30646 (patch)
treee2d6fb5df7fe98338a1631c0cdff48277528229e
parent16fe48b4248cd1e38a545ef35c5e9ffe9a49adb4 (diff)
downloademacs-6fb690e298b9e1bbf6a767c5e7e830030ae30646.tar.gz
emacs-6fb690e298b9e1bbf6a767c5e7e830030ae30646.zip
(calc-help-function-list, calc-help-variable-list): New variables.
(calc-help-index-entries): New function. (calc-describe-function): Use calc-help-function-list instead of obarray for completion. (calc-describe-variable): Use calc-help-variable-list instead of obarray for completion.
-rw-r--r--lisp/calc/calc-help.el56
1 files changed, 42 insertions, 14 deletions
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 32f86d6f750..c24a13b91d7 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -296,29 +296,57 @@ C-w Describe how there is no warranty for Calc."
296 (calc-describe-thing desc "Key Index" nil 296 (calc-describe-thing desc "Key Index" nil
297 (string-match "[A-Z][A-Z][A-Z]" desc)))))) 297 (string-match "[A-Z][A-Z][A-Z]" desc))))))
298 298
299(defvar calc-help-function-list nil
300 "List of functions provided by Calc.")
301
302(defvar calc-help-variable-list nil
303 "List of variables provided by Calc.")
304
305(defun calc-help-index-entries (&rest indices)
306 "Create a list of entries from the INDICES in the Calc info manual."
307 (let ((entrylist '())
308 entry)
309 (require 'info nil t)
310 (while indices
311 (condition-case nil
312 (with-temp-buffer
313 (Info-mode)
314 (Info-goto-node (concat "(Calc)" (car indices) " Index"))
315 (goto-char (point-min))
316 (while (re-search-forward "\n\\* \\(.*\\): " nil t)
317 (setq entry (match-string 1))
318 (if (and (not (string-match "<[1-9]+>" entry))
319 (not (string-match "(.*)" entry))
320 (not (string= entry "Menu")))
321 (unless (assoc entry entrylist)
322 (setq entrylist (cons entry entrylist))))))
323 (error nil))
324 (setq indices (cdr indices)))
325 entrylist))
326
299(defun calc-describe-function (&optional func) 327(defun calc-describe-function (&optional func)
300 (interactive) 328 (interactive)
329 (unless calc-help-function-list
330 (setq calc-help-function-list
331 (calc-help-index-entries "Function" "Command")))
301 (or func 332 (or func
302 (setq func (intern (completing-read "Describe function: " 333 (setq func (completing-read "Describe function: "
303 obarray nil t "calcFunc-")))) 334 calc-help-function-list
304 (setq func (symbol-name func)) 335 nil t)))
305 (if (string-match "\\`calc-." func) 336 (if (string-match "\\`calc-." func)
306 (calc-describe-thing func "Command Index") 337 (calc-describe-thing func "Command Index")
307 (calc-describe-thing (if (string-match "\\`calcFunc-." func) 338 (calc-describe-thing func "Function Index")))
308 (substring func 9)
309 func)
310 "Function Index")))
311 339
312(defun calc-describe-variable (&optional var) 340(defun calc-describe-variable (&optional var)
313 (interactive) 341 (interactive)
342 (unless calc-help-variable-list
343 (setq calc-help-variable-list
344 (calc-help-index-entries "Variable")))
314 (or var 345 (or var
315 (setq var (intern (completing-read "Describe variable: " 346 (setq var (completing-read "Describe variable: "
316 obarray nil t "var-")))) 347 calc-help-variable-list
317 (setq var (symbol-name var)) 348 nil t)))
318 (calc-describe-thing var "Variable Index" 349 (calc-describe-thing var "Variable Index"))
319 (if (string-match "\\`var-." var)
320 (substring var 4)
321 var)))
322 350
323(defun calc-describe-thing (thing where &optional target not-quoted) 351(defun calc-describe-thing (thing where &optional target not-quoted)
324 (message "Looking for `%s' in %s..." thing where) 352 (message "Looking for `%s' in %s..." thing where)