Function: octave-find-definition
octave-find-definition is an interactive and byte-compiled function
defined in octave.el.gz.
Signature
(octave-find-definition FN)
Documentation
Find the definition of FN.
Functions implemented in C++ can be found if
variable octave-source-directories(var)/octave-source-directories(fun) is set correctly.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/octave.el.gz
(defun octave-find-definition (fn)
"Find the definition of FN.
Functions implemented in C++ can be found if
variable `octave-source-directories' is set correctly."
(interactive (list (octave-completing-read)))
(require 'etags)
(let ((orig (point)))
(if (and (derived-mode-p 'octave-mode)
(octave-goto-function-definition fn))
(ring-insert find-tag-marker-ring (copy-marker orig))
(inferior-octave-send-list-and-digest
;; help NAME is more verbose
(list (format "\
if iskeyword('%s') disp('`%s'' is a keyword') else which('%s') endif\n"
fn fn fn)))
(let (line file)
;; Skip garbage lines such as
;; warning: fmincg.m: possible Matlab-style ....
(while (and (not file) (consp inferior-octave-output-list))
(setq line (pop inferior-octave-output-list))
(when (string-match "from the file \\(.*\\)$" line)
(setq file (match-string 1 line))))
(if (not file)
(user-error "%s" (or line (format-message "`%s' not found" fn)))
(ring-insert find-tag-marker-ring (point-marker))
(setq file (funcall octave-find-definition-filename-function file))
(when file
(find-file file)
(octave-goto-function-definition fn)))))))