/[emacs]/emacs/lisp/calc/calc-help.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-help.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6.4.1 by handa, Fri Apr 16 12:50:11 2004 UTC revision 1.6.4.2 by miles, Thu Oct 14 08:50:09 2004 UTC
# Line 93  C-w  Describe how there is no warranty f Line 93  C-w  Describe how there is no warranty f
93    
94  (defun calc-describe-copying ()  (defun calc-describe-copying ()
95    (interactive)    (interactive)
96    (calc-info)    (calc-info-goto-node "Copying"))
   (Info-goto-node "Copying"))  
97    
98  (defun calc-describe-distribution ()  (defun calc-describe-distribution ()
99    (interactive)    (interactive)
100    (calc-info)    (calc-info-goto-node "Reporting Bugs"))
   (Info-goto-node "Reporting Bugs"))  
101    
102  (defun calc-describe-no-warranty ()  (defun calc-describe-no-warranty ()
103    (interactive)    (interactive)
104    (calc-info)    (calc-info-goto-node "Copying")
   (Info-goto-node "Copying")  
105    (let ((case-fold-search nil))    (let ((case-fold-search nil))
106      (search-forward "     NO WARRANTY"))      (search-forward "     NO WARRANTY"))
107    (beginning-of-line)    (beginning-of-line)
# Line 190  C-w  Describe how there is no warranty f Line 187  C-w  Describe how there is no warranty f
187                               (message "Reading Calc summary from manual...")                               (message "Reading Calc summary from manual...")
188                               (save-window-excursion                               (save-window-excursion
189                                 (save-excursion                                 (save-excursion
190                                   (calc-info)                                   (calc-info-goto-node "Summary")
                                  (Info-goto-node "Summary")  
191                                   (goto-char (point-min))                                   (goto-char (point-min))
192                                   (forward-line 1)                                   (forward-line 1)
193                                   (copy-to-buffer "*Calc Summary*"                                   (copy-to-buffer "*Calc Summary*"
194                                                   (point) (point-max))                                                   (point) (point-max))
195                                   (Info-last)))                                   (if Info-history
196                                         (Info-last))))
197                               (setq case-fold-search nil)                               (setq case-fold-search nil)
198                               (re-search-forward "^\\(.*\\)\\[\\.\\. a b")                               (re-search-forward "^\\(.*\\)\\[\\.\\. a b")
199                               (setq calc-summary-indentation                               (setq calc-summary-indentation
# Line 299  C-w  Describe how there is no warranty f Line 296  C-w  Describe how there is no warranty f
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)
353    (let ((savewin (current-window-configuration)))    (let ((savewin (current-window-configuration)))
354      (calc-info)      (calc-info-goto-node where)
     (Info-goto-node where)  
355      (or (let ((case-fold-search nil))      (or (let ((case-fold-search nil))
356            (re-search-forward (format "\n\\* +%s: \\(.*\\)\\."            (re-search-forward (format "\n\\* +%s: \\(.*\\)\\."
357                                       (regexp-quote thing))                                       (regexp-quote thing))
# Line 338  C-w  Describe how there is no warranty f Line 362  C-w  Describe how there is no warranty f
362                                  nil t)                                  nil t)
363               (setq thing (format "%s9" (substring thing 0 -1))))               (setq thing (format "%s9" (substring thing 0 -1))))
364          (progn          (progn
365            (Info-last)            (if Info-history
366                  (Info-last))
367            (set-window-configuration savewin)            (set-window-configuration savewin)
368            (error "Can't find `%s' in %s" thing where)))            (error "Can't find `%s' in %s" thing where)))
369      (let (Info-history)      (let (Info-history)

Legend:
Removed from v.1.6.4.1  
changed lines
  Added in v.1.6.4.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26