- const gchar *name = psppire_window_get_filename (win);
- execute_syntax (create_syntax_editor_source (sw->buffer, start, stop, name));
+ struct lex_reader *reader;
+ gchar *text;
+
+ text = gtk_text_buffer_get_text (sw->buffer, &start, &stop, FALSE);
+ reader = lex_reader_for_string (text);
+ g_free (text);
+
+ lex_reader_set_file_name (reader, psppire_window_get_filename (win));
+
+ execute_syntax (reader);