diff options
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/textmodes/tildify.el | 37 |
2 files changed, 29 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f8ed1dced82..1a6b1cd517c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,19 @@ | |||
| 1 | 2014-06-05 Michal Nazarewicz <mina86@mina86.com> | 1 | 2014-06-05 Michal Nazarewicz <mina86@mina86.com> |
| 2 | 2 | ||
| 3 | * textmodes/tildify.el (tildify-ignored-environments-alist): | ||
| 4 | Optimise environments regexes | ||
| 5 | |||
| 6 | Each time beginning of an environment to ignore is found, | ||
| 7 | `tildify-find-env' needs to identify regexp for the ending | ||
| 8 | of the environment. This is done by trying all the opening | ||
| 9 | regexes on matched text in a loop, so to speed that up, this | ||
| 10 | loop should have fewer things to match, which can be done by | ||
| 11 | using alternatives in the opening regexes. | ||
| 12 | |||
| 13 | Coincidentally, this should make matching of the opening | ||
| 14 | regexp faster as well thanks to the use of `regexp-opt' and | ||
| 15 | having common prefix pulled from many regexes. | ||
| 16 | |||
| 3 | * textmodes/tildify.el (tildify-string-alist) | 17 | * textmodes/tildify.el (tildify-string-alist) |
| 4 | (tildify-ignored-environments-alist): Add `nxml-mode' to the list | 18 | (tildify-ignored-environments-alist): Add `nxml-mode' to the list |
| 5 | of supported modes since `xml-mode' is no longer a thing but just | 19 | of supported modes since `xml-mode' is no longer a thing but just |
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 6dd471d49ad..39ccad717d4 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el | |||
| @@ -119,42 +119,35 @@ mode, the item for the mode SYMBOL is looked up in the alist instead." | |||
| 119 | (symbol :tag "Like other"))))) | 119 | (symbol :tag "Like other"))))) |
| 120 | 120 | ||
| 121 | (defcustom tildify-ignored-environments-alist | 121 | (defcustom tildify-ignored-environments-alist |
| 122 | '((latex-mode | 122 | `((latex-mode |
| 123 | ("\\\\\\\\" . "") ; do not remove this | 123 | ("\\\\\\\\" . "") ; do not remove this |
| 124 | ("\\\\begin{verbatim}" . "\\\\end{verbatim}") | 124 | (,(eval-when-compile (concat |
| 125 | "\\\\begin{\\(" | ||
| 126 | (regexp-opt '("verbatim" "math" "displaymath" | ||
| 127 | "equation" "eqnarray" "eqnarray*")) | ||
| 128 | "\\)}")) | ||
| 129 | . ("\\\\end{" 1 "}")) | ||
| 125 | ("\\\\verb\\*?\\(.\\)" . (1)) | 130 | ("\\\\verb\\*?\\(.\\)" . (1)) |
| 126 | ("\\$\\$" . "\\$\\$") | 131 | ("\\$\\$?" . (0)) |
| 127 | ("\\$" . "\\$") | ||
| 128 | ("\\\\(" . "\\\\)") | 132 | ("\\\\(" . "\\\\)") |
| 129 | ("\\\\[[]" . "\\\\[]]") | 133 | ("\\\\[[]" . "\\\\[]]") |
| 130 | ("\\\\begin{math}" . "\\\\end{math}") | ||
| 131 | ("\\\\begin{displaymath}" . "\\\\end{displaymath}") | ||
| 132 | ("\\\\begin{equation}" . "\\\\end{equation}") | ||
| 133 | ("\\\\begin{eqnarray\\*?}" . "\\\\end{eqnarray\\*?}") | ||
| 134 | ("\\\\[a-zA-Z]+\\( +\\|{}\\)[a-zA-Z]*" . "") | 134 | ("\\\\[a-zA-Z]+\\( +\\|{}\\)[a-zA-Z]*" . "") |
| 135 | ("%" . "$")) | 135 | ("%" . "$")) |
| 136 | (plain-tex-mode . latex-mode) | 136 | (plain-tex-mode . latex-mode) |
| 137 | (html-mode | 137 | (html-mode |
| 138 | ("<pre[^>]*>" . "</pre>") | 138 | (,(eval-when-compile (concat |
| 139 | ("<dfn>" . "</dfn>") | 139 | "<\\(" |
| 140 | ("<code>" . "</code>") | 140 | (regexp-opt '("pre" "dfn" "code" "samp" "kbd" "var" |
| 141 | ("<samp>" . "</samp>") | 141 | "PRE" "DFN" "CODE" "SAMP" "KBD" "VAR")) |
| 142 | ("<kbd>" . "</kbd>") | 142 | "\\)\\>[^>]*>")) |
| 143 | ("<var>" . "</var>") | 143 | . ("</" 1 ">")) |
| 144 | ("<PRE[^>]*>" . "</PRE>") | ||
| 145 | ("<DFN>" . "</DFN>") | ||
| 146 | ("<CODE>" . "</CODE>") | ||
| 147 | ("<SAMP>" . "</SAMP>") | ||
| 148 | ("<KBD>" . "</KBD>") | ||
| 149 | ("<VAR>" . "</VAR>") | ||
| 150 | ("<! *--" . "-- *>") | 144 | ("<! *--" . "-- *>") |
| 151 | ("<" . ">")) | 145 | ("<" . ">")) |
| 152 | (sgml-mode . html-mode) | 146 | (sgml-mode . html-mode) |
| 153 | (xml-mode | 147 | (xml-mode |
| 154 | ("<! *--" . "-- *>") | 148 | ("<! *--" . "-- *>") |
| 155 | ("<" . ">")) | 149 | ("<" . ">")) |
| 156 | (nxml-mode . xml-mode) | 150 | (nxml-mode . xml-mode)) |
| 157 | (t nil)) | ||
| 158 | "Alist specifying ignored structured text environments. | 151 | "Alist specifying ignored structured text environments. |
| 159 | Parts of text defined in this alist are skipped without performing hard space | 152 | Parts of text defined in this alist are skipped without performing hard space |
| 160 | insertion on them. These setting allow skipping text parts like verbatim or | 153 | insertion on them. These setting allow skipping text parts like verbatim or |