~ubuntu-branches/ubuntu/oneiric/ess/oneiric

« back to all changes in this revision

Viewing changes to lisp/ess-help.el

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2010-11-08 16:52:27 UTC
  • mfrom: (1.2.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20101108165227-u844l0tlegcdn89k
Tags: 5.12-1
* New upstream version released today

* debian/emacen-startup: Follow suggestion by Kevin Ryde in #594750 and
  use debian-pkg-add-load-path-item as well; also improved emacsen-install
  script by using soft links instead of copies  (Closes: #594750)

Show diffs side-by-side

added added

removed removed

Lines of Context:
499
499
        (string-match "STA" ess-language)
500
500
        (string-match "SAS" ess-language)))
501
501
      (let* ((help-files-list
502
 
              (ess-uniq-list (append (ess-get-help-files-list)
503
 
                                   (ess-get-help-aliases-list)
504
 
                                   (mapcar 'list
505
 
                                           (ess-get-object-list
506
 
                                            ess-current-process-name)))))
 
502
              (ess-get-help-topics-list ess-current-process-name))
507
503
             (default (ess-read-helpobj-name-default help-files-list))
508
504
             (prompt-string (if default
509
505
                                (format "%s(default %s) " p-string default)
518
514
 
519
515
;;*;; Utility functions
520
516
 
 
517
(defun ess-get-help-topics-list (name)
 
518
  "Return a list of current S help topics associated with process NAME.
 
519
If `ess-sp-change' is non-nil or `ess-help-topics-list' is nil, (re)-populate
 
520
the latter and return it.  Otherwise, return `ess-help-topics-list'."
 
521
  (save-excursion
 
522
    (set-buffer (process-buffer (get-ess-process name)))
 
523
    (ess-make-buffer-current)
 
524
    (ess-write-to-dribble-buffer
 
525
     (format "(ess-get-help-topics-list %s) .." name))
 
526
    (if (or (not ess-help-topics-list) ess-sp-change)
 
527
        (setq ess-help-topics-list
 
528
              (ess-uniq-list
 
529
               (mapcar 'list
 
530
                       (append (ess-get-help-files-list)
 
531
                               (ess-get-help-aliases-list)
 
532
                               (ess-get-object-list name)))))
 
533
      ;; else return the existing list
 
534
      ess-help-topics-list)))
 
535
 
521
536
(defun ess-get-help-files-list ()
522
537
  "Return a list of files which have help available."
523
 
  (mapcar 'list
524
 
          (apply 'append
525
 
                 (mapcar '(lambda (dirname)
526
 
                            (if (file-directory-p dirname)
527
 
                                (directory-files dirname)))
528
 
                         (mapcar '(lambda (str) (concat str "/.Help"))
529
 
                                 (ess-search-list))))))
 
538
  (apply 'append
 
539
         (mapcar '(lambda (dirname)
 
540
                    (if (file-directory-p dirname)
 
541
                        (directory-files dirname)))
 
542
                 (mapcar '(lambda (str) (concat str "/.Help"))
 
543
                         (ess-search-list)))))
530
544
 
531
545
(defun ess-get-help-aliases-list ()
532
546
  "Return a list of aliases which have help available."
533
 
  (ess-uniq-list
534
 
   (mapcar 'list
535
 
           (apply 'append
536
 
                  (mapcar '(lambda (a-file)
537
 
                             (if (file-exists-p a-file)
538
 
                                 (ess-get-words-from-vector
539
 
                                  (format
540
 
                                   "names(.readRDS(\"%s\"))\n" a-file))))
541
 
                          (mapcar '(lambda (str) (concat str "/help/aliases.rds"))
542
 
                                  (ess-get-words-from-vector
543
 
                                   "searchpaths()\n")))))))
 
547
  (apply 'append
 
548
         (mapcar '(lambda (a-file)
 
549
                    (if (file-exists-p a-file)
 
550
                        (ess-get-words-from-vector
 
551
                         (format
 
552
                          "names(.readRDS(\"%s\"))\n" a-file))))
 
553
                 (mapcar '(lambda (str) (concat str "/help/aliases.rds"))
 
554
                         (ess-get-words-from-vector
 
555
                          "searchpaths()\n")))))
544
556
 
545
557
(defun ess-nuke-help-bs ()
546
558
  "Remove ASCII underlining and overstriking performed by ^H codes."