branch: master
commit e632aecf696cfe4efc4d75a8d151d20fdbaf2723
Author: mas <mas>
Commit: mas <mas>
Limited matches to letter/dash strings that are fboundp.
---
mmm-univ.el | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/mmm-univ.el b/mmm-univ.el
index 3e9b28f..f5ddddf 100644
--- a/mmm-univ.el
+++ b/mmm-univ.el
@@ -34,22 +34,32 @@
(require 'mmm-auto)
+(defun mmm-univ-get-mode (string)
+ (string-match "[a-zA-Z-]+" string)
+ (let ((modestr (match-string 0 string)))
+ (and modestr
+ (intern (if (equal (substring modestr -5) "-mode")
+ modestr
+ (concat modestr "-mode"))))))
+
(mmm-add-classes
`((universal
- :front "{%\\([^]]+\\)%}"
+ :front "{%\\([a-zA-Z-]+\\)%}"
:back "{%/~1%}"
:insert ((?/ universal "Submode: " @ "{%" str "%}" @ "\n" _ "\n"
@ "{%/" str "%}" @))
- :match-submode ,#'(lambda (str)
- (string-match "[a-zA-Z-]+" str)
- (let ((modestr (match-string 0 str)))
- (unless modestr (error "Something is screwy."))
- (if (equal (substring modestr -5) "-mode")
- (intern modestr)
- (intern (concat modestr "-mode")))))
+ :front-verify ,#'(lambda ()
+ (fboundp
+ (mmm-univ-get-mode (match-string 0))))
+ :match-submode mmm-univ-get-mode
:save-matches 1
)))
(provide 'mmm-univ)
+
+;;; Local Variables:
+;;; mmm-global-classes: nil
+;;; End:
+
;;; mmm-univ.el ends here
\ No newline at end of file