[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 509660a 354/433: Merge pull request #22 from purcell/inden
From: |
Dmitry Gutov |
Subject: |
[elpa] master 509660a 354/433: Merge pull request #22 from purcell/indentation |
Date: |
Thu, 15 Mar 2018 19:44:35 -0400 (EDT) |
branch: master
commit 509660ab723ddded557bb4948c9a184ef35ad54a
Merge: 423ead2 bcc5adf
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Merge pull request #22 from purcell/indentation
Merge branch 'indentation'
---
mmm-erb.el | 17 +++--------------
mmm-mode.el | 9 +++++----
mmm-region.el | 20 +++++++++++++++++++-
mmm-vars.el | 1 -
4 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/mmm-erb.el b/mmm-erb.el
index f7dd566..c850ba4 100644
--- a/mmm-erb.el
+++ b/mmm-erb.el
@@ -109,19 +109,10 @@
(?= ejs-expression nil @ "<%=" @ " " _ " " @ "%>" @))
:creation-hook mmm-erb-mark-as-special)))
-(pushnew '(indent-line-function buffer) mmm-save-local-variables)
-
;;;###autoload
(define-derived-mode html-erb-mode html-mode "ERB-HTML"
(setq sgml-unclosed-tags nil) ; Simplifies indentation logic.
- (add-hook 'mmm-html-erb-mode-hook 'mmm-erb-process-submode nil t)
- (add-hook 'mmm-ruby-mode-submode-hook 'mmm-erb-process-submode nil t)
- (add-hook 'mmm-css-mode-submode-hook 'mmm-erb-process-submode nil t)
- (add-hook 'mmm-js-mode-submode-hook 'mmm-erb-process-submode nil t))
-
-(defun mmm-erb-process-submode ()
- "Hook function to run after primary or submode major mode function."
- (setq indent-line-function 'mmm-erb-indent-line))
+ (set (make-local-variable 'mmm-indent-line-function) 'mmm-erb-indent-line))
(defun mmm-erb-mark-as-special ()
"Hook function to run in ERB and EJS tag regions."
@@ -245,7 +236,7 @@
((re-search-forward " *{ *" limit t) 'open)))
(defun mmm-erb-orig-indent-function (mode)
- (cadr (assoc 'indent-line-function (get mode 'mmm-local-variables))))
+ (get mode 'mmm-indent-line-function))
(defvar mmm-erb-offset-var-alist
'((html-erb-mode . sgml-basic-offset)
@@ -257,9 +248,7 @@
;;;###autoload
(define-derived-mode nxml-web-mode nxml-mode "nXML-Web"
- (add-hook 'mmm-nxml-web-mode-hook 'mmm-erb-process-submode nil t)
- (add-hook 'mmm-css-mode-submode-hook 'mmm-erb-process-submode nil t)
- (add-hook 'mmm-js-mode-submode-hook 'mmm-erb-process-submode nil t))
+ (set (make-local-variable 'mmm-indent-line-function) 'mmm-erb-indent-line))
(provide 'mmm-erb)
diff --git a/mmm-mode.el b/mmm-mode.el
index 0565eab..e6e83f7 100644
--- a/mmm-mode.el
+++ b/mmm-mode.el
@@ -117,17 +117,17 @@ over certain regions. The submode regions are usually
highlighted by
a background color for ease of recognition. While the point is in a
submode region, the following changes \(are supposed to) occur:
-1. The local keymap is that of the submode.
+1. The local keymap and the syntax table are that of the submode.
2. The mode line changes to show what submode region is active.
3. The major mode menu and mouse popup menu are that of the submode.
4. Some local variables of the submode shadow the default mode's.
-5. The syntax table and indentation are those of the submode.
-6. Font-lock fontifies correctly for the submode.
+5. Font-lock fontifies correctly for the submode.
+6. Indentation function dispatches to the appropriate submode.
For further information, including installation and configuration
instructions, see the Info file mmm.info which is included with the
distribution of MMM Mode. Many of MMM's configuration variables are
-available through M-x customize under Programming | Tools | Mmm."
+available through M-x customize-group RET mmm."
(interactive "P")
(if (if arg (> (prefix-numeric-value arg) 0) (not mmm-mode))
(mmm-mode-on)
@@ -168,6 +168,7 @@ available through M-x customize under Programming | Tools |
Mmm."
'mmm-beginning-of-syntax)
(set (make-local-variable 'syntax-propertize-function)
'mmm-syntax-propertize-function)
+ (set (make-local-variable 'indent-line-function) mmm-indent-line-function)
(setq mmm-mode t)
(condition-case err
(mmm-apply-all)
diff --git a/mmm-region.el b/mmm-region.el
index 927b56e..ca87d98 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -511,7 +511,8 @@ is non-nil, don't quit if the info is already there."
font-lock-beginning-of-syntax-function))
(put mode 'mmm-syntax-propertize-function
(and (boundp 'syntax-propertize-function)
- syntax-propertize-function)))
+ syntax-propertize-function))
+ (put mode 'mmm-indent-line-function indent-line-function))
;; Get variables
(setq global-vars (mmm-get-locals 'global)
buffer-vars (mmm-get-locals 'buffer)
@@ -821,7 +822,24 @@ of the REGIONS covers START to STOP."
(mmm-set-local-variables saved-mode saved-ovl))))
;;}}}
+;;{{{ Indentation
+
+(defvar mmm-indent-line-function 'mmm-indent-line
+ "The function to call to indent inside a primary mode region.
+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 ()
+ (interactive)
+ (funcall
+ (save-excursion
+ (back-to-indentation)
+ (mmm-update-submode-region)
+ (get (or mmm-current-submode mmm-primary-mode)
+ 'mmm-indent-line-function))))
+;;}}}
(provide 'mmm-region)
;;; mmm-region.el ends here
diff --git a/mmm-vars.el b/mmm-vars.el
index 8b8ea0a..c48e72d 100644
--- a/mmm-vars.el
+++ b/mmm-vars.el
@@ -131,7 +131,6 @@
font-lock-syntax-table
font-lock-mark-block-function ; Override this?
font-lock-syntactic-keywords
- indent-line-function
parse-sexp-ignore-comments ; Fixes indentation in PHP-mode?
;; Can be different in different buffers
(c-basic-offset
- [elpa] master 53524db 389/433: Remove version.texi from the repo, (continued)
- [elpa] master 53524db 389/433: Remove version.texi from the repo, Dmitry Gutov, 2018/03/15
- [elpa] master 2c9532b 326/433: Simplify mmm-update-mode-info, Dmitry Gutov, 2018/03/15
- [elpa] master e767fa2 265/433: Added script and documentation for installing from CVS, Dmitry Gutov, 2018/03/15
- [elpa] master 7965887 279/433: Fix error in mmm-mode when Emacs 23 immediately evaporates zero-width submode regions, Dmitry Gutov, 2018/03/15
- [elpa] master 7da80fb 422/433: Add cl-lib package dependency, Dmitry Gutov, 2018/03/15
- [elpa] master cd66bdd 316/433: Improve mmm-erb usage instructions, Dmitry Gutov, 2018/03/15
- [elpa] master 2e06d3d 356/433: Remove the useless CVS $Id tags, Dmitry Gutov, 2018/03/15
- [elpa] master 68fe94d 274/433: (mmm-ify): Change defaults for front-delim and, Dmitry Gutov, 2018/03/15
- [elpa] master 28d51d2 312/433: Note availability of Melpa packages, Dmitry Gutov, 2018/03/15
- [elpa] master 406e120 330/433: Merge pull request #19 from dgutov/font-lock, Dmitry Gutov, 2018/03/15
- [elpa] master 509660a 354/433: Merge pull request #22 from purcell/indentation,
Dmitry Gutov <=
- [elpa] master e583767 284/433: Provide more sensible face defaults for dark and light backgrounds, Dmitry Gutov, 2018/03/15
- [elpa] master c28501c 387/433: Don't use syntax-begin-function, Dmitry Gutov, 2018/03/15
- [elpa] master 141bbee 352/433: Remove regexp-opt's legacy stuff, Dmitry Gutov, 2018/03/15
- [elpa] master ff4c564 344/433: * mmm-noweb.el: Add the FIXME note., Dmitry Gutov, 2018/03/15
- [elpa] master 5c152e0 334/433: Merge pull request #20 from dgutov/overlays, Dmitry Gutov, 2018/03/15
- [elpa] master 16907a3 368/433: Delete .cvsignore, move almost everything to .gitignore, Dmitry Gutov, 2018/03/15
- [elpa] master df0d56b 406/433: Fix regression from the previous commit, Dmitry Gutov, 2018/03/15
- [elpa] master 50764ae 269/433: Fixed back recognition of output regions., Dmitry Gutov, 2018/03/15
- [elpa] master cb905bd 431/433: Add copyright blurbs to the test files, Dmitry Gutov, 2018/03/15
- [elpa] master 38f1f2a 390/433: Update TODO, Dmitry Gutov, 2018/03/15