slang-users mailing list

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

[slang-users] Re: is_defined


John E. Davis <jed@xxxxxxxxxxx> wrote:

> The statement first gets compiled to byte-code, and is then executed.
> The error comes during the compilation stage.

[...]

Thank you very much for this detailed explanation. What I was
trying to achieve was some nanny'ish error handling in
connection with enabling word completion from within my aspell
spell checking mode[1] on a mode-by-mode basis, configurable in
the mode hook by setting a variable there, like e.g.

  define mailedit_mode_hook ()
  {
    .
    .
    Aspell_Ask_Dictionary = 1;
    Aspell_Use_Tabcompletion = 1;
    init_aspell ();
  } 

and in the function that prompts for a dictionary, e.g.

  define aspell_select_dictionary ()
  {
     .
     .
     if (Aspell_Use_Tabcompletion)
      init_tabcomplete (aspell_set_tabcompletion_wordlist ());     
  }
  
so whenever you're prompted for a spelling dictionary, the
"init_tabcomplete" word completion for the corresponding spell
checking language is automatically initialized. I then just
wanted to autoload the "init_tabcomplete" function for the
user, in case he forgot to autoload it in his .jedrc. or
display a meaningful error message in case the word completion
script wasn't even installed.

I have solved it by setting this globally in aspell.sl:

   #ifnexists init_tabcomplete
   if (strlen (expand_jedlib_file ("tabcomplete.sl")))
     autoload ("init_tabcomplete", "tabcomplete");
   #endif  

and then in the function that prompts for an aspell dictionary

   define aspell_select_dictionary ()
   {
      .
      .
      variable fun = __get_reference ("init_tabcomplete");
      if (fun != NULL)
      {
        if (Aspell_Use_Tabcompletion)
          (@fun (aspell_set_tabcompletion_wordlist));
      }
      .
      .
    }
    
This seems to take care of both forgetting to install the
tabcomplete script and forgetting to autoload the
"init_tabcomplete" function. The problem with the error thrown
is that it prevents loading the spell checking functions.

Thank you,
Morten

[1] http://mbjnet.dk/aspell/
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


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