From: Kanak Kshetri Date: Wed, 20 Apr 2011 11:31:15 +0000 (-0400) Subject: jinja.el: replace obsolete mumamo-find-possible-chunk with mumamo-quick-chunk-forward... X-Git-Tag: 2.6~13 X-Git-Url: http://git.tremily.us/?p=jinja2.git;a=commitdiff_plain;h=e68d4c6ec147347e574543e972fa0c2ede771700 jinja.el: replace obsolete mumamo-find-possible-chunk with mumamo-quick-chunk-forward . This allows jinja mode to be used with nxhtml mode versions later than 2.07. Signed-off-by: Armin Ronacher --- diff --git a/ext/jinja.el b/ext/jinja.el index 401ba29..4cf0c72 100644 --- a/ext/jinja.el +++ b/ext/jinja.el @@ -80,104 +80,19 @@ This mode only provides syntax highlighting." (setq font-lock-defaults '(jinja-font-lock-keywords))) ;; mumamo stuff - (when (require 'mumamo nil t) - (defun mumamo-chunk-jinja3(pos min max) - "Find {# ... #}. Return range and `jinja-mode'. -See `mumamo-find-possible-chunk' for POS, MIN and MAX." - (mumamo-find-possible-chunk pos min max - 'mumamo-search-bw-exc-start-jinja3 - 'mumamo-search-bw-exc-end-jinja3 - 'mumamo-search-fw-exc-start-jinja3 - 'mumamo-search-fw-exc-end-jinja3)) - - (defun mumamo-chunk-jinja2(pos min max) - "Find {{ ... }}. Return range and `jinja-mode'. -See `mumamo-find-possible-chunk' for POS, MIN and MAX." - (mumamo-find-possible-chunk pos min max - 'mumamo-search-bw-exc-start-jinja2 - 'mumamo-search-bw-exc-end-jinja2 - 'mumamo-search-fw-exc-start-jinja2 - 'mumamo-search-fw-exc-end-jinja2)) - - (defun mumamo-chunk-jinja (pos min max) - "Find {% ... %}. Return range and `jinja-mode'. -See `mumamo-find-possible-chunk' for POS, MIN and MAX." - (mumamo-find-possible-chunk pos min max - 'mumamo-search-bw-exc-start-jinja - 'mumamo-search-bw-exc-end-jinja - 'mumamo-search-fw-exc-start-jinja - 'mumamo-search-fw-exc-end-jinja)) - - (defun mumamo-search-bw-exc-start-jinja (pos min) - "Helper for `mumamo-chunk-jinja'. -POS is where to start search and MIN is where to stop." - (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{%"))) - (and exc-start - (<= exc-start pos) - (cons exc-start 'jinja-mode)))) - - (defun mumamo-search-bw-exc-start-jinja2(pos min) - "Helper for `mumamo-chunk-jinja2'. -POS is where to start search and MIN is where to stop." - (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{{"))) - (and exc-start - (<= exc-start pos) - (cons exc-start 'jinja-mode)))) - - (defun mumamo-search-bw-exc-start-jinja3(pos min) - "Helper for `mumamo-chunk-jinja3'. -POS is where to start search and MIN is where to stop." - (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{#"))) - (and exc-start - (<= exc-start pos) - (cons exc-start 'jinja-mode)))) - - (defun mumamo-search-bw-exc-end-jinja (pos min) - "Helper for `mumamo-chunk-jinja'. -POS is where to start search and MIN is where to stop." - (mumamo-chunk-end-bw-str-inc pos min "%}")) - - (defun mumamo-search-bw-exc-end-jinja2(pos min) - "Helper for `mumamo-chunk-jinja2'. -POS is where to start search and MIN is where to stop." - (mumamo-chunk-end-bw-str-inc pos min "}}")) - - (defun mumamo-search-bw-exc-end-jinja3(pos min) - "Helper for `mumamo-chunk-jinja3'. -POS is where to start search and MIN is where to stop." - (mumamo-chunk-end-bw-str-inc pos min "#}")) - - (defun mumamo-search-fw-exc-start-jinja (pos max) - "Helper for `mumamo-chunk-jinja'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-start-fw-str-inc pos max "{%")) - - (defun mumamo-search-fw-exc-start-jinja2(pos max) - "Helper for `mumamo-chunk-jinja2'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-start-fw-str-inc pos max "{{")) - - (defun mumamo-search-fw-exc-start-jinja3(pos max) - "Helper for `mumamo-chunk-jinja3'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-start-fw-str-inc pos max "{#")) - - (defun mumamo-search-fw-exc-end-jinja (pos max) - "Helper for `mumamo-chunk-jinja'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-end-fw-str-inc pos max "%}")) + (defun mumamo-chunk-jinja3 (pos max) + "Find {# ... #}" + (mumamo-quick-chunk-forward pos max "{#" "#}" 'borders 'jinja-mode)) - (defun mumamo-search-fw-exc-end-jinja2(pos max) - "Helper for `mumamo-chunk-jinja2'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-end-fw-str-inc pos max "}}")) + (defun mumamo-chunk-jinja2 (pos max) + "Find {{ ... }}" + (mumamo-quick-chunk-forward pos max "{{" "}}" 'borders 'jinja-mode)) - (defun mumamo-search-fw-exc-end-jinja3(pos max) - "Helper for `mumamo-chunk-jinja3'. -POS is where to start search and MAX is where to stop." - (mumamo-chunk-end-fw-str-inc pos max "#}")) + (defun mumamo-chunk-jinja (pos max) + "Find {% ... %}" + (mumamo-quick-chunk-forward pos max "{%" "%}" 'borders 'jinja-mode)) ;;;###autoload (define-mumamo-multi-major-mode jinja-html-mumamo