From: Leo Liu Date: Wed, 15 May 2013 08:17:22 +0000 (+0800) Subject: * progmodes/octave.el (octave-goto-function-definition): Improve X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~79 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e3772e9833f971a450562350dc233bf00be7c5eb;p=emacs.git * progmodes/octave.el (octave-goto-function-definition): Improve and fix callers. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6c5de802fd5..ffcd36f4af1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-05-15 Leo Liu + + * progmodes/octave.el (octave-goto-function-definition): Improve + and fix callers. + 2013-05-15 Stefan Monnier * emacs-lisp/cl-extra.el (cl-getf): Return the proper value in diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 2fd2aadfc99..49c9c30d313 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -928,13 +928,21 @@ directory and makes this the current buffer's default directory." inferior-octave-completion-table nil nil nil nil def))) -(defun octave-goto-function-definition () - "Go to the first function definition." +(defun octave-goto-function-definition (fn) + "Go to the function definition of FN in current buffer." (goto-char (point-min)) - (if (not (re-search-forward octave-function-header-regexp nil t)) - (forward-comment (point-max)) - (goto-char (match-beginning 3)) - (match-string 3))) + (let ((search + (lambda (re sub) + (let (done) + (while (and (not done) (re-search-forward re nil t)) + (when (and (equal (match-string sub) fn) + (not (nth 8 (syntax-ppss)))) + (setq done t))) + (or done (goto-char (point-min))))))) + (pcase (file-name-extension (buffer-file-name)) + (`"cc" (funcall search + "\\_