From 66f50b12dee4e8eff49dcc07ebbe6dcbb69ccd1e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 2 Apr 2014 15:47:50 -0400 Subject: [PATCH] * lisp/progmodes/perl-mode.el (perl-indent-new-calculate): Handle forward-sexp failure. Fixes: debbugs:16985 --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/perl-mode.el | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b1c35a78937..a2322a026e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-04-02 Stefan Monnier + + * progmodes/perl-mode.el (perl-indent-new-calculate): + Handle forward-sexp failure (bug#16985). + 2014-04-02 Glenn Morris * menu-bar.el (menu-bar-file-menu): @@ -210,6 +215,7 @@ (electric-indent-mode): Don't mess with the global map any more. Don't drop the post-self-insert-hook is some buffer is still using it (bug#16770). + * bindings.el (global-map): Remove C-j binding. * emacs-lisp/nadvice.el (advice--make-docstring): Try harder to find 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)) -- 2.39.5