branch: externals/csharp-mode commit 2697c953102e680788802cd792a454e14114e6c0 Author: Theodor Thornhill <theodor.thornh...@frende.no> Commit: Theodor Thornhill <theodor.thornh...@frende.no>
Move bobp checking in one level It is always safe to use 'c-backward-syntactic-ws', so we can do that before checking for bobp. The reason this is smart is that the 'backward-char' can fail with a 'beginning-of-buffer' error. This causes indentation with 'C-x h TAB' sometimes to fail. Since a lambda function is super unlikely to be at beginning of buffer, or only after some doc comments (syntactic ws), this is an ok move. --- csharp-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp-mode.el b/csharp-mode.el index e5bb1fd..fae784a 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -487,9 +487,9 @@ (apply orig-fun args)))) (defun csharp-at-lambda-header () - (unless (bobp) - (save-excursion - (c-backward-syntactic-ws) + (save-excursion + (c-backward-syntactic-ws) + (unless (bobp) (backward-char) (c-safe (goto-char (scan-sexps (point) -1))) (when (or (looking-at "([[:alnum:][:space:]_,]*)[ \t\n]*=>[ \t\n]*{")