From ebd3fa6bc82283df585963007934b70993b50e05 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C3=ABl=20Cadilhac?= Date: Mon, 10 Sep 2007 17:25:58 +0000 Subject: [PATCH] (meta-indent-unfinished-line): Do not say that a `%' in a string is a comment-start. (meta-indent-previous-line): Fix style. --- lisp/ChangeLog | 2 ++ lisp/progmodes/meta-mode.el | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc915b8ee05..c4e6741e4f4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -5,6 +5,8 @@ (meta-comment-indent, meta-indent-previous-line) (meta-indent-unfinished-line, meta-beginning-of-defun) (meta-end-of-defun, meta-common-initialization): Handle \f. + (meta-indent-unfinished-line): Do not handle a `%' in a string as + a comment-start. * files.el (file-modes-char-to-who, file-modes-char-to-right) (file-modes-rights-to-number): Auxiliary functions for symbolic to diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index 4d4ab2c8fbf..984856b6957 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -652,15 +652,19 @@ If the list was changed, sort the list and remove duplicates first." ;; Ignore comments. (while (and (looking-at comment-start) (not (bobp))) (skip-chars-backward "\n\t\f ") - (if (not (bobp)) - (move-to-column (current-indentation))))) + (when (not (bobp)) + (move-to-column (current-indentation))))) (defun meta-indent-unfinished-line () "Tell if the current line of code ends with an unfinished expression." (save-excursion (end-of-line) ;; Skip backward the comments. - (while (search-backward comment-start (point-at-bol) t)) + (let ((point-not-in-string (point))) + (while (search-backward comment-start (point-at-bol) t) + (unless (meta-indent-in-string-p) + (setq point-not-in-string (point)))) + (goto-char point-not-in-string)) ;; Search for the end of the previous expression. (if (search-backward ";" (point-at-bol) t) (progn (while (and (meta-indent-in-string-p) -- 2.39.5