Function: octave-help
octave-help is an interactive and byte-compiled function defined in
octave.el.gz.
Signature
(octave-help FN)
Documentation
Display the documentation of FN.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/octave.el.gz
(defun octave-help (fn)
"Display the documentation of FN."
(interactive (list (octave-completing-read)))
(inferior-octave-send-list-and-digest
(list (format "help ('%s');\n" fn)))
(let ((lines inferior-octave-output-list)
(inhibit-read-only t))
(when (string-match "error: \\(.*\\)$" (car lines))
(error "%s" (match-string 1 (car lines))))
(with-help-window octave-help-buffer
(princ (mapconcat 'identity lines "\n"))
(with-current-buffer octave-help-buffer
;; Bound to t so that `help-buffer' returns current buffer for
;; `help-setup-xref'.
(let ((help-xref-following t))
(help-setup-xref (list 'octave-help fn)
(called-interactively-p 'interactive)))
;; Note: can be turned off by suppress_verbose_help_message.
;;
;; Remove boring trailing text: Additional help for built-in functions
;; and operators ...
(goto-char (point-max))
(when (search-backward "\n\n\n" nil t)
(goto-char (match-beginning 0))
(delete-region (point) (point-max)))
;; File name highlight
(goto-char (point-min))
(when (re-search-forward "from the file \\(.*\\)$"
(line-end-position)
t)
(let* ((file (match-string 1))
(dir (file-name-directory
(directory-file-name (file-name-directory file)))))
(replace-match "" nil nil nil 1)
(insert (substitute-quotes "`"))
;; Include the parent directory which may be regarded as
;; the category for the FN.
(help-insert-xref-button (file-relative-name file dir)
'octave-help-file fn)
(insert (substitute-quotes "'"))))
;; Make 'See also' clickable.
(with-syntax-table octave-mode-syntax-table
(when (re-search-forward "^\\s-*See also:" nil t)
(let ((end (save-excursion (re-search-forward "^\\s-*$" nil t))))
(while (re-search-forward
"\\s-*\\([^,\n]+?\\)\\s-*\\(?:[,]\\|[.]?$\\)" end t)
(make-text-button (match-beginning 1) (match-end 1)
:type 'octave-help-function)))))
(octave-help-mode)))))