summaryrefslogtreecommitdiff
path: root/lisp/progmodes/perl-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-04-02 15:47:50 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2014-04-02 15:47:50 -0400
commit66f50b12dee4e8eff49dcc07ebbe6dcbb69ccd1e (patch)
treea8e5337d11daff114417d27c26d458bff748c958 /lisp/progmodes/perl-mode.el
parentffcd5669d6a71dd9450a9c45b2ea67d3ddc7c988 (diff)
downloademacs-66f50b12dee4e8eff49dcc07ebbe6dcbb69ccd1e.tar.gz
* lisp/progmodes/perl-mode.el (perl-indent-new-calculate):
Handle forward-sexp failure. Fixes: debbugs:16985
Diffstat (limited to 'lisp/progmodes/perl-mode.el')
-rw-r--r--lisp/progmodes/perl-mode.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index d09fb59371a..3c7571e037b 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -854,11 +854,12 @@ changed by, or (parse-state) if line starts in a quoted string."
(and (= (char-syntax (following-char)) ?\))
(save-excursion
(forward-char 1)
- (forward-sexp -1)
- (perl-indent-new-calculate
- ;; Recalculate the parsing-start, since we may have jumped
- ;; dangerously close (typically in the case of nested functions).
- 'virtual nil (save-excursion (perl-beginning-of-function)))))
+ (when (condition-case nil (progn (forward-sexp -1) t)
+ (scan-error nil))
+ (perl-indent-new-calculate
+ ;; Recalculate the parsing-start, since we may have jumped
+ ;; dangerously close (typically in the case of nested functions).
+ 'virtual nil (save-excursion (perl-beginning-of-function))))))
(and (and (= (following-char) ?{)
(save-excursion (forward-char) (perl-hanging-paren-p)))
(+ (or default (perl-calculate-indent parse-start))