emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 1c8d387 201/433: Allowed language names for preference loo


From: Dmitry Gutov
Subject: [elpa] master 1c8d387 201/433: Allowed language names for preference lookup as "mode names".
Date: Thu, 15 Mar 2018 19:44:01 -0400 (EDT)

branch: master
commit 1c8d3872c59b9ac52fb80170f7cebbfef284b2db
Author: mas <mas>
Commit: mas <mas>

    Allowed language names for preference lookup as "mode names".
---
 mmm-sample.el | 10 +++++-----
 mmm-univ.el   |  5 ++---
 mmm-utils.el  | 13 +++++++++----
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/mmm-sample.el b/mmm-sample.el
index 2737d0f..dd426d8 100644
--- a/mmm-sample.el
+++ b/mmm-sample.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2000 by Michael Abraham Shulman
 
 ;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-sample.el,v 1.14 2001/01/13 03:55:46 mas Exp $
+;; Version: $Id: mmm-sample.el,v 1.15 2001/01/15 00:52:36 mas Exp $
 
 ;;{{{ GPL
 
@@ -89,13 +89,13 @@ and MODE is a major mode function symbol.")
 (defun mmm-here-doc-get-mode (string)
   (string-match "[a-zA-Z_-]+" string)
   (setq string (match-string 0 string))
-  (or (mmm-ensure-fboundp
+  (or (mmm-ensure-modename
        ;; First try the user override variable.
        (some #'(lambda (pair)
                 (if (string-match (car pair) string) (cdr pair) nil))
              mmm-here-doc-mode-alist))
       (let ((words (split-string (downcase string) "[_-]+")))
-        (or (mmm-ensure-fboundp
+        (or (mmm-ensure-modename
              ;; Try the whole name, stopping at "mode" if present.
              (intern
               (mapconcat #'identity
@@ -104,12 +104,12 @@ and MODE is a major mode function symbol.")
                          "-")))
             ;; Try each word with -mode tacked on
             (some #'(lambda (word)
-                      (mmm-ensure-fboundp
+                      (mmm-ensure-modename
                        (intern (concat word "-mode"))))
                   words)
             ;; Try each pair of words with -mode tacked on
             (loop for (one two) on words
-                  if (mmm-ensure-fboundp
+                  if (mmm-ensure-modename
                       (intern (concat one two "-mode")))
                   return it)
             ;; I'm unaware of any modes whose names, minus `-mode',
diff --git a/mmm-univ.el b/mmm-univ.el
index 3ddb91b..5108a9f 100644
--- a/mmm-univ.el
+++ b/mmm-univ.el
@@ -40,9 +40,8 @@
   (let ((modestr (intern (if (string-match "mode\\'" string)
                              string
                            (concat string "-mode")))))
-    (if (fboundp modestr)
-        modestr
-      (signal 'mmm-no-matching-submode nil))))
+    (or (mmm-ensure-modename modestr)
+        (signal 'mmm-no-matching-submode nil))))
 
 (mmm-add-classes
  `((universal
diff --git a/mmm-utils.el b/mmm-utils.el
index c33bf98..98be6a5 100644
--- a/mmm-utils.el
+++ b/mmm-utils.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2000 by Michael Abraham Shulman
 
 ;; Author: Michael Abraham Shulman <address@hidden>
-;; Version: $Id: mmm-utils.el,v 1.8 2001/01/14 01:26:09 mas Exp $
+;; Version: $Id: mmm-utils.el,v 1.9 2001/01/15 00:52:36 mas Exp $
 
 ;;{{{ GPL
 
@@ -139,9 +139,14 @@ string."
 ;;}}}
 ;;{{{ Ensure fboundp
 
-(defun mmm-ensure-fboundp (symbol)
-  "Return SYMBOL if it is `fboundp', else nil."
-  (if (fboundp symbol) symbol nil))
+(defun mmm-ensure-modename (symbol)
+  "Return SYMBOL if it is a valid submode name, else nil.
+Valid submode names are either `fboundp' or present as the `car' of an
+element in `mmm-major-mode-preferences'."
+  (if (or (fboundp symbol)
+          (assq symbol mmm-major-mode-preferences))
+      symbol
+    nil))
 
 ;;}}}
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]