branch: master
commit e257808a95256fe1a65ddc5bb7cacd7c4d48249b
Author: Adam <[email protected]>
Commit: Adam <[email protected]>
Copy mmm-indent-line body into mmm-indent-narrowed
---
mmm-region.el | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/mmm-region.el b/mmm-region.el
index 5b6bec1..a0e5de5 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -873,15 +873,25 @@ indentation function. See `mmm-indent-line' as the
starting point.")
(defun mmm-indent-line-narrowed ()
"An indent function which works on modes which don't play well with mmm-mode.
-Calls `mmm-indent-line' internally, but narrows the buffer before indenting to
+Works like `mmm-indent-line' , but narrows the buffer before indenting to
appease modes which rely on constructs like (point-min) to indent."
(interactive)
- (if mmm-current-overlay
- (save-restriction
- (narrow-to-region (overlay-start mmm-current-overlay)
- (overlay-end mmm-current-overlay))
- (mmm-indent-line))
- (mmm-indent-line)))
+ (funcall
+ (save-excursion
+ (back-to-indentation)
+ (mmm-update-submode-region)
+ (let ((indent-function (get
+ (if (and mmm-current-overlay
+ (> (overlay-end mmm-current-overlay)
(point)))
+ mmm-current-submode
+ mmm-primary-mode)
+ 'mmm-indent-line-function)))
+ (if mmm-current-overlay
+ (save-restriction
+ (narrow-to-region (overlay-start mmm-current-overlay)
+ (overlay-end mmm-current-overlay))
+ indent-function)
+ indent-function)))))
(defun mmm-indent-line ()
(interactive)