branch: master
commit 37f6dea57c6a4c5a75612aa52ec4580dceed6ed5
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
mmm-indent-line: Use primary mode if submode ends right here
---
mmm-region.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/mmm-region.el b/mmm-region.el
index 7fecc1f..61a5ddc 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -856,7 +856,7 @@ calls each respective submode's
`syntax-propertize-function'."
;;{{{ Indentation
(defvar mmm-indent-line-function 'mmm-indent-line
- "The function to call to indent inside a primary mode region.
+ "The function to call to indent a line.
This will be the value of `indent-line-function' for the whole
buffer. It's supposed to delegate to the appropriate submode's
indentation function. See `mmm-indent-line' as the starting point.")
@@ -867,8 +867,12 @@ indentation function. See `mmm-indent-line' as the
starting point.")
(save-excursion
(back-to-indentation)
(mmm-update-submode-region)
- (get (or mmm-current-submode mmm-primary-mode)
- 'mmm-indent-line-function))))
+ (get
+ (if (and mmm-current-overlay
+ (> (overlay-end mmm-current-overlay) (point)))
+ mmm-current-submode
+ mmm-primary-mode)
+ 'mmm-indent-line-function))))
;;}}}
(provide 'mmm-region)