jed-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: flyspell does work with JLM (Jörg's LaTeX mode)


Hi Itai,

"Itai Arad" <itaitay@xxxxxxxxx> wrote:
> On Nov 22, 2007 10:15 PM, Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
>
>> Text mode uses the old highlighting while JLM uses DFA highlighting.
>> IIRC, flyspell doesn't work with DFA highlighting—IMO, it can't.
>
> I don't think so. For example, I have written a dead-simple mode for
> the asymptote language that uses DFA, and it works great with
> flyspell.

For the record: Itai send me his mode per PM.

I found the reason why flyspell works with Itai's asymptote mode but not
with my LaTeX mode. DFA has special K rules for which it looks into the
keyword table created with define_keywords_n(). Flyspell puts wrong
spelled words into this keyword table and my LaTeX mode misses such a K
rule

Here is a patch that matches “words” and looks for them in the keyword
table. It doesn't work everywhere, i.e. it doesn't work in comments and
text between `` ''. I had also to disable the highlighting of the last
three characters before '', because it broke other highlighting rules,
and the highlighting of braces after \begin{env}, i.e. in
“\begin{slide}{Txet}” “{Txet}” is no more highlighted, but flyspell can
highlight “Txet”.

Which words are able to be highlighted can you see by line with
add_color_object and change Knormal to Ktext.

Should I disable highlighting of ``...''?

Index: latex.sl
===================================================================
--- latex.sl	(Revision 236)
+++ latex.sl	(Arbeitskopie)
@@ -4988,7 +4988,7 @@
     dfa_define_highlight_rule("%(.*[^ \t])?", "comment", name);
 
     dfa_define_highlight_rule("\\documentclass.*}"R, "Qpreprocess", name);
-    dfa_define_highlight_rule("\\begin{.*}({.*})*"R, "preprocess", name);
+    dfa_define_highlight_rule("\\begin{[^}]*}"R, "preprocess", name);
     dfa_define_highlight_rule("\\end{.*}"R, "Qpreprocess", name);
 
     % % known keywords in curly braces
@@ -5140,28 +5140,17 @@
     % quoted strings accross lines; mark the three charaters after and
     % before the quote characters
     dfa_define_highlight_rule("[\"`]`.?.?.?", "string", name);
-    dfa_define_highlight_rule(".?.?.?\"'", "string", name);
-    dfa_define_highlight_rule(".?.?.?''", "string", name);
+    dfa_define_highlight_rule("\"'", "string", name);
+    dfa_define_highlight_rule("''", "string", name);
 
     dfa_define_highlight_rule("[ \t]+$", "trailing_whitespace", name);
 
-    % Workaround to make UTF-8 characters are display correctly, not as
-    % <C3><nn> or <E2><nn><nn>
-    dfa_define_highlight_rule("\xC2.", "normal", name);
-    dfa_define_highlight_rule("\xC3.", "normal", name);
-    dfa_define_highlight_rule("\xE2..", "normal", name);
-    dfa_define_highlight_rule("\xE3..", "normal", name);
-    dfa_define_highlight_rule("\xE4..", "normal", name);
-    dfa_define_highlight_rule("\xE5..", "normal", name);
-    dfa_define_highlight_rule("\xE6..", "normal", name);
-    dfa_define_highlight_rule("\xE7..", "normal", name);
-    dfa_define_highlight_rule("\xE8..", "normal", name);
-    dfa_define_highlight_rule("\xE9..", "normal", name);
+    % This rule matches all words, including words with non-ascii
+    % characters. The K gives flyspell the possibility to define words
+    % with define_keywords_n() they are spelled wrong.
+    % add_color_object("text"); set_color("text", "black", "blue");
+    dfa_define_highlight_rule("[^ -@\[-`{-~]+"R, "Knormal", name);
 
-    % all the rest
-    % Fixme: Why we need this rule?
-    dfa_define_highlight_rule(".", "normal", name);
-
     dfa_build_highlight_table(name);
 }
 

Thanks, Jörg.
-- 
Der Klügere gibt nach …
… deshalb regieren die Dummen die Welt!

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]