296 |
(calc-describe-thing desc "Key Index" nil |
(calc-describe-thing desc "Key Index" nil |
297 |
(string-match "[A-Z][A-Z][A-Z]" desc)))))) |
(string-match "[A-Z][A-Z][A-Z]" desc)))))) |
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 |
|
|
327 |
(defun calc-describe-function (&optional func) |
(defun calc-describe-function (&optional func) |
328 |
(interactive) |
(interactive) |
329 |
|
(unless calc-help-function-list |
330 |
|
(setq calc-help-function-list |
331 |
|
(calc-help-index-entries "Function" "Command"))) |
332 |
(or func |
(or func |
333 |
(setq func (intern (completing-read "Describe function: " |
(setq func (completing-read "Describe function: " |
334 |
obarray nil t "calcFunc-")))) |
calc-help-function-list |
335 |
(setq func (symbol-name func)) |
nil t))) |
336 |
(if (string-match "\\`calc-." func) |
(if (string-match "\\`calc-." func) |
337 |
(calc-describe-thing func "Command Index") |
(calc-describe-thing func "Command Index") |
338 |
(calc-describe-thing (if (string-match "\\`calcFunc-." func) |
(calc-describe-thing func "Function Index"))) |
|
(substring func 9) |
|
|
func) |
|
|
"Function Index"))) |
|
339 |
|
|
340 |
(defun calc-describe-variable (&optional var) |
(defun calc-describe-variable (&optional var) |
341 |
(interactive) |
(interactive) |
342 |
|
(unless calc-help-variable-list |
343 |
|
(setq calc-help-variable-list |
344 |
|
(calc-help-index-entries "Variable"))) |
345 |
(or var |
(or var |
346 |
(setq var (intern (completing-read "Describe variable: " |
(setq var (completing-read "Describe variable: " |
347 |
obarray nil t "var-")))) |
calc-help-variable-list |
348 |
(setq var (symbol-name var)) |
nil t))) |
349 |
(calc-describe-thing var "Variable Index" |
(calc-describe-thing var "Variable Index")) |
|
(if (string-match "\\`var-." var) |
|
|
(substring var 4) |
|
|
var))) |
|
350 |
|
|
351 |
(defun calc-describe-thing (thing where &optional target not-quoted) |
(defun calc-describe-thing (thing where &optional target not-quoted) |
352 |
(message "Looking for `%s' in %s..." thing where) |
(message "Looking for `%s' in %s..." thing where) |