[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 23170fe 205/433: Added `mmm-primary-mode' variable so that
From: |
Dmitry Gutov |
Subject: |
[elpa] master 23170fe 205/433: Added `mmm-primary-mode' variable so that `major-mode' can be saved. |
Date: |
Thu, 15 Mar 2018 19:44:02 -0400 (EDT) |
branch: master
commit 23170fe079325f9890ea4d6c9f0b3eb580f1d856
Author: mas <mas>
Commit: mas <mas>
Added `mmm-primary-mode' variable so that `major-mode' can be saved.
---
mmm-mode.el | 7 ++++---
mmm-region.el | 18 +++++++++---------
mmm-vars.el | 31 ++++++++++++++++++++++++-------
3 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/mmm-mode.el b/mmm-mode.el
index eb7c5dc..77d6e3a 100644
--- a/mmm-mode.el
+++ b/mmm-mode.el
@@ -8,7 +8,7 @@
;; Keywords: convenience, faces, languages, tools
;; Version: 0.4.6
-;; Revision: $Id: mmm-mode.el,v 1.10 2000/09/20 18:51:13 mas Exp $
+;; Revision: $Id: mmm-mode.el,v 1.11 2001/02/03 01:39:28 mas Exp $
;;{{{ GPL
@@ -318,6 +318,7 @@ Programming | Tools | Mmm, except the major mode and
submode hooks
;; variable `mmm-mode' will already be set.
(mmm-valid-buffer
(unless mmm-mode
+ (setq mmm-primary-mode major-mode)
(mmm-update-mode-info major-mode)
(setq mmm-region-saved-locals-for-dominant
(list* (list 'font-lock-cache-state nil)
@@ -359,9 +360,9 @@ Programming | Tools | Mmm, except the major mode and
submode hooks
(mmm-clear-local-variables)
(mmm-update-submode-region)
(setq font-lock-fontify-region-function
- (get major-mode 'mmm-fontify-region-function)
+ (get mmm-primary-mode 'mmm-fontify-region-function)
font-lock-beginning-of-syntax-function
- (get major-mode 'mmm-beginning-of-syntax-function))
+ (get mmm-primary-mode 'mmm-beginning-of-syntax-function))
(mmm-update-font-lock-buffer)
(mmm-refontify-maybe)
(setq mmm-mode nil)))
diff --git a/mmm-region.el b/mmm-region.el
index 172df20..b93952d 100644
--- a/mmm-region.el
+++ b/mmm-region.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2000 by Michael Abraham Shulman
;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-region.el,v 1.29 2001/01/11 01:40:49 mas Exp $
+;; Version: $Id: mmm-region.el,v 1.30 2001/02/03 01:39:28 mas Exp $
;;{{{ GPL
@@ -402,7 +402,7 @@ different keymaps, syntax tables, local variables, etc. for
submodes."
(when (mmm-update-current-submode)
(mmm-save-changed-local-variables mmm-previous-overlay
mmm-previous-submode)
- (let ((mode (or mmm-current-submode major-mode)))
+ (let ((mode (or mmm-current-submode mmm-primary-mode)))
(mmm-update-mode-info mode)
(mmm-set-local-variables mode)
(mmm-enable-font-lock mode))
@@ -410,9 +410,9 @@ different keymaps, syntax tables, local variables, etc. for
submodes."
(setq mode-name
(mmm-format-string
mmm-submode-mode-line-format
- `(("~M" . ,(get major-mode 'mmm-mode-name))
+ `(("~M" . ,(get mmm-primary-mode 'mmm-mode-name))
("~m" . ,(get mmm-current-submode 'mmm-mode-name)))))
- (setq mode-name (get major-mode 'mmm-mode-name)))
+ (setq mode-name (get mmm-primary-mode 'mmm-mode-name)))
(force-mode-line-update)))
(defun mmm-add-hooks ()
@@ -485,7 +485,7 @@ Looks up both global, buffer, and region saves."
"Save by-buffer and by-region variables for OVL and MODE.
Called when we move to a new submode region, with OVL and MODE the
region and mode for the previous position."
- (let ((buffer-vars (cdr (assq (or mode major-mode)
+ (let ((buffer-vars (cdr (assq (or mode mmm-primary-mode)
mmm-buffer-saved-locals)))
(region-vars (if ovl
(overlay-get ovl 'mmm-local-variables)
@@ -525,7 +525,7 @@ region and mode for the previous position."
(if (some #'(lambda (mode)
(get mode 'mmm-font-lock-mode))
(remove-duplicates
- (cons major-mode
+ (cons mmm-primary-mode
(mapcar #'(lambda (ovl)
(overlay-get ovl 'mmm-mode))
(mmm-overlays-in (point-min) (point-max))))))
@@ -563,7 +563,7 @@ union covers the region from START to STOP."
(maplist #'(lambda (pos-list)
(if (cdr pos-list)
(list (or (mmm-submode-at (car pos-list) 'beg)
- major-mode)
+ mmm-primary-mode)
(car pos-list) (cadr pos-list))))
(mmm-submode-changes-in start stop))))
(setcdr (last regions 2) nil)
@@ -608,7 +608,7 @@ of the REGIONS covers START to STOP."
(defun mmm-fontify-region-list (mode regions)
"Fontify REGIONS, each like \(BEG END), in mode MODE."
(save-excursion
- (let ((major-mode mode)
+ (let (;(major-mode mode)
(func (get mode 'mmm-fontify-region-function)))
(mapcar #'(lambda (reg)
(goto-char (car reg))
@@ -630,7 +630,7 @@ of the REGIONS covers START to STOP."
(defun mmm-beginning-of-syntax ()
(goto-char
(let ((ovl (mmm-overlay-at (point)))
- (func (get (or mmm-current-submode major-mode)
+ (func (get (or mmm-current-submode mmm-primary-mode)
'mmm-beginning-of-syntax-function)))
(max (if ovl (overlay-start ovl) (point-min))
(if func (progn (funcall func) (point)) (point-min))
diff --git a/mmm-vars.el b/mmm-vars.el
index 2efca29..f2c1fdf 100644
--- a/mmm-vars.el
+++ b/mmm-vars.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2000 by Michael Abraham Shulman
;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-vars.el,v 1.40 2001/01/15 00:35:34 mas Exp $
+;; Version: $Id: mmm-vars.el,v 1.41 2001/02/03 01:39:28 mas Exp $
;;{{{ GPL
@@ -91,7 +91,8 @@
(defvar mmm-save-local-variables
`(;; Don't use `function' (#') here!! We're already inside `quote'!
- comment-start
+ major-mode
+ comment-start
comment-end
(comment-line-start-skip buffer (fortran-mode))
comment-start-skip
@@ -123,6 +124,9 @@
nil (c-mode c++-mode objc-mode pike-mode java-mode jde-mode))
(c-conditional-key
nil (c-mode c++-mode objc-mode pike-mode java-mode jde-mode))
+ ;; User indentation style control
+ (((lambda () c-indentation-style) . c-set-style)
+ nil (c-mode c++-mode objc-mode pike-mode java-mode jde-mode))
;; XEmacs makes this a local variable
,@(when mmm-xemacs
'((c-offsets-alist
@@ -416,7 +420,7 @@ If SUFFIX is nil or unsupplied, run `mmm-<BODY>-hook'
instead."
(if hook (run-hooks hook))))
(defun mmm-run-major-hook ()
- (mmm-run-constructed-hook major-mode))
+ (mmm-run-constructed-hook mmm-primary-mode))
(defun mmm-run-submode-hook (submode)
(mmm-run-constructed-hook submode "submode"))
@@ -507,6 +511,13 @@ Do not set this variable directly; use the function
`mmm-mode'.")
(make-variable-buffer-local 'mmm-mode)
;;}}}
+;;{{{ Primary Mode
+
+(defvar mmm-primary-mode nil
+ "The primary major mode in the current buffer.")
+(make-variable-buffer-local 'mmm-primary-mode)
+
+;;}}}
;;{{{ Classes Alist
;; :parent could be an all-class argument. Same with :keymap.
@@ -693,10 +704,16 @@ Uses `mmm-mode-ext-classes-alist' to find submode
classes."
(defun mmm-mode-ext-applies (element)
(destructuring-bind (mode ext class) element
- (and (if mode (eq mode major-mode) t)
- (if ext (and (buffer-file-name)
- (save-match-data
- (string-match ext (buffer-file-name))))
+ (and (if mode
+ (eq mode
+ ;; If MMM is on in this buffer, use the primary mode,
+ ;; otherwise use the normal indicator.
+ (or mmm-primary-mode major-mode))
+ t)
+ (if ext
+ (and (buffer-file-name)
+ (save-match-data
+ (string-match ext (buffer-file-name))))
t))))
(defun mmm-get-all-classes (global)
- [elpa] master a040c3d 176/433: Added comment about installing with multiple emacsen., (continued)
- [elpa] master a040c3d 176/433: Added comment about installing with multiple emacsen., Dmitry Gutov, 2018/03/15
- [elpa] master 885e2fb 180/433: (mmm-keywords-used): Added `:private'., Dmitry Gutov, 2018/03/15
- [elpa] master e0a2e51 196/433: (mmm-save-local-variables): Added syntax and indentation variables for, Dmitry Gutov, 2018/03/15
- [elpa] master d674c74 202/433: (mmm-format-matches): Removed reference to `count' variable., Dmitry Gutov, 2018/03/15
- [elpa] master d64a049 192/433: Modified classes to use preferred mode list., Dmitry Gutov, 2018/03/15
- [elpa] master b0b7520 217/433: # Added comment about bug fix., Dmitry Gutov, 2018/03/15
- [elpa] master 293e13a 198/433: (mmm-format-matches): Changed to allow accessing any subexp, not, Dmitry Gutov, 2018/03/15
- [elpa] master 2a00982 215/433: * mmm-mason.el (mmm-mason-end-line, mmm-mason-start-line): Use bolp, Dmitry Gutov, 2018/03/15
- [elpa] master 1ef198a 219/433: # Updated, Dmitry Gutov, 2018/03/15
- [elpa] master ef73242 214/433: Added `javascript-mode' to list of C-derived modes., Dmitry Gutov, 2018/03/15
- [elpa] master 23170fe 205/433: Added `mmm-primary-mode' variable so that `major-mode' can be saved.,
Dmitry Gutov <=
- [elpa] master 72ca55f 213/433: # Updated menus., Dmitry Gutov, 2018/03/15
- [elpa] master c95f9b0 157/433: Added file (contributed by Marcus Harnisch)., Dmitry Gutov, 2018/03/15
- [elpa] master c9c6c19 194/433: Added ePerl and JSP to autoload., Dmitry Gutov, 2018/03/15
- [elpa] master c659e19 141/433: Released 0.4.4, Dmitry Gutov, 2018/03/15
- [elpa] master d06e9a3 143/433: (mmm-here-doc-get-mode): Extended to recognize names like TEXT_EOF., Dmitry Gutov, 2018/03/15
- [elpa] master 28cda1d 160/433: # Added headers., Dmitry Gutov, 2018/03/15
- [elpa] master ad9724f 140/433: # Updated., Dmitry Gutov, 2018/03/15
- [elpa] master 36e10b1 167/433: (mmm-ify): Explicitly set defaults for keywords in &rest parameter., Dmitry Gutov, 2018/03/15
- [elpa] master 944e3b4 173/433: Set MASON_VERSION., Dmitry Gutov, 2018/03/15
- [elpa] master 588edf0 169/433: (mmm-set-file-name-for-modes): Changed to a list for finer control., Dmitry Gutov, 2018/03/15