[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r112589: * progmodes/octave.el (octav
From: |
Leo Liu |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r112589: * progmodes/octave.el (octave-goto-function-definition): Improve |
Date: |
Wed, 15 May 2013 16:17:22 +0800 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112589
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Wed 2013-05-15 16:17:22 +0800
message:
* progmodes/octave.el (octave-goto-function-definition): Improve
and fix callers.
modified:
lisp/ChangeLog
lisp/progmodes/octave.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-05-15 02:00:07 +0000
+++ b/lisp/ChangeLog 2013-05-15 08:17:22 +0000
@@ -1,3 +1,8 @@
+2013-05-15 Leo Liu <address@hidden>
+
+ * progmodes/octave.el (octave-goto-function-definition): Improve
+ and fix callers.
+
2013-05-15 Stefan Monnier <address@hidden>
* emacs-lisp/cl-extra.el (cl-getf): Return the proper value in
=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el 2013-05-14 10:11:56 +0000
+++ b/lisp/progmodes/octave.el 2013-05-15 08:17:22 +0000
@@ -928,13 +928,21 @@
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
+ "\\_<DEFUN\\s-*(\\s-*\\(\\(?:\\sw\\|\\s_\\)+\\)" 1))
+ (t (funcall search octave-function-header-regexp 3)))))
(defun octave-function-file-p ()
"Return non-nil if the first token is \"function\".
@@ -1686,7 +1694,7 @@
(setq file (funcall octave-find-definition-filename-function file))
(when file
(find-file file)
- (octave-goto-function-definition)))))
+ (octave-goto-function-definition fn)))))
(provide 'octave)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r112589: * progmodes/octave.el (octave-goto-function-definition): Improve,
Leo Liu <=