From 4d25fd7e52b254e3ca57bbacf73217caa450c75d Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Tue, 14 May 2013 13:19:29 +0800 Subject: [PATCH] * progmodes/octave.el (octave-font-lock-keywords): Fix error during redisplay. (octave-goto-function-definition, octave-find-definition): Minor tweaks. --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/octave.el | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75002528d21..803e2772109 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-05-14 Leo Liu + + * progmodes/octave.el (octave-font-lock-keywords): Fix error + during redisplay. + (octave-goto-function-definition, octave-find-definition): Minor tweaks. + 2013-05-14 Glenn Morris * progmodes/flymake.el (flymake-xml-program): New option. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index 7189b606a0c..e4e0dbc4ee1 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -459,13 +459,14 @@ Non-nil means always go to the next Octave code line after sending." (let ((beg (match-beginning 0)) (end (match-end 0))) (unless (octave-in-string-or-comment-p) - (unwind-protect + (condition-case nil (progn (goto-char beg) (backward-up-list) (when (memq (char-after) '(?\( ?\[ ?\{)) - (put-text-property beg end 'face nil))) - (goto-char end))))) + (put-text-property beg end 'face nil)) + (goto-char end)) + (error (goto-char end)))))) nil)) ;; Fontify all operators. (cons octave-operator-regexp 'font-lock-builtin-face) @@ -929,9 +930,9 @@ directory and makes this the current buffer's default directory." (defun octave-goto-function-definition () "Go to the first function definition." - (when (save-excursion - (goto-char (point-min)) - (re-search-forward octave-function-header-regexp nil t)) + (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))) @@ -1681,9 +1682,10 @@ if iskeyword(\"%s\") disp(\"`%s' is a keyword\") else which(\"%s\") endif\n" (user-error "%s" (or line (format "`%s' not found" fn))) (require 'etags) (ring-insert find-tag-marker-ring (point-marker)) - (find-file (funcall octave-find-definition-filename-function file)) - (or (octave-goto-function-definition) - (forward-comment (point-max)))))) + (setq file (funcall octave-find-definition-filename-function file)) + (when file + (find-file file) + (octave-goto-function-definition))))) (provide 'octave) -- 2.11.4.GIT