[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 86803d6 200/433: (mmm-set-major-mode-preferences): Added f
From: |
Dmitry Gutov |
Subject: |
[elpa] master 86803d6 200/433: (mmm-set-major-mode-preferences): Added function. |
Date: |
Thu, 15 Mar 2018 19:44:01 -0400 (EDT) |
branch: master
commit 86803d69d8b86967d4f4f6953778c290fa9c28fa
Author: mas <mas>
Commit: mas <mas>
(mmm-set-major-mode-preferences): Added function.
---
mmm-vars.el | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/mmm-vars.el b/mmm-vars.el
index 5d016e4..2efca29 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.39 2001/01/14 01:26:53 mas Exp $
+;; Version: $Id: mmm-vars.el,v 1.40 2001/01/15 00:35:34 mas Exp $
;;{{{ GPL
@@ -311,7 +311,26 @@ unnecessary. It probably won't go away, though."
"User preferences about what major modes to use.
Each element has the form \(LANGUAGE . MODE) where LANGUAGE is the
name of a programming language such as `perl' as a symbol, and MODE is
-the major mode to use, such as `cperl-mode' or `perl-mode'.")
+the major mode to use, such as `cperl-mode' or `perl-mode'."
+ :group 'mmm
+ :type '(repeat (cons symbol
+ (restricted-sexp :match-alternatives
+ (commandp)))))
+
+(defun mmm-set-major-mode-preferences (language mode &optional default)
+ "Set the preferred major mode for LANGUAGE to MODE.
+This sets the value of `mmm-major-mode-preferences'. If there is
+already a mode specified for LANGUAGE, and DEFAULT is nil or
+unsupplied, then it is changed. If DEFAULT is non-nil, then any
+existing mode is unchanged. This may be used by packages to ensure
+that some mode is present, but not override any user-specified mode."
+ (let ((pair (assq language mmm-major-mode-preferences)))
+ (if pair
+ ;; Existing mode preference
+ (unless default
+ (setcdr pair mode))
+ ;; No existing mode preference
+ (add-to-list 'mmm-major-mode-preferences (cons language mode)))))
;;}}}
;;{{{ Key Bindings
- [elpa] master 2defd28 188/433: (mmm-save-local-variables): Added `parse-sexp-ignore-comments', which, (continued)
- [elpa] master 2defd28 188/433: (mmm-save-local-variables): Added `parse-sexp-ignore-comments', which, Dmitry Gutov, 2018/03/15
- [elpa] master e4084f8 186/433: Added set-background example for XEmacs., Dmitry Gutov, 2018/03/15
- [elpa] master cbbb3cc 162/433: Added comments on RPM Spec, File Variables, and Here-documents., Dmitry Gutov, 2018/03/15
- [elpa] master 7374d58 193/433: Added ePerl submode class., Dmitry Gutov, 2018/03/15
- [elpa] master 2802d0b 182/433: # Updated., Dmitry Gutov, 2018/03/15
- [elpa] master 2d7d17f 195/433: (mmm-major-mode-preferences): Added check for `jde-mode' for Java code., Dmitry Gutov, 2018/03/15
- [elpa] master 33baef7 179/433: Added file, Dmitry Gutov, 2018/03/15
- [elpa] master ad6a934 199/433: # Updated docstring, Dmitry Gutov, 2018/03/15
- [elpa] master 1c8d387 201/433: Allowed language names for preference lookup as "mode names"., Dmitry Gutov, 2018/03/15
- [elpa] master f0e34d0 185/433: (mmm-apply-class): Rearranged parameters so faces actually work., Dmitry Gutov, 2018/03/15
- [elpa] master 86803d6 200/433: (mmm-set-major-mode-preferences): Added function.,
Dmitry Gutov <=
- [elpa] master 4bdcb2f 224/433: Fixed inline JavaScript regexp ( \w ==> \\w )., Dmitry Gutov, 2018/03/15
- [elpa] master 62b7c8c 233/433: # Updated for recent changes in configuration., Dmitry Gutov, 2018/03/15
- [elpa] master 068f332 226/433: # Fixed a couple comments, Dmitry Gutov, 2018/03/15
- [elpa] master d94c8be 240/433: * FAQ: Added question about end delimiter., Dmitry Gutov, 2018/03/15
- [elpa] master 0faf52e 256/433: Updated., Dmitry Gutov, 2018/03/15
- [elpa] master d5a1a43 223/433: Empty regions no longer prevent parsing of later regions., Dmitry Gutov, 2018/03/15
- [elpa] master b2dac24 253/433: Used match-string-no-properties (Joe Kelsey), Dmitry Gutov, 2018/03/15
- [elpa] master 2524d7a 208/433: Added `require's and `defvar's to eliminate compliation warnings., Dmitry Gutov, 2018/03/15
- [elpa] master c712ad4 190/433: Added flags telling which faces to use for which regions., Dmitry Gutov, 2018/03/15
- [elpa] master 23cd237 197/433: Modified CSS to use preferred mode., Dmitry Gutov, 2018/03/15