Emacs 将模式从regexp设置为regexp?

Emacs 将模式从regexp设置为regexp?,emacs,elisp,python-sphinx,restructuredtext,nxhtml,Emacs,Elisp,Python Sphinx,Restructuredtext,Nxhtml,这是一个关于我的问题。如果在nxhtml/util/mumamo-fun.el的末尾添加以下代码: (定义rst bk乳胶指令块(位置最小值最大值) “查找数学块。返回范围和“latex模式”。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (mumamo快速静态块位置最小-最大值“.数学::\n\n”“..“零”模式t)) ;;;###自动加载 (定义mumamo多主模式rst bk mumamo模式 “使用StructuredText docstrings为Python打开多

这是一个关于我的问题。如果在
nxhtml/util/mumamo-fun.el的末尾添加以下代码:

(定义rst bk乳胶指令块(位置最小值最大值)
“查找数学块。返回范围和“latex模式”。
有关位置、最小值和最大值,请参见“mumamo查找可能的块”
(mumamo快速静态块位置最小-最大值“.数学::\n\n”“..“零”模式t))
;;;###自动加载
(定义mumamo多主模式rst bk mumamo模式
“使用StructuredText docstrings为Python打开多个主要模式。”
(“ReST”rst模式
(
rst bk指令块
)))
(添加到列表“自动模式列表”(“\\.rst\\\”.rst bk mumamo模式))
而且

(加载“~/.emacs.d/site lisp/nxhtml/autostart.el”)
(要求“mumamo”)
(需要“mumamo-fun”)
~/.emacs

在字符串
之间获取块。。数学::\n\n
应为latex模式

我的问题是-如何在给定模式的两个给定regexp之间生成块

编辑

我在mumamo-fun.el的末尾添加了以下内容:

【代码】;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ReST+math+bash+python+cl ;; 乳胶: (定义rst bk mumamo数学正则表达式块开始(最大位置) (让((其中(mumamo块开始fw re pos max “\.\.数学::\(.?\\\\124;\ n\)*?\n\n” ))) (何时何地 (列出其中的“latex模式”)) (定义rst bk mumamo数学正则表达式块结束(最大位置) (保存匹配数据 (mumamo块端fw位置最大值 “\\(^[:blank:][+$\\\n\\)+[^[:blank:][\n]” ))) (定义rst bk mumamo数学快速正则表达式块(位置 闵 最大值) (保存匹配数据 (mumamo可能数据块转发位置最大值rst bk mumamo数学正则表达式数据块开始 'rst bk mumamo math regexp chunk end()) (定义rst bk mumamo数学指令(位置最小值最大值) “查找数学块。返回范围和“数学模式”。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (rst bk mumamo数学快速正则表达式块位置最小值最大值)) (定义rst bk mumamo数学内联块(位置最小值最大值) “查找数学块。返回范围和“数学模式”。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (mumamo快速静态块位置最小-最大值:数学:```零'数学模式t)) ;; 猛击: (卸载rst bk mumamo sh regexp块启动(最大位置) (let((其中(mumamo chunk start fw re pos max“\\\.\\.代码块::bash\\(.\\\\\n\\)*?\n\n”)) (何时何地 (列出其中的“sh模式”)) (定义rst bk mumamo sh regexp块端(最大位置) (保存匹配数据 (mumamo块端fw位置最大值 “\\(^[:blank:][+$\\\n\\)+[^[:blank:][\n]” ))) (定义rst bk mumamo sh快速注册表块(位置 闵 最大值) (保存匹配数据 (mumamo可能的数据块转发位置最大值rst bk mumamo sh regexp数据块开始 'rst bk mumamo sh regexp chunk end()) (解除rst bk mumamo sh指令(位置最小值最大值) “查找数学块。返回范围和'sh模式。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (rst bk mumamo sh快速调节块位置最小值最大值)) ;; 蟒蛇: (定义rst bk mumamo py regexp块开始(最大位置) (let((其中(mumamo chunk start fw re pos max“\\\.\\.代码块::py\\.(thon\\)?\(.\\\\\n\\)*?\n\n”)) (何时何地 (列出其中的“python模式”)) (定义rst bk mumamo py regexp块端(最大位置) (保存匹配数据 (mumamo区块结束fw re pos max“\\(^[:blank:]+$\\\\n\\)+[^[:blank:][\n]”) (定义rst bk mumamo py quick regexp块(位置 闵 最大值) (保存匹配数据 (mumamo可能的块转发位置max'rst bk mumamo py regexp块开始 'rst bk mumamo py regexp chunk end()) (解除rst bk mumamo py指令(位置最小值最大值) “查找数学块。返回范围和'py模式。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (rst bk mumamo py快速调节器块位置最小值最大值)) ;; 氯: (定义rst bk mumamo cl正则表达式块启动(最大位置) (let((其中(mumamo chunk start fw re pos max“\\\.\\.代码块::cl\\(.\\\\\n\\)*?\n\n”)) (何时何地 (列出其中的“emacs lisp模式”)) (定义rst bk mumamo cl regexp块端(最大位置) (保存匹配数据 (mumamo区块结束fw re pos max“\\(^[:blank:]+$\\\\n\\)+[^[:blank:][\n]”) (定义rst bk mumamo cl快速注册表块(位置 闵 最大值) (保存匹配数据 (mumamo可能的数据块转发位置最大值rst bk mumamo cl regexp数据块开始 'rst bk mumamo cl regexp chunk end()) (解除rst bk mumamo cl指令(位置最小值最大值) “查找数学块。返回范围和'cl模式。 有关位置、最小值和最大值,请参见“mumamo查找可能的块” (rst bk mumamo cl快速调节块位置最小值最大值)) ;;;###自动加载 (定义mumamo多主模式rst bk mumamo模式 “使用StructuredText docstrings为Python打开多个主要模式。” (“ReST”rst模式( rst bk mumamo数学指令 rst bk mumamo数学内联块 rst bk mumamo sh指令 rst bk mumamo py指令 )))
就在
(提供“mumamo-fun)
之前

然后在
.emacs
中:

(加载“~/.emacs.d/site lisp/nxhtml/autostart.el”)
;; Mumamo让emacs 23.3崩溃了:
(当(和(等于emacs主版本23)
(等同于emacs小调版本3))
(加载后评估“字节码”
“(添加到列表”字节编译非过时变量
'字体锁定语法的开头-
.. math:

   TEXT
.. code-block: bash

   TEXT
.. code-block: py

   TEXT
(defun regexp-chunk-start (pos max)
  (let ((where (mumamo-chunk-start-fw-re pos max "math:\n\n")))
    (when where
      (list where 'latex-mode))))

(defun regexp-chunk-end (pos max)
  (save-match-data
    (mumamo-chunk-end-fw-re pos max "\\.\\.")))


(defun mumamo-quick-regexp-chunk (pos
                                  min
                                  max)
  (save-match-data
    (mumamo-possible-chunk-forward pos max 'regexp-chunk-start
                                           'regexp-chunk-end)))


(defun rst-bk-latex-directive (pos min max)
  "Find math chunks. Return range and 'latex-mode.
   See `mumamo-find-possible-chunk' for POS, MIN and MAX."
  (mumamo-quick-regexp-chunk pos min max))

;;;###autoload
(define-mumamo-multi-major-mode rst-bk-mumamo-mode
  "Turn on multiple major modes for Python with RestructuredText docstrings."
  ("ReST" rst-mode (rst-bk-latex-directive)))

(add-to-list 'auto-mode-alist '("\\.rst\\'" . rst-bk-mumamo-mode))
(defmacro define-quick-regexp-chunk (regexp-chunk-fun begin-mark end-mark mode)
  (let ((regexp-chunk-start-fun (gensym))
        (regexp-chunk-end-fun (gensym)))
    `(progn
       (defun ,regexp-chunk-start-fun (pos max)
         (let ((where (mumamo-chunk-start-fw-re pos max ,begin-mark)))
           (when where
             (list where ,mode))))

       (defun ,regexp-chunk-end-fun (pos max)
         (save-match-data
           (mumamo-chunk-end-fw-re pos max ,end-mark)))


       (defun ,regexp-chunk-fun (pos
                                 min
                                 max)
         (save-match-data
           (mumamo-possible-chunk-forward pos max ',regexp-chunk-start-fun
                                                  ',regexp-chunk-end-fun))))))

;; switch to latex-mode in between "math:\n\n" ".." 
;; defines a function named "rst-bk-latex-directive" which should be called by MuMaMo
(define-quick-regexp-chunk rst-bk-latex-directive "math:\n\n" "\\.\\." 'latex-mode)

;;;###autoload
(define-mumamo-multi-major-mode rst-bk-mumamo-mode
  "Turn on multiple major modes for Python with RestructuredText docstrings."
  ("ReST" rst-mode (rst-bk-latex-directive)))

(add-to-list 'auto-mode-alist '("\\.rst\\'" . rst-bk-mumamo-mode))