Skip to content
Myr

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.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kanak Kshetri · committed by Armin Ronacher · parent 75ffeb6 · Browse files · 1 file+9 added−94 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>

Diff stats

1 file+9 added−94 removed

  • other:+9 added−94 removed

1 file+9 added−94 removed

modified:ext/jinja.el+9 added-94 removed
78 unmodified lines
79 ;;(set (make-local-variable 'comment-end) "#}")80 (setq font-lock-defaults '(jinja-font-lock-keywords)))8182;; mumamo stuff8383(when (require 'mumamo nil t)8486 (defun mumamo-chunk-jinja3(pos min max)87 "Find {# ... #}. Return range and `jinja-mode'.88See `mumamo-find-possible-chunk' for POS, MIN and MAX."89 (mumamo-find-possible-chunk pos min max90 'mumamo-search-bw-exc-start-jinja391 'mumamo-search-bw-exc-end-jinja392 'mumamo-search-fw-exc-start-jinja393 'mumamo-search-fw-exc-end-jinja3))85 (defun mumamo-chunk-jinja3 (pos max)86 "Find {# ... #}"87 (mumamo-quick-chunk-forward pos max "{#" "#}" 'borders 'jinja-mode))8895 (defun mumamo-chunk-jinja2(pos min max)96 "Find {{ ... }}. Return range and `jinja-mode'.97See `mumamo-find-possible-chunk' for POS, MIN and MAX."98 (mumamo-find-possible-chunk pos min max99 'mumamo-search-bw-exc-start-jinja2100 'mumamo-search-bw-exc-end-jinja2101 'mumamo-search-fw-exc-start-jinja2102 'mumamo-search-fw-exc-end-jinja2))89 (defun mumamo-chunk-jinja2 (pos max)90 "Find {{ ... }}"91 (mumamo-quick-chunk-forward pos max "{{" "}}" 'borders 'jinja-mode))92104 (defun mumamo-chunk-jinja (pos min max)105 "Find {% ... %}. Return range and `jinja-mode'.106See `mumamo-find-possible-chunk' for POS, MIN and MAX."107 (mumamo-find-possible-chunk pos min max108 'mumamo-search-bw-exc-start-jinja109 'mumamo-search-bw-exc-end-jinja110 'mumamo-search-fw-exc-start-jinja111 'mumamo-search-fw-exc-end-jinja))93 (defun mumamo-chunk-jinja (pos max)94 "Find {% ... %}"95 (mumamo-quick-chunk-forward pos max "{%" "%}" 'borders 'jinja-mode))96113 (defun mumamo-search-bw-exc-start-jinja (pos min)114 "Helper for `mumamo-chunk-jinja'.115POS is where to start search and MIN is where to stop."116 (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{%")))117 (and exc-start118 (<= exc-start pos)119 (cons exc-start 'jinja-mode))))120121 (defun mumamo-search-bw-exc-start-jinja2(pos min)122 "Helper for `mumamo-chunk-jinja2'.123POS is where to start search and MIN is where to stop."124 (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{{")))125 (and exc-start126 (<= exc-start pos)127 (cons exc-start 'jinja-mode))))128129 (defun mumamo-search-bw-exc-start-jinja3(pos min)130 "Helper for `mumamo-chunk-jinja3'.131POS is where to start search and MIN is where to stop."132 (let ((exc-start (mumamo-chunk-start-bw-str-inc pos min "{#")))133 (and exc-start134 (<= exc-start pos)135 (cons exc-start 'jinja-mode))))136137 (defun mumamo-search-bw-exc-end-jinja (pos min)138 "Helper for `mumamo-chunk-jinja'.139POS is where to start search and MIN is where to stop."140 (mumamo-chunk-end-bw-str-inc pos min "%}"))141142 (defun mumamo-search-bw-exc-end-jinja2(pos min)143 "Helper for `mumamo-chunk-jinja2'.144POS is where to start search and MIN is where to stop."145 (mumamo-chunk-end-bw-str-inc pos min "}}"))146147 (defun mumamo-search-bw-exc-end-jinja3(pos min)148 "Helper for `mumamo-chunk-jinja3'.149POS is where to start search and MIN is where to stop."150 (mumamo-chunk-end-bw-str-inc pos min "#}"))151152 (defun mumamo-search-fw-exc-start-jinja (pos max)153 "Helper for `mumamo-chunk-jinja'.154POS is where to start search and MAX is where to stop."155 (mumamo-chunk-start-fw-str-inc pos max "{%"))156157 (defun mumamo-search-fw-exc-start-jinja2(pos max)158 "Helper for `mumamo-chunk-jinja2'.159POS is where to start search and MAX is where to stop."160 (mumamo-chunk-start-fw-str-inc pos max "{{"))161162 (defun mumamo-search-fw-exc-start-jinja3(pos max)163 "Helper for `mumamo-chunk-jinja3'.164POS is where to start search and MAX is where to stop."165 (mumamo-chunk-start-fw-str-inc pos max "{#"))166167 (defun mumamo-search-fw-exc-end-jinja (pos max)168 "Helper for `mumamo-chunk-jinja'.169POS is where to start search and MAX is where to stop."170 (mumamo-chunk-end-fw-str-inc pos max "%}"))171172 (defun mumamo-search-fw-exc-end-jinja2(pos max)173 "Helper for `mumamo-chunk-jinja2'.174POS is where to start search and MAX is where to stop."175 (mumamo-chunk-end-fw-str-inc pos max "}}"))176177 (defun mumamo-search-fw-exc-end-jinja3(pos max)178 "Helper for `mumamo-chunk-jinja3'.179POS is where to start search and MAX is where to stop."180 (mumamo-chunk-end-fw-str-inc pos max "#}"))18197;;;###autoload98 (define-mumamo-multi-major-mode jinja-html-mumamo99 "Turn on multiple major modes for Jinja with main mode `html-mode'.100This also covers inlined style and javascript."
28 unmodified lines