[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 93cd2cf 412/433: Add function for narrowed indentation
From: |
Dmitry Gutov |
Subject: |
[elpa] master 93cd2cf 412/433: Add function for narrowed indentation |
Date: |
Thu, 15 Mar 2018 19:44:46 -0400 (EDT) |
branch: master
commit 93cd2cfc15a3cc5eae3b25cd92f08a9f6dc361a5
Author: Adam <address@hidden>
Commit: Adam <address@hidden>
Add function for narrowed indentation
Sometimes, modes rely on functions like (point-min) or overstep their region
when attempting to indent a line. This can cause issues like
https://github.com/AdamNiederer/vue-mode/issues/50
This function narrows the buffer before indenting, preventing any issues
which
might arise from reliance on having one's own buffer.
This doesn't change any defaults, but I figured some other mmm-mode
derivatives
could make use of this function.
---
mmm-region.el | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mmm-region.el b/mmm-region.el
index 6567b31..5b6bec1 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -871,6 +871,18 @@ 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.")
+(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
+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)))
+
(defun mmm-indent-line ()
(interactive)
(funcall
- [elpa] master 8b9c1e7 303/433: Switch mmm-erb.el to unix line endings, and add closing comment line, (continued)
- [elpa] master 8b9c1e7 303/433: Switch mmm-erb.el to unix line endings, and add closing comment line, Dmitry Gutov, 2018/03/15
- [elpa] master ac4822d 295/433: Merge pull request #4 from dgutov/js-fix, Dmitry Gutov, 2018/03/15
- [elpa] master 86cb980 426/433: Write TODO some more, Dmitry Gutov, 2018/03/15
- [elpa] master 0da2ac9 358/433: * mmm-syntax-propertize-function: Don't pass nil to mmm-set-local-variables, Dmitry Gutov, 2018/03/15
- [elpa] master e414b5b 314/433: Fix #12, Dmitry Gutov, 2018/03/15
- [elpa] master 631e7f1 408/433: Add c-symbol-char-key to the saved variables, Dmitry Gutov, 2018/03/15
- [elpa] master c493716 404/433: Revert "mmm-match-region: Return front-pos even without front-delim; likewise for back", Dmitry Gutov, 2018/03/15
- [elpa] master d2c8ade 428/433: More text, Dmitry Gutov, 2018/03/15
- [elpa] master 7661968 415/433: Merge pull request #74 from AdamNiederer/master, Dmitry Gutov, 2018/03/15
- [elpa] master 6812418 424/433: Add a FIXME, Dmitry Gutov, 2018/03/15
- [elpa] master 93cd2cf 412/433: Add function for narrowed indentation,
Dmitry Gutov <=
- [elpa] master 16d937d 019/433: Added files required by automake., Dmitry Gutov, 2018/03/15
- [elpa] master 8e205dd 400/433: Don't use version.texi at all, Dmitry Gutov, 2018/03/15
- [elpa] master 2ca7e6a 300/433: Add header comment, provide description, Dmitry Gutov, 2018/03/15
- [elpa] master 956354f 375/433: Fix missing var declaration, Dmitry Gutov, 2018/03/15
- [elpa] master fff25f6 311/433: Note that 'autogen.sh' should be run to generate 'configure' and 'Makefile.in' (see #11), Dmitry Gutov, 2018/03/15
- [elpa] master 3fb2964 416/433: Update Michael's email address to an active one, Dmitry Gutov, 2018/03/15
- [elpa] master 6c5d442 425/433: Fix copyright entry, Dmitry Gutov, 2018/03/15
- [elpa] master e848ef1 323/433: * mmm-fontify-region: Save and restore submode, overlay and local vars, Dmitry Gutov, 2018/03/15
- [elpa] master 004a618 370/433: Fix #23, Dmitry Gutov, 2018/03/15
- [elpa] master 53524db 389/433: Remove version.texi from the repo, Dmitry Gutov, 2018/03/15