From: Leo Liu Date: Sat, 11 May 2013 03:50:34 +0000 (+0800) Subject: * progmodes/octave.el (octave-beginning-of-line) X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~229^2~119 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=083fe0d743d138c948e5a9bfe008a602b71c62ba;p=emacs.git * progmodes/octave.el (octave-beginning-of-line) (octave-end-of-line): Check before using up-list because it jumps out of more syntactic contructs since moving to smie. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3195d379b54..6fba2016bb2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-05-11 Leo Liu + + * progmodes/octave.el (octave-beginning-of-line) + (octave-end-of-line): Check before using up-list because it jumps + out of more syntactic contructs since moving to smie. + 2013-05-11 Glenn Morris * faces.el (internal-face-x-get-resource): @@ -89,7 +95,7 @@ 2013-05-09 Leo Liu * progmodes/octave.el (inferior-octave-completion-at-point): - Restore the broken file completion. (Bug#14300) + Restore file completion. (Bug#14300) (inferior-octave-startup): Fix incorrect highlighting for the first prompt. diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index f6aa3b2ac42..a2b076c4f8e 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el @@ -1107,45 +1107,43 @@ On success, return 0. Otherwise, go as far as possible and return -1." If on an empty or comment line, go to the beginning of that line. Otherwise, move backward to the beginning of the first Octave code line which is not inside a continuation statement, i.e., which does not -follow a code line ending in `...' or `\\', or is inside an open +follow a code line ending with `...' or is inside an open parenthesis list." (interactive) (beginning-of-line) - (if (not (looking-at "\\s-*\\($\\|\\s<\\)")) - (while (or (condition-case nil - (progn - (up-list -1) - (beginning-of-line) - t) - (error nil)) - (and (or (looking-at "\\s-*\\($\\|\\s<\\)") - (save-excursion - (if (zerop (octave-previous-code-line)) - (looking-at octave-continuation-regexp)))) - (zerop (forward-line -1))))))) + (unless (looking-at "\\s-*\\($\\|\\s<\\)") + (while (or (when (cadr (syntax-ppss)) + (goto-char (cadr (syntax-ppss))) + (beginning-of-line) + t) + (and (or (looking-at "\\s-*\\($\\|\\s<\\)") + (save-excursion + (if (zerop (octave-previous-code-line)) + (looking-at octave-continuation-regexp)))) + (zerop (forward-line -1))))))) (defun octave-end-of-line () "Move point to end of current Octave line. If on an empty or comment line, go to the end of that line. Otherwise, move forward to the end of the first Octave code line which -does not end in `...' or `\\' or is inside an open parenthesis list." +does not end with `...' or is inside an open parenthesis list." (interactive) (end-of-line) - (if (save-excursion - (beginning-of-line) - (looking-at "\\s-*\\($\\|\\s<\\)")) - () - (while (or (condition-case nil - (progn - (up-list 1) - (end-of-line) - t) - (error nil)) - (and (save-excursion - (beginning-of-line) - (or (looking-at "\\s-*\\($\\|\\s<\\)") - (looking-at octave-continuation-regexp))) - (zerop (forward-line 1))))) + (unless (save-excursion + (beginning-of-line) + (looking-at "\\s-*\\($\\|\\s<\\)")) + (while (or (when (cadr (syntax-ppss)) + (condition-case nil + (progn + (up-list 1) + (end-of-line) + t) + (error nil))) + (and (save-excursion + (beginning-of-line) + (or (looking-at "\\s-*\\($\\|\\s<\\)") + (looking-at octave-continuation-regexp))) + (zerop (forward-line 1))))) (end-of-line))) (defun octave-mark-block ()