[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c68cee0 411/433: Merge pull request #73 from AdamNiederer/
From: |
Dmitry Gutov |
Subject: |
[elpa] master c68cee0 411/433: Merge pull request #73 from AdamNiederer/master |
Date: |
Thu, 15 Mar 2018 19:44:45 -0400 (EDT) |
branch: master
commit c68cee0beaeb99c5bd178fab6fec995bce4e501f
Merge: 631e7f1 0cc4df5
Author: Dmitry Gutov <address@hidden>
Commit: GitHub <address@hidden>
Merge pull request #73 from AdamNiederer/master
Mode transition hooks
---
mmm-mode.el | 10 ++++++++++
mmm-region.el | 12 ++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/mmm-mode.el b/mmm-mode.el
index 9637829..41c6be8 100644
--- a/mmm-mode.el
+++ b/mmm-mode.el
@@ -123,6 +123,16 @@ submode region, the following changes \(are supposed to)
occur:
4. Some local variables of the submode shadow the default mode's.
5. Font-lock fontifies correctly for the submode.
6. Indentation function dispatches to the appropriate submode.
+7. User-specified hooks run when the point enters or exits a submode.
+
+The user may specify a number of hooks which may run when the point
+transitions between submodes, or between the primary mode and a
+submode. When a major mode is entered, the hook mmm-x-enter-hook is
+run, where x is the name of the major mode. When a major mode is
+left, the hook mmm-y-exit-hook is run, where y is the name of the
+major mode. Users may also specify hooks with names of the form
+mmm-x-y-hook which are run when the point leaves a mode named x,
+and enters a mode named y.
For further information, including installation and configuration
instructions, see the Info file mmm.info which is included with the
diff --git a/mmm-region.el b/mmm-region.el
index 547b351..6567b31 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -545,10 +545,14 @@ different keymaps, syntax tables, local variables, etc.
for submodes."
(when (mmm-update-current-submode)
(mmm-save-changed-local-variables mmm-previous-submode
mmm-previous-overlay)
- (let ((mode (or mmm-current-submode mmm-primary-mode)))
- (mmm-update-mode-info mode)
- (mmm-set-local-variables mode mmm-current-overlay)
- (mmm-enable-font-lock mode))
+ (let ((new-mode (or mmm-current-submode mmm-primary-mode))
+ (old-mode (or mmm-previous-submode mmm-primary-mode)))
+ (mmm-run-constructed-hook old-mode new-mode)
+ (mmm-run-constructed-hook old-mode "exit")
+ (mmm-run-constructed-hook new-mode "enter")
+ (mmm-update-mode-info new-mode)
+ (mmm-set-local-variables new-mode mmm-current-overlay)
+ (mmm-enable-font-lock new-mode))
(mmm-set-mode-line)
(dolist (func (if mmm-current-overlay
(overlay-get mmm-current-overlay 'entry-hook)
- [elpa] master 389fc1b 246/433: Updated revision date., (continued)
- [elpa] master 389fc1b 246/433: Updated revision date., Dmitry Gutov, 2018/03/15
- [elpa] master 1742b06 362/433: Add mmm-erb.el to lisp_LISP, Dmitry Gutov, 2018/03/15
- [elpa] master 4eeeef0 371/433: Add first test ever, Dmitry Gutov, 2018/03/15
- [elpa] master 0d4108b 345/433: Make README more up-to-date, Dmitry Gutov, 2018/03/15
- [elpa] master f261642 398/433: Merge pull request #50 from syohex/fix-invalid-function-call, Dmitry Gutov, 2018/03/15
- [elpa] master 4085494 402/433: Release 0.5.4, Dmitry Gutov, 2018/03/15
- [elpa] master 99539e8 340/433: Rewrite mmm-regions-alist for performance, Dmitry Gutov, 2018/03/15
- [elpa] master 4f79b74 373/433: Add two failing tests, Dmitry Gutov, 2018/03/15
- [elpa] master bdc7d47 273/433: (html-js): Support JS version in language attribute., Dmitry Gutov, 2018/03/15
- [elpa] master f926613 206/433: # Applied patch from Alan Shutko <address@hidden>., Dmitry Gutov, 2018/03/15
- [elpa] master c68cee0 411/433: Merge pull request #73 from AdamNiederer/master,
Dmitry Gutov <=
- [elpa] master 15c766d 216/433: * mmm-vars.el (mmm-classes-alist): Document new keywords., Dmitry Gutov, 2018/03/15
- [elpa] master 6e50485 268/433: Added html-php submode class., Dmitry Gutov, 2018/03/15
- [elpa] master c6a30e3 251/433: Trimmed ancient docstring., Dmitry Gutov, 2018/03/15
- [elpa] master 30811bc 249/433: Added new files to be byte-compiled (Joe Kelsey), Dmitry Gutov, 2018/03/15
- [elpa] master 7b783ee 308/433: Don't confuse script tags with EJS tags, Dmitry Gutov, 2018/03/15
- [elpa] master 00c99c7 278/433: (lisp_LISP): Added mmm-myghty.el., Dmitry Gutov, 2018/03/15
- [elpa] master ad24c9d 275/433: * mmm-noweb.el (mmm-syntax-region-list), Dmitry Gutov, 2018/03/15
- [elpa] master a27d7af 329/433: Allow toggling whitespace-mode after initialization, Dmitry Gutov, 2018/03/15
- [elpa] master ce3cb79 367/433: * mmm-update-mode-info: bind `buffer-file-truename' to nil, Dmitry Gutov, 2018/03/15
- [elpa] master 37f6dea 396/433: mmm-indent-line: Use primary mode if submode ends right here, Dmitry Gutov, 2018/03/15